From 8c7934e10d0990b901e9f79c362c1d95209cd447 Mon Sep 17 00:00:00 2001
From: 赵文轩 <1652863494@qq.com>
Date: 星期二, 18 六月 2024 11:52:51 +0800
Subject: [PATCH] hisPDF工具类

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiMethod.java |  206 +++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 164 insertions(+), 42 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiMethod.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiMethod.java
index 1cc6c23..dec7927 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiMethod.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiMethod.java
@@ -1,14 +1,12 @@
 package com.ltkj.web.controller.his;
 
 
-import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ltkj.common.core.domain.AjaxResult;
-import com.ltkj.common.utils.SecurityUtils;
 import com.ltkj.hosp.domain.*;
 import com.ltkj.hosp.hisDto.*;
 import com.ltkj.hosp.service.*;
@@ -51,6 +49,14 @@
     private ISysConfigService configService;
     @Resource
     private ITbTransitionService transitionService;
+    @Autowired
+    private LtkjJianchajianyanTreeService ltkjJianchajianyanTreeService;
+    @Autowired
+    private LtkjJfzhglmxjfxmzdService ltkjJfzhglmxjfxmzdService;
+    @Autowired
+    private LtkjMxjfxmzdService ltkjMxjfxmzdService;
+    @Autowired
+    private LtkjEjjfxmzdService ltkjEjjfxmzdService;
 
     //灏嗘柟娉曡繑鍥炲�艰В鏋愭垚json鏍煎紡
     public JSONObject getJSONObject(String builder) {
@@ -81,10 +87,10 @@
                 String pationid = resultData.get("PationId").toString();
                 if (null != pationid) {
                 customer.setPationId(pationid);
-//                customerService.updateById(customer);
-   /*             OutpinregapplyDto outpinregapplyDto = new OutpinregapplyDto();
+                customerService.updateById(customer);
+                OutpinregapplyDto outpinregapplyDto = new OutpinregapplyDto();
                 outpinregapplyDto.setPationid(pationid);
-                outpinregapplyDto.setSqysbm(SecurityUtils.getUsername());
+                outpinregapplyDto.setSqysbm("00029");
                 outpinregapplyDto.setMzksbm("0101");
                 outpinregapplyDto.setCzybm("00029");
                 outpinregapplyDto.setSfjz("0");
@@ -103,16 +109,14 @@
                         Map<String, Object> resultDatasss = (Map<String, Object>) resultDatas.get(0);
                         String hisRegistrationId = resultDatasss.get("his_registration_id").toString();
                         //闂ㄨ瘖鍖荤敓鎺ヨ瘖
-                        controller.Outpinconapply(hisRegistrationId, date, SecurityUtils.getUsername());
+                        controller.Outpinconapply(hisRegistrationId, date,"00029");
                         customer.setCardId(hisRegistrationId);
                         customerService.updateById(customer);
-                        transitionService.updateCardIdByTjNumAndIdCard(customer.getCusIdcard(),hisRegistrationId);
-                        if(null !=tjOrder){
-                            tjOrder.setCardId(hisRegistrationId);
-                            orderService.updateById(tjOrder);
-                        }
+                        transitionService.updateCardIdByTjNumAndIdCard(customer.getCusIdcard(),hisRegistrationId,tjOrder.getTjNumber());
+                        tjOrder.setCardId(hisRegistrationId);
+                        orderService.updateById(tjOrder);
                     }
-                }*/
+                }
                     AjaxResult error = tijianshenqing(customer, date);
                     if (error != null) return error;
                     return AjaxResult.success();
@@ -129,7 +133,7 @@
         OutpintestapplyDto dto = new OutpintestapplyDto();
         dto.setHisRegistrationId(customer.getCardId());
         dto.setSfjz(customer.getCusIdcard());
-        dto.setSqysbm(SecurityUtils.getUsername());
+        dto.setSqysbm("00029");
         dto.setMzksbm("0101");
         dto.setSjrq(date);
         dto.setCzybm("00029");
@@ -140,7 +144,7 @@
         if (null != detailList && detailList.size() > 0) {
             LambdaQueryWrapper<TjProject> wq = new LambdaQueryWrapper<>();
             wq.in(TjProject::getProId, detailList.stream().map(TbTransition::getParentProId).collect(Collectors.toList()));
-            wq.groupBy(TjProject::getHisXmbm);
+//            wq.groupBy(TjProject::getHisXmbm);
             wq.in(TjProject::getDeptId, "241","317");
             List<TjProject> projects = projectService.list(wq);
             if (null != projects && projects.size() > 0) {
@@ -154,7 +158,7 @@
                             }else {
                                 detailsDto.setSfzhfy("0");
                             }
-                            detailsDto.setSl(1);
+                            detailsDto.setSl(project.getSl());
                             detailsDtos.add(detailsDto);
                         }
                     }
@@ -168,13 +172,52 @@
             JSONObject object3 = getJSONObject(result5);
             String code3 = object3.getStr("ResultCode");
             if (code3.equals("0")) {
-                Map<String, Object> datas = object3.getJSONObject("ResultData");
-                datas.put("cardId", customer.getCardId());
-                JSONObject object4 = JSONUtil.parseObj(datas);
-                LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-                lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpintestapply");
-                HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper);
-                hisApiGetMethodService.save(object4, "Outpintestapply", hisApiConfig,JSONUtil.toJsonStr(BeanUtil.beanToMap(dto)));
+                List<OutpintestapplyDetailsDto> details = dto.getDetails();
+                for (OutpintestapplyDetailsDto detail : details) {
+                    LtkjJianchajianyanTree tree = new LtkjJianchajianyanTree();
+                    tree.setCardId(dto.getHisRegistrationId());
+                    LambdaQueryWrapper<TjCustomer> wrapper4 = new LambdaQueryWrapper<>();
+                    wrapper4.eq(TjCustomer::getCardId,tree.getCardId());
+                    TjCustomer tjCustomer = customerService.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()+"銆�";
+                    }
+                    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());
+                    }
+                    ltkjJianchajianyanTreeService.save(tree);
+                }
+//                Map<String, Object> datas = object3.getJSONObject("ResultData");
+//                datas.put("cardId", customer.getCardId());
+//                JSONObject object4 = JSONUtil.parseObj(datas);
+//                LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+//                lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpintestapply");
+//                HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper);
+//                hisApiGetMethodService.save(object4, "Outpintestapply", hisApiConfig,JSONUtil.toJsonStr(BeanUtil.beanToMap(dto)));
 
             }else {
                 return AjaxResult.error();
@@ -185,7 +228,7 @@
         OutpinexamapplyDto outpinexamapplyDto = new OutpinexamapplyDto();
         outpinexamapplyDto.setHisRegistrationId(customer.getCardId());
         outpinexamapplyDto.setSfzh(customer.getCusIdcard());
-        outpinexamapplyDto.setSqysbm(SecurityUtils.getUsername());
+        outpinexamapplyDto.setSqysbm("00029");
         outpinexamapplyDto.setMzksbm("0101");
         outpinexamapplyDto.setCzybm("00029");
         outpinexamapplyDto.setCzyksbm("0101");
@@ -194,7 +237,7 @@
         if (null != detailLists && detailLists.size() > 0) {
             LambdaQueryWrapper<TjProject> wq = new LambdaQueryWrapper<>();
             wq.in(TjProject::getProId, detailLists.stream().map(TbTransition::getParentProId).collect(Collectors.toList()));
-            wq.groupBy(TjProject::getHisXmbm);
+//            wq.groupBy(TjProject::getHisXmbm);
             wq.in(TjProject::getDeptId, "247", "248", "249", "250", "251", "252", "271", "273", "274", "275","298");
             List<TjProject> projects = projectService.list(wq);
             if (null != projects && projects.size() > 0) {
@@ -208,7 +251,7 @@
                             }else {
                                 detailsDto.setSfzhfy("0");
                             }
-                            detailsDto.setSl(1);
+                            detailsDto.setSl(project.getSl());
                             detailsDtoss.add(detailsDto);
                         }
 
@@ -223,13 +266,52 @@
             JSONObject object5 = getJSONObject(result6);
             String code4 = object5.getStr("ResultCode");
             if (code4.equals("0")) {
-                Map<String, Object> map = object5.getJSONObject("ResultData");
-                map.put("cardId", customer.getCardId());
-                JSONObject jsonObject = JSONUtil.parseObj(map);
-                LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-                lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpinexamapply");
-                HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper);
-                hisApiGetMethodService.save(jsonObject, "Outpinexamapply", hisApiConfig,JSONUtil.toJsonStr(BeanUtil.beanToMap(outpinexamapplyDto)));
+                List<OutpintestapplyDetailsDto> details = outpinexamapplyDto.getDetails();
+                for (OutpintestapplyDetailsDto detail : details) {
+                    LtkjJianchajianyanTree tree = new LtkjJianchajianyanTree();
+                    tree.setCardId(outpinexamapplyDto.getHisRegistrationId());
+                    LambdaQueryWrapper<TjCustomer> wrapper4 = new LambdaQueryWrapper<>();
+                    wrapper4.eq(TjCustomer::getCardId,tree.getCardId());
+                    TjCustomer tjCustomer = customerService.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()+"銆�";
+                    }
+                    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());
+                    }
+                    ltkjJianchajianyanTreeService.save(tree);
+                }
+//                Map<String, Object> map = object5.getJSONObject("ResultData");
+//                map.put("cardId", customer.getCardId());
+//                JSONObject jsonObject = JSONUtil.parseObj(map);
+//                LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+//                lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpinexamapply");
+//                HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper);
+//                hisApiGetMethodService.save(jsonObject, "Outpinexamapply", hisApiConfig,JSONUtil.toJsonStr(BeanUtil.beanToMap(outpinexamapplyDto)));
 
             }else {
                 return AjaxResult.error();
@@ -241,7 +323,7 @@
         OutpintreatapplyDto dao = new OutpintreatapplyDto();
         dao.setHisRegistrationId(customer.getCardId());
         dao.setSfzh(customer.getCusIdcard());
-        dao.setSqysbm(SecurityUtils.getUsername());
+        dao.setSqysbm("00029");
         dao.setMzksbm("0101");
         dao.setSjrq(date);
         dao.setCzybm("00029");
@@ -251,8 +333,9 @@
         if (null != details && details.size() > 0) {
             LambdaQueryWrapper<TjProject> wq = new LambdaQueryWrapper<>();
             wq.in(TjProject::getProId, details.stream().map(TbTransition::getParentProId).collect(Collectors.toList()));
-            wq.groupBy(TjProject::getHisXmbm);
+//            wq.groupBy(TjProject::getHisXmbm);
             wq.in(TjProject::getDeptId, "100", "240", "253", "254", "255", "257", "258", "259", "269", "270");
+//            wq.isNull(TjProject::getDeptId);
             List<TjProject> projects = projectService.list(wq);
             if (null != projects && projects.size() > 0) {
                 for (TjProject project : projects) {
@@ -265,7 +348,7 @@
                             } else {
                                 detailsDto.setSfzhfy("0");
                             }
-                            detailsDto.setSl(1);
+                            detailsDto.setSl(project.getSl());
                             detailDtos.add(detailsDto);
                         }
                     }
@@ -279,13 +362,52 @@
             JSONObject mzylyzsq3 = getJSONObject(mzylyzsq2);
             String code5 = mzylyzsq3.getStr("ResultCode");
             if (code5.equals("0")) {
-                Map<String, Object> map = mzylyzsq3.getJSONObject("ResultData");
-                map.put("cardId", customer.getCardId());
-                JSONObject jsonObject = JSONUtil.parseObj(map);
-                LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-                lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpintreatapply");
-                HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper);
-                hisApiGetMethodService.save(jsonObject, "Outpintreatapply", hisApiConfig,JSONUtil.toJsonStr(BeanUtil.beanToMap(dao)));
+                List<OutpintestapplyDetailsDto> details1 = dao.getDetails();
+                for (OutpintestapplyDetailsDto detail : details1) {
+                    LtkjJianchajianyanTree tree = new LtkjJianchajianyanTree();
+                    tree.setCardId(dao.getHisRegistrationId());
+                    LambdaQueryWrapper<TjCustomer> wrapper4 = new LambdaQueryWrapper<>();
+                    wrapper4.eq(TjCustomer::getCardId,tree.getCardId());
+                    TjCustomer tjCustomer = customerService.getOne(wrapper4);
+                    tree.setPationid(tjCustomer.getPationId());
+                    JSONObject resultData = mzylyzsq3.getJSONObject("ResultData");
+                    tree.setSqdh(resultData.getStr("zlczh"));
+                    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()+"銆�";
+                    }
+                    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());
+                    }
+                    ltkjJianchajianyanTreeService.save(tree);
+                }
+//                Map<String, Object> map = mzylyzsq3.getJSONObject("ResultData");
+//                map.put("cardId", customer.getCardId());
+//                JSONObject jsonObject = JSONUtil.parseObj(map);
+//                LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+//                lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpintreatapply");
+//                HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper);
+//                hisApiGetMethodService.save(jsonObject, "Outpintreatapply", hisApiConfig,JSONUtil.toJsonStr(BeanUtil.beanToMap(dao)));
             }else {
                 return AjaxResult.error();
             }

--
Gitblit v1.8.0