package com.ltkj.web.controller.system;
|
|
|
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateUtil;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.ltkj.common.core.domain.AjaxResult;
|
import com.ltkj.hosp.domain.*;
|
import com.ltkj.hosp.service.*;
|
import com.ltkj.hosp.vodomain.*;
|
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.transaction.annotation.Transactional;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import java.util.*;
|
import java.util.stream.Collectors;
|
|
/**
|
* @Company: 西安路泰科技有限公司
|
* @Author: zjh
|
* @Date: 2023/9/1 09:08
|
*/
|
|
|
@RestController
|
@RequestMapping("/group/inspection")
|
@Api(tags = "团体检查接口集")
|
public class GroupInspectionController {
|
|
@Resource
|
private ITjOrderService orderService;
|
@Resource
|
private ITjCustomerService customerService;
|
@Resource
|
private ITjDwDeptService dwDeptService;
|
@Resource
|
private ITjDwGroupingService dwGroupingService;
|
@Resource
|
private ITjGroupingProService groupingProService;
|
@Resource
|
private ITjReservationService reservationService;
|
@Resource
|
private ITjRulesService tjRulesService;
|
@Resource
|
private ITjOrderDetailRulesService detailRulesService;
|
|
|
|
@GetMapping("/getDeptAndDwDeptByComp")
|
@ApiOperation(value = "根据单位查询部门和单位部门信息")
|
public AjaxResult getDeptAndDwDeptByComp(@ApiParam(value = "单位") @RequestParam(required = false) Long compId){
|
|
LambdaQueryWrapper<TjDwDept> wq= new LambdaQueryWrapper<>();
|
if(null !=compId){
|
wq.eq(TjDwDept::getDwId,compId);
|
}
|
List<TjDwDept> groupingList = dwDeptService.list(wq);
|
|
return AjaxResult.success(groupingList);
|
}
|
|
@GetMapping("/getDwGroupingByDwDeptId")
|
@ApiOperation(value = "根据单位部门查询单位分组信息信息")
|
public AjaxResult getDwGroupingByDwDeptId(@ApiParam(value = "单位部门id") @RequestParam(required = false) String dwDeptId){
|
|
LambdaQueryWrapper<TjDwGrouping> wq= new LambdaQueryWrapper<>();
|
if(null !=dwDeptId){
|
wq.eq(TjDwGrouping::getDwDeptId,dwDeptId);
|
}
|
List<TjDwGrouping> groupingList = dwGroupingService.list(wq);
|
return AjaxResult.success(groupingList);
|
}
|
|
|
|
|
@GetMapping("/getPeopleList")
|
@ApiOperation(value = "团检病种页面查询人员列表接口")
|
public AjaxResult getPeopleList(@ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer page,
|
@ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize,
|
@ApiParam(value = "单位") @RequestParam(required = false) Long compId,
|
@ApiParam(value = "部门)") @RequestParam(required = false) String deptName,
|
@ApiParam(value = "部门分组id") @RequestParam(required = false) String groupingId,
|
@ApiParam(value = "开始时间") @RequestParam(required = false) String beginTime,
|
@ApiParam(value = "结束时间") @RequestParam(required = false) String endTime){
|
|
LambdaQueryWrapper<TjReservation> wq=new LambdaQueryWrapper<>();
|
wq.isNotNull(TjReservation::getTeamNo);
|
if (null != beginTime && null != endTime) {
|
wq.between(TjReservation::getUpdateTime,DateUtil.beginOfDay(DateUtil.parse(beginTime)),DateUtil.endOfDay(DateUtil.parse(endTime)));
|
}
|
if(null !=compId) wq.eq(TjReservation::getCompanyId,compId);
|
if(null !=deptName)wq.like(TjReservation::getDepartment,deptName);
|
if(null !=groupingId)wq.eq(TjReservation::getGroupingId,groupingId);
|
List<TjReservation> reservations = reservationService.list(wq);
|
List<GetPeopleListVo> reservationPage =new ArrayList<>();
|
for (TjReservation record : reservations) {
|
TjCustomer customer = customerService.getOne(new LambdaQueryWrapper<TjCustomer>().eq(TjCustomer::getCusIdcard, record.getIdCard()));
|
if(null !=customer){
|
TjOrder order = orderService.getOne(new LambdaQueryWrapper<TjOrder>().eq(TjOrder::getTeamNo, record.getTeamNo()).eq(TjOrder::getUserId,customer.getCusId()));
|
if(null !=order){
|
GetPeopleListVo vo=new GetPeopleListVo();
|
vo.setTjNumber(order.getTjNumber());
|
vo.setName(record.getName());
|
vo.setSex(record.getSex());
|
vo.setDepartment(record.getDepartment());
|
vo.setAge(record.getAge());
|
vo.setCompany(record.getCompany());
|
reservationPage.add(vo);
|
}
|
}
|
}
|
List<GetPeopleListVo> voList = reservationPage.stream().skip((long) (page - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
|
Map<String, Object> map = new HashMap<>();
|
map.put("voList", voList);
|
map.put("total", reservationPage.size());
|
return AjaxResult.success(map);
|
}
|
|
|
/**
|
* 查询规则+病种列表
|
*/
|
@GetMapping("/getTjRulesListByGroupingId")
|
@ApiOperation(value = "团检页面查询病种字典列表")
|
public AjaxResult getTjRulesListByGroupingId(@ApiParam(value = "分组id") @RequestParam(required = false) String groupingId,
|
@ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer page,
|
@ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize) {
|
LambdaQueryWrapper<TjGroupingPro> wq= new LambdaQueryWrapper<>();
|
if(null !=groupingId) wq.eq(TjGroupingPro::getGroupingId, groupingId);
|
List<TjGroupingPro> proList = groupingProService.list(wq);
|
Set<TjRules> list=new HashSet<>();
|
if(null !=proList && proList.size()>0){
|
for (TjGroupingPro tjGroupingPro : proList) {
|
List<TjRules> rulesList = tjRulesService.getTjRulesListByProId(tjGroupingPro.getProId());
|
if(null !=rulesList && rulesList.size()>0){
|
list.addAll(rulesList);
|
}
|
}
|
}
|
List<TjRules> rulesList = list.stream().skip((long) (page - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
|
Map<String, Object> map = new HashMap<>();
|
map.put("rulesList", rulesList);
|
map.put("total", list.size());
|
return AjaxResult.success(map);
|
}
|
|
|
@PostMapping("/getTjRulesStatisticsByTjNumAndAid")
|
@ApiOperation(value = "团检页面统计病种接口")
|
public AjaxResult getTjRulesStatisticsByTjNumAndAid(@ApiParam(value = "体检号集合") @RequestBody TjRulesStatisticsDto dto ) {
|
|
List<String> tjNums = dto.getTjNums();
|
List<String> aids = dto.getAids();
|
|
|
if(null==tjNums || tjNums.size()==0){
|
tjNums= new ArrayList<>();
|
tjNums.add("0");
|
}
|
|
if(null==aids || aids.size()==0){
|
aids= new ArrayList<>();
|
aids.add("0");
|
}
|
List<TjRulesStatisticsVo> list = detailRulesService.getTjRulesStatisticsByTjNumAndAid(tjNums,aids);
|
return AjaxResult.success(list);
|
}
|
|
|
|
|
@GetMapping("/getTeamTjDwDeptTreeList")
|
@ApiOperation(value = "团检页面报告管理侧面树节点")
|
public AjaxResult getTeamTjDwDeptTreeList() {
|
List<TjDwDept> dwDeptList = dwDeptService.getDwDeptNameList();
|
List<TeamTjDwDeptVo> list=new ArrayList<>();
|
if(null !=dwDeptList && dwDeptList.size()>0){
|
for (TjDwDept dept : dwDeptList) {
|
List<TjDwDept> deptList = dwDeptService.getDwDeptListByTjDwDeptId(dept.getDwId());
|
TeamTjDwDeptVo deptVo= new TeamTjDwDeptVo();
|
deptVo.setDwName(dept.getDwName());
|
deptVo.setDwDepts(deptList);
|
list.add(deptVo);
|
}
|
}
|
return AjaxResult.success(list);
|
}
|
|
|
@GetMapping("/getTeamTjBaoGaoList")
|
@ApiOperation(value = "团检页面报告管理数据查询接口")
|
public AjaxResult getTeamTjBaoGaoList(@ApiParam(value = "单位部门") @RequestParam String dwDeptId,
|
@ApiParam(value = "开始时间") @RequestParam String beginTime,
|
@ApiParam(value = "结束时间") @RequestParam String endTime) {
|
DateTime beginTimes = null;
|
DateTime endTimes = null;
|
if (null != beginTime && null != endTime) {
|
beginTimes = DateUtil.beginOfDay(DateUtil.parse(beginTime));
|
endTimes = DateUtil.endOfDay(DateUtil.parse(endTime));
|
}
|
List<TeamTjDwBaoGaoVo> list = dwDeptService.getTeamTjDwBaoGaoVoByTjDwDeptId(dwDeptId, beginTimes, endTimes);
|
if(null !=list && list.size()>0){
|
for (TeamTjDwBaoGaoVo gaoVo : list) {
|
gaoVo.setStartTime(beginTimes);
|
gaoVo.setEnfTime(endTimes);
|
}
|
}
|
return AjaxResult.success(list);
|
}
|
|
}
|