| | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.crypto.symmetric.DES; |
| | | import cn.hutool.extra.pinyin.PinyinUtil; |
| | | import cn.hutool.json.JSONArray; |
| | |
| | | import com.ltkj.web.controller.lis.LisApiMethod; |
| | | import com.ltkj.web.controller.pacs.PacsApiMethodService; |
| | | import com.ltkj.web.controller.service.TjSysAsyncServiceImpl; |
| | | import com.ltkj.web.wxUtils.HttpClientUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import jodd.util.StringUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.time.DateFormatUtils; |
| | | import org.aspectj.weaver.ast.Var; |
| | |
| | | private LisJyflhbService lisJyflhbService; |
| | | @Autowired |
| | | private ISysDictDataService sysDictDataService; |
| | | @Autowired |
| | | private TjFlowingWaterHisService tjFlowingWaterHisService; |
| | | |
| | | //将方法返回值解析成json格式 |
| | | public JSONObject getJSONObject(String builder) { |
| | | String Response = JSONUtil.parseObj(builder).getStr("Response"); |
| | |
| | | @ApiOperation(value = "查询体检记录列表") |
| | | public AjaxResult getOrderList(@ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer pageNum, |
| | | @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize, |
| | | @ApiParam(value = "状态") @RequestParam(required = false) Integer zt, |
| | | @ApiParam(value = "体检号)") @RequestParam(required = false) String tjNum, |
| | | @ApiParam(value = "姓名)") @RequestParam(required = false) String name, |
| | | @ApiParam(value = "项目名)") @RequestParam(required = false) String xmmc, |
| | | @ApiParam(value = "登记开始时间") @RequestParam(required = false) Date djbeginTime, |
| | | @ApiParam(value = "登记结束时间") @RequestParam(required = false) Date djendTime, |
| | | @ApiParam(value = "报告开始时间") @RequestParam(required = false) Date bgbeginTime, |
| | | @ApiParam(value = "报告结束时间") @RequestParam(required = false) Date bgendTime) { |
| | | @ApiParam(value = "报告结束时间") @RequestParam(required = false) Date bgendTime, |
| | | @ApiParam(value = "单位") @RequestParam(required = false) String dw) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Long> cusIds = null; |
| | | if (null != name) { |
| | | LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.like(TjCustomer::getCusName, name); |
| | | List<TjCustomer> customerList = tjCustomerService.list(wqq); |
| | | if (null != customerList && customerList.size() > 0) { |
| | | List<TjOrder> list = new ArrayList<>(); |
| | | for (TjCustomer customer : customerList) { |
| | | LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | if (null != djbeginTime && null != djendTime) { |
| | | wq.between(TjOrder::getCreateTime, DateUtil.beginOfDay(djbeginTime), DateUtil.endOfDay(djendTime)); |
| | | } |
| | | wq.eq(TjOrder::getUserId, customer.getCusId()); |
| | | list.addAll(tjOrderService.list(wq)); |
| | | } |
| | | List<TjOrder> collect = null; |
| | | if (list.size() > 0) { |
| | | for (TjOrder order : list) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId()); |
| | | if (null != tjCustomer) { |
| | | // order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerName(tjCustomer.getCusName()); |
| | | // order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | order.setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | // order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | order.setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setCareer(tjCustomer.getCareer()); |
| | | order.setIdType(tjCustomer.getIdType()); |
| | | order.setAgeUnit(tjCustomer.getAgeUnit()); |
| | | order.setTjCount(String.valueOf(tjCustomer.getCusNumber())); |
| | | } |
| | | String firmId = order.getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) { |
| | | order.setDictCompName(iDictCompService.getById(String.valueOf(order.getFirmId())).getCnName()); |
| | | } |
| | | if (null != order.getPacId()) { |
| | | if (null != tjPackageService.getById(order.getPacId())) { |
| | | order.setPacName(tjPackageService.getById(order.getPacId()).getPacName()); |
| | | } |
| | | if (null != dwDeptService.getById(order.getPacId())) { |
| | | order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); |
| | | } |
| | | } |
| | | TjDjdDyjl dycs = djdDyjlService.getDjdDyCsByTjNum(order.getTjNumber()); |
| | | if(null !=dycs)order.setDycs(Math.toIntExact(dycs.getDycs())); |
| | | } |
| | | collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | } |
| | | if (null != collect) { |
| | | map.put("total", collect.size()); |
| | | } else { |
| | | map.put("total", 0); |
| | | } |
| | | map.put("list", collect); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | cusIds = tjCustomerService.list(wqq).stream().map(TjCustomer::getCusId).collect(Collectors.toList()); |
| | | } |
| | | |
| | | Page<TjOrder> page1 = new Page<>(pageNum, pageSize); |
| | | LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | if (null != djbeginTime && null != djendTime) { |
| | |
| | | |
| | | if (null != xmmc) { |
| | | wq.in(TjOrder::getTjNumber, projectService.getTjNumLIstByXmmx(xmmc)); |
| | | } |
| | | |
| | | if (StrUtil.isNotBlank(dw)) { |
| | | wq.like(TjOrder::getFirmName, dw); |
| | | } |
| | | |
| | | if (null != cusIds && !cusIds.isEmpty()) { |
| | | wq.in(TjOrder::getUserId, cusIds); |
| | | } |
| | | |
| | | if(null !=zt && (zt==0 || zt==1 || zt==2)){ |
| | | List<TjOrder> orders=new ArrayList<>(); |
| | | List<TjOrder> tjOrders=null; |
| | | List<TjOrder> orderList = tjOrderService.list(wq); |
| | | if(null !=orderList && !orderList.isEmpty()){ |
| | | for (TjOrder order : orderList) { |
| | | int czwj = remarkService.panduaniscunzaiweijian(order.getTjNumber()); |
| | | int sfwc = remarkService.panduaniswancheng(order.getTjNumber()); |
| | | if (zt==0 && czwj == 0) { |
| | | //未检0 |
| | | order.setZt("未检"); |
| | | orders.add(order); |
| | | } |
| | | if (zt==1 && czwj > 0) { |
| | | //在检1 |
| | | order.setZt("在检"); |
| | | orders.add(order); |
| | | } |
| | | if (zt==2 && sfwc == 0 && order.getCheckStatus()==0 && order.getCheckTime()==null && order.getHeshouStatus()==0 && order.getPrintLastTime()==null) { |
| | | //已完成2 |
| | | order.setZt("已完成"); |
| | | orders.add(order); |
| | | } |
| | | } |
| | | if(!orders.isEmpty()){ |
| | | tjOrders=orders.stream().sorted(Comparator.comparing(TjOrder::getCreateTime).reversed()) |
| | | .skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | for (TjOrder order : tjOrders) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId()); |
| | | if (null != tjCustomer) { |
| | | order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setTjCustomerName(tjCustomer.getCusName()); |
| | | order.setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | order.setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | order.setCareer(tjCustomer.getCareer()); |
| | | order.setIdType(tjCustomer.getIdType()); |
| | | order.setAgeUnit(tjCustomer.getAgeUnit()); |
| | | order.setTjCount(String.valueOf(tjCustomer.getCusNumber())); |
| | | if (null != tjCustomer.getCompName()) { |
| | | order.setDictCompName(tjCustomer.getCompName()); |
| | | } else { |
| | | String firmId = order.getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) { |
| | | order.setDictCompName(iDictCompService.getById(String.valueOf(order.getFirmId())).getCnName()); |
| | | } |
| | | } |
| | | if (null != order.getPacId()) { |
| | | if (null != tjPackageService.getById(order.getPacId())) { |
| | | order.setPacName(tjPackageService.getById(order.getPacId()).getPacName()); |
| | | } else if (null != dwDeptService.getById(order.getPacId())) { |
| | | order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); |
| | | } |
| | | } |
| | | TjDjdDyjl dycs = djdDyjlService.getDjdDyCsByTjNum(order.getTjNumber()); |
| | | if (null != dycs) order.setDycs(Math.toIntExact(dycs.getDycs())); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | map.put("list", tjOrders); |
| | | map.put("total", orders.size()); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | if(null !=zt){ |
| | | if(zt==3){ |
| | | //已审核 |
| | | wq.isNotNull(TjOrder::getCheckTime); |
| | | wq.eq(TjOrder::getCheckStatus,1); |
| | | wq.isNull(TjOrder::getHeshouTime); |
| | | wq.isNull(TjOrder::getPrintLastTime); |
| | | wq.eq(TjOrder::getHeshouStatus,0); |
| | | } |
| | | if(zt==4){ |
| | | //生成报告 |
| | | wq.isNotNull(TjOrder::getReportTime); |
| | | wq.isNull(TjOrder::getHeshouTime); |
| | | wq.isNull(TjOrder::getPrintLastTime); |
| | | wq.eq(TjOrder::getHeshouStatus,0); |
| | | } |
| | | if(zt==5){ |
| | | //报告核收 |
| | | wq.eq(TjOrder::getHeshouStatus,1); |
| | | wq.isNull(TjOrder::getPrintLastTime); |
| | | } |
| | | if(zt==6){ |
| | | //已出报告 |
| | | wq.isNotNull(TjOrder::getPrintLastTime); |
| | | wq.eq(TjOrder::getHeshouStatus,1); |
| | | wq.isNotNull(TjOrder::getPrintLastTime); |
| | | } |
| | | } |
| | | |
| | | wq.orderByDesc(TjOrder::getCreateTime); |
| | |
| | | order.setIdType(tjCustomer.getIdType()); |
| | | order.setAgeUnit(tjCustomer.getAgeUnit()); |
| | | order.setTjCount(String.valueOf(tjCustomer.getCusNumber())); |
| | | if (null != tjCustomer.getCompName()) { |
| | | order.setDictCompName(tjCustomer.getCompName()); |
| | | } else { |
| | | String firmId = order.getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) { |
| | | order.setDictCompName(iDictCompService.getById(String.valueOf(order.getFirmId())).getCnName()); |
| | | } |
| | | } |
| | | if (null != order.getPacId()) { |
| | | if (null != tjPackageService.getById(order.getPacId())) { |
| | | order.setPacName(tjPackageService.getById(order.getPacId()).getPacName()); |
| | | } else if (null != dwDeptService.getById(order.getPacId())) { |
| | | order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); |
| | | } |
| | | } |
| | | TjDjdDyjl dycs = djdDyjlService.getDjdDyCsByTjNum(order.getTjNumber()); |
| | | if (null != dycs) order.setDycs(Math.toIntExact(dycs.getDycs())); |
| | | } |
| | | String firmId = order.getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) { |
| | | order.setDictCompName(iDictCompService.getById(String.valueOf(order.getFirmId())).getCnName()); |
| | | } |
| | | if (null != order.getPacId()) { |
| | | if (null != tjPackageService.getById(order.getPacId())) { |
| | | order.setPacName(tjPackageService.getById(order.getPacId()).getPacName()); |
| | | } else if (null != dwDeptService.getById(order.getPacId())) { |
| | | order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); |
| | | int czwj = remarkService.panduaniscunzaiweijian(order.getTjNumber()); |
| | | int sfwc = remarkService.panduaniswancheng(order.getTjNumber()); |
| | | Date checkTime = order.getCheckTime(); |
| | | Date reportTime = order.getReportTime(); |
| | | Integer heshouStatus = order.getHeshouStatus(); |
| | | Date lastTime = order.getPrintLastTime(); |
| | | |
| | | if(null !=zt){ |
| | | if(zt==3){ |
| | | order.setZt("已审核"); |
| | | } |
| | | if(zt==4){ |
| | | order.setZt("生成报告"); |
| | | } |
| | | if(zt==5){ |
| | | order.setZt("报告核收"); |
| | | } |
| | | if(zt==6){ |
| | | order.setZt("已出报告"); |
| | | } |
| | | }else { |
| | | if (czwj == 0) { |
| | | //未检0 |
| | | order.setZt("未检"); |
| | | } |
| | | if (czwj > 0) { |
| | | //在检1 |
| | | order.setZt("在检"); |
| | | } |
| | | if (sfwc == 0) { |
| | | //已完成2 |
| | | order.setZt("已完成"); |
| | | } |
| | | if (null != checkTime) { |
| | | //已审核3 |
| | | order.setZt("已审核"); |
| | | } |
| | | if (null != reportTime) { |
| | | //生成报告4 |
| | | order.setZt("生成报告"); |
| | | } |
| | | if (1== heshouStatus) { |
| | | //报告核收5 |
| | | order.setZt("报告核收"); |
| | | } |
| | | if (null != lastTime) { |
| | | //已出报告6 |
| | | order.setZt("已出报告"); |
| | | } |
| | | } |
| | | TjDjdDyjl dycs = djdDyjlService.getDjdDyCsByTjNum(order.getTjNumber()); |
| | | if(null !=dycs)order.setDycs(Math.toIntExact(dycs.getDycs())); |
| | | } |
| | | } |
| | | map.put("list", list); |
| | |
| | | @ApiOperation(value = "体检报告页面——体检记录列表") |
| | | public AjaxResult getOrderListOO(@ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer pageNum, |
| | | @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize, |
| | | @ApiParam(value = "打印未打印状态 0未打印 1已打印") @RequestParam(required = false) Integer dyzt, |
| | | @ApiParam(value = "体检号)") @RequestParam(required = false) String tjNum, |
| | | @ApiParam(value = "姓名)") @RequestParam(required = false) String name, |
| | | @ApiParam(value = "单位") @RequestParam(required = false) String dw, |
| | | @ApiParam(value = "报告开始时间") @RequestParam(required = false) String djbeginTime, |
| | | @ApiParam(value = "报告结束时间") @RequestParam(required = false) String djendTime) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if (null != name) { |
| | | /* Map<String, Object> map = new HashMap<>(); |
| | | List<Long> cusIds = null; |
| | | if (StringUtil.isNotBlank(name)) { |
| | | LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.like(TjCustomer::getCusName, name); |
| | | List<TjCustomer> customerList = tjCustomerService.list(wqq); |
| | | if (null != customerList && !customerList.isEmpty()) { |
| | | List<TjOrder> list = new ArrayList<>(); |
| | | for (TjCustomer customer : customerList) { |
| | | LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | wq.isNotNull(TjOrder::getReportTime); |
| | | wq.eq(TjOrder::getUserId, customer.getCusId()); |
| | | wq.eq(TjOrder::getHeshouStatus, 1); //核收状态为1才能打印 |
| | | list.addAll(tjOrderService.list(wq)); |
| | | } |
| | | List<TjOrder> collect = null; |
| | | if (!list.isEmpty()) { |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(list.get(i).getUserId()); |
| | | if (null == tjCustomer) { |
| | | list.remove(list.get(i)); |
| | | continue; |
| | | } |
| | | list.get(i).setTjCustomerSex(tjCustomer.getCusSex()); |
| | | list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | list.get(i).setTjCustomerName(tjCustomer.getCusName()); |
| | | list.get(i).setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | list.get(i).setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | |
| | | String firmId = list.get(i).getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(list.get(i).getFirmId()))) { |
| | | list.get(i).setDictCompName(iDictCompService.getById(String.valueOf(list.get(i).getFirmId())).getCnName()); |
| | | } |
| | | if (null != list.get(i).getPacId()) { |
| | | if (null != tjPackageService.getById(list.get(i).getPacId())) { |
| | | list.get(i).setPacName(tjPackageService.getById(list.get(i).getPacId()).getPacName()); |
| | | } |
| | | if (null != dwDeptService.getById(list.get(i).getPacId())) { |
| | | list.get(i).setPacName(dwDeptService.getById(list.get(i).getPacId()).getDwDeptName()); |
| | | } |
| | | } |
| | | //从打印记录查出最新打印时间 |
| | | LambdaQueryWrapper<TjReportPrint> wqqq = new LambdaQueryWrapper<>(); |
| | | wqqq.eq(TjReportPrint::getTjNumber, list.get(i).getTjNumber()); |
| | | wqqq.orderByDesc(TjReportPrint::getPrintTime); |
| | | wqqq.last("limit 1"); |
| | | TjReportPrint one = tjReportPrintService.getOne(wqqq); |
| | | if (one != null) { |
| | | list.get(i).setPrintLastTime(one.getPrintTime()); |
| | | } |
| | | |
| | | } |
| | | collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | } |
| | | if (null != collect) { |
| | | map.put("total", collect.size()); |
| | | } else { |
| | | map.put("total", 0); |
| | | } |
| | | map.put("list", collect); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | cusIds = tjCustomerService.list(wqq).stream().map(TjCustomer::getCusId).collect(Collectors.toList()); |
| | | } |
| | | Page<TjOrder> page1 = new Page<>(pageNum, pageSize); |
| | | LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | wq.isNotNull(TjOrder::getReportTime); |
| | | wq.eq(TjOrder::getHeshouStatus, 1); //核收状态为1才能打印 |
| | | if (dyzt == 0) { |
| | | wq.isNull(TjOrder::getPrintLastTime); |
| | | wq.eq(TjOrder::getHeshouStatus, 1); //核收状态为1才能打印 |
| | | } else { |
| | | wq.isNotNull(TjOrder::getPrintLastTime); |
| | | } |
| | | |
| | | if (null != djbeginTime && null != djendTime) { |
| | | wq.between(TjOrder::getCreateTime, DateUtil.beginOfDay(DateUtil.parseDate(djbeginTime)), DateUtil.endOfDay(DateUtil.parseDate(djendTime))); |
| | | } |
| | | if (null != tjNum) { |
| | | wq.eq(TjOrder::getTjNumber, tjNum); |
| | | wq.like(TjOrder::getTjNumber, tjNum); |
| | | } |
| | | if (StringUtil.isNotBlank(dw)) { |
| | | wq.like(TjOrder::getFirmName, dw); |
| | | } |
| | | if (null != cusIds && !cusIds.isEmpty()) { |
| | | wq.in(TjOrder::getUserId, cusIds); |
| | | } |
| | | wq.orderByDesc(TjOrder::getCreateTime); |
| | | Page<TjOrder> page2 = tjOrderService.page(page1, wq); |
| | |
| | | list.get(i).setTjCustomerSex(tjCustomer.getCusSex()); |
| | | list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | list.get(i).setTjCustomerName(tjCustomer.getCusName()); |
| | | list.get(i).setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | list.get(i).setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | if (tjCustomer.getCusIdcard() != null) { |
| | | list.get(i).setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | list.get(i).setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | } |
| | | |
| | | String firmId = list.get(i).getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(list.get(i).getFirmId()))) { |
| | | list.get(i).setDictCompName(iDictCompService.getById(String.valueOf(list.get(i).getFirmId())).getCnName()); |
| | | if (null != tjCustomer.getCompName()) { |
| | | list.get(i).setDictCompName(tjCustomer.getCompName()); |
| | | } else { |
| | | String firmId = list.get(i).getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(list.get(i).getFirmId()))) { |
| | | list.get(i).setDictCompName(iDictCompService.getById(String.valueOf(list.get(i).getFirmId())).getCnName()); |
| | | } |
| | | } |
| | | if (null != list.get(i).getPacId()) { |
| | | if (null != tjPackageService.getById(list.get(i).getPacId())) { |
| | |
| | | } |
| | | } |
| | | //从打印记录查出最新打印时间 |
| | | LambdaQueryWrapper<TjReportPrint> wqqq = new LambdaQueryWrapper<>(); |
| | | wqqq.eq(TjReportPrint::getTjNumber, list.get(i).getTjNumber()); |
| | | wqqq.orderByDesc(TjReportPrint::getPrintTime); |
| | | wqqq.last("limit 1"); |
| | | TjReportPrint one = tjReportPrintService.getOne(wqqq); |
| | | if (one != null) { |
| | | list.get(i).setPrintLastTime(one.getPrintTime()); |
| | | } |
| | | // LambdaQueryWrapper<TjReportPrint> wqqq = new LambdaQueryWrapper<>(); |
| | | // wqqq.eq(TjReportPrint::getTjNumber, list.get(i).getTjNumber()); |
| | | // wqqq.orderByDesc(TjReportPrint::getPrintTime); |
| | | // wqqq.last("limit 1"); |
| | | // TjReportPrint one = tjReportPrintService.getOne(wqqq); |
| | | // if (one != null) { |
| | | // list.get(i).setPrintLastTime(one.getPrintTime()); |
| | | // } |
| | | } |
| | | } |
| | | map.put("list", list); |
| | | map.put("total", page2.getTotal()); |
| | | map.put("total", page2.getTotal());*/ |
| | | |
| | | if (djbeginTime == null) djbeginTime = ""; |
| | | if (djendTime == null) djendTime = ""; |
| | | Map<String, Object> map= tjOrderService.getTjBgdyList(pageNum,pageSize,dyzt,tjNum,name,dw,djbeginTime,djendTime); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | |
| | | return AjaxResult.error("对不起您的预约已超时请重新预约"); |
| | | } |
| | | if (null != tjReservation.getTeamNo()) tjOrder.setTeamNo(tjReservation.getTeamNo()); |
| | | if (null != tjReservation.getCompanyId()) tjOrder.setFirmId(tjReservation.getCompanyId()); |
| | | // if (null != tjReservation.getCompanyId()) tjOrder.setFirmId(tjReservation.getCompanyId()); |
| | | // if (null != tjReservation.getCompany()) tjOrder.setFirmName(tjReservation.getCompany()); |
| | | if (null != tjReservation.getDepartment()) tjOrder.setFirmDeptName(tjReservation.getDepartment()); |
| | | if (null != tjReservation.getJobNo()) tjOrder.setFirmWorkId(tjReservation.getJobNo()); |
| | | if (null != tjReservation.getPacId()) tjOrder.setPacId(tjReservation.getPacId()); |
| | |
| | | tjOrder.setGroupId(tjReservation.getGroupingId()); |
| | | tjOrder.setFirmDeptId(tjReservation.getPacId()); |
| | | } |
| | | // if (null != tjReservation.getDepartmentId()) tjOrder.setFirmDeptId(tjReservation.getDepartmentId()); |
| | | tjReservation.setIsExpire(1); |
| | | tjReservationService.updateById(tjReservation); |
| | | if (null != tjReservation.getTeamNo() && tjOrder.getTjType().equals("1")) { |
| | |
| | | tjOrder.setTjType("2"); |
| | | } |
| | | } |
| | | |
| | | if (null != tjCustomer.getCompName()) { |
| | | tjOrder.setFirmName(tjCustomer.getCompName()); |
| | | } |
| | | if (null != tjCustomer.getDictCompId()) { |
| | | tjOrder.setFirmId(String.valueOf(tjCustomer.getDictCompId())); |
| | | } else { |
| | | tjOrder.setFirmId("0"); |
| | | } |
| | | |
| | | |
| | | if (null != tjOrder.getPhoto()) { |
| | | File file = new File(tjOrder.getPhoto()); |
| | |
| | | tjOrder.setPhoto(encode); |
| | | } |
| | | } |
| | | if (tjOrder.getFirmId() == null) { |
| | | tjOrder.setFirmId("0"); |
| | | } |
| | | |
| | | |
| | | if (null == tjOrder.getPacId() && null != transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjOrder.getUserId()))) { |
| | | tjOrder.setPacId(transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjOrder.getUserId()))); |
| | | } |
| | |
| | | //asyncService.newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser,null); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | |
| | | String s = configService.selectConfigByKey("is_request_common_his_api"); |
| | | if (null != s && s.equals("Y")) { |
| | | String apiUrl = configService.selectConfigByKey("common_api_url"); |
| | | String hospbm = configService.selectConfigByKey("common_api_service_hospbm"); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("pationId",tjCustomer.getPationId()); |
| | | map.put("cardId",tjCustomer.getHisJzkh()); |
| | | map.put("tjNum",tjFlowingWater.getTjSerialNumber()); |
| | | map.put("kaiDanKs","7805"); |
| | | // 收费标志 1待售费 2待退费 |
| | | map.put("shouTuiStatus","1"); |
| | | |
| | | JSONArray array = JSONUtil.createArray(); |
| | | LambdaQueryWrapper<TbTransition> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TbTransition::getTjNum,tjOrder.getTjNumber()); |
| | | wrapper.eq(TbTransition::getCusId,tjCustomer.getCusIdcard()); |
| | | wrapper.eq(TbTransition::getCardId,tjCustomer.getCardId()); |
| | | wrapper.isNotNull(TbTransition::getOrdPrice); |
| | | wrapper.gt(TbTransition::getOrdPrice,0); |
| | | |
| | | List<TbTransition> list = tbTransitionService.list(wrapper); |
| | | for (TbTransition transition : list) { |
| | | LambdaQueryWrapper<TjProject> wrapper1 = new LambdaQueryWrapper<>(); |
| | | wrapper1.eq(TjProject::getProId,transition.getProId()); |
| | | TjProject project = projectService.getOne(wrapper1); |
| | | |
| | | LambdaQueryWrapper<SysDept> wrapper2 = new LambdaQueryWrapper<>(); |
| | | wrapper2.eq(SysDept::getDeptId,project.getDeptId()); |
| | | SysDept dept = sysDeptService.getOne(wrapper2); |
| | | |
| | | JSONObject obj = JSONUtil.createObj(); |
| | | Integer sl = project.getSl(); |
| | | BigDecimal danjia = transition.getOrdPrice(); |
| | | BigDecimal allPrice = danjia.multiply(new BigDecimal(sl)); |
| | | obj.putOpt("danJia",danjia); |
| | | obj.putOpt("jieSuanJe",allPrice); |
| | | obj.putOpt("shuliang",sl); |
| | | obj.putOpt("zhiXingKs",dept.getDeptId()); |
| | | obj.putOpt("zhiXingKsMc",dept.getDeptName()); |
| | | obj.putOpt("shouFeiXmId",project.getHisXmbm()); |
| | | obj.putOpt("shouFeiXmMc",project.getHisXmmc()); |
| | | |
| | | // obj.putOpt("zhiXingKs","7805"); |
| | | // obj.putOpt("zhiXingKsMc","体检科"); |
| | | // obj.putOpt("shouFeiXmId","4735346"); |
| | | // obj.putOpt("shouFeiXmMc","体检费"); |
| | | array.add(obj); |
| | | } |
| | | map.put("feiYongInfoList",array); |
| | | |
| | | String post = HttpClientUtils.sendPost(apiUrl + "/api/his/"+hospbm+"/creatCostInfo", map); |
| | | JSONObject object = JSONUtil.parseObj(post); |
| | | if (object.getInt("code") == 200) { |
| | | JSONObject data = object.getJSONObject("data"); |
| | | tjFlowingWater.setHisWaterId(data.getStr("feiYongId")); |
| | | JSONArray mxList = data.getJSONArray("mxList"); |
| | | if (mxList != null && !mxList.isEmpty()) { |
| | | List<TjFlowingWaterHis> his = mxList.toList(TjFlowingWaterHis.class); |
| | | tjFlowingWaterHisService.saveBatch(his); |
| | | } |
| | | tjFlowingWaterService.updateById(tjFlowingWater); |
| | | }else { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error(); |
| | | } |
| | | } |
| | | } |
| | | // 查询 对接Lis、Pacs申请如果类型包含在配置内则使用对接lis、pacs |
| | | if (lisApiMethod.isUseLisAndPacsRegister(tjOrder)) { |
| | |
| | | // if (!ajaxResult.get("code").toString().equals("200")) return ajaxResult; |
| | | tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), |
| | | sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | |
| | | remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(),tjFlowingWater.getTjSerialNumber().toString()); |
| | | List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser,null); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | |
| | | } |
| | | // pacsApiMethodService.OrderAdd(tjCustomer,tjOrder); |
| | |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | public void addCaiYangDengJi(List<TjOrderDetail> detailList, boolean detailList1, TjOrder order, SysUser sysUser,String jxbz) { |
| | | public void addCaiYangDengJi(List<TjOrderDetail> detailList, boolean detailList1, TjOrder order, SysUser sysUser, String jxbz) { |
| | | if (null != detailList && detailList1) { |
| | | Date date = new Date(); |
| | | String format = DateUtil.format(date, "yyMMddHHmmssSSS"); |
| | |
| | | String dictLabel = sysDictDataService.selectDictLabel("sys_dict_specimen", project.getSpecimenType()); |
| | | if (null != proParentId && proParentId == 0) { |
| | | sampling.setJyxh(idUtils.generateLisID()); |
| | | sampling.setSpecimenTypeCode(project.getSpecimenType()); |
| | | sampling.setSpecimenType(dictLabel); |
| | | sampling.setJyxmdm(project.getProId().toString()); |
| | | sampling.setSpecimenTypeCode(project.getSpecimenType()); |
| | | sampling.setSpecimenType(dictLabel); |
| | | sampling.setJyxmdm(project.getProId().toString()); |
| | | } else { |
| | | TjProject project1 = projectService.getById(proParentId); |
| | | sampling.setJyxh(idUtils.generateLisID()); |
| | | |
| | | sampling.setSpecimenTypeCode(project1.getSpecimenType()); |
| | | sampling.setSpecimenType(dictLabel); |
| | | sampling.setJyxmdm(project.getProId().toString()); |
| | | sampling.setSpecimenTypeCode(project1.getSpecimenType()); |
| | | sampling.setSpecimenType(dictLabel); |
| | | sampling.setJyxmdm(project.getProId().toString()); |
| | | |
| | | } |
| | | sampling.setSamplingNumber(format); |
| | |
| | | } |
| | | } |
| | | String config = configService.selectConfigByKey("sfkqdyhis"); |
| | | if (lisApiMethod.isUseLisAndPacsRegister(order) && (null != config && config.equals("Y"))){ |
| | | if (lisApiMethod.isUseLisAndPacsRegister(order) && (null != config && config.equals("Y"))) { |
| | | AjaxResult ajaxResult = lisApiMethod.getJyFlHb(); |
| | | if (ajaxResult.get("code").toString().equals("200")){ |
| | | if (ajaxResult.get("code").toString().equals("200")) { |
| | | String str = ajaxResult.get("data").toString(); |
| | | str = str.replace("=", ":"); |
| | | JSONArray array = JSONUtil.parseArray(str); |
| | |
| | | lisJyflhb.setMc(object.getStr("mc")); |
| | | lisJyflhb.setFlbm(object.getStr("flbm")); |
| | | LambdaQueryWrapper<LisJyflhb> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(LisJyflhb::getFlbm,lisJyflhb.getFlbm()); |
| | | wrapper.eq(LisJyflhb::getFlbm, lisJyflhb.getFlbm()); |
| | | LisJyflhb jyflhb = lisJyflhbService.getOne(wrapper); |
| | | if (jyflhb == null) { |
| | | lisJyflhb.setId(IdUtil.getSnowflake().nextId()); |
| | | lisJyflhbService.save(lisJyflhb); |
| | | }else { |
| | | } else { |
| | | lisJyflhb.setId(jyflhb.getId()); |
| | | lisJyflhbService.updateById(lisJyflhb); |
| | | } |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/addPlOrderAndDetail") |
| | |
| | | transitionService.deletedTbTransitionListByCusIdAndPac(cusId, cardId); |
| | | List<TjPackageProject> ppList = tjPackageProjectService.getTjPackageProjectListByPacId(String.valueOf(pacId)); |
| | | if (null != ppList && !ppList.isEmpty()) { |
| | | String string = transitionService.panduantaocanshifouchongfu(cusId,pacId); |
| | | if(!StringUtils.isBlank(string)){ |
| | | String string = transitionService.panduantaocanshifouchongfu(cusId, pacId); |
| | | if (!StringUtils.isBlank(string)) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("操作失败! 以下项目已存在: "+string); |
| | | return AjaxResult.error("操作失败! 以下项目已存在: " + string); |
| | | } |
| | | transitionService.saveRedisTransitionByPacId(cusId, cardId, pacId); |
| | | } |
| | |
| | | if (null != tjReservation && tjReservation.getPayType() == 1) { |
| | | tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), |
| | | sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(),tjFlowingWater.getTjSerialNumber().toString()); |
| | | } |
| | | } |
| | | if (tjFlowingWater.getPayStasus() == 1L) { |
| | |
| | | tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); |
| | | tjFlowingWater.setPayType(4L); |
| | | tjFlowingWaterService.updateById(tjFlowingWater); |
| | | remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(),tjFlowingWater.getTjSerialNumber().toString()); |
| | | // asyncService.addTjChargingStandard(tjOrder, transitionService.getTbTransitionListByCusId(tjCustomer.getCusIdcard(), tjOrder.getCardId()), sysUser); |
| | | } |
| | | } |
| | |
| | | if (null != tjReservation && tjReservation.getPayType() == 1) { |
| | | tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), |
| | | sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(),tjFlowingWater.getTjSerialNumber().toString()); |
| | | } |
| | | } |
| | | if (tjFlowingWater.getPayStasus() == 1) { |
| | | tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), |
| | | sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(),tjFlowingWater.getTjSerialNumber().toString()); |
| | | } |
| | | if (tjFlowingWater.getDiscount() == null) { |
| | | transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), new BigDecimal(10), tjOrder.getTjNumber()); |
| | |
| | | // } |
| | | } |
| | | |
| | | @PostMapping("/heXiaoByIds/{orderIds}") |
| | | @PostMapping("/heXiaoByIds") |
| | | @ApiOperation(value = "核收报告——————总检审核通过后可以核销,核收后才能打印") |
| | | @Transactional |
| | | @RepeatSubmit |
| | | public AjaxResult heXiaoByIds(@PathVariable String[] orderIds) { |
| | | public AjaxResult heXiaoByIds(@RequestBody List<String> orderIds) { |
| | | if(null !=orderIds && !orderIds.isEmpty()){ |
| | | Date date = new Date(); |
| | | for (String orderId : orderIds) { |
| | | TjOrder byId = tjOrderService.getById(orderId); |
| | | if (null != byId) { |
| | | if (byId.getReportTime() == null) { |
| | | |
| | | /*if (byId.getReportTime() == null) { |
| | | LambdaQueryWrapper<TjReportTemplate> tjReportTemplateLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | tjReportTemplateLambdaQueryWrapper.eq(TjReportTemplate::getFlag, 1); |
| | | tjReportTemplateLambdaQueryWrapper.eq(TjReportTemplate::getOpen, 0); |
| | |
| | | //修改order表中的打印报告时间为当前时间 |
| | | LambdaUpdateWrapper<TjOrder> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(TjOrder::getTjNumber, byId.getTjNumber()); |
| | | updateWrapper.set(TjOrder::getReportTime, new Date()); |
| | | updateWrapper.set(TjOrder::getPrintLastTime, new Date()); |
| | | updateWrapper.set(TjOrder::getDownloadLastTime, new Date()); |
| | | updateWrapper.set(TjOrder::getStatus, TjConstants.TJ_END); |
| | | tjOrderService.update(updateWrapper); |
| | | } |
| | | String hisRegistrationId = byId.getCardId(); |
| | | Date createTime = byId.getCreateTime(); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String ksrq = dateFormat.format(createTime); |
| | | String jsrq = dateFormat.format(date); |
| | | HashMap<String, Object> params = new HashMap<>(); |
| | | params.put("his_registration_id", hisRegistrationId); |
| | | params.put("ksbm", ""); |
| | | params.put("pationid", ""); |
| | | params.put("ksrq", ksrq); |
| | | params.put("jsrq", jsrq); |
| | | params.put("pagecount", 100); |
| | | params.put("page", 1); |
| | | |
| | | LambdaQueryWrapper<TjCustomer> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjCustomer::getCusId, byId.getUserId()); |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wq1); |
| | | LambdaQueryWrapper<TjReportTemplate> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjReportTemplate::getFlag,"4"); |
| | | wrapper.eq(TjReportTemplate::getOpen,"1"); |
| | | wrapper.eq(TjReportTemplate::getFlag, "4"); |
| | | wrapper.eq(TjReportTemplate::getOpen, "1"); |
| | | TjReportTemplate zongJianYiShiQianMing = reportTemplateService.getOne(wrapper); |
| | | try { |
| | | shengchengbgmoban(byId.getTjNumber(), byId, tjCustomer, reportTemplate,zongJianYiShiQianMing); |
| | | shengchengbgmoban(byId.getTjNumber(), byId, tjCustomer, reportTemplate, zongJianYiShiQianMing); |
| | | byId.setStatus(TjConstants.TJ_END); |
| | | byId.setReportTime(date); |
| | | byId.setPrintLastTime(date); |
| | | byId.setDownloadLastTime(date); |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | e.printStackTrace(); |
| | |
| | | logger.error("生成报告异常"); |
| | | return AjaxResult.error("生成报告异常,核收失败"); |
| | | } |
| | | } |
| | | |
| | | }*/ |
| | | byId.setHeshouStatus(1); |
| | | byId.setHeshouDoctor(UserHoder.getLoginUser().getUserId()); |
| | | byId.setHeshouTime(date); |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success("核收成功"); |
| | | } |
| | | |
| | | |
| | | public AjaxResult shengchengbgmoban(String tjNumber, TjOrder tjOrder, TjCustomer tjCustomer, TjReportTemplate reportTemplate,TjReportTemplate zongJianYiShiQianMing) throws Exception { |
| | | // AjaxResult ajaxResult = hisPDFUtil.hisPDF(tjOrder, tjCustomer, reportTemplate); |
| | | // AjaxResult ajaxResult = hisPDFUtil.hisPDFNew(tjOrder, tjCustomer, reportTemplate); |
| | | AjaxResult ajaxResult = hisPDFUtil.hisPDFNew2(tjOrder, tjCustomer, reportTemplate,zongJianYiShiQianMing); |
| | | public AjaxResult shengchengbgmoban(String tjNumber, TjOrder tjOrder, TjCustomer tjCustomer, TjReportTemplate reportTemplate, TjReportTemplate zongJianYiShiQianMing) throws Exception { |
| | | |
| | | AjaxResult ajaxResult = hisPDFUtil.hisPDFNew2(tjOrder, tjCustomer, reportTemplate, zongJianYiShiQianMing); |
| | | if (!ajaxResult.get("code").toString().equals("200")) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } else { |
| | |
| | | tjReport.setType("体检报告"); |
| | | tjReport.setPrint("pdf"); |
| | | tjReportService.save(tjReport); |
| | | // Date date = new Date(); |
| | | // tjOrder.setStatus(TjConstants.TJ_END); |
| | | // tjOrder.setReportTime(date); |
| | | // tjOrder.setPrintLastTime(date); |
| | | // tjOrder.setDownloadLastTime(date); |
| | | // tjOrderService.updateById(tjOrder); |
| | | } |
| | | return ajaxResult; |
| | | } |
| | |
| | | // if (null != payByTjNum) { |
| | | // return AjaxResult.error("该用户已收费不可撤销签到!"); |
| | | // } |
| | | if(null !=order.getFinishTime()) return AjaxResult.error("该人员已签离,不可撤销!!!"); |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId())); |
| | | remarkService.deletedOrderRemarkByTjNum(tjNum); |
| | | tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId())); |
| | | transitionService.deletedTbTransitionByTjNum(tjNum); |
| | | if (null != order.getFinishTime()) return AjaxResult.error("该人员已签离,不可撤销!!!"); |
| | | |
| | | TjCustomer customer = tjCustomerService.getById(order.getUserId()); |
| | | customer.setCardId("0"); |
| | | tjCustomerService.updateById(customer); |
| | | String s = configService.selectConfigByKey("is_request_common_his_api"); |
| | | if (null != s && s.equals("Y") && "2".equals(order.getTjType())){ |
| | | String apiUrl = configService.selectConfigByKey("common_api_url"); |
| | | String hospbm = configService.selectConfigByKey("common_api_service_hospbm"); |
| | | |
| | | ArrayList<TjFlowingWater> weizhifu = new ArrayList<>(); |
| | | ArrayList<TjFlowingWater> yizhifu = new ArrayList<>(); |
| | | LambdaQueryWrapper<TjFlowingWater> wrapper1 = new LambdaQueryWrapper<>(); |
| | | wrapper1.eq(TjFlowingWater::getOrderId, order.getOrderId()); |
| | | wrapper1.orderByDesc(TjFlowingWater::getJxbz); |
| | | List<TjFlowingWater> list = tjFlowingWaterService.list(wrapper1); |
| | | LambdaQueryWrapper<TjCustomer> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjCustomer::getCusId,order.getUserId()); |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wrapper); |
| | | |
| | | for (TjFlowingWater water : list) { |
| | | if (water.getPayStasus() == 0L){ |
| | | weizhifu.add(water); |
| | | }else { |
| | | yizhifu.add(water); |
| | | } |
| | | } |
| | | |
| | | AjaxResult error = zuofeiWeiZhifu(weizhifu, tjCustomer, apiUrl, hospbm, order,true,tjNum); |
| | | if (error != null && !error.get("code").toString().equals("200")) return error; |
| | | |
| | | AjaxResult error1 = zuofeiYiZhifu(yizhifu, tjCustomer, order, apiUrl, hospbm,false,tjNum); |
| | | if (error1 != null && !error.get("code").toString().equals("200")) return error1; |
| | | }else { |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId())); |
| | | remarkService.deletedOrderRemarkByTjNum(tjNum); |
| | | tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId())); |
| | | transitionService.deletedTbTransitionByTjNum(tjNum); |
| | | |
| | | TjCustomer customer = tjCustomerService.getById(order.getUserId()); |
| | | customer.setCardId("0"); |
| | | tjCustomerService.updateById(customer); |
| | | |
| | | tjSamplingMapper.deleteByTjNumAndCusId(tjNum, order.getUserId()); |
| | | } |
| | | |
| | | String configByKey = configService.selectConfigByKey("sfkqdyhis"); |
| | | tjSamplingMapper.deleteByTjNumAndCusId(tjNum, order.getUserId()); |
| | | if (configByKey.equals("Y")) { |
| | | |
| | | HashMap<String, Object> hisRequestParams = new HashMap<>(); |
| | |
| | | remarkService.deletedOrderRemarkByTjNum(order.getTjNumber()); |
| | | tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId())); |
| | | transitionService.deletedTbTransitionByTjNum(order.getTjNumber()); |
| | | transitionService.updateTbTransitionByTjNum(order.getTjNumber()); |
| | | // transitionService.updateTbTransitionByTjNum(order.getTjNumber()); |
| | | } |
| | | } |
| | | for (String id : reservationIds) { |
| | |
| | | |
| | | |
| | | @GetMapping("/revokeTjOrderByTjh") |
| | | @ApiOperation(value = "根据就体检号删除记录") |
| | | @ApiOperation(value = "强制撤销接口根据就体检号删除记录") |
| | | @Transactional |
| | | public AjaxResult revokeTjOrderByTjh(@RequestParam @ApiParam(value = "体检号") String tjNum) { |
| | | |
| | |
| | | // if (null != payByTjNum) { |
| | | // return AjaxResult.error("该用户已收费不可撤销签到!"); |
| | | // } |
| | | //这里删除的是这个人所有项目包括补录项目 |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId())); |
| | | remarkService.deletedOrderRemarkByTjNum(tjNum); |
| | | tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId())); |
| | | transitionService.deletedTbTransitionByTjNum(tjNum); |
| | | tjSamplingMapper.deleteByTjNumAndCusId(order.getTjNumber(), order.getUserId()); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | // @Transactional |
| | | public AjaxResult revokeBlProByBldhAndTjh(@RequestBody TjProBlDto dto) { |
| | | |
| | | if (null == dto.getBldhs() || dto.getBldhs().size() == 0) { |
| | | if (null == dto.getBldhs() || dto.getBldhs().isEmpty()) { |
| | | log.info("请选择要撤销的补录项目"); |
| | | return AjaxResult.error("请选择要撤销的补录项目"); |
| | | } |
| | |
| | | return AjaxResult.error("撤销失败,调用作废出现失败"); |
| | | } |
| | | } |
| | | try { |
| | | extracted(dto, order); |
| | | } catch (Exception e) { |
| | | log.info("撤销失败,删除表失败"); |
| | | return AjaxResult.error("撤销失败,删除表失败!"); |
| | | String s = configService.selectConfigByKey("is_request_common_his_api"); |
| | | if (null != s && s.equals("Y") && "2".equals(order.getTjType())) { |
| | | ArrayList<TjFlowingWater> weizhifu = new ArrayList<>(); |
| | | ArrayList<TjFlowingWater> yizhifu = new ArrayList<>(); |
| | | for (String bldh : dto.getBldhs()) { |
| | | LambdaQueryWrapper<TjFlowingWater> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjFlowingWater::getJxbz,bldh); |
| | | TjFlowingWater water = tjFlowingWaterService.getOne(wrapper); |
| | | if (water.getPayStasus() == 0L){ |
| | | weizhifu.add(water); |
| | | }else { |
| | | yizhifu.add(water); |
| | | } |
| | | } |
| | | String apiUrl = configService.selectConfigByKey("common_api_url"); |
| | | String hospbm = configService.selectConfigByKey("common_api_service_hospbm"); |
| | | LambdaQueryWrapper<TjCustomer> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjCustomer::getCusId,order.getUserId()); |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wrapper); |
| | | AjaxResult error = zuofeiWeiZhifu(weizhifu, tjCustomer, apiUrl, hospbm, order,true,dto.getTjh()); |
| | | if (error != null && !error.get("code").toString().equals("200")) return error; |
| | | |
| | | AjaxResult error1 = zuofeiYiZhifu(yizhifu, tjCustomer, order, apiUrl, hospbm,false,dto.getTjh()); |
| | | if (error1 != null && !error.get("code").toString().equals("200")) return error1; |
| | | return AjaxResult.success(); |
| | | }else { |
| | | try { |
| | | extracted(dto, order); |
| | | } catch (Exception e) { |
| | | log.info("撤销失败,删除表失败"); |
| | | return AjaxResult.error("撤销失败,删除表失败!"); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | private AjaxResult zuofeiYiZhifu(ArrayList<TjFlowingWater> yizhifu, TjCustomer tjCustomer, TjOrder order, String apiUrl, String hospbm,Boolean isDelete,String tjNum) { |
| | | if (!yizhifu.isEmpty()){ |
| | | for (TjFlowingWater water : yizhifu) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("pationId", tjCustomer.getPationId()); |
| | | map.put("cardId", tjCustomer.getHisJzkh()); |
| | | map.put("tjNum", water.getTjSerialNumber()); |
| | | map.put("kaiDanKs","7805"); |
| | | // 收费标志 1待收费 2待退费 |
| | | map.put("shouTuiStatus","2"); |
| | | JSONArray array = JSONUtil.createArray(); |
| | | String bldh = water.getJxbz(); |
| | | List<TbTransition> list; |
| | | if (bldh != null){ |
| | | LambdaQueryWrapper<TbTransition> wrapper1 = new LambdaQueryWrapper<>(); |
| | | wrapper1.eq(TbTransition::getJxbz,bldh); |
| | | wrapper1.gt(TbTransition::getOrdPrice,0); |
| | | list = tbTransitionService.list(wrapper1); |
| | | }else { |
| | | LambdaQueryWrapper<TbTransition> wrapper1 = new LambdaQueryWrapper<>(); |
| | | wrapper1.isNull(TbTransition::getJxbz); |
| | | wrapper1.eq(TbTransition::getTjNum,tjNum); |
| | | wrapper1.gt(TbTransition::getOrdPrice,0); |
| | | list = tbTransitionService.list(wrapper1); |
| | | } |
| | | for (TbTransition transition : list) { |
| | | LambdaQueryWrapper<TjProject> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(TjProject::getProId,transition.getProId()); |
| | | TjProject project = projectService.getOne(queryWrapper); |
| | | LambdaQueryWrapper<TjFlowingWaterHis> wrapper2 = new LambdaQueryWrapper<>(); |
| | | wrapper2.eq(TjFlowingWaterHis::getParentId,water.getHisWaterId()); |
| | | wrapper2.eq(TjFlowingWaterHis::getXmId,project.getHisXmbm()); |
| | | List<TjFlowingWaterHis> list1 = tjFlowingWaterHisService.list(wrapper2); |
| | | for (TjFlowingWaterHis waterHis : list1) { |
| | | LambdaQueryWrapper<SysDept> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(SysDept::getDeptId,project.getDeptId()); |
| | | SysDept dept = sysDeptService.getOne(wrapper); |
| | | JSONObject obj = JSONUtil.createObj(); |
| | | BigDecimal danjia = transition.getOrdPrice(); |
| | | Integer sl = project.getSl(); |
| | | BigDecimal allPrice = danjia.multiply(new BigDecimal(sl)); |
| | | obj.putOpt("danJia",danjia); |
| | | obj.putOpt("jieSuanJe",allPrice.negate()); |
| | | obj.putOpt("shuliang",Math.negateExact(sl)); |
| | | obj.putOpt("feiYongMxId",waterHis.getCurrentId()); |
| | | obj.putOpt("feiYongId",water.getHisWaterId()); |
| | | obj.putOpt("zhiXingKs",dept.getDeptId()); |
| | | obj.putOpt("zhiXingKsMc",dept.getDeptName()); |
| | | obj.putOpt("shouFeiXmId",project.getHisXmbm()); |
| | | obj.putOpt("shouFeiXmMc",project.getHisXmmc()); |
| | | |
| | | // obj.putOpt("zhiXingKs","7805"); |
| | | // obj.putOpt("zhiXingKsMc","体检科"); |
| | | // obj.putOpt("shouFeiXmId","4735346"); |
| | | // obj.putOpt("shouFeiXmMc","体检费"); |
| | | array.add(obj); |
| | | } |
| | | |
| | | } |
| | | map.put("feiYongInfoList",array); |
| | | log.info("退费申请 入参 -> {}",JSONUtil.toJsonStr(map)); |
| | | String post = HttpClientUtils.sendPost(apiUrl + "/api/his/"+ hospbm +"/creatCostInfo", map); |
| | | log.info("退费申请 返回 -> {}",JSONUtil.toJsonStr(post)); |
| | | JSONObject jsonObject = JSONUtil.parseObj(post); |
| | | if (jsonObject.getStr("code").equals("200")) { |
| | | // hisTfWaterId |
| | | String tfid = jsonObject.getJSONObject("data").getStr("feiYongId"); |
| | | water.setHisTfWaterId(tfid); |
| | | tjFlowingWaterService.updateById(water); |
| | | if (isDelete) { |
| | | for (TjFlowingWater water1 : yizhifu) { |
| | | String bldh1 = water1.getJxbz(); |
| | | remarkService.deleteTjOrderDetailByjxbz(bldh1); |
| | | tjOrderDetailService.deleteTjOrderDetailByjxbz(bldh1); |
| | | tjFlowingWaterService.deleteTjOrderDetailByjxbz(bldh1); |
| | | transitionService.deleteTjOrderDetailByjxbz(bldh1); |
| | | blService.remove(new LambdaQueryWrapper<TjProBl>().eq(TjProBl::getTjh, tjNum).eq(TjProBl::getBldh, bldh1)); |
| | | tjSamplingMapper.deleteByTjNumAndCusIdAndJxbzo(tjNum, order.getUserId(), bldh1); |
| | | } |
| | | } |
| | | }else return AjaxResult.error(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private AjaxResult zuofeiWeiZhifu(ArrayList<TjFlowingWater> weizhifu, TjCustomer tjCustomer, String apiUrl, String hospbm, TjOrder order,Boolean isDelete,String tjNum) { |
| | | if (!weizhifu.isEmpty()){ |
| | | HashMap<String, Object> chexiaoMap = new HashMap<>(); |
| | | chexiaoMap.put("pationId", tjCustomer.getPationId()); |
| | | chexiaoMap.put("cardId", tjCustomer.getHisJzkh()); |
| | | String feiyongList = weizhifu.stream().map(TjFlowingWater::getHisWaterId).collect(Collectors.joining(",")); |
| | | chexiaoMap.put("feiYongIdList",feiyongList.trim().replaceAll(" ","")); |
| | | |
| | | String post = HttpClientUtils.sendPost(apiUrl + "/api/his/"+ hospbm +"/revokeCost", chexiaoMap); |
| | | if (JSONUtil.parseObj(post).getStr("code").equals("200")) { |
| | | if (isDelete) { |
| | | for (TjFlowingWater water : weizhifu) { |
| | | String bldh = water.getJxbz(); |
| | | if(StrUtil.isNotBlank(bldh)){ |
| | | remarkService.deleteTjOrderDetailByjxbz(bldh); |
| | | tjOrderDetailService.deleteTjOrderDetailByjxbz(bldh); |
| | | tjFlowingWaterService.deleteTjOrderDetailByjxbz(bldh); |
| | | transitionService.deleteTjOrderDetailByjxbz(bldh); |
| | | blService.remove(new LambdaQueryWrapper<TjProBl>().eq(TjProBl::getTjh, tjNum).eq(TjProBl::getBldh, bldh)); |
| | | tjSamplingMapper.deleteByTjNumAndCusIdAndJxbzo(tjNum, order.getUserId(), bldh); |
| | | }else { |
| | | //这里删除的是这个人所有项目包括补录项目 |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId())); |
| | | remarkService.deletedOrderRemarkByTjNum(tjNum); |
| | | tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId())); |
| | | transitionService.deletedTbTransitionByTjNum(tjNum); |
| | | tjSamplingMapper.deleteByTjNumAndCusId(order.getTjNumber(), order.getUserId()); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } else return AjaxResult.error(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | // @Transactional(propagation =Propagation.REQUIRES_NEW) |
| | |
| | | @GetMapping("/chushenyemianqijianjiekou") |
| | | @ApiOperation(value = "初审页面弃检接口") |
| | | @Transactional |
| | | public AjaxResult chushenyemianqijianjiekou(@RequestParam String tjNUm,@RequestParam String proId) { |
| | | LambdaQueryWrapper<TjOrderRemark> wq=new LambdaQueryWrapper<>(); |
| | | wq.eq(TjOrderRemark::getTjNumber,tjNUm); |
| | | wq.eq(TjOrderRemark::getProId,proId); |
| | | public AjaxResult chushenyemianqijianjiekou(@RequestParam String tjNUm, @RequestParam String proId) { |
| | | LambdaQueryWrapper<TjOrderRemark> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjOrderRemark::getTjNumber, tjNUm); |
| | | wq.eq(TjOrderRemark::getProId, proId); |
| | | TjOrderRemark remark = remarkService.getOne(wq); |
| | | remark.setType(1); |
| | | remark.setType(2); |
| | | remarkService.updateById(remark); |
| | | return AjaxResult.success("操作成功!"); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/zongjanyemianshjianzhou") |
| | | @ApiOperation(value = "总检获取时间轴接口") |
| | | @Transactional |
| | | public AjaxResult zongjanyemianshjianzhou(@RequestBody List<String> tjNUms) { |
| | | |
| | | if(null !=tjNUms && !tjNUms.isEmpty()){ |
| | | List<Map<String,Object>> list=new ArrayList<>(); |
| | | for (String tjNUm : tjNUms) { |
| | | Map<String,Object> map=new HashMap<>(); |
| | | TjOrder order = tjOrderService.getOrderByTjNum(tjNUm); |
| | | if (null != order) { |
| | | int czwj = remarkService.panduaniscunzaiweijian(tjNUm); |
| | | int sfwc = remarkService.panduaniswancheng(tjNUm); |
| | | Date checkTime = order.getCheckTime(); |
| | | Date reportTime = order.getReportTime(); |
| | | Integer heshouStatus = order.getHeshouStatus(); |
| | | Date lastTime = order.getPrintLastTime(); |
| | | int a=0; |
| | | if (czwj == 0) { |
| | | //未检 |
| | | a=0; |
| | | } |
| | | if (czwj > 0) { |
| | | //在检 |
| | | a=1; |
| | | } |
| | | if (sfwc == 0) { |
| | | //已完成 |
| | | a=2; |
| | | } |
| | | if (null != checkTime) { |
| | | //已审核 |
| | | a=3; |
| | | } |
| | | if (null != reportTime) { |
| | | //生成报告 |
| | | a=4; |
| | | } |
| | | if (heshouStatus==1) { |
| | | //报告核收 |
| | | a=5; |
| | | } |
| | | if (null != lastTime) { |
| | | //已出报告 |
| | | a=6; |
| | | } |
| | | map.put("tjNUm",tjNUm); |
| | | map.put("sjz",a); |
| | | list.add(map); |
| | | } |
| | | } |
| | | return AjaxResult.success(list); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/heshouchexiao") |
| | | @ApiOperation(value = "撤销报告接口") |
| | | @Transactional |
| | | public AjaxResult heshouchexiao(@RequestBody List<String> tjNUms) { |
| | | |
| | | if(null !=tjNUms && !tjNUms.isEmpty()){ |
| | | |
| | | // 不在使用逻辑删除 逻辑删除导致打印报告生成 查询sql缓慢 |
| | | //逻辑删除数据库里的报告 |
| | | LambdaQueryWrapper<TjReport> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.select(TjReport::getReId); |
| | | wq1.in(TjReport::getTjNumber, tjNUms); |
| | | wq1.eq(TjReport::getPrint, "pdf"); |
| | | List<Long> list = tjReportService.list(wq1).stream().map(TjReport::getReId).collect(Collectors.toList()); |
| | | for (String tjNUm : tjNUms) { |
| | | TjOrder order = tjOrderService.getOrderByTjNum(tjNUm); |
| | | if(null !=order){ |
| | | order.setHeshouStatus(0); |
| | | order.setHeshouTime(null); |
| | | order.setHeshouDoctor(null); |
| | | order.setPrintLastTime(null); |
| | | order.setReportTime(null); |
| | | order.setStatus(TjConstants.TJ_WAIT); |
| | | if (!tjOrderService.updateById(order)) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("操作失败"); |
| | | } |
| | | } |
| | | } |
| | | int i = tjReportService.deleteTjReportByReIds(list.toArray(new Long[]{})); |
| | | if (i == 0) { |
| | | return AjaxResult.error("撤回失败!"); |
| | | } |
| | | return AjaxResult.success("操作成功"); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |