| | |
| | | package com.ltkj.web.controller.system; |
| | | |
| | | import java.nio.channels.NonReadableChannelException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | 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.utils.poi.ExcelUtil; |
| | | import com.ltkj.hosp.domain.TjAdvice; |
| | | import com.ltkj.hosp.domain.TjAdviceKjbq; |
| | | import com.ltkj.hosp.domain.TjProject; |
| | | import com.ltkj.hosp.domain.TjUserAdvice; |
| | | import com.ltkj.hosp.service.ITjAdviceService; |
| | | import com.ltkj.hosp.service.ITjProjectService; |
| | | import com.ltkj.hosp.service.TjAdviceKjbqService; |
| | | import com.ltkj.hosp.service.TjUserAdviceService; |
| | | import com.ltkj.system.service.ISysUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ltkj.common.annotation.Log; |
| | |
| | | private ITjAdviceService tjAdviceService; |
| | | @Resource |
| | | private ITjProjectService tjProjectService; |
| | | @Resource |
| | | private TjAdviceKjbqService kjbqService; |
| | | @Resource |
| | | private TjUserAdviceService userAdviceService; |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @PostMapping("/addTjAdviceKjbq") |
| | | @ApiOperation(value = "新增体检建议快捷标签接口") |
| | | public AjaxResult addTjAdviceKjbq(@RequestBody TjAdviceKjbq adviceKjbq) { |
| | | return AjaxResult.success(kjbqService.save(adviceKjbq)); |
| | | } |
| | | |
| | | @DeleteMapping("/deletedTjAdviceKjbq") |
| | | @ApiOperation(value = "根据id删除体检建议快捷标签接口") |
| | | public AjaxResult deletedTjAdviceKjbq(@RequestParam Long adviceKjbqId) { |
| | | return AjaxResult.success(kjbqService.removeById(adviceKjbqId)); |
| | | } |
| | | |
| | | @PutMapping("/updateTjAdviceKjbq") |
| | | @ApiOperation(value = "修改体检建议快捷标签接口") |
| | | public AjaxResult updateTjAdviceKjbq(@RequestBody TjAdviceKjbq adviceKjbq) { |
| | | return AjaxResult.success(kjbqService.updateById(adviceKjbq)); |
| | | } |
| | | |
| | | @PostMapping("/updateQybzTjAdviceKjbqById") |
| | | @ApiOperation(value = "修改体检建议快捷标签启用状态接口") |
| | | 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, |
| | | @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); |
| | | if (null != userId && !userId.equals("")) { |
| | | wq.eq(TjAdviceKjbq::getUserId, userId); |
| | | } |
| | | if (null != qyzt) { |
| | | wq.eq(TjAdviceKjbq::getQyzt,qyzt); |
| | | } |
| | | Page<TjAdviceKjbq> kjbqPage = kjbqService.page(page1, wq); |
| | | if(null !=kjbqPage.getRecords() && kjbqPage.getRecords().size()>0){ |
| | | for (TjAdviceKjbq record : kjbqPage.getRecords()) { |
| | | if(null !=record.getUserId()){ |
| | | record.setUserName(userService.getById(record.getUserId()).getNickName()); |
| | | } |
| | | |
| | | } |
| | | } |
| | | return AjaxResult.success(kjbqPage); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getKjTjAdviceKjbqBySex") |
| | | @ApiOperation(value = "根据体检人性别和是否为总检查询体检建议接口") |
| | | public AjaxResult getKjTjAdviceKjbqBySex(@RequestParam String sex, @RequestParam @ApiParam(value = "0常规医生 1总检") 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); |
| | | 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, |
| | | @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); |
| | | if (null != userId) { |
| | | LambdaQueryWrapper<TjUserAdvice> wq0=new LambdaQueryWrapper<>(); |
| | | wq0.eq(TjUserAdvice::getUserId,userId); |
| | | List<TjUserAdvice> list = userAdviceService.list(wq0); |
| | | 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); |
| | | return AjaxResult.success(kjbqPage); |
| | | } |
| | | |
| | | } |
| | | return AjaxResult.success("该用户暂时没有常用建议!"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询advice列表 |