| | |
| | | import com.ltkj.hosp.domain.*; |
| | | import com.ltkj.hosp.dto.QianDaoDto; |
| | | import com.ltkj.hosp.dto.TjProBlDto; |
| | | import com.ltkj.hosp.dto.UpdateTransitionnewPriceDto; |
| | | import com.ltkj.hosp.hisDto.OutpinimpapplyDto; |
| | | import com.ltkj.hosp.hisDto.OutpinmedicapplyDto; |
| | | import com.ltkj.hosp.mapper.TbTransitionMapper; |
| | | import com.ltkj.hosp.mapper.TestMapper; |
| | | import com.ltkj.hosp.mapper.TjSamplingMapper; |
| | | import com.ltkj.hosp.pacsDto.SavePacsApply; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/hosp/order") |
| | | @Api(tags = "PC端 ----体检记录接口") |
| | | @Api(tags = "PC端 ----体检记录接口 OrderController") |
| | | @Slf4j |
| | | public class TjOrderController extends BaseController { |
| | | @Resource |
| | |
| | | private ISysDictDataService sysDictDataService; |
| | | @Autowired |
| | | private TjFlowingWaterHisService tjFlowingWaterHisService; |
| | | @Resource |
| | | private ITjXdPictureService xdPictureService; |
| | | @Autowired |
| | | private TjOrderYcxmService ycxmService; |
| | | @Autowired |
| | | private TbTransitionMapper tbTransitionMapper; |
| | | |
| | | //将方法返回值解析成json格式 |
| | | public JSONObject getJSONObject(String builder) { |
| | |
| | | wq.in(TjOrder::getUserId, cusIds); |
| | | } |
| | | |
| | | if(null !=zt && (zt==0 || zt==1 || zt==2)){ |
| | | List<TjOrder> orders=new ArrayList<>(); |
| | | List<TjOrder> tjOrders=null; |
| | | 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()){ |
| | | 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) { |
| | | if (zt == 0 && czwj == 0) { |
| | | //未检0 |
| | | order.setZt("未检"); |
| | | orders.add(order); |
| | | } |
| | | if (zt==1 && czwj > 0) { |
| | | 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) { |
| | | 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()) |
| | | 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()); |
| | |
| | | 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()); |
| | | } |
| | | String firmName = order.getFirmName(); |
| | | if (StringUtil.isNotBlank(firmName)) { |
| | | order.setDictCompName(firmName); |
| | | } |
| | | if (null != order.getPacId()) { |
| | | if (null != tjPackageService.getById(order.getPacId())) { |
| | |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | if(null !=zt){ |
| | | if(zt==3){ |
| | | if (null != zt) { |
| | | if (zt == 3) { |
| | | //已审核 |
| | | wq.isNotNull(TjOrder::getCheckTime); |
| | | wq.eq(TjOrder::getCheckStatus,1); |
| | | wq.eq(TjOrder::getCheckStatus, 1); |
| | | wq.isNull(TjOrder::getHeshouTime); |
| | | wq.isNull(TjOrder::getPrintLastTime); |
| | | wq.eq(TjOrder::getHeshouStatus,0); |
| | | wq.eq(TjOrder::getHeshouStatus, 0); |
| | | } |
| | | if(zt==4){ |
| | | if (zt == 4) { |
| | | //生成报告 |
| | | wq.isNotNull(TjOrder::getReportTime); |
| | | wq.isNull(TjOrder::getHeshouTime); |
| | | wq.isNull(TjOrder::getPrintLastTime); |
| | | wq.eq(TjOrder::getHeshouStatus,0); |
| | | wq.eq(TjOrder::getHeshouStatus, 0); |
| | | } |
| | | if(zt==5){ |
| | | if (zt == 5) { |
| | | //报告核收 |
| | | wq.eq(TjOrder::getHeshouStatus,1); |
| | | wq.eq(TjOrder::getHeshouStatus, 1); |
| | | wq.isNull(TjOrder::getPrintLastTime); |
| | | } |
| | | if(zt==6){ |
| | | if (zt == 6) { |
| | | //已出报告 |
| | | wq.isNotNull(TjOrder::getPrintLastTime); |
| | | wq.eq(TjOrder::getHeshouStatus,1); |
| | | wq.eq(TjOrder::getHeshouStatus, 1); |
| | | wq.isNotNull(TjOrder::getPrintLastTime); |
| | | } |
| | | } |
| | |
| | | Integer heshouStatus = order.getHeshouStatus(); |
| | | Date lastTime = order.getPrintLastTime(); |
| | | |
| | | if(null !=zt){ |
| | | if(zt==3){ |
| | | if (null != zt) { |
| | | if (zt == 3) { |
| | | order.setZt("已审核"); |
| | | } |
| | | if(zt==4){ |
| | | if (zt == 4) { |
| | | order.setZt("生成报告"); |
| | | } |
| | | if(zt==5){ |
| | | if (zt == 5) { |
| | | order.setZt("报告核收"); |
| | | } |
| | | if(zt==6){ |
| | | if (zt == 6) { |
| | | order.setZt("已出报告"); |
| | | } |
| | | }else { |
| | | } else { |
| | | if (czwj == 0) { |
| | | //未检0 |
| | | order.setZt("未检"); |
| | |
| | | //生成报告4 |
| | | order.setZt("生成报告"); |
| | | } |
| | | if (1== heshouStatus) { |
| | | if (1 == heshouStatus) { |
| | | //报告核收5 |
| | | order.setZt("报告核收"); |
| | | } |
| | |
| | | |
| | | if (djbeginTime == null) djbeginTime = ""; |
| | | if (djendTime == null) djendTime = ""; |
| | | Map<String, Object> map= tjOrderService.getTjBgdyList(pageNum,pageSize,dyzt,tjNum,name,dw,djbeginTime,djendTime); |
| | | Map<String, Object> map = tjOrderService.getTjBgdyList(pageNum, pageSize, dyzt, tjNum, name, dw, djbeginTime, djendTime); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wq); |
| | | if (tjCustomer == null) return AjaxResult.error("该客户未登记"); |
| | | |
| | | LambdaQueryWrapper<TjOrder> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.eq(TjOrder::getUserId, tjOrder.getUserId()); |
| | | wqq.eq(TjOrder::getCheckStatus, 0); |
| | | wqq.isNull(TjOrder::getFinishTime); |
| | | // if (!tjCustomer.getCardId().equals("0")) { |
| | | wqq.eq(TjOrder::getCardId, tjCustomer.getCardId()); |
| | | // LambdaQueryWrapper<TjOrder> wqq = new LambdaQueryWrapper<>(); |
| | | // wqq.eq(TjOrder::getUserId, tjOrder.getUserId()); |
| | | // wqq.eq(TjOrder::getCheckStatus, 0); |
| | | // wqq.isNull(TjOrder::getFinishTime); |
| | | //// if (!tjCustomer.getCardId().equals("0")) { |
| | | // wqq.eq(TjOrder::getCardId, tjCustomer.getCardId()); |
| | | //// } |
| | | // TjOrder order = tjOrderService.getOne(wqq); |
| | | // if (null != order) { |
| | | // transitionService.deletedTbTransitionListByCusIdAndTjNum(tjCustomer.getCusIdcard(), tjCustomer.getCardId()); |
| | | // return AjaxResult.error("不可重复登记"); |
| | | // } |
| | | TjOrder order = tjOrderService.getOne(wqq); |
| | | if (null != order) { |
| | | transitionService.deletedTbTransitionListByCusIdAndTjNum(tjCustomer.getCusIdcard(), tjCustomer.getCardId()); |
| | | return AjaxResult.error("不可重复登记"); |
| | | } |
| | | TjFlowingWater tjFlowingWater = new TjFlowingWater(); |
| | | LambdaQueryWrapper<TjReservation> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjReservation::getIdCard, tjCustomer.getCusIdcard()); |
| | |
| | | return AjaxResult.error("对不起您的预约已超时请重新预约"); |
| | | } |
| | | if (null != tjReservation.getTeamNo()) tjOrder.setTeamNo(tjReservation.getTeamNo()); |
| | | // if (null != tjReservation.getCompanyId()) tjOrder.setFirmId(tjReservation.getCompanyId()); |
| | | // if (null != tjReservation.getCompany()) tjOrder.setFirmName(tjReservation.getCompany()); |
| | | 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.setTjType("2"); |
| | | } |
| | | } |
| | | |
| | | if (null != tjCustomer.getCompName()) { |
| | | tjOrder.setFirmName(tjCustomer.getCompName()); |
| | | } |
| | | if (null != tjCustomer.getDictCompId()) { |
| | | tjOrder.setFirmId(String.valueOf(tjCustomer.getDictCompId())); |
| | | } else { |
| | | if (StringUtil.isBlank(tjOrder.getFirmId())) { |
| | | tjOrder.setFirmId("0"); |
| | | } |
| | | |
| | | |
| | | if (null != tjOrder.getPhoto()) { |
| | | File file = new File(tjOrder.getPhoto()); |
| | |
| | | |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED) |
| | | public AjaxResult processOrderWithTransaction(TjOrder tjOrder, TjCustomer tjCustomer, TjReservation tjReservation, TjFlowingWater tjFlowingWater, MallOrder mallOrder, SysUser sysUser) { |
| | | //生成体检号 |
| | | String tjNumber = (SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmss").format(new Date())); |
| | | tjOrder.setTjNumber(tjNumber); |
| | | BigDecimal discount = BigDecimal.valueOf(Double.parseDouble(tjOrder.getTjFlowingWater().getDiscount())); |
| | | |
| | | //获取拼接前缀 |
| | | String makeLisTmhPrefix = configService.selectConfigByKey("make_lis_tmh_prefix"); |
| | | |
| | | //生成体检号 |
| | | // String tjNumber = (SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmss").format(new Date())); |
| | | // if(StringUtil.isNotBlank(makeLisTmhPrefix)) tjNumber=makeLisTmhPrefix+tjNumber; |
| | | |
| | | |
| | | String tjNumber = (SecurityUtils.getUsername() + IdUtils.getTjNumber()); |
| | | if (StringUtil.isNotBlank(makeLisTmhPrefix)) tjNumber = makeLisTmhPrefix + tjNumber; |
| | | tjOrder.setTjNumber(tjNumber); |
| | | |
| | | |
| | | BigDecimal discount = BigDecimal.valueOf(Double.parseDouble(tjOrder.getTjFlowingWater().getDiscount())); |
| | | tjOrder.setDiscount(discount.toString()); |
| | | if (tjOrderService.save(tjOrder)) { |
| | | //保存收货地址 |
| | |
| | | Date date1 = new Date(System.currentTimeMillis()); |
| | | String s1 = SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmssSSS").format(date1); |
| | | tjFlowingWater.setWaterId(PinyinUtil.getFirstLetter(tjCustomer.getCusName(), "").toUpperCase() + s1); |
| | | BigDecimal copeWith = tjOrder.getTjFlowingWater().getCopeWith(); |
| | | BigDecimal paidIn = tjOrder.getTjFlowingWater().getPaidIn(); |
| | | |
| | | tjFlowingWater.setCopeWith(copeWith); |
| | | tjFlowingWater.setPaidIn(paidIn); |
| | | tjFlowingWater.setDiscount(discount.toString()); |
| | | |
| | | tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); |
| | | tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn()); |
| | | tjFlowingWater.setDiscount(tjOrder.getTjFlowingWater().getDiscount()); |
| | | BigDecimal subtract = paidIn.subtract(copeWith.multiply(discount.divide(BigDecimal.valueOf(10)))); |
| | | log.info("签到登记体检人: " + tjOrder.getTjNumber() + " 应付: " + copeWith); |
| | | log.info("签到登记体检人: " + tjOrder.getTjNumber() + " 折扣: " + discount); |
| | | log.info("签到登记体检人: " + tjOrder.getTjNumber() + " 实付: " + paidIn); |
| | | log.info("签到登记体检人: " + tjOrder.getTjNumber() + " 相差: " + subtract); |
| | | |
| | | if (isPay.equals("true")) { |
| | | if (null != mallOrder) { |
| | |
| | | // tjFlowingWater.setPayStasus(0L); |
| | | } |
| | | } |
| | | |
| | | //修改每项的原价现价 |
| | | // transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), discount, tjOrder.getTjNumber()); |
| | | //修改临时表体检号 |
| | | transitionService.updateTbTransitionTjNumByCusId(tjCustomer.getCusIdcard(), tjOrder.getTjNumber()); |
| | | //补差价 |
| | | /* if(subtract.compareTo(BigDecimal.ZERO)>0){ |
| | | tjFlowingWater.setPaidIn(paidIn.add(subtract)); |
| | | TbTransition onwTbTransition = transitionService.getOnwTbTransition(tjCustomer.getCusIdcard(),tjOrder.getTjNumber()); |
| | | if(null !=onwTbTransition){ |
| | | log.info("签到登记体检人: "+tjOrder.getTjNumber()+"给: "+onwTbTransition.getParentProName()+" "+onwTbTransition.getNowPrice() |
| | | +" 补差价 "+subtract+" 最终得 "+onwTbTransition.getNowPrice().add(subtract)); |
| | | onwTbTransition.setNowPrice(onwTbTransition.getNowPrice().add(subtract)); |
| | | transitionService.updateById(onwTbTransition); |
| | | } |
| | | }*/ |
| | | |
| | | if (tjFlowingWaterService.save(tjFlowingWater)) { |
| | | tjOrder.setTjSerialNumber(String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | tjOrderService.updateById(tjOrder); |
| | | } |
| | | |
| | | //修改每项的原价现价 //修改临时表体检号 |
| | | transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), discount, tjOrder.getTjNumber()); |
| | | |
| | | /*调用his接口*/ |
| | | String config = configService.selectConfigByKey("sfkqdyhis"); |
| | |
| | | |
| | | log.info("该登记人的his就诊号是: " + tjOrder.getCardId()); |
| | | //团体 |
| | | if ("1".equals(tjOrder.getTjType())) { |
| | | /* if ("1".equals(tjOrder.getTjType())) { |
| | | // asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | } |
| | | }*/ |
| | | //个人 |
| | | if ("2".equals(tjOrder.getTjType())) { |
| | | /* if ("2".equals(tjOrder.getTjType())) { |
| | | //asyncService.newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | } |
| | | }*/ |
| | | // 查询 对接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<TjXdPicture> xdPictureList = xdPictureService.saveTjXdPicture(tjOrder.getTjNumber()); |
| | | xdPictureService.saveBatch(xdPictureList); |
| | | // List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | // addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | } else { |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | |
| | | hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId()); |
| | | } |
| | | // hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId()); |
| | | return AjaxResult.success(tjNumber); |
| | | } else { |
| | | tjCustomer.setCardId(tjOrder.getTjNumber()); |
| | |
| | | } |
| | | |
| | | //团体 |
| | | if ("1".equals(tjOrder.getTjType())) { |
| | | // asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | } |
| | | // if ("1".equals(tjOrder.getTjType())) { |
| | | // ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | //// asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | // List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | // addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | // return AjaxResult.success(tjNumber); |
| | | // } |
| | | //个人 |
| | | if ("2".equals(tjOrder.getTjType())) { |
| | | //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); |
| | | // if ("2".equals(tjOrder.getTjType())) { |
| | | // //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); |
| | | // |
| | | // 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(); |
| | | // } |
| | | // } |
| | | // return AjaxResult.success(tjNumber); |
| | | // } |
| | | |
| | | 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)) { |
| | | // 这是上面个人方法引入数据 |
| | | tjFlowingWater.setPayStasus(1L); |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | // AjaxResult ajaxResult = hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder, sysUser, result); |
| | | // 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()); |
| | | remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(), tjFlowingWater.getTjSerialNumber().toString()); |
| | | List<TjXdPicture> xdPictureList = xdPictureService.saveTjXdPicture(tjOrder.getTjNumber()); |
| | | xdPictureService.saveBatch(xdPictureList); |
| | | List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | |
| | | return AjaxResult.success(tjNumber); |
| | | } else { |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | AjaxResult error = isRequestCommonHisApi(tjOrder, tjCustomer, tjFlowingWater); |
| | | if (error != null) return error; |
| | | // List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | // addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | } |
| | | // pacsApiMethodService.OrderAdd(tjCustomer,tjOrder); |
| | | |
| | | return AjaxResult.success(tjNumber); |
| | | // pacsApiMethodService.OrderAdd(tjCustomer,tjOrder); |
| | | // return AjaxResult.success(tjNumber); |
| | | } |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | private AjaxResult isRequestCommonHisApi(TjOrder tjOrder, TjCustomer tjCustomer, TjFlowingWater tjFlowingWater) { |
| | | 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::getNowPrice); |
| | | wrapper.gt(TbTransition::getNowPrice, 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.getNowPrice(); |
| | | 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()); |
| | | 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(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public void addCaiYangDengJi(List<TjOrderDetail> detailList, boolean detailList1, TjOrder order, SysUser sysUser, String jxbz) { |
| | | String lis_tmh_prefix = configService.selectConfigByKey("make_lis_tmh_prefix"); |
| | | String config = configService.selectConfigByKey("sfkqdyhis"); |
| | | Boolean lisAndPacsRegister = lisApiMethod.isUseLisAndPacsRegister(order); |
| | | if (null != detailList && detailList1) { |
| | | Date date = new Date(); |
| | | String format = DateUtil.format(date, "yyMMddHHmmssSSS"); |
| | |
| | | Long proParentId = project.getProParentId(); |
| | | String dictLabel = sysDictDataService.selectDictLabel("sys_dict_specimen", project.getSpecimenType()); |
| | | if (null != proParentId && proParentId == 0) { |
| | | sampling.setJyxh(idUtils.generateLisID()); |
| | | sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix)); |
| | | sampling.setSpecimenTypeCode(project.getSpecimenType()); |
| | | sampling.setSpecimenType(dictLabel); |
| | | sampling.setJyxmdm(project.getProId().toString()); |
| | | if (config.equals("Y") && lisAndPacsRegister) |
| | | sampling.setJyxmdm(project.getLisXmbm()); |
| | | else sampling.setJyxmdm(project.getProId().toString()); |
| | | } else { |
| | | TjProject project1 = projectService.getById(proParentId); |
| | | sampling.setJyxh(idUtils.generateLisID()); |
| | | sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix)); |
| | | |
| | | sampling.setSpecimenTypeCode(project1.getSpecimenType()); |
| | | sampling.setSpecimenType(dictLabel); |
| | | sampling.setJyxmdm(project.getProId().toString()); |
| | | if (config.equals("Y") && lisAndPacsRegister) |
| | | sampling.setJyxmdm(project1.getLisXmbm()); |
| | | else sampling.setJyxmdm(project1.getProId().toString()); |
| | | |
| | | } |
| | | sampling.setSamplingNumber(format); |
| | |
| | | samplingService.save(sampling); |
| | | } |
| | | } |
| | | String config = configService.selectConfigByKey("sfkqdyhis"); |
| | | if (lisApiMethod.isUseLisAndPacsRegister(order) && (null != config && config.equals("Y"))) { |
| | | AjaxResult ajaxResult = lisApiMethod.getJyFlHb(); |
| | | if (ajaxResult.get("code").toString().equals("200")) { |
| | |
| | | } |
| | | |
| | | } |
| | | if (StrUtil.isNotBlank(jxbz)) { |
| | | tjSamplingMapper.updateUserIdByTjNumAndJxbz(order.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), jxbz); |
| | | } else { |
| | | tjSamplingMapper.updateUserIdByTjNum(order.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId())); |
| | | } |
| | | } |
| | | |
| | | |
| | | @PostMapping("/addPlOrderAndDetail") |
| | | @ApiOperation(value = "体检批量签到登记接口") |
| | | @Transactional //(切换数据库出错,所以注释) |
| | | // @Transactional //(切换数据库出错,所以注释) |
| | | public AjaxResult addPlOrderAndDetail(@RequestBody QianDaoDto daoDto, HttpServletResponse response) { |
| | | SysUser sysUser = UserHoder.getLoginUser().getUser(); |
| | | List<String> cusIds = daoDto.getCusIds(); |
| | | ArrayList<String> tjNumbers = new ArrayList<>(); |
| | | ArrayList<String> errTjh = new ArrayList<>(); |
| | | if (null != cusIds && !cusIds.isEmpty()) { |
| | | ExecutorService threadPools = Executors.newFixedThreadPool(cusIds.size()); |
| | | for (String cusId : cusIds) { |
| | |
| | | // } |
| | | // } |
| | | // }); |
| | | String tjh = (sysUser.getUserName() + new SimpleDateFormat("yyMMddHHmmss").format(new Date())); |
| | | |
| | | |
| | | |
| | | String finalTjh = tjh; |
| | | Future<AjaxResult> future = executor.submit(new Callable<AjaxResult>() { |
| | | @Override |
| | | public AjaxResult call() throws Exception { |
| | | return getAjaxResult(aLong, sysUser, daoDto.getTjCategory()); |
| | | return getAjaxResult(aLong, sysUser, daoDto.getTjCategory(), finalTjh); |
| | | } |
| | | }); |
| | | try { |
| | | AjaxResult result = future.get(); |
| | | String tjNumber = result.get("tjNumber").toString(); |
| | | tjNumbers.add(tjNumber); |
| | | String code = result.get("code").toString(); |
| | | if (code.equals("200")) { |
| | | String tjNumber = result.get("tjNumber").toString(); |
| | | tjNumbers.add(tjNumber); |
| | | }else { |
| | | String userId = result.get("userId").toString(); |
| | | errTjh.add(userId); |
| | | } |
| | | } catch (InterruptedException | ExecutionException e) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | threadPools.shutdown(); |
| | | } |
| | | } |
| | | // TODO 因为有体检号会查出空数据 先使用死数据 |
| | | tjNumbers = new ArrayList<>(); |
| | | tjNumbers.add("02095240229171627"); |
| | | tjNumbers.add("02095240229173104"); |
| | | tjNumbers.add("10001240524172002"); |
| | | tjNumbers.add("10001240304124410"); |
| | | tjNumbers.add("00325240304160123"); |
| | | tjNumbers.add("02095240304162044"); |
| | | tjNumbers.add("02095240304162152"); |
| | | tjNumbers.add("10001240304163505"); |
| | | Map<String, Object> map = null; |
| | | try { |
| | | map = PDFDocumentUtil.getDocument(); |
| | | Document document = (Document) map.get("document"); |
| | | for (int i = 0; i < tjNumbers.size(); i++) { |
| | | // TODO 因为有体检号会查出空数据 先使用死数据 打印导诊单 |
| | | if (!tjNumbers.isEmpty()) { |
| | | Map<String, Object> map = null; |
| | | try { |
| | | List<Map<String, String>> djdInfos = tjOrderService.selectDjdInfo(tjNumbers.get(i)); |
| | | Map<String, Object> userInfo = tjOrderService.selectDjdUserInfo(tjNumbers.get(i)); |
| | | LocalDateTime tjsj = (LocalDateTime) userInfo.get("tjsj"); |
| | | DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); |
| | | String time = null; |
| | | if (tjsj != null) { |
| | | time = dateFormat.format(tjsj); |
| | | map = PDFDocumentUtil.getDocument(); |
| | | Document document = (Document) map.get("document"); |
| | | // for (int i = 0; i < tjNumbers.size(); i++) { |
| | | int i = 0; |
| | | for (String tjNumber : tjNumbers) { |
| | | try { |
| | | List<Map<String, Object>> djdInfos = tjOrderService.selectDjdInfo(tjNumber); |
| | | Map<String, Object> userInfo = tjOrderService.selectDjdUserInfo(tjNumber); |
| | | if(null !=userInfo && null !=djdInfos && !djdInfos.isEmpty()){ |
| | | LocalDateTime tjsj = (LocalDateTime) userInfo.get("tjsj"); |
| | | DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); |
| | | String time = null; |
| | | if (tjsj != null) { |
| | | time = dateFormat.format(tjsj); |
| | | } |
| | | PDFDocumentUtil.makeUserInfoTable(document, (String) userInfo.get("tjname"), (String) userInfo.get("sex") |
| | | , (String) userInfo.get("tjh"), (String) userInfo.get("lxdh"), (String) userInfo.get("tjname"), time); |
| | | PDFDocumentUtil.makeTjInfo(document, djdInfos); |
| | | // 多条则换页 |
| | | if (i + 1 < tjNumbers.size()) { |
| | | document.newPage(); |
| | | } |
| | | } |
| | | |
| | | } catch (DocumentException | IOException e) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | //这里删除的是这个人所有项目包括补录项目 |
| | | TjOrder order = tjOrderService.getOrderByTjNum(tjNumber); |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId())); |
| | | remarkService.deletedOrderRemarkByTjNum(tjNumber); |
| | | tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId())); |
| | | // transitionService.deletedTbTransitionByTjNum(tjNum); |
| | | tjSamplingMapper.deleteByTjNumAndCusId(order.getTjNumber(), order.getUserId()); |
| | | |
| | | TjReservation reservation = tjReservationService.getById(order.getReservationId()); |
| | | if(null !=reservation){ |
| | | reservation.setIsExpire(2); |
| | | tjReservationService.updateById(reservation); |
| | | transitionService.updateTbTransitionByTjNum(tjNumber); |
| | | } |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | PDFDocumentUtil.makeUserInfoTable(document, (String) userInfo.get("tjname"), (String) userInfo.get("sex") |
| | | , (String) userInfo.get("tjh"), (String) userInfo.get("lxdh"), (String) userInfo.get("tjname"), time); |
| | | PDFDocumentUtil.makeTjInfo(document, djdInfos); |
| | | // 多条则换页 |
| | | if (i + 1 < tjNumbers.size()) { |
| | | document.newPage(); |
| | | } |
| | | } catch (DocumentException | IOException e) { |
| | | |
| | | // } |
| | | document.close(); |
| | | ByteArrayOutputStream outputStream = (ByteArrayOutputStream) map.get("stream"); |
| | | String encodeToString = java.util.Base64.getEncoder().encodeToString(outputStream.toByteArray()); |
| | | return AjaxResult.success().put("file", encodeToString); |
| | | } catch (IOException | DocumentException e) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | e.printStackTrace(); |
| | | } |
| | | return AjaxResult.success("操作成功"); |
| | | } |
| | | document.close(); |
| | | ByteArrayOutputStream outputStream = (ByteArrayOutputStream) map.get("stream"); |
| | | String encodeToString = java.util.Base64.getEncoder().encodeToString(outputStream.toByteArray()); |
| | | return AjaxResult.success().put("file", encodeToString); |
| | | } catch (IOException | DocumentException e) { |
| | | e.printStackTrace(); |
| | | if (!errTjh.isEmpty()){ |
| | | return AjaxResult.success("以上人员签到失败",errTjh); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.success("操作成功"); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | private void getAjaxResults(String cusIdcard) { |
| | | @GetMapping("/signOrderInfo") |
| | | public AjaxResult signOrderInfo(@RequestParam("tjNum") String tjNum){ |
| | | List<Map<String, Object>> djdInfos = tjOrderService.selectDjdInfo(tjNum); |
| | | Map<String, Object> userInfo = tjOrderService.selectDjdUserInfo(tjNum); |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("djd",djdInfos); |
| | | hashMap.put("user",userInfo); |
| | | return AjaxResult.success(hashMap); |
| | | } |
| | | |
| | | // @Transactional |
| | | public void getAjaxResults(String cusIdcard) { |
| | | if (!"".equals(cusIdcard) && cusIdcard != null) { |
| | | //根据配置调取存储过程 将临时表数据存入预约表2023.12.12 |
| | | final String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); |
| | |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | } |
| | | |
| | | private AjaxResult getAjaxResult(Long userId, SysUser sysUser, String tjCategory) throws IOException { |
| | | // @Transactional |
| | | public AjaxResult getAjaxResult(Long userId, SysUser sysUser, String tjCategory,String tjh) throws IOException { |
| | | |
| | | LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjCustomer::getCusId, userId); |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wq); |
| | | if (tjCustomer == null) return AjaxResult.error("该客户未登记或不存在"); |
| | | |
| | | LambdaQueryWrapper<TjOrder> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.eq(TjOrder::getUserId, userId); |
| | | wqq.eq(TjOrder::getCheckStatus, 0); |
| | | wqq.isNull(TjOrder::getFinishTime); |
| | | if (!tjCustomer.getCardId().equals("0")) { |
| | | wqq.eq(TjOrder::getCardId, tjCustomer.getCardId()); |
| | | } |
| | | TjOrder order = tjOrderService.getOne(wqq); |
| | | if (null != order) { |
| | | transitionService.deletedTbTransitionListByCusIdAndTjNum(tjCustomer.getCusIdcard(), tjCustomer.getCardId()); |
| | | return AjaxResult.error("不可重复登记"); |
| | | } |
| | | TjOrder tjOrder = new TjOrder(); |
| | | Date date = new Date(); |
| | | tjOrder.setCreateTime(date); |
| | |
| | | if (tjReservation != null) { |
| | | tjOrder.setReservationId(tjReservation.getId()); |
| | | mallOrder = mallOrderService.getOne(new LambdaQueryWrapper<MallOrder>().eq(MallOrder::getReservationId, tjReservation.getId())); |
| | | if (DateUtil.endOfDay(new Date()).before(tjReservation.getReservationTime())) { |
| | | return AjaxResult.error("未到预约时间"); |
| | | } |
| | | if (DateUtil.endOfDay(tjReservation.getReservationTime()).before(new Date())) { |
| | | tjReservation.setIsExpire(1); |
| | | tjReservationService.updateById(tjReservation); |
| | | return AjaxResult.error("对不起您的预约已超时请重新预约"); |
| | | } |
| | | // if (DateUtil.endOfDay(new Date()).before(tjReservation.getReservationTime())) { |
| | | // return AjaxResult.error("未到预约时间"); |
| | | // } |
| | | // if (DateUtil.endOfDay(tjReservation.getReservationTime()).before(new Date())) { |
| | | // tjReservation.setIsExpire(1); |
| | | // tjReservationService.updateById(tjReservation); |
| | | // return AjaxResult.error("对不起您的预约已超时请重新预约"); |
| | | // } |
| | | if (null != tjReservation.getTeamNo()) tjOrder.setTeamNo(tjReservation.getTeamNo()); |
| | | 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()); |
| | |
| | | } |
| | | tjReservation.setIsExpire(1); |
| | | tjReservationService.updateById(tjReservation); |
| | | if (null != tjReservation.getTeamNo()) { |
| | | tjOrder.setTjType("1"); |
| | | } else{ |
| | | tjOrder.setTjType("2"); |
| | | } |
| | | |
| | | if (StringUtil.isBlank(tjOrder.getFirmId())) { |
| | | tjOrder.setFirmId("0"); |
| | | } |
| | | // |
| | | // tjReservation.setIsExpire(1); |
| | | // tjReservationService.updateById(tjReservation); |
| | | |
| | | //生成体检号 |
| | | String tjNumber = (sysUser.getUserName() + new SimpleDateFormat("yyMMddHHmmss").format(new Date())); |
| | | |
| | | tjNumber = tjNumber.replaceAll(".{4}$", userId.toString().substring(userId.toString().length() - 4)); |
| | | |
| | | tjOrder.setTjNumber(tjNumber); |
| | | tjh = tjh.replaceAll(".{4}$", userId.toString().substring(userId.toString().length() - 4)); |
| | | |
| | | // tjOrder.setTjNumber(tjNumber); |
| | | tjOrder.setTjNumber(tjh); |
| | | if (null != tjOrder.getPhoto()) { |
| | | File file = new File(tjOrder.getPhoto()); |
| | | if (file.isFile()) { |
| | |
| | | tjCustomer.setCusNumber(cusNumber); |
| | | // BigDecimal discount = BigDecimal.valueOf(Double.parseDouble(tjOrder.getTjFlowingWater().getDiscount())).divide(BigDecimal.valueOf(10)); |
| | | TjFlowingWater tjFlowingWater = new TjFlowingWater(); |
| | | tjFlowingWater.setCreateTime(date); |
| | | tjFlowingWater.setCreateTime(date); |
| | | tjFlowingWater.setUpdateTime(date); |
| | | tjFlowingWater.setCreateBy(sysUser.getNickName()); |
| | | tjFlowingWater.setUpdateBy(sysUser.getNickName()); |
| | | tjFlowingWater.setCopeWith(tbTransitionMapper.sumTbTransitionOrdPriceByTjNum(tjOrder.getTjNumber())); |
| | | tjFlowingWater.setPaidIn(tbTransitionMapper.sumTbTransitionNowPriceByTjNum(tjOrder.getTjNumber())); |
| | | tjFlowingWater.setDiscount(String.valueOf(10)); |
| | | tjFlowingWater.setPayStasus(1L); |
| | | tjFlowingWater.setPayType(3L); |
| | | |
| | | tjFlowingWater.setPayStasus(0L); |
| | | if ("1".equals(tjOrder.getTjType())) { |
| | | if (tjReservation.getPayType() == 1) { |
| | |
| | | if (tjFlowingWaterService.save(tjFlowingWater)) { |
| | | tjOrder.setTjSerialNumber(String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | tjOrderService.updateById(tjOrder); |
| | | |
| | | |
| | | } |
| | | asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | transitionService.updateTbTransitionTjNumByCusId(tjCustomer.getCusIdcard(), tjOrder.getTjNumber()); |
| | | tjCustomer.setCardId(tjOrder.getTjNumber()); |
| | | tjCustomerService.updateById(tjCustomer); |
| | | transitionService.updateCardIdByTjNumAndIdCard(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), tjOrder.getTjNumber()); |
| | | tjOrder.setCardId(tjOrder.getTjNumber()); |
| | | tjOrderService.updateById(tjOrder); |
| | | |
| | | // asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | |
| | | if (lisApiMethod.isUseLisAndPacsRegister(tjOrder)) { |
| | | // 这是上面个人方法引入数据 |
| | | tjFlowingWater.setPayStasus(1L); |
| | | tjOrder.setTjFlowingWater(tjFlowingWater); |
| | | newSaveextracted(tjOrder, tjCustomer, BigDecimal.valueOf(10), sysUser, tjReservation, tjFlowingWater); |
| | | 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<TjXdPicture> xdPictureList = xdPictureService.saveTjXdPicture(tjOrder.getTjNumber()); |
| | | xdPictureService.saveBatch(xdPictureList); |
| | | List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | // return AjaxResult.success(tjNumber); |
| | | } |
| | | |
| | | tjCustomer.setCardId("0"); |
| | | tjCustomerService.updateById(tjCustomer); |
| | | return AjaxResult.success().put("tjNumber", tjNumber); |
| | | } |
| | | } |
| | | return AjaxResult.error(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error().put("userId",userId); |
| | | } |
| | | |
| | | |
| | |
| | | return AjaxResult.error("操作失败! 以下项目已存在: " + string); |
| | | } |
| | | transitionService.saveRedisTransitionByPacId(cusId, cardId, pacId); |
| | | |
| | | //补差价 |
| | | List<Map<String, Object>> cjMaps = groupingProService.huoquxiangmuchajia(pacId.toString(), cusId); |
| | | if (null != cjMaps && !cjMaps.isEmpty()) { |
| | | for (Map<String, Object> cjMap : cjMaps) { |
| | | transitionService.buxiangmuchajia(cusId, pacId.toString(), cjMap.get("xmid").toString(), new BigDecimal(cjMap.get("cj").toString())); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | private List<Map<String, Object>> getMaps(String cusId, String cardId) { |
| | | |
| | | List<TbTransition> transitionList = null; |
| | | // if (redisCache.hasKey(cardId + cusId)) { |
| | | // transitionList = redisCache.getCacheList(cardId + cusId); |
| | | // } else { |
| | | transitionList = transitionService.getTbTransitionListByCusId(cusId, cardId); |
| | | // } |
| | | if (null == transitionList) return null; |
| | | Map<Long, List<TbTransition>> collect = transitionList.stream().collect(Collectors.groupingBy(TbTransition::getParentProId)); |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | |
| | | map.put("proPrantId", entry.getKey().toString()); |
| | | if (null != pacId) { |
| | | TjPackage aPackage = tjPackageService.getById(entry.getValue().get(0).getPacId()); |
| | | map.put("tjCategory", aPackage.getTjCategory()); |
| | | map.put("pacName", aPackage.getPacName()); |
| | | TjProject tjProject = projectService.getById(entry.getKey()); |
| | | // TjPackageProject project = tjPackageProjectService.getOne(new LambdaQueryWrapper<TjPackageProject>().eq(TjPackageProject::getPacId, pacId) |
| | | // .eq(TjPackageProject::getProId, entry.getKey())); |
| | | map.put("ordPrice", tjProject.getProPrice()); |
| | | // if (null != project) { |
| | | // map.put("nowPrice", project.getPriceNow()); |
| | | // } else { |
| | | // map.put("nowPrice", tjProject.getProPrice()); |
| | | // } |
| | | map.put("nowPrice", transitionService.getTbTransitionDxPriceByPac(cusId, entry.getKey(), cardId, pacId)); |
| | | if (null != aPackage) { |
| | | map.put("tjCategory", aPackage.getTjCategory()); |
| | | map.put("pacName", aPackage.getPacName()); |
| | | TjProject tjProject = projectService.getById(entry.getKey()); |
| | | map.put("ordPrice", tjProject.getProPrice()); |
| | | map.put("nowPrice", transitionService.getTbTransitionDxPriceByPac(cusId, entry.getKey(), cardId, pacId)); |
| | | } else { |
| | | TjDwGrouping grouping = dwGroupingService.getById(pacId); |
| | | map.put("tjCategory", null); |
| | | map.put("pacName", grouping.getGroupingName()); |
| | | TjProject tjProject = projectService.getById(entry.getKey()); |
| | | map.put("ordPrice", tjProject.getProPrice()); |
| | | map.put("nowPrice", transitionService.getTbTransitionDxPriceByPac(cusId, entry.getKey(), cardId, pacId)); |
| | | } |
| | | |
| | | } else { |
| | | map.put("tjCategory", null); |
| | | map.put("pacName", "单项"); |
| | | List<TbTransition> tbTransitionList = entry.getValue(); |
| | | if (null != tbTransitionList && tbTransitionList.size() > 0) { |
| | | if (null != tbTransitionList && !tbTransitionList.isEmpty()) { |
| | | BigDecimal money1 = new BigDecimal("0.00"); |
| | | BigDecimal money2 = new BigDecimal("0.00"); |
| | | for (TbTransition tbTransition : tbTransitionList) { |
| | |
| | | @ApiOperation(value = "根据体检号获取汇总和明细的数据") |
| | | public AjaxResult getTransitionInfo(@RequestParam("tjNumber") String tjNumber) { |
| | | QueryWrapper<TbTransition> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("parent_pro_id", "parent_pro_name", "sum(ord_price) as ord_price") |
| | | wrapper.select("parent_pro_id", "parent_pro_name", "sum(now_price) as ord_price") |
| | | .eq("tj_num", tjNumber) |
| | | .groupBy("parent_pro_name"); |
| | | .groupBy("parent_pro_id"); |
| | | List<TbTransition> list = transitionService.list(wrapper); |
| | | List<Long> parentProIds = list.stream().map(item -> item.getParentProId()).collect(Collectors.toList()); |
| | | LambdaQueryWrapper<TjProject> projectQueryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | 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()); |
| | | remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(), tjFlowingWater.getTjSerialNumber().toString()); |
| | | List<TjXdPicture> xdPictureList = xdPictureService.saveTjXdPicture(tjOrder.getTjNumber()); |
| | | xdPictureService.saveBatch(xdPictureList); |
| | | } |
| | | } |
| | | if (tjFlowingWater.getPayStasus() == 1L) { |
| | |
| | | tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); |
| | | tjFlowingWater.setPayType(4L); |
| | | tjFlowingWaterService.updateById(tjFlowingWater); |
| | | remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(),tjFlowingWater.getTjSerialNumber().toString()); |
| | | remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(), tjFlowingWater.getTjSerialNumber().toString()); |
| | | // asyncService.addTjChargingStandard(tjOrder, transitionService.getTbTransitionListByCusId(tjCustomer.getCusIdcard(), tjOrder.getCardId()), sysUser); |
| | | List<TjXdPicture> xdPictureList = xdPictureService.saveTjXdPicture(tjOrder.getTjNumber()); |
| | | xdPictureService.saveBatch(xdPictureList); |
| | | } |
| | | } |
| | | |
| | |
| | | tjAskMedicalHistoryService.updateTjAskMedicalHistoryByCusId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjCustomer.getCusId())); |
| | | boolean b = tjOrderDetailService.saveTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), |
| | | String.valueOf(sysUser.getUserId()), tjOrder.getCardId()); |
| | | if (!b) { |
| | | List<TjGroupingPro> proList = groupingProService.list(new LambdaQueryWrapper<TjGroupingPro>().eq(TjGroupingPro::getGroupingId, tjOrder.getGroupId())); |
| | | if (null != proList && !proList.isEmpty()) { |
| | | for (TjGroupingPro groupingPro : proList) { |
| | | TjOrderDetail detail = new TjOrderDetail(); |
| | | TjProject tjProject = projectService.selectTjProjectByProId(Long.valueOf(groupingPro.getProId())); |
| | | detail.setIsSampling(String.valueOf(tjProject.getIsSampling())); |
| | | detail.setOrderId(tjOrder.getOrderId()); |
| | | detail.setProId(Long.valueOf(groupingPro.getProId())); |
| | | detail.setTjStatus(0L); |
| | | detail.setCreateBy(sysUser.getNickName()); |
| | | detail.setCreateTime(new Date()); |
| | | detail.setUpdateBy(sysUser.getNickName()); |
| | | detail.setUpdateTime(new Date()); |
| | | detail.setCreateId(String.valueOf(sysUser.getUserId())); |
| | | detail.setUpdateId(String.valueOf(sysUser.getUserId())); |
| | | tjOrderDetailService.save(detail); |
| | | } |
| | | List<String> list = proList.stream().map(TjGroupingPro::getProId).collect(Collectors.toList()); |
| | | List<TjProject> projectList = projectService.list(new LambdaQueryWrapper<TjProject>().in(TjProject::getProParentId, list)); |
| | | for (TjProject project : projectList) { |
| | | TjOrderDetail detail = new TjOrderDetail(); |
| | | detail.setOrderId(tjOrder.getOrderId()); |
| | | detail.setProId(project.getProId()); |
| | | detail.setTjStatus(0L); |
| | | detail.setCreateBy(sysUser.getNickName()); |
| | | detail.setCreateTime(new Date()); |
| | | detail.setUpdateBy(sysUser.getNickName()); |
| | | detail.setUpdateTime(new Date()); |
| | | detail.setCreateId(String.valueOf(sysUser.getUserId())); |
| | | detail.setUpdateId(String.valueOf(sysUser.getUserId())); |
| | | //获取该项目的默认值赋值给结果 |
| | | if (null != project.getProDefault()) { |
| | | detail.setProResult(project.getProDefault()); |
| | | } else { |
| | | detail.setProResult(null); |
| | | } |
| | | detail.setIsSampling(String.valueOf(project.getIsSampling())); |
| | | |
| | | tjOrderDetailService.save(detail); |
| | | } |
| | | } |
| | | } |
| | | // if (!b) { |
| | | // List<TjGroupingPro> proList = groupingProService.list(new LambdaQueryWrapper<TjGroupingPro>().eq(TjGroupingPro::getGroupingId, tjOrder.getGroupId())); |
| | | // if (null != proList && !proList.isEmpty()) { |
| | | // for (TjGroupingPro groupingPro : proList) { |
| | | // TjOrderDetail detail = new TjOrderDetail(); |
| | | // TjProject tjProject = projectService.selectTjProjectByProId(Long.valueOf(groupingPro.getProId())); |
| | | // detail.setIsSampling(String.valueOf(tjProject.getIsSampling())); |
| | | // detail.setOrderId(tjOrder.getOrderId()); |
| | | // detail.setProId(Long.valueOf(groupingPro.getProId())); |
| | | // detail.setTjStatus(0L); |
| | | // detail.setCreateBy(sysUser.getNickName()); |
| | | // detail.setCreateTime(new Date()); |
| | | // detail.setUpdateBy(sysUser.getNickName()); |
| | | // detail.setUpdateTime(new Date()); |
| | | // detail.setCreateId(String.valueOf(sysUser.getUserId())); |
| | | // detail.setUpdateId(String.valueOf(sysUser.getUserId())); |
| | | // tjOrderDetailService.save(detail); |
| | | // } |
| | | // List<String> list = proList.stream().map(TjGroupingPro::getProId).collect(Collectors.toList()); |
| | | // List<TjProject> projectList = projectService.list(new LambdaQueryWrapper<TjProject>().in(TjProject::getProParentId, list)); |
| | | // for (TjProject project : projectList) { |
| | | // TjOrderDetail detail = new TjOrderDetail(); |
| | | // detail.setOrderId(tjOrder.getOrderId()); |
| | | // detail.setProId(project.getProId()); |
| | | // detail.setTjStatus(0L); |
| | | // detail.setCreateBy(sysUser.getNickName()); |
| | | // detail.setCreateTime(new Date()); |
| | | // detail.setUpdateBy(sysUser.getNickName()); |
| | | // detail.setUpdateTime(new Date()); |
| | | // detail.setCreateId(String.valueOf(sysUser.getUserId())); |
| | | // detail.setUpdateId(String.valueOf(sysUser.getUserId())); |
| | | // //获取该项目的默认值赋值给结果 |
| | | // if (null != project.getProDefault()) { |
| | | // detail.setProResult(project.getProDefault()); |
| | | // } else { |
| | | // detail.setProResult(null); |
| | | // } |
| | | // detail.setIsSampling(String.valueOf(project.getIsSampling())); |
| | | // |
| | | // tjOrderDetailService.save(detail); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | //添加remark表数据 |
| | | remarkService.saveTjOrderRemarkByOrderId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjOrder.getOrderId())); |
| | |
| | | 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()); |
| | | 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()); |
| | | remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(), tjFlowingWater.getTjSerialNumber().toString()); |
| | | } |
| | | if (tjFlowingWater.getDiscount() == null) { |
| | | transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), new BigDecimal(10), tjOrder.getTjNumber()); |
| | |
| | | @Transactional |
| | | @RepeatSubmit |
| | | 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 (null != orderIds && !orderIds.isEmpty()) { |
| | | Date date = new Date(); |
| | | for (String orderId : orderIds) { |
| | | TjOrder byId = tjOrderService.getById(orderId); |
| | | if (null != byId) { |
| | | |
| | | /*if (byId.getReportTime() == null) { |
| | | LambdaQueryWrapper<TjReportTemplate> tjReportTemplateLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | return AjaxResult.error("生成报告异常,核收失败"); |
| | | } |
| | | }*/ |
| | | byId.setHeshouStatus(1); |
| | | byId.setHeshouDoctor(UserHoder.getLoginUser().getUserId()); |
| | | byId.setHeshouTime(date); |
| | | final boolean b = tjOrderService.updateById(byId); |
| | | if (!b) { |
| | | return AjaxResult.error("核收失败"); |
| | | byId.setHeshouStatus(1); |
| | | byId.setHeshouDoctor(UserHoder.getLoginUser().getUserId()); |
| | | byId.setHeshouTime(date); |
| | | final boolean b = tjOrderService.updateById(byId); |
| | | if (!b) { |
| | | return AjaxResult.error("核收失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success("核收成功"); |
| | | } |
| | |
| | | // } |
| | | if (null != order.getFinishTime()) return AjaxResult.error("该人员已签离,不可撤销!!!"); |
| | | |
| | | Boolean useLisAndPacsRegister = lisApiMethod.isUseLisAndPacsRegister(order); |
| | | |
| | | String s = configService.selectConfigByKey("is_request_common_his_api"); |
| | | if (null != s && s.equals("Y") && "2".equals(order.getTjType())){ |
| | | // if (null != s && s.equals("Y") && "2".equals(order.getTjType())) { |
| | | if (null != s && s.equals("Y") && !useLisAndPacsRegister) { |
| | | String apiUrl = configService.selectConfigByKey("common_api_url"); |
| | | String hospbm = configService.selectConfigByKey("common_api_service_hospbm"); |
| | | |
| | |
| | | wrapper1.orderByDesc(TjFlowingWater::getJxbz); |
| | | List<TjFlowingWater> list = tjFlowingWaterService.list(wrapper1); |
| | | LambdaQueryWrapper<TjCustomer> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjCustomer::getCusId,order.getUserId()); |
| | | wrapper.eq(TjCustomer::getCusId, order.getUserId()); |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wrapper); |
| | | |
| | | for (TjFlowingWater water : list) { |
| | | if (water.getPayStasus() == 0L){ |
| | | if (water.getPayStasus() == 0L) { |
| | | weizhifu.add(water); |
| | | }else { |
| | | } else { |
| | | yizhifu.add(water); |
| | | } |
| | | } |
| | | |
| | | AjaxResult error = zuofeiWeiZhifu(weizhifu, tjCustomer, apiUrl, hospbm, order,true,tjNum); |
| | | 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); |
| | | AjaxResult error1 = zuofeiYiZhifu(yizhifu, tjCustomer, order, apiUrl, hospbm, false, tjNum); |
| | | if (error1 != null && !error.get("code").toString().equals("200")) return error1; |
| | | }else { |
| | | } else { |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId())); |
| | | remarkService.deletedOrderRemarkByTjNum(tjNum); |
| | | tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId())); |
| | | transitionService.deletedTbTransitionByTjNum(tjNum); |
| | | ycxmService.delOrderYcXmJyByTjh(tjNum); |
| | | |
| | | TjCustomer customer = tjCustomerService.getById(order.getUserId()); |
| | | customer.setCardId("0"); |
| | | tjCustomerService.updateById(customer); |
| | | |
| | | xdPictureService.deleteTjXdPictureBytjNum(tjNum); |
| | | tjSamplingMapper.deleteByTjNumAndCusId(tjNum, order.getUserId()); |
| | | } |
| | | |
| | |
| | | if (null != reservationTime) |
| | | wq.between(TjReservation::getReservationTime, DateUtil.beginOfDay(reservationTime), DateUtil.endOfDay(reservationTime)); |
| | | List<TjReservation> reservationList = tjReservationService.list(wq); |
| | | if (null != reservationList && reservationList.size() > 0) { |
| | | if (null != reservationList && !reservationList.isEmpty()) { |
| | | LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.in(TjOrder::getReservationId, reservationList.stream().map(TjReservation::getId).collect(Collectors.toList())); |
| | | List<TjOrder> orderList = tjOrderService.list(wq1); |
| | | if (null != orderList && orderList.size() > 0) { |
| | | if (null != orderList && !orderList.isEmpty()) { |
| | | LambdaQueryWrapper<TjReservation> wq3 = new LambdaQueryWrapper<>(); |
| | | wq3.in(TjReservation::getId, orderList.stream().map(TjOrder::getReservationId).collect(Collectors.toList())); |
| | | // wq3.eq(TjReservation::getTeamNo,reservationList.get(0).getTeamNo()); |
| | |
| | | @ApiOperation(value = "根据客户体检号批量撤销体检记录") |
| | | @Transactional |
| | | public AjaxResult plRevokeTjOrderByTjNum(@RequestBody @ApiParam(value = "预约主键id集合") List<String> reservationIds) { |
| | | if (null != reservationIds && reservationIds.size() > 0) { |
| | | if (null != reservationIds && !reservationIds.isEmpty()) { |
| | | LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.in(TjOrder::getReservationId, reservationIds); |
| | | List<TjOrder> orderList = tjOrderService.list(wq1); |
| | | if (null != orderList && orderList.size() > 0) { |
| | | if (null != orderList && !orderList.isEmpty()) { |
| | | for (TjOrder order : orderList) { |
| | | // TjOrder order = tjOrderService.getOrderByTjNum(tjNum); |
| | | if (null != order) { |
| | |
| | | for (int i = 0; i < tjNumbers.size(); i++) { |
| | | String tjNumber = tjNumbers.get(i).getTjNumber(); |
| | | try { |
| | | List<Map<String, String>> djdInfos = tjOrderService.selectDjdInfo(tjNumber); |
| | | List<Map<String, Object>> djdInfos = tjOrderService.selectDjdInfo(tjNumber); |
| | | Map<String, Object> userInfo = tjOrderService.selectDjdUserInfo(tjNumber); |
| | | LocalDateTime tjsj = (LocalDateTime) userInfo.get("tjsj"); |
| | | DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); |
| | |
| | | LambdaQueryWrapper<TjProBl> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjProBl::getTjh, tjNum); |
| | | List<TjProBl> blList = blService.list(wq); |
| | | if (null != blList && blList.size() > 0) { |
| | | if (null != blList && !blList.isEmpty()) { |
| | | for (TjProBl bl : blList) { |
| | | LambdaQueryWrapper<TjOrderRemark> wqr = new LambdaQueryWrapper<>(); |
| | | wqr.eq(TjOrderRemark::getJxbz, bl.getBldh()); |
| | | List<TjOrderRemark> remarkList = remarkService.list(wqr); |
| | | if (null != remarkList && remarkList.size() > 0) { |
| | | if (null != remarkList && !remarkList.isEmpty()) { |
| | | List<Long> collect = remarkList.stream().map(TjOrderRemark::getProId).collect(Collectors.toList()); |
| | | LambdaQueryWrapper<TjProject> wqp = new LambdaQueryWrapper<>(); |
| | | wqp.in(TjProject::getProId, collect); |
| | |
| | | } |
| | | } |
| | | String s = configService.selectConfigByKey("is_request_common_his_api"); |
| | | if (null != s && s.equals("Y") && "2".equals(order.getTjType())) { |
| | | Boolean useLisAndPacsRegister = lisApiMethod.isUseLisAndPacsRegister(order); |
| | | // if (null != s && s.equals("Y") && "2".equals(order.getTjType())) { |
| | | if (null != s && s.equals("Y") && !useLisAndPacsRegister) { |
| | | 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); |
| | | wrapper.eq(TjFlowingWater::getJxbz, bldh); |
| | | TjFlowingWater water = tjFlowingWaterService.getOne(wrapper); |
| | | if (water.getPayStasus() == 0L){ |
| | | if (water.getPayStasus() == 0L) { |
| | | weizhifu.add(water); |
| | | }else { |
| | | } 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()); |
| | | wrapper.eq(TjCustomer::getCusId, order.getUserId()); |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wrapper); |
| | | AjaxResult error = zuofeiWeiZhifu(weizhifu, tjCustomer, apiUrl, hospbm, order,true,dto.getTjh()); |
| | | 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()); |
| | | 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 { |
| | | } else { |
| | | try { |
| | | extracted(dto, order); |
| | | } catch (Exception e) { |
| | |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | private AjaxResult zuofeiYiZhifu(ArrayList<TjFlowingWater> yizhifu, TjCustomer tjCustomer, TjOrder order, String apiUrl, String hospbm,Boolean isDelete,String tjNum) { |
| | | if (!yizhifu.isEmpty()){ |
| | | 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"); |
| | | map.put("kaiDanKs", "7805"); |
| | | // 收费标志 1待收费 2待退费 |
| | | map.put("shouTuiStatus","2"); |
| | | map.put("shouTuiStatus", "2"); |
| | | JSONArray array = JSONUtil.createArray(); |
| | | String bldh = water.getJxbz(); |
| | | List<TbTransition> list; |
| | | if (bldh != null){ |
| | | if (bldh != null) { |
| | | LambdaQueryWrapper<TbTransition> wrapper1 = new LambdaQueryWrapper<>(); |
| | | wrapper1.eq(TbTransition::getJxbz,bldh); |
| | | wrapper1.gt(TbTransition::getOrdPrice,0); |
| | | wrapper1.eq(TbTransition::getJxbz, bldh); |
| | | wrapper1.gt(TbTransition::getOrdPrice, 0); |
| | | list = tbTransitionService.list(wrapper1); |
| | | }else { |
| | | } else { |
| | | LambdaQueryWrapper<TbTransition> wrapper1 = new LambdaQueryWrapper<>(); |
| | | wrapper1.isNull(TbTransition::getJxbz); |
| | | wrapper1.eq(TbTransition::getTjNum,tjNum); |
| | | wrapper1.gt(TbTransition::getOrdPrice,0); |
| | | 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()); |
| | | 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()); |
| | | 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()); |
| | | 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("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","体检科"); |
| | |
| | | } |
| | | |
| | | } |
| | | 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); |
| | | map.put("feiYongInfoList", array); |
| | | log.info("退费申请 入参 -> {}", JSONUtil.toJsonStr(map)); |
| | | String post = HttpClientUtils.sendPost(apiUrl + "/api/his/" + hospbm + "/creatCostInfo", map); |
| | | log.info("退费申请 返回 -> {}", JSONUtil.toJsonStr(post)); |
| | | if (null != 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(); |
| | | } 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()){ |
| | | 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(" ","")); |
| | | chexiaoMap.put("feiYongIdList", feiyongList.trim().replaceAll(" ", "")); |
| | | |
| | | String post = HttpClientUtils.sendPost(apiUrl + "/api/his/"+ hospbm +"/revokeCost", chexiaoMap); |
| | | 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)){ |
| | | 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 { |
| | | } else { |
| | | //这里删除的是这个人所有项目包括补录项目 |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId())); |
| | |
| | | @Transactional |
| | | public AjaxResult zongjanyemianshjianzhou(@RequestBody List<String> tjNUms) { |
| | | |
| | | if(null !=tjNUms && !tjNUms.isEmpty()){ |
| | | List<Map<String,Object>> list=new ArrayList<>(); |
| | | if (null != tjNUms && !tjNUms.isEmpty()) { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (String tjNUm : tjNUms) { |
| | | Map<String,Object> map=new HashMap<>(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | TjOrder order = tjOrderService.getOrderByTjNum(tjNUm); |
| | | if (null != order) { |
| | | int czwj = remarkService.panduaniscunzaiweijian(tjNUm); |
| | |
| | | Date reportTime = order.getReportTime(); |
| | | Integer heshouStatus = order.getHeshouStatus(); |
| | | Date lastTime = order.getPrintLastTime(); |
| | | int a=0; |
| | | int a = 0; |
| | | if (czwj == 0) { |
| | | //未检 |
| | | a=0; |
| | | a = 0; |
| | | } |
| | | if (czwj > 0) { |
| | | //在检 |
| | | a=1; |
| | | a = 1; |
| | | } |
| | | if (sfwc == 0) { |
| | | //已完成 |
| | | a=2; |
| | | a = 2; |
| | | } |
| | | if (null != checkTime) { |
| | | //已审核 |
| | | a=3; |
| | | a = 3; |
| | | } |
| | | if (null != reportTime) { |
| | | //生成报告 |
| | | a=4; |
| | | a = 4; |
| | | } |
| | | if (heshouStatus==1) { |
| | | if (heshouStatus == 1) { |
| | | //报告核收 |
| | | a=5; |
| | | a = 5; |
| | | } |
| | | if (null != lastTime) { |
| | | //已出报告 |
| | | a=6; |
| | | a = 6; |
| | | } |
| | | map.put("tjNUm",tjNUm); |
| | | map.put("sjz",a); |
| | | map.put("tjNUm", tjNUm); |
| | | map.put("sjz", a); |
| | | list.add(map); |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success(list); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/heshouchexiao") |
| | |
| | | @Transactional |
| | | public AjaxResult heshouchexiao(@RequestBody List<String> tjNUms) { |
| | | |
| | | if(null !=tjNUms && !tjNUms.isEmpty()){ |
| | | if (null != tjNUms && !tjNUms.isEmpty()) { |
| | | |
| | | // 不在使用逻辑删除 逻辑删除导致打印报告生成 查询sql缓慢 |
| | | //逻辑删除数据库里的报告 |
| | |
| | | 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){ |
| | | if (null != order) { |
| | | order.setHeshouStatus(0); |
| | | order.setHeshouTime(null); |
| | | order.setHeshouDoctor(null); |
| | |
| | | } |
| | | } |
| | | } |
| | | int i = tjReportService.deleteTjReportByReIds(list.toArray(new Long[]{})); |
| | | if (i == 0) { |
| | | return AjaxResult.error("撤回失败!"); |
| | | if (!list.isEmpty()) { |
| | | int i = tjReportService.deleteTjReportByReIds(list.toArray(new Long[]{})); |
| | | if (i == 0) { |
| | | return AjaxResult.error("撤回失败!"); |
| | | } |
| | | } |
| | | return AjaxResult.success("操作成功"); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | @GetMapping("/qiandaodengjitianjiaxiangmubydanweifenzu") |
| | | @ApiOperation(value = "签到登记根据单位分组获取体检项目") |
| | | @Transactional |
| | | public AjaxResult qiandaodengjitianjiaxiangmubydanweifenzu(@RequestParam String cusIdcard, @RequestParam String groupingId) { |
| | | try { |
| | | transitionService.saveTemoTransitionByGroupingId(cusIdcard, groupingId); |
| | | return AjaxResult.success("操作成功!"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return AjaxResult.error(); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/ttaddtTransition") |
| | | @ApiOperation(value = "团体添加过渡表数据") |
| | | @Transactional |
| | | public AjaxResult ttaddtTransition(@RequestBody Map<String, Object> map) { |
| | | Object packId = map.get("pacId"); |
| | | if (null == map.get("cusId")) return AjaxResult.error("请选择体检人"); |
| | | String cusId = map.get("cusId").toString(); |
| | | Object proIds1 = map.get("proIds"); |
| | | List<Long> proIds = null; |
| | | if (null != proIds1 && !proIds1.equals("")) { |
| | | proIds = JSON.parseArray(proIds1.toString(), Long.class); |
| | | } |
| | | TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(cusId); |
| | | String cardId = "0"; |
| | | if (null != tjCustomer) { |
| | | cardId = tjCustomer.getCardId(); |
| | | } |
| | | if ((null == proIds || proIds.isEmpty()) && (null == packId || packId.equals(""))) { |
| | | transitionService.deletedTbTransitionByCusId(cusId); |
| | | } |
| | | /*套餐*/ |
| | | if (null != packId && !packId.equals("")) { |
| | | Long pacId = Long.valueOf(packId.toString()); |
| | | List<TbTransition> list = transitionService.getTbTransitionListByCusIdAndPac(cusId, String.valueOf(pacId)); |
| | | if (null == list || list.isEmpty()) { |
| | | transitionService.deletedTbTransitionListByCusIdAndPac(cusId, cardId); |
| | | String string = transitionService.ttpanduantaocanshifouchongfu(cusId, pacId); |
| | | if (!StringUtils.isBlank(string)) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("操作失败! 以下项目已存在: " + string); |
| | | } |
| | | transitionService.ttsaveTemoTransitionByGroupingId(cusId, cardId, pacId.toString()); |
| | | //补差价 |
| | | List<Map<String, Object>> cjMaps = groupingProService.huoquxiangmuchajia(pacId.toString(), cusId); |
| | | if (null != cjMaps && !cjMaps.isEmpty()) { |
| | | for (Map<String, Object> cjMap : cjMaps) { |
| | | transitionService.buxiangmuchajia(cusId, pacId.toString(), cjMap.get("xmid").toString(), new BigDecimal(cjMap.get("cj").toString())); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | //单项 |
| | | if (null != proIds && !proIds.isEmpty()) { |
| | | //异步保存数据库表 |
| | | for (Long proId : proIds) { |
| | | TjProject project = projectService.selectTjProjectByProId(proId); |
| | | if (null != project) { |
| | | List<TbTransition> transitionList = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(proId)); |
| | | if (null == transitionList || transitionList.isEmpty()) { |
| | | transitionService.saveRedisTransitionByProId(cusId, cardId, proId); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @GetMapping(value = "newgetTransitionList") |
| | | @ApiOperation(value = "最新查询过渡表数据") |
| | | public AjaxResult newgetTransitionList(@RequestParam @ApiParam(value = "客户id") String cusId) { |
| | | // String pacId = transitionService.getTbTransitionPacId(cusId); |
| | | // if(StringUtil.isNotBlank(pacId)){ |
| | | // //补差价 |
| | | // List<Map<String,Object>> cjMaps = groupingProService.huoquxiangmuchajia(pacId, cusId); |
| | | // if(null !=cjMaps && !cjMaps.isEmpty()){ |
| | | // for (Map<String, Object> cjMap : cjMaps) { |
| | | // transitionService.buxiangmuchajia(cusId,pacId,cjMap.get("xmid").toString(),new BigDecimal(cjMap.get("cj").toString())); |
| | | // } |
| | | // } |
| | | // } |
| | | List<TbTransition> list = transitionService.newgetTransitionList(cusId); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @PostMapping(value = "updateTransitionnewPrice") |
| | | @ApiOperation(value = "签到登记页面根据折扣修改项目现价") |
| | | @Transactional |
| | | public AjaxResult updateTransitionnewPrice(@RequestBody List<UpdateTransitionnewPriceDto> dtos) { |
| | | |
| | | if (null != dtos && !dtos.isEmpty()) { |
| | | for (UpdateTransitionnewPriceDto dto : dtos) { |
| | | LambdaQueryWrapper<TbTransition> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TbTransition::getCusId, dto.getCusIdCard()); |
| | | wq.eq(TbTransition::getParentProId, dto.getParentProId()); |
| | | wq.isNull(TbTransition::getTjNum); |
| | | List<TbTransition> list = transitionService.list(wq); |
| | | log.info("修改的客户身份证号为: " + dto.getCusIdCard()); |
| | | log.info("父项目id为: " + dto.getParentProId()); |
| | | log.info("折扣为: " + new BigDecimal(dto.getDiscount())); |
| | | if (null != list && !list.isEmpty()) { |
| | | BigDecimal dxzj = transitionService.getTbTransitionPriceAndOrdPrice(dto.getCusIdCard(), dto.getParentProId()); |
| | | for (TbTransition transition : list) { |
| | | BigDecimal ordPrice = transition.getOrdPrice(); |
| | | BigDecimal multiply = ordPrice.multiply((new BigDecimal(dto.getDiscount()).divide(BigDecimal.valueOf(10)))); |
| | | log.info("后端计算的金额: " + multiply); |
| | | transition.setNowPrice(multiply); |
| | | transition.setDiscount(new BigDecimal(dto.getDiscount())); |
| | | transitionService.updateById(transition); |
| | | } |
| | | if (null != dto.getYhj() && dto.getYhj().compareTo(BigDecimal.ZERO) >= 0) { |
| | | List<TbTransition> transitionList = list.stream().filter(a -> |
| | | transitionService.getTbTransitionPriceAndOrdPrice(dto.getCusIdCard(), dto.getParentProId()).subtract(dto.getYhj()).compareTo(BigDecimal.ZERO) >= 0).collect(Collectors.toList()); |
| | | if (!transitionList.isEmpty()) { |
| | | TbTransition tbTransition = transitionList.get(0); |
| | | tbTransition.setNowPrice(dxzj); |
| | | transitionService.updateById(tbTransition); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/huifuyuyuejilu") |
| | | @ApiOperation(value = "体检记录页面恢复预约记录接口") |
| | | @Transactional |
| | | public AjaxResult huifuyuyuejilu(@RequestBody List<String> tjNUms) { |
| | | |
| | | if (null != tjNUms && !tjNUms.isEmpty()) { |
| | | for (String tjNUm : tjNUms) { |
| | | TjOrder order = tjOrderService.getOrderByTjNum(tjNUm); |
| | | if(null !=order && StringUtil.isNotBlank(order.getReservationId())){ |
| | | //这里删除的是这个人所有项目包括补录项目 |
| | | 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()); |
| | | |
| | | TjReservation reservation = tjReservationService.getById(order.getReservationId()); |
| | | if(null !=reservation){ |
| | | reservation.setIsExpire(2); |
| | | tjReservationService.updateById(reservation); |
| | | transitionService.updateTbTransitionByTjNum(tjNUm); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | } |
| | | |