| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ltkj.common.annotation.Excel; |
| | | import com.ltkj.common.core.domain.entity.SysDept; |
| | | import com.ltkj.common.utils.StringUtils; |
| | | import com.ltkj.common.utils.poi.ExcelUtil; |
| | | import com.ltkj.framework.config.UserHoder; |
| | |
| | | import com.ltkj.hosp.service.ITjProjectService; |
| | | import com.ltkj.hosp.service.TjAdviceKjbqService; |
| | | import com.ltkj.hosp.service.TjUserAdviceService; |
| | | import com.ltkj.system.service.ISysDeptService; |
| | | import com.ltkj.system.service.ISysUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import jodd.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | private TjUserAdviceService userAdviceService; |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | @Autowired |
| | | private ISysDeptService sysDeptService; |
| | | |
| | | @PostMapping("/addTjAdviceKjbq") |
| | | @ApiOperation(value = "新增体检建议快捷标签接口") |
| | |
| | | @GetMapping("/getKjTjAdviceKjbqBySex") |
| | | @ApiOperation(value = "根据体检人性别和是否为总检查询体检建议接口") |
| | | public AjaxResult getKjTjAdviceKjbqBySex(@RequestParam String sex, @RequestParam @ApiParam(value = "1常规医生 0总检") String isZj, |
| | | @RequestParam(required = false) @ApiParam(value ="建议内容") String jynr, |
| | | @ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer page, |
| | | @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize) { |
| | | LambdaQueryWrapper<TjAdvice> wq = new LambdaQueryWrapper<>(); |
| | | Page<TjAdvice> page1 = new Page<>(page, pageSize); |
| | | wq.eq(TjAdvice::getAdSex, sex).or().isNull(TjAdvice::getAdSex); |
| | | // wq.eq(TjAdvice::getAdSex, sex).or().isNull(TjAdvice::getAdSex); |
| | | wq.eq(TjAdvice::getIsZj, isZj); |
| | | if(StringUtil.isNotBlank(jynr)) wq.like(TjAdvice::getAdvice,jynr); |
| | | wq.and(i -> i.eq(TjAdvice::getAdSex, sex).or().isNull(TjAdvice::getAdSex)); |
| | | Page<TjAdvice> kjbqPage = tjAdviceService.page(page1, wq); |
| | | return AjaxResult.success(kjbqPage); |
| | | } |
| | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "体检建议列表查询") |
| | | public AjaxResult list(@RequestParam(required = false) @ApiParam(value = "项目名") String proName, |
| | | @ApiParam(value = "标题") @RequestParam(required = false) String bt, |
| | | @ApiParam(value = "建议") @RequestParam(required = false) String nr, |
| | | @ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer page, |
| | | @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize) { |
| | | Page<TjAdvice> page1 = new Page<>(page, pageSize); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<TjAdvice> list = null; |
| | | long total = 0; |
| | | if (null != proName) { |
| | | LambdaQueryWrapper<TjProject> wq = new LambdaQueryWrapper<>(); |
| | | list = new ArrayList<>(); |
| | | wq.like(TjProject::getProName, proName); |
| | | List<TjProject> projectList = tjProjectService.list(wq); |
| | | if (null != projectList && projectList.size() > 0) { |
| | | for (TjProject project : projectList) { |
| | | LambdaQueryWrapper<TjAdvice> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.eq(TjAdvice::getProId, project.getProId()); |
| | | IPage<TjAdvice> adviceList = tjAdviceService.page(page1, wqq); |
| | | if (null != adviceList.getRecords() && adviceList.getRecords().size() > 0) { |
| | | for (TjAdvice record : adviceList.getRecords()) { |
| | | record.setProName(project.getProName()); |
| | | String kjbq = record.getKjbq(); |
| | | if(null !=kjbq && !kjbq.equals("")){ |
| | | String[] split = kjbq.split(","); |
| | | record.setKjbqz(Arrays.asList(split)); |
| | | } |
| | | } |
| | | list.addAll(adviceList.getRecords()); |
| | | } |
| | | total = adviceList.getTotal(); |
| | | } |
| | | } |
| | | map.put("list", list); |
| | | map.put("total", total); |
| | | return AjaxResult.success(map); |
| | | } |
| | | Page<TjAdvice> page2 = tjAdviceService.page(page1); |
| | | list = page2.getRecords(); |
| | | if (null != list && list.size() > 0) { |
| | | for (TjAdvice advice : list) { |
| | | TjProject tjProject = tjProjectService.getById(advice.getProId()); |
| | | if (null != tjProject) { |
| | | advice.setProName(tjProject.getProName()); |
| | | } |
| | | String kjbq = advice.getKjbq(); |
| | | if(null !=kjbq && !kjbq.equals("")){ |
| | | String[] split = kjbq.split(","); |
| | | advice.setKjbqz(Arrays.asList(split)); |
| | | } |
| | | } |
| | | } |
| | | map.put("list", list); |
| | | map.put("total", page2.getTotal()); |
| | | return AjaxResult.success(map); |
| | | @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize, |
| | | @RequestParam(required = false)String deptId) { |
| | | // LambdaQueryWrapper<SysDept> wrapper = new LambdaQueryWrapper<>(); |
| | | // wrapper.eq(SysDept::getParentId, 0); |
| | | // SysDept sysDept = sysDeptService.getOne(wrapper); |
| | | // Page<TjAdvice> page1 = new Page<>(page, pageSize); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // List<TjAdvice> list = null; |
| | | // long total = 0; |
| | | // if (null != proName) { |
| | | // LambdaQueryWrapper<TjProject> wq = new LambdaQueryWrapper<>(); |
| | | // list = new ArrayList<>(); |
| | | // wq.like(TjProject::getProName, proName); |
| | | // List<TjProject> projectList = tjProjectService.list(wq); |
| | | // if (null != projectList && !projectList.isEmpty()) { |
| | | // for (TjProject project : projectList) { |
| | | // LambdaQueryWrapper<TjAdvice> wqq = new LambdaQueryWrapper<>(); |
| | | // wqq.eq(TjAdvice::getProId, project.getProId()); |
| | | // if (!deptId.equals(String.valueOf(sysDept.getDeptId()))) { |
| | | // wqq.eq(TjAdvice::getDept_id, deptId); |
| | | // } |
| | | // IPage<TjAdvice> adviceList = tjAdviceService.page(page1, wqq); |
| | | // if (null != adviceList.getRecords() && !adviceList.getRecords().isEmpty()) { |
| | | // for (TjAdvice record : adviceList.getRecords()) { |
| | | // record.setProName(project.getProName()); |
| | | // String kjbq = record.getKjbq(); |
| | | // if(null !=kjbq && !kjbq.isEmpty()){ |
| | | // String[] split = kjbq.split(","); |
| | | // record.setKjbqz(Arrays.asList(split)); |
| | | // } |
| | | // } |
| | | // list.addAll(adviceList.getRecords()); |
| | | // } |
| | | // total = adviceList.getTotal(); |
| | | // } |
| | | // } |
| | | // map.put("list", list); |
| | | // map.put("total", total); |
| | | // List<TjAdvice> list1 = tjAdviceService.selectList(proName,deptId,(page -1) * pageSize,pageSize); |
| | | // return AjaxResult.success(map); |
| | | // } |
| | | // LambdaQueryWrapper<TjAdvice> wq=new LambdaQueryWrapper<>(); |
| | | // if(!StringUtil.isBlank(bt)) wq.like(TjAdvice::getTitle,bt); |
| | | // if(!StringUtil.isBlank(nr)) wq.like(TjAdvice::getAdvice,nr); |
| | | // if (!deptId.equals(String.valueOf(sysDept.getDeptId()))) { |
| | | // wq.eq(TjAdvice::getDept_id, deptId); |
| | | // } |
| | | // Page<TjAdvice> page2 = tjAdviceService.page(page1,wq); |
| | | // list = page2.getRecords(); |
| | | // if (null != list && !list.isEmpty()) { |
| | | // for (TjAdvice advice : list) { |
| | | // TjProject tjProject = tjProjectService.getById(advice.getProId()); |
| | | // if (null != tjProject) { |
| | | // advice.setProName(tjProject.getProName()); |
| | | // } |
| | | // String kjbq = advice.getKjbq(); |
| | | // if(null !=kjbq && !kjbq.equals("")){ |
| | | // String[] split = kjbq.split(","); |
| | | // advice.setKjbqz(Arrays.asList(split)); |
| | | // } |
| | | // } |
| | | // } |
| | | // map.put("list", list); |
| | | // map.put("total", page2.getTotal()); |
| | | List<TjAdvice> tjAdvices = tjAdviceService.selectList(proName, deptId, (page - 1) * pageSize, pageSize,bt,nr); |
| | | Integer count = tjAdviceService.selectListCount(proName, deptId,bt,nr); |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("list",tjAdvices); |
| | | hashMap.put("total",count); |
| | | return AjaxResult.success(hashMap); |
| | | } |
| | | |
| | | /** |