| | |
| | | package com.ltkj.web.controller.system; |
| | | |
| | | import java.nio.channels.NonReadableChannelException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ltkj.common.annotation.Excel; |
| | | import com.ltkj.common.utils.poi.ExcelUtil; |
| | | import com.ltkj.framework.config.UserHoder; |
| | | import com.ltkj.hosp.domain.TjAdvice; |
| | | import com.ltkj.hosp.domain.TjAdviceKjbq; |
| | | import com.ltkj.hosp.domain.TjProject; |
| | |
| | | @PostMapping("/addTjAdviceKjbq") |
| | | @ApiOperation(value = "新增体检建议快捷标签接口") |
| | | public AjaxResult addTjAdviceKjbq(@RequestBody TjAdviceKjbq adviceKjbq) { |
| | | |
| | | return AjaxResult.success(kjbqService.save(adviceKjbq)); |
| | | } |
| | | |
| | |
| | | |
| | | @PostMapping("/updateQybzTjAdviceKjbqById") |
| | | @ApiOperation(value = "修改体检建议快捷标签启用状态接口") |
| | | public AjaxResult updateQybzTjAdviceKjbqById(@RequestParam int qybz,@RequestParam Long id) { |
| | | public AjaxResult updateQybzTjAdviceKjbqById(@RequestParam int qybz, @RequestParam Long id) { |
| | | TjAdviceKjbq kjbq = kjbqService.getById(id); |
| | | kjbq.setQyzt(String.valueOf(qybz)); |
| | | return AjaxResult.success(kjbqService.updateById(kjbq)); |
| | |
| | | |
| | | @GetMapping("/getTjAdviceKjbqByFl") |
| | | @ApiOperation(value = "根据标签分类查询体检建议快捷标签接口") |
| | | public AjaxResult getTjAdviceKjbqByFl(@RequestParam(required = false)@ApiParam(value = "用户id 传当前登录人 超管登录时不传 为null") String userId, |
| | | @RequestParam(required = false)@ApiParam(value = "启用状态 0启用 1停用") Integer qyzt, |
| | | public AjaxResult getTjAdviceKjbqByFl(@RequestParam(required = false) @ApiParam(value = "用户id 传当前登录人 超管登录时不传 为null") String userId, |
| | | @RequestParam(required = false) @ApiParam(value = "启用状态 0启用 1停用") Integer qyzt, |
| | | @ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer page, |
| | | @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize) { |
| | | LambdaQueryWrapper<TjAdviceKjbq> wq = new LambdaQueryWrapper<>(); |
| | | Page<TjAdviceKjbq> page1=new Page<>(page,pageSize); |
| | | Page<TjAdviceKjbq> page1 = new Page<>(page, pageSize); |
| | | if (null != userId && !userId.equals("")) { |
| | | wq.eq(TjAdviceKjbq::getUserId, userId); |
| | | } |
| | | if (null != qyzt) { |
| | | wq.eq(TjAdviceKjbq::getQyzt,qyzt); |
| | | wq.eq(TjAdviceKjbq::getQyzt, qyzt); |
| | | } |
| | | Page<TjAdviceKjbq> kjbqPage = kjbqService.page(page1, wq); |
| | | if(null !=kjbqPage.getRecords() && kjbqPage.getRecords().size()>0){ |
| | | if (null != kjbqPage.getRecords() && kjbqPage.getRecords().size() > 0) { |
| | | for (TjAdviceKjbq record : kjbqPage.getRecords()) { |
| | | if(null !=record.getUserId()){ |
| | | if (null != record.getUserId()) { |
| | | record.setUserName(userService.getById(record.getUserId()).getNickName()); |
| | | } |
| | | |
| | |
| | | |
| | | @GetMapping("/getKjTjAdviceKjbqBySex") |
| | | @ApiOperation(value = "根据体检人性别和是否为总检查询体检建议接口") |
| | | public AjaxResult getKjTjAdviceKjbqBySex(@RequestParam String sex, @RequestParam @ApiParam(value = "0常规医生 1总检") String isZj, |
| | | public AjaxResult getKjTjAdviceKjbqBySex(@RequestParam String sex, @RequestParam @ApiParam(value = "1常规医生 0总检") String isZj, |
| | | @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); |
| | | Page<TjAdvice> page1 = new Page<>(page, pageSize); |
| | | wq.eq(TjAdvice::getAdSex, sex).or().isNull(TjAdvice::getAdSex); |
| | | wq.eq(TjAdvice::getIsZj, isZj); |
| | | Page<TjAdvice> kjbqPage = tjAdviceService.page(page1, wq); |
| | | return AjaxResult.success(kjbqPage); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("/getCyTjAdviceKjbqBySex") |
| | | @ApiOperation(value = "根据当前登录人id获取常用建议") |
| | | public AjaxResult getCyTjAdviceKjbqBySex(@RequestParam String sex,@RequestParam @ApiParam(value = "用户id 传当前登录人") Long userId, |
| | | public AjaxResult getCyTjAdviceKjbqBySex(@RequestParam String sex, @RequestParam @ApiParam(value = "用户id 传当前登录人") Long userId, |
| | | @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); |
| | | Page<TjAdvice> page1 = new Page<>(page, pageSize); |
| | | // wq.eq(TjAdvice::getAdSex,sex).or().eq(TjAdvice::getAdSex,"2"); |
| | | if (null != userId) { |
| | | LambdaQueryWrapper<TjUserAdvice> wq0=new LambdaQueryWrapper<>(); |
| | | wq0.eq(TjUserAdvice::getUserId,userId); |
| | | LambdaQueryWrapper<TjUserAdvice> wq0 = new LambdaQueryWrapper<>(); |
| | | wq0.eq(TjUserAdvice::getUserId, userId); |
| | | List<TjUserAdvice> list = userAdviceService.list(wq0); |
| | | if(null !=list && list.size()>0){ |
| | | if (null != list && list.size() > 0) { |
| | | List<Long> longs = list.stream().map(TjUserAdvice::getAdviceId).collect(Collectors.toList()); |
| | | wq.in(TjAdvice::getId, longs); |
| | | Page<TjAdvice> kjbqPage = tjAdviceService.page(page1, wq); |
| | | wq.in(TjAdvice::getId,longs); |
| | | wq.last("and (ad_sex=1 OR ad_sex=2)"); |
| | | Page<TjAdvice> kjbqPage = tjAdviceService.page(page1,wq); |
| | | return AjaxResult.success(kjbqPage); |
| | | } |
| | | |
| | | } |
| | | return AjaxResult.success("该用户暂时没有常用建议!"); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/addCyTjAdviceByUserId") |
| | | @ApiOperation(value = "添加当前登录人常用建议接口") |
| | | public AjaxResult addCyTjAdviceByUserId(@RequestParam @ApiParam(value = "所选建议主键id数组") List<Long> adviceIds) { |
| | | String userId = UserHoder.getLoginUser().getUserId(); |
| | | if (null != adviceIds && adviceIds.size() > 0) { |
| | | for (Long id : adviceIds) { |
| | | TjUserAdvice tjUserAdvice = userAdviceService.getTjUserAdviceByUserId(Long.valueOf(userId), id); |
| | | if (null == tjUserAdvice) { |
| | | TjUserAdvice userAdvice = new TjUserAdvice(); |
| | | userAdvice.setAdviceId(id); |
| | | userAdvice.setUserId(Long.valueOf(userId)); |
| | | userAdviceService.save(userAdvice); |
| | | } |
| | | } |
| | | return AjaxResult.success("添加成功!"); |
| | | } |
| | | return AjaxResult.success("请选择您要添加的建议!"); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/addCyTjAdvice") |
| | | @ApiOperation(value = "添加常用建议接口") |
| | | public AjaxResult addCyTjAdvice(@RequestBody TjAdvice adviceId) { |
| | | String userId = UserHoder.getLoginUser().getUserId(); |
| | | if (null != adviceId) { |
| | | if (tjAdviceService.save(adviceId)) { |
| | | TjUserAdvice tjUserAdvice = userAdviceService.getTjUserAdviceByUserId(Long.valueOf(userId),adviceId.getId()); |
| | | if (null == tjUserAdvice) { |
| | | TjUserAdvice userAdvice = new TjUserAdvice(); |
| | | userAdvice.setAdviceId(adviceId.getId()); |
| | | userAdvice.setUserId(Long.valueOf(userId)); |
| | | userAdviceService.save(userAdvice); |
| | | } |
| | | } |
| | | return AjaxResult.success("操作成功!"); |
| | | } |
| | | return AjaxResult.success("请选择您要添加的建议!"); |
| | | } |
| | | |
| | | |
| | | |
| | | // ================/**/================================================================================================================================== |
| | | /** |
| | | * 查询advice列表 |
| | | */ |
| | |
| | | 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()); |
| | | } |
| | |
| | | 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)); |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('advice:advice:query')") |
| | | @GetMapping(value = "/{id}") |
| | | @ApiOperation(value = "根据主键id获取advice详细信息") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | return AjaxResult.success(tjAdviceService.selectTjAdviceById(id)); |
| | | TjAdvice advice = tjAdviceService.getById(id); |
| | | if(null !=advice){ |
| | | String kjbq = advice.getKjbq(); |
| | | if(null !=kjbq && !kjbq.equals("")){ |
| | | String[] split = kjbq.split(","); |
| | | advice.setKjbqz(Arrays.asList(split)); |
| | | } |
| | | } |
| | | return AjaxResult.success(advice); |
| | | } |
| | | |
| | | /** |
| | |
| | | // @PreAuthorize("@ss.hasPermi('advice:advice:add')") |
| | | @Log(title = "advice", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | @ApiOperation(value = "新增体检建议接口") |
| | | public AjaxResult add(@RequestBody TjAdvice tjAdvice) { |
| | | return AjaxResult.success(tjAdviceService.insertTjAdvice(tjAdvice)); |
| | | return AjaxResult.success(tjAdviceService.save(tjAdvice)); |
| | | } |
| | | |
| | | /** |