From cd6114bf85d19e6bdcd6a17c66f34b8c838870d5 Mon Sep 17 00:00:00 2001 From: zhaowenxuan <chacca165@163.com> Date: 星期三, 16 十月 2024 15:31:23 +0800 Subject: [PATCH] 增加标本代码设置 --- ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java | 449 +++++++++++++++++++++++++++---------------------------- 1 files changed, 223 insertions(+), 226 deletions(-) diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java index 4ec3fe7..1cb7102 100644 --- a/ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java +++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java @@ -10,11 +10,13 @@ import com.ltkj.common.core.domain.AjaxResult; import com.ltkj.common.core.domain.entity.SysUser; import com.ltkj.common.core.redis.RedisCache; +import com.ltkj.common.utils.IdUtils; import com.ltkj.common.utils.SecurityUtils; import com.ltkj.common.utils.StringUtils; import com.ltkj.framework.config.MatchUtils; import com.ltkj.hosp.domain.*; import com.ltkj.hosp.hisDto.*; +import com.ltkj.hosp.pacsDto.SavePacsApply; import com.ltkj.hosp.service.*; import com.ltkj.hosp.vodomain.AddNewReservationConfirm; import com.ltkj.hosp.vodomain.LineChartsVo; @@ -24,8 +26,13 @@ import com.ltkj.system.service.ISysConfigService; import com.ltkj.system.service.ISysDeptService; import com.ltkj.system.service.ISysUserService; +import com.ltkj.web.config.IdcardUtil.IdcardUtil; import com.ltkj.web.controller.his.HisApiGetMethodService; import com.ltkj.web.controller.his.HisApiMethodService; +import com.ltkj.web.controller.lis.LisApiMethod; +import com.ltkj.web.controller.pacs.PacsApiMethodService; +import com.ltkj.web.controller.system.TjOrderController; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -48,6 +55,7 @@ * @Date: 2023/9/15 15:57 */ +@Slf4j @Service @Transactional public class TjSysAsyncServiceImpl implements TjAsyncService { @@ -131,6 +139,15 @@ private TjCfService cfService; @Resource private LtkjHysqdService hysqdService; + @Autowired + private PacsApiMethodService pacsApiMethodService; + @Autowired + private LisApiMethod lisApiMethod; + @Autowired + private IdUtils idUtils; + @Autowired + private LtkjJybbzdService jybbzdService; + @Override public void newSaveextracted(TjOrder tjOrder, TjCustomer tjCustomer, BigDecimal discount, SysUser sysUser, TjReservation tjReservation, TjFlowingWater tjFlowingWater) { @@ -393,21 +410,44 @@ chargingStandardService.save(tjChargingStandard); } - LambdaQueryWrapper<TjOrderDetail> wq = new LambdaQueryWrapper<>(); - wq.eq(TjOrderDetail::getOrderId, order.getOrderId()); - wq.isNotNull(TjOrderDetail::getFlowingWaterId); - wq.eq(TjOrderDetail::getIsSampling, 0); - List<TjOrderDetail> detailList = tjOrderDetailService.list(wq); - if (null != detailList && detailList.size() > 0) { +// LambdaQueryWrapper<TjOrderDetail> wq = new LambdaQueryWrapper<>(); +// wq.eq(TjOrderDetail::getOrderId, order.getOrderId()); +// wq.isNotNull(TjOrderDetail::getFlowingWaterId); +// wq.eq(TjOrderDetail::getIsSampling, 0); +// List<TjOrderDetail> detailList = tjOrderDetailService.list(wq); + List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(order.getOrderId()); + addCaiYangDengJi(detailList, !detailList.isEmpty(), order, sysUser); + } + + public void addCaiYangDengJi(List<TjOrderDetail> detailList, boolean detailList1, TjOrder order, SysUser sysUser) { + if (null != detailList && detailList1) { String format = DateUtil.format(new Date(), "yyMMddHHmmssSSS"); for (TjOrderDetail detail : detailList) { TjSampling sampling = new TjSampling(); if (null == projectService.getById(detail.getProId())) continue; - Long proParentId = projectService.getById(detail.getProId()).getProParentId(); + TjProject project = projectService.getById(detail.getProId()); + Long proParentId = project.getProParentId(); if (null != proParentId && proParentId == 0) { - sampling.setSpecimenType(projectService.getById(detail.getProId()).getSpecimenType()); + sampling.setJyxh(idUtils.generateLisID()); + LtkjJyxmzd jyxmzd = lisApiMethod.getJyxmzd(project); + if (jyxmzd != null) { + sampling.setSpecimenTypeCode(jyxmzd.getJybbdm()); + LambdaQueryWrapper<LtkjJybbzd> wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(LtkjJybbzd::getJybbdm,jyxmzd.getJybbdm()); + LtkjJybbzd jybbzd = jybbzdService.getOne(wrapper); + sampling.setSpecimenType(jybbzd.getJybbmc()); + } } else { - sampling.setSpecimenType(projectService.getById(projectService.getById(detail.getProId()).getProParentId()).getSpecimenType()); + TjProject project1 = projectService.getById(proParentId); + sampling.setJyxh(idUtils.generateLisID()); + LtkjJyxmzd jyxmzd = lisApiMethod.getJyxmzd(project1); + if (jyxmzd != null) { + sampling.setSpecimenTypeCode(jyxmzd.getJybbdm()); + LambdaQueryWrapper<LtkjJybbzd> wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(LtkjJybbzd::getJybbdm,jyxmzd.getJybbdm()); + LtkjJybbzd jybbzd = jybbzdService.getOne(wrapper); + sampling.setSpecimenType(jybbzd.getJybbmc()); + } } sampling.setSamplingNumber(format); sampling.setTjNum(order.getTjNumber()); @@ -503,7 +543,7 @@ @Override @Async("async") - @Transactional +// @Transactional public void iundividualCharges(TjFlowingWater tjFlowingWater, TjOrder order, TjCustomer customer, SysUser sysUser) { Date dates = new Date(); final String date = DateUtil.format(dates, "yyyy-MM-dd HH:mm:ss"); @@ -522,7 +562,6 @@ proBl.setBlje(String.valueOf(tjFlowingWater.getPaidIn())); blService.save(proBl); - List<TjConsumables> list2 = new ArrayList<>(); String[] tjProIds = tjFlowingWater.getTjProIds(); String config = configService.selectConfigByKey("sfkqdyhis"); @@ -542,8 +581,9 @@ List<TjProject> projectList=new ArrayList<>(); for (String tjProId : tjProIds) { - LambdaQueryWrapper<TbTransition> wqq = new LambdaQueryWrapper<>(); - wqq.eq(TbTransition::getCusId, customer.getCusIdcard()); +// LambdaQueryWrapper<TbTransition> wqq = new LambdaQueryWrapper<>(); +// wqq.eq(TbTransition::getCusId, customer.getCusIdcard()); +// wqq.isNull(TbTransition::getTjNum); TjProject project = projectService.getById(Long.valueOf(tjProId)); if (null != project && project.getProParentId() == 0) { TjOrderRemark tjOrderRemark = new TjOrderRemark(); @@ -591,7 +631,7 @@ detail1.setJxbz(jxbz); tjOrderDetailService.save(detail1); } - wqq.in(TbTransition::getProId, proIds); +// wqq.in(TbTransition::getProId, proIds); if(null !=config && config.equals("Y")){ //妫�楠� @@ -729,7 +769,7 @@ } else { - wqq.in(TbTransition::getProId, Arrays.asList(tjProIds)); +// wqq.in(TbTransition::getProId, Arrays.asList(tjProIds)); TjProject projects = projectService.selectTjProjectByProId(Long.valueOf(tjProId)); if (null != projects) { TjProject projectss = projectService.getById(projects.getProParentId()); @@ -737,11 +777,9 @@ projectList.add(projectss); } } -// List<Long> proIds = projectService.getTjProjectListBySoneId(tjProId).stream().map(TjProject::getProId).collect(Collectors.toList()); TjOrderDetail detail = new TjOrderDetail(); detail.setTjStatus(0L); detail.setOrderId(tjFlowingWater.getOrderId()); -// detail.setFlowingWaterId(String.valueOf(tjFlowingWater.getTjSerialNumber())); detail.setProId(Long.valueOf(tjProId)); detail.setIsAddition("Y"); detail.setCreateBy(sysUser.getNickName()); @@ -755,64 +793,26 @@ } - List<TbTransition> tbTransitionList = transitionService.list(wqq); - if (null != tbTransitionList && tbTransitionList.size() > 0) { +// List<TbTransition> tbTransitionList = transitionService.list(wqq); + List<TbTransition> tbTransitionList = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(customer.getCusIdcard(),tjProId); + if (null != tbTransitionList && !tbTransitionList.isEmpty()) { for (TbTransition transition : tbTransitionList) { - transition.setJxbz(jxbz); - transition.setTjNum(order.getTjNumber()); - transition.setCardId(order.getCardId()); - transition.setNowPrice(transition.getOrdPrice().multiply(BigDecimal.valueOf(Double.parseDouble(tjFlowingWater.getDiscount())).divide(BigDecimal.valueOf(10)))); - transitionService.updateById(transition); -// TjProject tjProject = projectService.selectTjProjectByProId(transition.getProId()); - //瀛愰」 -// if (null != tjProject) { -// TjChargingStandard tjChargingStandard = new TjChargingStandard(); -// tjChargingStandard.setTjNum(order.getTjNumber()); -// tjChargingStandard.setProId(transition.getProId()); -// tjChargingStandard.setPrice(transition.getNowPrice()); -// tjChargingStandard.setProName(tjProject.getProName()); -// tjChargingStandard.setCreateBy(sysUser.getNickName()); -// tjChargingStandard.setCreateTime(dates); -// tjChargingStandard.setUpdateBy(sysUser.getNickName()); -// tjChargingStandard.setUpdateTime(dates); -// tjChargingStandard.setCreateId(String.valueOf(sysUser.getUserId())); -// tjChargingStandard.setUpdateId(String.valueOf(sysUser.getUserId())); -// chargingStandardService.save(tjChargingStandard); -// } +// transition.setJxbz(jxbz); +// transition.setTjNum(order.getTjNumber()); +// transition.setCardId(order.getCardId()); +// transition.setNowPrice(transition.getOrdPrice().multiply(BigDecimal.valueOf(Double.parseDouble(tjFlowingWater.getDiscount())).divide(BigDecimal.valueOf(10)))); +// transitionService.updateById(transition); + transitionService.updateTbTransitionById(transition.getId().toString(),jxbz,order.getTjNumber(),order.getCardId(), + transition.getOrdPrice().multiply(BigDecimal.valueOf(Double.parseDouble(tjFlowingWater.getDiscount())).divide(BigDecimal.valueOf(10)))); } - //鐖堕」 -// -// TjProject parentProject = projectService.selectTjProjectByProId(Long.valueOf(tjProId)); -// if (null != parentProject && parentProject.getProParentId() == 0) { -// LambdaQueryWrapper<TjProConsumables> wqqq = new LambdaQueryWrapper<>(); -// wqqq.eq(TjProConsumables::getProId, parentProject.getProId()); -// List<TjProConsumables> proConsumables = proConsumablesService.list(wqqq); -// if (null != proConsumables && proConsumables.size() > 0) { -// for (TjProConsumables tjProConsumables : proConsumables) { -// TjConsumables tjConsumables = consumablesService.selectTjConsumablesById(tjProConsumables.getConsumablesId()); -// list2.add(tjConsumables); -// } -// } -// -// } else { -// TjProject parentProjects = projectService.getById(tjProId); -// if (null != parentProjects) { -// LambdaQueryWrapper<TjProConsumables> wqqq = new LambdaQueryWrapper<>(); -// wqqq.eq(TjProConsumables::getProId, parentProjects.getProId()); -// List<TjProConsumables> proConsumables = proConsumablesService.list(wqqq); -// if (null != proConsumables && proConsumables.size() > 0) { -// for (TjProConsumables tjProConsumables : proConsumables) { -// TjConsumables tjConsumables = consumablesService.selectTjConsumablesById(tjProConsumables.getConsumablesId()); -// list2.add(tjConsumables); -// } -// } -// } -// } } } - if(projectList.size()>0){ + ArrayList<TjProject> jianChaProjects = new ArrayList<>(); + ArrayList<TjProject> jianYanProjects = new ArrayList<>(); + + if(!projectList.isEmpty()){ List<TjProject> list = projectList.stream().distinct().collect(Collectors.toList()); for (TjProject project : list) { TjOrderRemark tjOrderRemark = new TjOrderRemark(); @@ -832,7 +832,6 @@ TjOrderDetail detail1 = new TjOrderDetail(); detail1.setTjStatus(0L); detail1.setOrderId(tjFlowingWater.getOrderId()); -// detail1.setFlowingWaterId(String.valueOf(tjFlowingWater.getTjSerialNumber())); detail1.setProId(project.getProId()); detail1.setIsAddition("Y"); detail1.setCreateBy(sysUser.getNickName()); @@ -848,6 +847,7 @@ // if (project.getProPrice().compareTo(BigDecimal.ZERO) != 0 && (project.getDeptId() == 241L || project.getDeptId() == 317L)) { if (project.getProPrice().compareTo(BigDecimal.ZERO) != 0 && deptService.getJyDeptIds().contains(project.getDeptId().toString())) { if (null != project.getHisXmbm()) { + jianYanProjects.add(project); OutpintestapplyDetailsDto detailsDto = new OutpintestapplyDetailsDto(); detailsDto.setMxfyxmbm(project.getHisXmbm()); @@ -895,6 +895,7 @@ // project.getDeptId() == 275L || project.getDeptId() == 298L)) { if (project.getProPrice().compareTo(BigDecimal.ZERO) != 0 && deptService.getJcDeptIds().contains(project.getDeptId().toString())) { if (null != project.getHisXmbm()) { + jianChaProjects.add(project); OutpintestapplyDetailsDto detailsDto = new OutpintestapplyDetailsDto(); detailsDto.setMxfyxmbm(project.getHisXmbm()); if (project.getSfzhfy().equals("Y")) { @@ -981,135 +982,142 @@ } if(null !=config && config.equals("Y")){ + if (lisApiMethod.isUseLisAndPacsRegister(order)) { + List<TjProject> projectList2 = jianYanProjects.stream().distinct().collect(Collectors.toList()); + List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(order.getOrderId()); + addCaiYangDengJi(detailList, !detailList.isEmpty(), order, sysUser); - - - //妫�楠岀敵璇� - if(detailsDtos.size()>0){ - OutpintestapplyDto dto = new OutpintestapplyDto(); - dto.setHisRegistrationId(order.getCardId()); - dto.setSfzh(customer.getCusIdcard()); - dto.setSqysbm("00029"); - dto.setMzksbm("0101"); - dto.setSjrq(date); - dto.setCzybm("00029"); - dto.setCzyksbm("0101"); - dto.setSfjz("0"); - dto.setDetails(detailsDtos.stream().distinct().collect(Collectors.toList())); - AjaxResult ajaxResult1 = controller.Outpintestapply(dto); - String result5 = getAjaxResult(ajaxResult1); - JSONObject object3 = getJSONObject(result5); - String code3 = object3.getStr("ResultCode"); - if (code3.equals("0")) { - List<OutpintestapplyDetailsDto> details = dto.getDetails(); - for (OutpintestapplyDetailsDto detail : details) { - LtkjJianchajianyanTree tree = new LtkjJianchajianyanTree(); - tree.setSfjx("Y"); - tree.setJxbz(jxbz); - tree.setCardId(dto.getHisRegistrationId()); - LambdaQueryWrapper<TjCustomer> wrapper4 = new LambdaQueryWrapper<>(); - wrapper4.eq(TjCustomer::getCardId, tree.getCardId()); - TjCustomer tjCustomer = tjCustomerService.getOne(wrapper4); - tree.setPationid(tjCustomer.getPationId()); - JSONObject resultData = object3.getJSONObject("ResultData"); - tree.setSqdh(resultData.getStr("jysqdh")); - tree.setFyhj(resultData.getStr("fyhj")); - String mxfyxmbm = detail.getMxfyxmbm(); - tree.setHisXmdm(mxfyxmbm); - tree.setType("妫�楠�"); - LambdaQueryWrapper<TjProject> wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(TjProject::getHisXmbm, mxfyxmbm); - List<TjProject> list = projectService.list(wrapper); - String tj_price = ""; - for (TjProject project : list) { - tj_price += project.getProPrice() + "銆�"; + // 妫�鏌ョ敵璇� + pacsReg(order, customer, jianChaProjects); + }else { + //妫�楠岀敵璇� + if(!detailsDtos.isEmpty()){ + OutpintestapplyDto dto = new OutpintestapplyDto(); + dto.setHisRegistrationId(order.getCardId()); + dto.setSfzh(customer.getCusIdcard()); + dto.setSqysbm("00029"); + dto.setMzksbm("0101"); + dto.setSjrq(date); + dto.setCzybm("00029"); + dto.setCzyksbm("0101"); + dto.setSfjz("0"); + dto.setDetails(detailsDtos.stream().distinct().collect(Collectors.toList())); + AjaxResult ajaxResult1 = controller.Outpintestapply(dto); + String result5 = getAjaxResult(ajaxResult1); + JSONObject object3 = getJSONObject(result5); + String code3 = object3.getStr("ResultCode"); + if (code3.equals("0")) { + List<OutpintestapplyDetailsDto> details = dto.getDetails(); + for (OutpintestapplyDetailsDto detail : details) { + LtkjJianchajianyanTree tree = new LtkjJianchajianyanTree(); + tree.setSfjx("Y"); + tree.setJxbz(jxbz); + tree.setCardId(dto.getHisRegistrationId()); + LambdaQueryWrapper<TjCustomer> wrapper4 = new LambdaQueryWrapper<>(); + wrapper4.eq(TjCustomer::getCardId, tree.getCardId()); + TjCustomer tjCustomer = tjCustomerService.getOne(wrapper4); + tree.setPationid(tjCustomer.getPationId()); + JSONObject resultData = object3.getJSONObject("ResultData"); + tree.setSqdh(resultData.getStr("jysqdh")); + tree.setFyhj(resultData.getStr("fyhj")); + String mxfyxmbm = detail.getMxfyxmbm(); + tree.setHisXmdm(mxfyxmbm); + tree.setType("妫�楠�"); + LambdaQueryWrapper<TjProject> wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(TjProject::getHisXmbm, mxfyxmbm); + wrapper.eq(TjProject::getProParentId,0); + List<TjProject> list = projectService.list(wrapper); + String tj_price = ""; + for (TjProject project : list) { + tj_price += project.getProPrice() + "銆�"; + } + tree.setTjPrice(tj_price.substring(0, tj_price.length() - 1)); + LambdaQueryWrapper<LtkjJfzhglmxjfxmzd> wrapper1 = new LambdaQueryWrapper<>(); + if (detail.getSfzhfy().equals("1")) + wrapper1.eq(LtkjJfzhglmxjfxmzd::getZhxmdm, mxfyxmbm); + else wrapper1.eq(LtkjJfzhglmxjfxmzd::getXmdm, mxfyxmbm); + List<LtkjJfzhglmxjfxmzd> ltkjJfzhglmxjfxmzds = ltkjJfzhglmxjfxmzdService.list(wrapper1); + if (ltkjJfzhglmxjfxmzds != null && !ltkjJfzhglmxjfxmzds.isEmpty()) { + String xmdm = ltkjJfzhglmxjfxmzds.get(0).getXmdm(); + LambdaQueryWrapper<LtkjMxjfxmzd> wrapper2 = new LambdaQueryWrapper<>(); + wrapper2.eq(LtkjMxjfxmzd::getXmdm, xmdm); + LtkjMxjfxmzd mxjfxmzd = ltkjMxjfxmzdService.getOne(wrapper2); + LambdaQueryWrapper<LtkjEjjfxmzd> wrapper3 = new LambdaQueryWrapper<>(); + wrapper3.eq(LtkjEjjfxmzd::getEjkmdm, mxjfxmzd.getEjkmdm()); + LtkjEjjfxmzd ejjfxmzd = ltkjEjjfxmzdService.getOne(wrapper3); + tree.setXmfl(ejjfxmzd.getYjkmdm()); + } + tree.setCreateTime(dates); + ltkjJianchajianyanTreeService.save(tree); } - tree.setTjPrice(tj_price.substring(0, tj_price.length() - 1)); - LambdaQueryWrapper<LtkjJfzhglmxjfxmzd> wrapper1 = new LambdaQueryWrapper<>(); - if (detail.getSfzhfy().equals("1")) - wrapper1.eq(LtkjJfzhglmxjfxmzd::getZhxmdm, mxfyxmbm); - else wrapper1.eq(LtkjJfzhglmxjfxmzd::getXmdm, mxfyxmbm); - List<LtkjJfzhglmxjfxmzd> ltkjJfzhglmxjfxmzds = ltkjJfzhglmxjfxmzdService.list(wrapper1); - if (ltkjJfzhglmxjfxmzds != null && !ltkjJfzhglmxjfxmzds.isEmpty()) { - String xmdm = ltkjJfzhglmxjfxmzds.get(0).getXmdm(); - LambdaQueryWrapper<LtkjMxjfxmzd> wrapper2 = new LambdaQueryWrapper<>(); - wrapper2.eq(LtkjMxjfxmzd::getXmdm, xmdm); - LtkjMxjfxmzd mxjfxmzd = ltkjMxjfxmzdService.getOne(wrapper2); - LambdaQueryWrapper<LtkjEjjfxmzd> wrapper3 = new LambdaQueryWrapper<>(); - wrapper3.eq(LtkjEjjfxmzd::getEjkmdm, mxjfxmzd.getEjkmdm()); - LtkjEjjfxmzd ejjfxmzd = ltkjEjjfxmzdService.getOne(wrapper3); - tree.setXmfl(ejjfxmzd.getYjkmdm()); - } - tree.setCreateTime(dates); - ltkjJianchajianyanTreeService.save(tree); + } - } - } - //闂ㄨ瘖妫�鏌ョ敵璇� - if(detailsDtoss.size()>0){ - OutpinexamapplyDto outpinexamapplyDto = new OutpinexamapplyDto(); - outpinexamapplyDto.setHisRegistrationId(order.getCardId()); - outpinexamapplyDto.setSfzh(customer.getCusIdcard()); - outpinexamapplyDto.setSqysbm("00029"); - outpinexamapplyDto.setMzksbm("0101"); - outpinexamapplyDto.setCzybm("00029"); - outpinexamapplyDto.setCzyksbm("0101"); - outpinexamapplyDto.setSfjz("0"); - outpinexamapplyDto.setDetails(detailsDtoss.stream().distinct().collect(Collectors.toList())); - AjaxResult ajaxResult2 = controller.Outpinexamapply(outpinexamapplyDto); - String result6 = getAjaxResult(ajaxResult2); - JSONObject object5 = getJSONObject(result6); - String code4 = object5.getStr("ResultCode"); - if (code4.equals("0")) { - List<OutpintestapplyDetailsDto> details = outpinexamapplyDto.getDetails(); - for (OutpintestapplyDetailsDto detail : details) { - LtkjJianchajianyanTree tree = new LtkjJianchajianyanTree(); - tree.setSfjx("Y"); - tree.setJxbz(jxbz); - tree.setCardId(outpinexamapplyDto.getHisRegistrationId()); - LambdaQueryWrapper<TjCustomer> wrapper4 = new LambdaQueryWrapper<>(); - wrapper4.eq(TjCustomer::getCardId, tree.getCardId()); - TjCustomer tjCustomer = tjCustomerService.getOne(wrapper4); - tree.setPationid(tjCustomer.getPationId()); - JSONObject resultData = object5.getJSONObject("ResultData"); - tree.setSqdh(resultData.getStr("jcsqdh")); - tree.setFyhj(resultData.getStr("fyhj")); - String mxfyxmbm = detail.getMxfyxmbm(); - tree.setHisXmdm(mxfyxmbm); - tree.setType("妫�鏌�"); - LambdaQueryWrapper<TjProject> wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(TjProject::getHisXmbm, mxfyxmbm); - List<TjProject> list = projectService.list(wrapper); - String tj_price = ""; - for (TjProject project : list) { - tj_price += project.getProPrice() + "銆�"; + //闂ㄨ瘖妫�鏌ョ敵璇� + if(!detailsDtoss.isEmpty()){ + OutpinexamapplyDto outpinexamapplyDto = new OutpinexamapplyDto(); + outpinexamapplyDto.setHisRegistrationId(order.getCardId()); + outpinexamapplyDto.setSfzh(customer.getCusIdcard()); + outpinexamapplyDto.setSqysbm("00029"); + outpinexamapplyDto.setMzksbm("0101"); + outpinexamapplyDto.setCzybm("00029"); + outpinexamapplyDto.setCzyksbm("0101"); + outpinexamapplyDto.setSfjz("0"); + outpinexamapplyDto.setDetails(detailsDtoss.stream().distinct().collect(Collectors.toList())); + AjaxResult ajaxResult2 = controller.Outpinexamapply(outpinexamapplyDto); + String result6 = getAjaxResult(ajaxResult2); + JSONObject object5 = getJSONObject(result6); + String code4 = object5.getStr("ResultCode"); + if (code4.equals("0")) { + List<OutpintestapplyDetailsDto> details = outpinexamapplyDto.getDetails(); + for (OutpintestapplyDetailsDto detail : details) { + LtkjJianchajianyanTree tree = new LtkjJianchajianyanTree(); + tree.setSfjx("Y"); + tree.setJxbz(jxbz); + tree.setCardId(outpinexamapplyDto.getHisRegistrationId()); + LambdaQueryWrapper<TjCustomer> wrapper4 = new LambdaQueryWrapper<>(); + wrapper4.eq(TjCustomer::getCardId, tree.getCardId()); + TjCustomer tjCustomer = tjCustomerService.getOne(wrapper4); + tree.setPationid(tjCustomer.getPationId()); + JSONObject resultData = object5.getJSONObject("ResultData"); + tree.setSqdh(resultData.getStr("jcsqdh")); + tree.setFyhj(resultData.getStr("fyhj")); + String mxfyxmbm = detail.getMxfyxmbm(); + tree.setHisXmdm(mxfyxmbm); + tree.setType("妫�鏌�"); + LambdaQueryWrapper<TjProject> wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(TjProject::getHisXmbm, mxfyxmbm); + wrapper.eq(TjProject::getProParentId,0); + List<TjProject> list = projectService.list(wrapper); + String tj_price = ""; + for (TjProject project : list) { + tj_price += project.getProPrice() + "銆�"; + } + tree.setTjPrice(tj_price.substring(0, tj_price.length() - 1)); + LambdaQueryWrapper<LtkjJfzhglmxjfxmzd> wrapper1 = new LambdaQueryWrapper<>(); + if (detail.getSfzhfy().equals("1")) + wrapper1.eq(LtkjJfzhglmxjfxmzd::getZhxmdm, mxfyxmbm); + else wrapper1.eq(LtkjJfzhglmxjfxmzd::getXmdm, mxfyxmbm); + List<LtkjJfzhglmxjfxmzd> ltkjJfzhglmxjfxmzds = ltkjJfzhglmxjfxmzdService.list(wrapper1); + if (ltkjJfzhglmxjfxmzds != null && !ltkjJfzhglmxjfxmzds.isEmpty()) { + String xmdm = ltkjJfzhglmxjfxmzds.get(0).getXmdm(); + LambdaQueryWrapper<LtkjMxjfxmzd> wrapper2 = new LambdaQueryWrapper<>(); + wrapper2.eq(LtkjMxjfxmzd::getXmdm, xmdm); + LtkjMxjfxmzd mxjfxmzd = ltkjMxjfxmzdService.getOne(wrapper2); + LambdaQueryWrapper<LtkjEjjfxmzd> wrapper3 = new LambdaQueryWrapper<>(); + wrapper3.eq(LtkjEjjfxmzd::getEjkmdm, mxjfxmzd.getEjkmdm()); + LtkjEjjfxmzd ejjfxmzd = ltkjEjjfxmzdService.getOne(wrapper3); + tree.setXmfl(ejjfxmzd.getYjkmdm()); + } + tree.setCreateTime(dates); + ltkjJianchajianyanTreeService.save(tree); } - tree.setTjPrice(tj_price.substring(0, tj_price.length() - 1)); - LambdaQueryWrapper<LtkjJfzhglmxjfxmzd> wrapper1 = new LambdaQueryWrapper<>(); - if (detail.getSfzhfy().equals("1")) - wrapper1.eq(LtkjJfzhglmxjfxmzd::getZhxmdm, mxfyxmbm); - else wrapper1.eq(LtkjJfzhglmxjfxmzd::getXmdm, mxfyxmbm); - List<LtkjJfzhglmxjfxmzd> ltkjJfzhglmxjfxmzds = ltkjJfzhglmxjfxmzdService.list(wrapper1); - if (ltkjJfzhglmxjfxmzds != null && !ltkjJfzhglmxjfxmzds.isEmpty()) { - String xmdm = ltkjJfzhglmxjfxmzds.get(0).getXmdm(); - LambdaQueryWrapper<LtkjMxjfxmzd> wrapper2 = new LambdaQueryWrapper<>(); - wrapper2.eq(LtkjMxjfxmzd::getXmdm, xmdm); - LtkjMxjfxmzd mxjfxmzd = ltkjMxjfxmzdService.getOne(wrapper2); - LambdaQueryWrapper<LtkjEjjfxmzd> wrapper3 = new LambdaQueryWrapper<>(); - wrapper3.eq(LtkjEjjfxmzd::getEjkmdm, mxjfxmzd.getEjkmdm()); - LtkjEjjfxmzd ejjfxmzd = ltkjEjjfxmzdService.getOne(wrapper3); - tree.setXmfl(ejjfxmzd.getYjkmdm()); - } - tree.setCreateTime(dates); - ltkjJianchajianyanTreeService.save(tree); } } } - //鑽搧鐢宠 - if(outpinmedicapplyDetilsDtos.size()>0){ + if(!outpinmedicapplyDetilsDtos.isEmpty()){ OutpinmedicapplyDto dto1=new OutpinmedicapplyDto(); dto1.setHisRegistrationId(order.getCardId()); dto1.setSfzh(customer.getCusIdcard()); @@ -1157,7 +1165,7 @@ } //闂ㄨ瘖娌荤枟澶勭疆鐢宠 - if(detailDtos.size()>0){ + if(!detailDtos.isEmpty()){ OutpintreatapplyDto dao = new OutpintreatapplyDto(); dao.setHisRegistrationId(order.getCardId()); dao.setSfzh(customer.getCusIdcard()); @@ -1191,6 +1199,7 @@ tree.setType("澶勭疆"); LambdaQueryWrapper<TjProject> wrapper = new LambdaQueryWrapper<>(); wrapper.eq(TjProject::getHisXmbm, mxfyxmbm); + wrapper.eq(TjProject::getProParentId,0); List<TjProject> list = projectService.list(wrapper); String tj_price = ""; for (TjProject project : list) { @@ -1219,7 +1228,6 @@ } } - //鐖堕」鑰楁潗 // ArrayList<TjConsumables> collect = list2.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(TjConsumables::getId))), ArrayList::new)); // for (TjConsumables tjConsumables : collect) { @@ -1238,6 +1246,28 @@ // tjChargingStandard.setUpdateId(String.valueOf(sysUser.getUserId())); // chargingStandardService.save(tjChargingStandard); // } + } + + private void pacsReg(TjOrder order, TjCustomer customer, ArrayList<TjProject> jianChaProjects) { + List<TjProject> projectList1 = jianChaProjects.stream().distinct().collect(Collectors.toList()); + JSONArray array = JSONUtil.createArray(); + ArrayList<SavePacsApply> successPacsList = new ArrayList<>(); + ArrayList<SavePacsApply> errorPacsList = new ArrayList<>(); + int allTotal = 0; + try { + allTotal = pacsApiMethodService.saveProjects(order, customer, projectList1, array, successPacsList, errorPacsList); + } catch (Exception e) { + log.error(e.getMessage()); + for (Object object : array) { + JSONObject jsonObject = (JSONObject) object; + pacsApiMethodService.updatePacsApply(jsonObject.getStr("regNo"), jsonObject.getStr("cardId"), jsonObject.getStr("name")); + } + } + log.info("妫�鏌ユ�昏 ->{}涓�", allTotal); + if (!errorPacsList.isEmpty()) { + log.info("鎴愬姛 ->{}", successPacsList); + log.error("澶辫触 ->{}", errorPacsList); + } } @Override @@ -1735,41 +1765,8 @@ chargingStandardService.save(tjChargingStandard); } - LambdaQueryWrapper<TjOrderDetail> wq = new LambdaQueryWrapper<>(); - wq.eq(TjOrderDetail::getOrderId, order.getOrderId()); - wq.isNotNull(TjOrderDetail::getFlowingWaterId); - wq.eq(TjOrderDetail::getIsSampling, 0); - List<TjOrderDetail> detailList = tjOrderDetailService.list(wq); - if (null != detailList && detailList.size() > 0) { - String format = DateUtil.format(new Date(), "yyMMddHHmmssSSS"); - for (TjOrderDetail detail : detailList) { - TjSampling sampling = new TjSampling(); - if (null == projectService.getById(detail.getProId())) continue; - Long proParentId = projectService.getById(detail.getProId()).getProParentId(); - if (null != proParentId && proParentId == 0) { - sampling.setSpecimenType(projectService.getById(detail.getProId()).getSpecimenType()); - } else { - sampling.setSpecimenType(projectService.getById(projectService.getById(detail.getProId()).getProParentId()).getSpecimenType()); - } - sampling.setSamplingNumber(format); - sampling.setTjNum(order.getTjNumber()); - sampling.setCusId(String.valueOf(order.getUserId())); - if (tjCustomerService.getById(String.valueOf(order.getUserId())) != null) { - sampling.setCusName(tjCustomerService.getById(String.valueOf(order.getUserId())).getCusName()); - } - sampling.setApplicationTime(new Date()); - sampling.setTjTime(order.getCreateTime()); - sampling.setProId(String.valueOf(detail.getProId())); - sampling.setProName(projectService.getById(detail.getProId()).getProName()); - sampling.setCreateBy(sysUser.getNickName()); - sampling.setCreateTime(new Date()); - sampling.setUpdateBy(sysUser.getNickName()); - sampling.setUpdateTime(new Date()); - sampling.setCreateId(String.valueOf(sysUser.getUserId())); - sampling.setUpdateId(String.valueOf(sysUser.getUserId())); - samplingService.save(sampling); - } - } + List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(order.getOrderId()); + addCaiYangDengJi(detailList, detailList.size() > 0, order, sysUser); } //棣栭〉楗肩姸鍥剧櫥璁颁汉鏁版帴鍙� -- Gitblit v1.8.0