Browse Source

出院医嘱和版本号问题

xiaochan 6 months ago
parent
commit
2eef9d7915

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>web-server</artifactId>
-    <version>12.6.5</version>
+    <version>12.6.8</version>
     <name>web-server</name>
     <description>server for yibao-web</description>
     <properties>

+ 1 - 12
src/main/java/thyyxxk/webserver/controller/zhuyuanyizheng/YizhuLuRuController.java

@@ -272,18 +272,7 @@ public class YizhuLuRuController {
 
     @GetMapping("/getYzZdOrderItemConfirm")
     public ResultVo<Map<String, Set<String>>> getYzZdOrderItemConfirm() {
-        List<YzZdOrderItemConfirm> yzZdOrderItemConfirm = extraCache.getYzZdOrderItemConfirm();
-        if (yzZdOrderItemConfirm != null && !yzZdOrderItemConfirm.isEmpty()) {
-            Map<String, Set<String>> map = new HashMap<>();
-
-            yzZdOrderItemConfirm.forEach(item -> {
-                map.computeIfAbsent(item.getItemName(), k -> new HashSet<>()).add(item.getOrderCode());
-            });
-
-            return ResultVoUtil.success(map);
-        }
-
-        return ResultVoUtil.success(new HashMap<>());
+        return ResultVoUtil.success(extraCache.getYzZdOrderItemMap());
     }
 
 }

+ 1 - 9
src/main/java/thyyxxk/webserver/dao/his/hutoolcache/HutoolCacheDao.java

@@ -65,6 +65,7 @@ public interface HutoolCacheDao {
             " password," +
             " b.code_rs," +
             " rtrim(b.yb_code) as ybCode," +
+            "hzDay = (select hz_day from zd_unit_code where zd_unit_code.code = b.dept_code)," +
             " emp_tit_code," +
             " rtrim(b.dept_code) as deptCode,user_config, " +
             " cast(isnull(NULLIF(doctor_xz_yp, ''), 0) as int) doctor_xz_yp " +
@@ -81,15 +82,6 @@ public interface HutoolCacheDao {
     @Select("select role_id from dj_user_role where user_code=#{code}")
     List<Integer> selectUserRoles(String code);
 
-
-    @Select("select b.id\n" +
-            "from t_intergration_platform_role_menu a,\n" +
-            "     t_intergration_menu b\n" +
-            "where role_id in\n" +
-            "      (select dj_user_role.role_id from dj_user_role where user_code = #{code})\n" +
-            "  and a.menu_id = b.id")
-    List<Integer> selectUserMenu(String code);
-
     @Select("select dept_code from zy_part_time_dept where code=#{code}")
     List<String> selectUserPartTimeDept(String code);
 

+ 6 - 2
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyiji/QueRenYiZhuShouFeiDao.java

@@ -35,10 +35,14 @@ public interface QueRenYiZhuShouFeiDao {
             "ward_name = (select name from zd_unit_code where code = ward_code),  " +
             "shi_fou_you_chu_yuan_yi_zhu =  " +
             "case when (select count(1) from yz_act_order where inpatient_no= a.inpatient_no and admiss_times= a.admiss_times  " +
-            "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')) > 0  " +
+            "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in (select order_code\n" +
+            "from yz_zd_order_item_confirm\n" +
+            "where item_name = N'出院')) > 0  " +
             "then 1  " +
             "when (select count(1) from yz_inact_order where inpatient_no= a.inpatient_no and admiss_times= a.admiss_times  " +
-            "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')) > 0  " +
+            "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in (select order_code\n" +
+            "from yz_zd_order_item_confirm\n" +
+            "where item_name = N'出院')) > 0  " +
             "then 1 else 0 end  " +
             "FROM yz_zy_patient_fee a  left join  zy_actpatient b on (a.inpatient_no = b.inpatient_no and a.admiss_times = b.admiss_times)  " +
             "where a.charge_status ='3' " +

+ 3 - 10
src/main/java/thyyxxk/webserver/service/LoginService.java

@@ -51,9 +51,6 @@ public class LoginService {
             }
             dao.insertNewUserToDjUserBase(tempUserInfo);
         }
-
-        String ip = IpAddressUtil.getIPAddress(request);
-
         String pwd = encrypt ? SecureUtil.md5(userInfo.getPassword()) : userInfo.getPassword();
         boolean through
                 = !Objects.equals("fromTriageScreen", userInfo.getSid())
@@ -61,7 +58,6 @@ public class LoginService {
         if (through) {
             return ResultVoUtil.fail(ExceptionEnum.INVALID_PASSWORD, userInfo);
         }
-
         String token = TokenUtil.getInstance().createToken(tempUserInfo.getCode());
         try {
             String qxwxToken = tokenService.getWeComAddressBookToken();
@@ -69,20 +65,17 @@ public class LoginService {
             tempUserInfo.setAvatar(json.getString("avatar"));
         } catch (Exception ignored) {
         }
-        tempUserInfo = userCache.get(tempUserInfo.getCode());
-        userInfo.setDeptName(deptCache.get(tempUserInfo.getDeptCode()).getName());
+        tempUserInfo.setDeptName(deptCache.get(tempUserInfo.getDeptCode()).getName());
         Set<String> deptList = publicServer.getDept(true, userInfo);
         if (!deptList.isEmpty()) {
             Map<String, String> tempMap = new HashMap<>(deptList.size());
             deptList.forEach(item -> {
                 tempMap.put(item, deptCache.getDeptName(item));
             });
-            userInfo.setPartTimeDeptMap(tempMap);
+            tempUserInfo.setPartTimeDeptMap(tempMap);
         }
-        userInfo.setHzDay(dao.getDeptHzDayByCode(userInfo.getDeptCode()));
+        tempUserInfo.setHzDay(dao.getDeptHzDayByCode(userInfo.getDeptCode()));
         tempUserInfo.setToken(token);
-        tempUserInfo.setIp(ip);
-        tempUserInfo.setSid(makeSid(tempUserInfo.getCode(), userInfo.getSid(), ip));
         userCache.put(tempUserInfo.getCode(), tempUserInfo);
         return ResultVoUtil.success(tempUserInfo);
     }

+ 32 - 7
src/main/java/thyyxxk/webserver/service/hutoolcache/ExtraCache.java

@@ -2,14 +2,14 @@ package thyyxxk.webserver.service.hutoolcache;
 
 import cn.hutool.cache.Cache;
 import cn.hutool.cache.CacheUtil;
+import com.alibaba.fastjson.JSONObject;
 import lombok.RequiredArgsConstructor;
+import org.jetbrains.annotations.NotNull;
 import org.springframework.stereotype.Component;
 import thyyxxk.webserver.dao.his.hutoolcache.HutoolCacheDao;
 import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.YzZdOrderItemConfirm;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.function.Supplier;
 
 @Component
@@ -22,7 +22,7 @@ public class ExtraCache implements HutoolCacheInterface<Object> {
 
     @SuppressWarnings("unchecked")
     public <T> T getValue(String key, Supplier<T> function) {
-        Object value = cache.get(key);
+        Object value = get(key);
         if (value == null) {
             value = function.get();
             put(key, value);
@@ -31,7 +31,6 @@ public class ExtraCache implements HutoolCacheInterface<Object> {
         return (T) value;
     }
 
-    @SuppressWarnings("unchecked")
     public <T> T getValue(CacheEnums key, Supplier<T> function) {
         return getValue(key.getName(), function);
     }
@@ -46,7 +45,11 @@ public class ExtraCache implements HutoolCacheInterface<Object> {
 
     @Override
     public Object get(String key) {
-        return cache.get(key);
+        Object o = cache.get(key);
+        if (o == null) {
+            return null;
+        }
+        return JSONObject.parseObject(JSONObject.toJSONString(o), Object.class);
     }
 
     @Override
@@ -54,7 +57,7 @@ public class ExtraCache implements HutoolCacheInterface<Object> {
         cache.remove(key);
     }
 
-    public void del(CacheEnums key) {
+    public void del(@NotNull CacheEnums key) {
         cache.remove(key.getName());
     }
 
@@ -70,12 +73,30 @@ public class ExtraCache implements HutoolCacheInterface<Object> {
 
     /**
      * 获取一些特殊的医嘱的
+     *
      * @return 返回数据
      */
     public List<YzZdOrderItemConfirm> getYzZdOrderItemConfirm() {
         return getValue(CacheEnums.YI_ZHU_SPECIAL_MEDICAL_ADVICE, dao::getYzZdOrderItemConfirm);
     }
 
+
+    public Map<String, Set<String>> getYzZdOrderItemMap() {
+        List<YzZdOrderItemConfirm> yzZdOrderItemConfirm = getYzZdOrderItemConfirm();
+
+        if (yzZdOrderItemConfirm == null) {
+            return Collections.emptyMap();
+        }
+
+        Map<String, Set<String>> map = new HashMap<>();
+
+        yzZdOrderItemConfirm.forEach(item -> {
+            map.computeIfAbsent(item.getItemName(), k -> new HashSet<>()).add(item.getOrderCode());
+        });
+        return map;
+    }
+
+
     public Map<String, String> getMessage() {
         Map<String, String> map = new HashMap<>();
         map.put(CacheEnums.SYSTEM_UPDATES_MESSAGE.getName(),
@@ -85,4 +106,8 @@ public class ExtraCache implements HutoolCacheInterface<Object> {
         return map;
     }
 
+    @Override
+    public String getLabel() {
+        return "其他缓存";
+    }
 }

+ 5 - 0
src/main/java/thyyxxk/webserver/service/hutoolcache/RegionCache.java

@@ -65,4 +65,9 @@ public class RegionCache implements HutoolCacheInterface<String> {
         cache.clear();
     }
 
+
+    @Override
+    public String getLabel() {
+        return "区域缓存";
+    }
 }

+ 5 - 1
src/main/java/thyyxxk/webserver/service/hutoolcache/UserCache.java

@@ -23,6 +23,9 @@ public class UserCache implements HutoolCacheInterface<UserInfo> {
 
     @Override
     public void put(String key, UserInfo value) {
+        if (value == null) {
+            return;
+        }
         cache.put(key, value);
     }
 
@@ -34,8 +37,9 @@ public class UserCache implements HutoolCacheInterface<UserInfo> {
         UserInfo userInfo = cache.get(key);
         if (userInfo == null) {
             userInfo = dbInfo(key);
-            cache.put(key, userInfo);
+            put(key, userInfo);
         }
+
         return userInfo;
     }
 

+ 158 - 156
src/main/java/thyyxxk/webserver/service/medicaladvice/medicamanage/MedicalManagementService.java

@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,6 +26,7 @@ import thyyxxk.webserver.entity.medicaladvice.medicamanage.YzOrderParam;
 import thyyxxk.webserver.entity.medicaladvice.medicamanage.YzPrintRec;
 import thyyxxk.webserver.entity.medicaladvice.medicamanage.YzPrintVO;
 import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.XinZhenYzActOrder;
+import thyyxxk.webserver.service.hutoolcache.ExtraCache;
 import thyyxxk.webserver.service.hutoolcache.UserCache;
 import thyyxxk.webserver.service.inpatient.PatientService;
 import thyyxxk.webserver.utils.AssertUtil;
@@ -34,11 +36,7 @@ import thyyxxk.webserver.utils.ResultVoUtil;
 import thyyxxk.webserver.utils.StringUtil;
 
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -48,127 +46,120 @@ import java.util.stream.Collectors;
  */
 @Slf4j
 @Service
+@RequiredArgsConstructor
 public class MedicalManagementService {
     private final MedicalManagementDao dao;
     private final PatientService patientService;
     private final YiZhuLuRuDao yiZhuLuRuDao;
     private final YzPrintRecDao yzPrintRecDao;
     private final UserCache userCache;
+    private final ExtraCache extraCache;
     //打印分页数
     private static final int PRINT_PAGE_SIZE = 20;
     //长期 临时医嘱打印名称
     private static final String PRINT_NAME_ORD_LONG = "print_ord_long";
     private static final String PRINT_NAME_ORD_ONCE = "print_ord_once";
 
-    @Autowired
-    public MedicalManagementService(MedicalManagementDao dao, PatientService patientService, YiZhuLuRuDao yiZhuLuRuDao, YzPrintRecDao yzPrintRecDao, UserCache userCache) {
-        this.dao = dao;
-        this.patientService = patientService;
-        this.yiZhuLuRuDao = yiZhuLuRuDao;
-        this.yzPrintRecDao = yzPrintRecDao;
-        this.userCache = userCache;
-    }
-
 
-    public ResultVo<Map<String,Object>> cqYzPrint(YzOrderParam param) {
-       return getPrinInfo(param);
+    public ResultVo<Map<String, Object>> cqYzPrint(YzOrderParam param) {
+        return getPrinInfo(param);
     }
 
     public ResultVo<Map<String, Object>> lsYzPrint(YzOrderParam param) {
-      return   getPrinInfo(param);
+        return getPrinInfo(param);
     }
 
-    private String getPageCondition(YzOrderParam param,String pageTemplate){
+    private String getPageCondition(YzOrderParam param, String pageTemplate) {
         String pageCondition;
-        AssertUtil.isnotBlank(param.getPrintType(),"请选择打印类型");
-        if(param.getPrintType() == 1){
+        AssertUtil.isnotBlank(param.getPrintType(), "请选择打印类型");
+        if (param.getPrintType() == 1) {
             pageCondition = StrUtil.format(" isnull({},0)=0  ", pageTemplate);
-        }else {
-            AssertUtil.isnotBlank(param.getPageNum(),"请选择医嘱页码");
-            if(param.getPrintType() == 2){
-                pageCondition = StrUtil.format("isnull({},0) ={}",pageTemplate,param.getPageNum()) ;
-            }else {
-                pageCondition = StrUtil.format("isnull({},0) >={}",pageTemplate,param.getPageNum()) ;
+        } else {
+            AssertUtil.isnotBlank(param.getPageNum(), "请选择医嘱页码");
+            if (param.getPrintType() == 2) {
+                pageCondition = StrUtil.format("isnull({},0) ={}", pageTemplate, param.getPageNum());
+            } else {
+                pageCondition = StrUtil.format("isnull({},0) >={}", pageTemplate, param.getPageNum());
             }
         }
         return pageCondition;
     }
 
-   private ResultVo<Map<String, Object>>  getPrinInfo(YzOrderParam param){
-       Map<String, Object> map = new HashMap<>(2);
-       List<YzPrintVO> yzPrintVOList ;
-       if(param.getType() == 1){
-           //长期医嘱
-          String pageCondition = getPageCondition(param,"a.print_page");
-           yzPrintVOList =  dao.getcqYzPrint(param.getPatNo(),param.getTimes(),pageCondition);
-       }else {
-           String pageCondition = getPageCondition(param,"a.print_page_once");
-           yzPrintVOList = dao.getlsYzPrint(param.getPatNo(),param.getTimes(),pageCondition);
-       }
-       if(CollUtil.isNotEmpty(yzPrintVOList)){
-           List<YzPrintVO> childrenList = yzPrintVOList.stream().filter(o -> o.getParentNo() != null ).collect(Collectors.toList());
-           Map<Long, List<YzPrintVO>> groupMap = null;
-           if(CollUtil.isNotEmpty(childrenList)) {
+    private ResultVo<Map<String, Object>> getPrinInfo(YzOrderParam param) {
+        Map<String, Object> map = new HashMap<>(2);
+        List<YzPrintVO> yzPrintVOList;
+        if (param.getType() == 1) {
+            //长期医嘱
+            String pageCondition = getPageCondition(param, "a.print_page");
+            yzPrintVOList = dao.getcqYzPrint(param.getPatNo(), param.getTimes(), pageCondition);
+        } else {
+            String pageCondition = getPageCondition(param, "a.print_page_once");
+            yzPrintVOList = dao.getlsYzPrint(param.getPatNo(), param.getTimes(), pageCondition);
+        }
+        if (CollUtil.isNotEmpty(yzPrintVOList)) {
+            List<YzPrintVO> childrenList = yzPrintVOList.stream().filter(o -> o.getParentNo() != null).collect(Collectors.toList());
+            Map<Long, List<YzPrintVO>> groupMap = null;
+            if (CollUtil.isNotEmpty(childrenList)) {
                 groupMap = childrenList.stream().collect(Collectors.groupingBy(o -> o.getParentNo()));
-           }
-           for (YzPrintVO obj: yzPrintVOList) {
-               obj.setOrderGroupNo("");
-               obj.setDate(DateUtil.format(obj.getStartTime(),"MM-dd"));
-               obj.setTime(DateUtil.format(obj.getStartTime(),"HH:mm"));
-               obj.setStopDate(DateUtil.format(obj.getEndTime(),"MM-dd"));
-               obj.setStopTime(DateUtil.format(obj.getEndTime(),"HH:mm"));
-               obj.setModifierName(getUserName(obj.getModifier()));
-               obj.setExecId2Name(getUserName(obj.getExecId2()
-               ));
-               obj.setExecName(getUserName(obj.getExecId()));
-               obj.setFrequCode(StrUtil.replace(obj.getFrequCode(),"Always","").replace("Once",""));
-               obj.setDoctorName(getUserName(obj.getDoctorCode()));
-               obj.setNurseName(getUserName(obj.getNurseCode()));
-               obj.setNewOrderName(StrUtil.replace(obj.getNewOrderName(),"诊疗项目",""));
-               obj.setExecTimeStr(obj.getExecTime()==null ? "" : DateUtil.format(obj.getExecTime(),"MM-dd HH:mm"));
-               if(MapUtil.isNotEmpty(groupMap)){
-                    if(obj.getParentNo() == null && groupMap.containsKey(obj.getActOrderNo())){
+            }
+            for (YzPrintVO obj : yzPrintVOList) {
+                obj.setOrderGroupNo("");
+                obj.setDate(DateUtil.format(obj.getStartTime(), "MM-dd"));
+                obj.setTime(DateUtil.format(obj.getStartTime(), "HH:mm"));
+                obj.setStopDate(DateUtil.format(obj.getEndTime(), "MM-dd"));
+                obj.setStopTime(DateUtil.format(obj.getEndTime(), "HH:mm"));
+                obj.setModifierName(getUserName(obj.getModifier()));
+                obj.setExecId2Name(getUserName(obj.getExecId2()
+                ));
+                obj.setExecName(getUserName(obj.getExecId()));
+                obj.setFrequCode(StrUtil.replace(obj.getFrequCode(), "Always", "").replace("Once", ""));
+                obj.setDoctorName(getUserName(obj.getDoctorCode()));
+                obj.setNurseName(getUserName(obj.getNurseCode()));
+                obj.setNewOrderName(StrUtil.replace(obj.getNewOrderName(), "诊疗项目", ""));
+                obj.setExecTimeStr(obj.getExecTime() == null ? "" : DateUtil.format(obj.getExecTime(), "MM-dd HH:mm"));
+                if (MapUtil.isNotEmpty(groupMap)) {
+                    if (obj.getParentNo() == null && groupMap.containsKey(obj.getActOrderNo())) {
                         obj.setOrderGroupNo("┏");
-                    }else if(obj.getParentNo() != null){
+                    } else if (obj.getParentNo() != null) {
                         List<YzPrintVO> yzPrintVOS = groupMap.get(obj.getParentNo());
-                        if(obj.getActOrderNo() == yzPrintVOS.get(yzPrintVOS.size()-1).getActOrderNo()){
+                        if (obj.getActOrderNo() == yzPrintVOS.get(yzPrintVOS.size() - 1).getActOrderNo()) {
                             obj.setOrderGroupNo("┗");
-                        }else {
+                        } else {
                             obj.setOrderGroupNo("┃");
                         }
                     }
-               }
-           }
-       }
-
-       List<YzPrintVO> result = dealYzPrintVOList(param,yzPrintVOList);
-       Patient patientInfo = getPatientBaseInfo(param.getPatNo(),param.getTimes(),param.getInOutStatusFlag());
-       map.put("yzPrintVOList",result);
-       map.put("patientInfo",patientInfo);
-       return ResultVoUtil.success(map);
+                }
+            }
+        }
+
+        List<YzPrintVO> result = dealYzPrintVOList(param, yzPrintVOList);
+        Patient patientInfo = getPatientBaseInfo(param.getPatNo(), param.getTimes(), param.getInOutStatusFlag());
+        map.put("yzPrintVOList", result);
+        map.put("patientInfo", patientInfo);
+        return ResultVoUtil.success(map);
     }
 
     private List<YzPrintVO> dealYzPrintVOList(YzOrderParam param, List<YzPrintVO> yzPrintVOList) {
         List<YzPrintVO> result = new ArrayList<>();
-        if(CollUtil.isEmpty(yzPrintVOList)) return result;
+        if (CollUtil.isEmpty(yzPrintVOList)) return result;
         if (param.getPrintType() == 1) {
             List<List<YzPrintVO>> splitList = CollUtil.split(yzPrintVOList, PRINT_PAGE_SIZE);
             if (splitList.get(splitList.size() - 1).size() <= PRINT_PAGE_SIZE) {
                 addEmptyYzPrintVO(splitList.get(splitList.size() - 1), PRINT_PAGE_SIZE - splitList.get(splitList.size() - 1).size());
             }
-            for (int i = 0; i < splitList.size() ; i++) {
+            for (int i = 0; i < splitList.size(); i++) {
                 result.addAll(splitList.get(i));
-                YzPrintVO temp = setPageFlag(param, i+1);
+                YzPrintVO temp = setPageFlag(param, i + 1);
                 result.add(temp);
             }
-        }else if(param.getPrintType() == 2){
-        //    单页查询
+        } else if (param.getPrintType() == 2) {
+            //    单页查询
             addAllPrintData(param, result, Convert.toInt(param.getPageNum()), yzPrintVOList, "当前页数据已超出打印范围,请重置打印页号");
-        }else {
-        //    查询某页后
+        } else {
+            //    查询某页后
             Map<Integer, List<YzPrintVO>> pageNoGroup = yzPrintVOList.stream().collect(Collectors.groupingBy(o -> o.getPageNo()));
             List<Integer> sortPageNo = CollUtil.newArrayList(pageNoGroup.keySet()).stream().sorted().collect(Collectors.toList());
-            sortPageNo.forEach(pageNo->{
+            sortPageNo.forEach(pageNo -> {
                 List<YzPrintVO> temp = pageNoGroup.get(pageNo);
                 addAllPrintData(param, result, pageNo, temp, pageNo + "页数据已超出打印范围,请重置打印页号");
             });
@@ -192,21 +183,22 @@ public class MedicalManagementService {
     private YzPrintVO setPageFlag(YzOrderParam param, int pageNum) {
         YzPrintVO temp = new YzPrintVO();
         temp.setPageFlag("1");
-        if(param.getType() == 1){
+        if (param.getType() == 1) {
             temp.setPrintPage(pageNum);
-        }else {
+        } else {
             temp.setPrintPageOnce(pageNum);
-        } return temp;
+        }
+        return temp;
     }
 
-    private void addEmptyYzPrintVO(List<YzPrintVO> list,int size){
-       if(size > 0){
-           for (int i = 0; i < size; i++) {
-               YzPrintVO e = new YzPrintVO();
-               e.setPageFlag("0");
-               list.add(e);
-           }
-       }
+    private void addEmptyYzPrintVO(List<YzPrintVO> list, int size) {
+        if (size > 0) {
+            for (int i = 0; i < size; i++) {
+                YzPrintVO e = new YzPrintVO();
+                e.setPageFlag("0");
+                list.add(e);
+            }
+        }
     }
 
 
@@ -216,21 +208,22 @@ public class MedicalManagementService {
     }
 
 
-    public List<Patient> queryPatientInfo(String patNo,String ward,String inOutStatusFlag){
-       AssertUtil.isnotBlank(ward,"科室不能为空");
-       QueryWrapper<?> query = new QueryWrapper<>();
-       query.eq("a.ward", ward);
-       query.likeRight(StringUtil.notBlank(patNo),"a.inpatient_no", patNo);
-       String tableName;
-       if("1".equals(inOutStatusFlag)){
-           tableName = "zy_inactpatient";
-       }else {
-           tableName = "zy_actpatient";
-       }
-
-       List<Patient> patient = dao.queryPatientInfo(query,tableName);
-       return patient;
-   }
+    public List<Patient> queryPatientInfo(String patNo, String ward, String inOutStatusFlag) {
+        AssertUtil.isnotBlank(ward, "科室不能为空");
+        QueryWrapper<?> query = new QueryWrapper<>();
+        query.eq("a.ward", ward);
+        query.likeRight(StringUtil.notBlank(patNo), "a.inpatient_no", patNo);
+        String tableName;
+        if ("1".equals(inOutStatusFlag)) {
+            tableName = "zy_inactpatient";
+        } else {
+            tableName = "zy_actpatient";
+        }
+
+        List<Patient> patient = dao.queryPatientInfo(query, tableName);
+        return patient;
+    }
+
     /**
      * @description:查询医嘱
      * @author: lihong
@@ -238,7 +231,7 @@ public class MedicalManagementService {
      * @param: yzQueryBase
      * @return: java.lang.Object
      **/
-    public Map<String,Object> queryYz(YzQueryBase yzQueryBase) {
+    public Map<String, Object> queryYz(YzQueryBase yzQueryBase) {
         Map<String, Object> result = new HashMap<>(3);
         List<XinZhenYzActOrder> yiZhuList = listYzActOrder(yzQueryBase);
         if (CollUtil.isNotEmpty(yiZhuList)) {
@@ -273,9 +266,9 @@ public class MedicalManagementService {
             }
 
         }
-        Patient patientInfo = getPatientBaseInfo(yzQueryBase.getPatNo(),yzQueryBase.getTimes(),yzQueryBase.getInOutStatusFlag());
+        Patient patientInfo = getPatientBaseInfo(yzQueryBase.getPatNo(), yzQueryBase.getTimes(), yzQueryBase.getInOutStatusFlag());
         result.put("patientInfo", patientInfo);
-        result.put("yzDataList",yiZhuList);
+        result.put("yzDataList", yiZhuList);
         return result;
     }
 
@@ -285,7 +278,7 @@ public class MedicalManagementService {
         qw.eq("a.inpatient_no", yzQueryBase.getPatNo()).eq("a.admiss_times", yzQueryBase.getTimes());
         if ("3".equals(yzQueryBase.getStatusFlag())) {
             qw.inSql("a.status_flag", "'3','4'");
-        } else if ( StringUtil.notBlank(yzQueryBase.getStatusFlag()) && !"0".equals(yzQueryBase.getStatusFlag())) {
+        } else if (StringUtil.notBlank(yzQueryBase.getStatusFlag()) && !"0".equals(yzQueryBase.getStatusFlag())) {
             qw.eq("a.status_flag", yzQueryBase.getStatusFlag());
         }
         /**显示范围 0 全部 1停止 2当前(查询确认和执行) 3 今天 */
@@ -304,30 +297,39 @@ public class MedicalManagementService {
     }
 
 
-    public Patient getPatientBaseInfo(String patNo,Integer times,String inOutStatusFlag){
-        Patient patientInfo = patientService.getPatientBaseInfo(patNo,times,inOutStatusFlag);
+    public Patient getPatientBaseInfo(String patNo, Integer times, String inOutStatusFlag) {
+        Patient patientInfo = patientService.getPatientBaseInfo(patNo, times, inOutStatusFlag);
         YzQueryBase yzQueryBase = new YzQueryBase();
         yzQueryBase.setPatNo(patNo);
         yzQueryBase.setTimes(times);
         yzQueryBase.setQueryRange("0");
         yzQueryBase.setStatusFlag("0");
         List<XinZhenYzActOrder> orderList = listYzActOrder(yzQueryBase);
-        for(XinZhenYzActOrder item : orderList){
+        Map<String, Set<String>> yzZdOrderItemMap = extraCache.getYzZdOrderItemMap();
+
+        for (XinZhenYzActOrder item : orderList) {
+            // 药品编码会重复
+            if (!"00".equals(item.getSerial())) {
+                continue;
+            }
+
             if ("3".equals(item.getStatusFlag()) || "4".equals(item.getStatusFlag())) {
-                if(item.getOrderName().contains("级护理")){
+                if (item.getOrderName().contains("级护理")) {
                     patientInfo.setNursingLevel(item.getOrderName());
                 }
             }
-            if ("05888".equals(item.getOrderCode())) {
+            if (yzZdOrderItemMap.get("病重").contains(item.getOrderCode())) {
                 patientInfo.setCriticallyIllStatus("病重");
-            }else if("05887".equals(item.getOrderCode())) {
+            }
+
+            if (yzZdOrderItemMap.get("病危").contains(item.getOrderCode())) {
                 patientInfo.setCriticallyIllStatus("病危");
             }
         }
-        Integer count =   dao.existOprt(patNo, times);
-        if(count != null){
+        Integer count = dao.existOprt(patNo, times);
+        if (count != null) {
             patientInfo.setOprtStatus("有手术");
-        }else {
+        } else {
             patientInfo.setOprtStatus("无手术");
         }
         return patientInfo;
@@ -356,21 +358,21 @@ public class MedicalManagementService {
         //select * from    yz_print_rec where   inpatient_no ='0418368' and admiss_times =1 and print_name ='print_ord_once'
         //        --UPDATE yz_act_order SET print_page_once = 3 WHERE act_order_no = 17648285
         //        --update yz_print_rec set current_page =3 , last_row =14 where inpatient_no ='0418368' and admiss_times =1 and print_name ='print_ord_once'
-        AssertUtil.isnotBlank(param.getPatNo(),"请选择一条病人");
+        AssertUtil.isnotBlank(param.getPatNo(), "请选择一条病人");
         QueryWrapper query = new QueryWrapper();
-        query.eq("inpatient_no",param.getPatNo());
-        query.eq("admiss_times",param.getTimes());
-        query.eq("print_name", param.getType() == 1 ? PRINT_NAME_ORD_LONG :PRINT_NAME_ORD_ONCE);
+        query.eq("inpatient_no", param.getPatNo());
+        query.eq("admiss_times", param.getTimes());
+        query.eq("print_name", param.getType() == 1 ? PRINT_NAME_ORD_LONG : PRINT_NAME_ORD_ONCE);
         YzPrintRec yzPrintRec = yzPrintRecDao.selectOne(query);
         List<YzPrintVO> yzPrintVOS = param.getType() == 1 ? dao.getcqYzPrint(param.getPatNo(), param.getTimes(), " isnull(a.print_page,0)=0 ") : dao.getlsYzPrint(param.getPatNo(), param.getTimes(), " isnull(a.print_page_once,0)=0 ");
         YzPrintRec rec = new YzPrintRec();
         rec.setInpatientNo(param.getPatNo());
         rec.setAdmissTimes(param.getTimes());
-        rec.setPrintName(param.getType() == 1 ? PRINT_NAME_ORD_LONG :PRINT_NAME_ORD_ONCE);
-        int size ;
-        if(yzPrintRec == null){
+        rec.setPrintName(param.getType() == 1 ? PRINT_NAME_ORD_LONG : PRINT_NAME_ORD_ONCE);
+        int size;
+        if (yzPrintRec == null) {
             size = yzPrintVOS.size();
-        }else {
+        } else {
             Integer cur = yzPrintRec.getCurrentPage();
             Integer lr = yzPrintRec.getLastRow();
             int preSize = (cur - 1) * PRINT_PAGE_SIZE + lr;
@@ -380,34 +382,34 @@ public class MedicalManagementService {
         int lastRow = size % PRINT_PAGE_SIZE == 0 ? PRINT_PAGE_SIZE : size % PRINT_PAGE_SIZE;
         rec.setCurrentPage(currentPage);
         rec.setLastRow(lastRow);
-        if(yzPrintRec != null){
+        if (yzPrintRec != null) {
             yzPrintRecDao.delete(query);
         }
         yzPrintRecDao.insert(rec);
         //print_page,print_page_once
-        updatePageNo(yzPrintVOS,yzPrintRec,param.getType() == 1 ? " print_page" : " print_page_once");
+        updatePageNo(yzPrintVOS, yzPrintRec, param.getType() == 1 ? " print_page" : " print_page_once");
         return ResultVoUtil.success();
     }
 
-    private void updatePageNo(List<YzPrintVO> yzPrintVOS, YzPrintRec yzPrintRec,String printPageWhere) {
-        if(yzPrintRec == null){
+    private void updatePageNo(List<YzPrintVO> yzPrintVOS, YzPrintRec yzPrintRec, String printPageWhere) {
+        if (yzPrintRec == null) {
             int curPage = 1;
             List<List<YzPrintVO>> split = CollUtil.split(yzPrintVOS, PRINT_PAGE_SIZE);
-            for(List<YzPrintVO> item :split){
+            for (List<YzPrintVO> item : split) {
                 for (YzPrintVO temp : item) {
                     temp.setPageNo(curPage);
                 }
                 List<Long> orderNoList = item.stream().map(o -> o.getActOrderNo()).collect(Collectors.toList());
                 String join = CollUtil.join(orderNoList, ",");
-                dao.updatePrintPageNo(join,curPage,printPageWhere);
+                dao.updatePrintPageNo(join, curPage, printPageWhere);
                 ++curPage;
             }
-        }else {
+        } else {
             int curPage = yzPrintRec.getCurrentPage();
             int lastRow = yzPrintRec.getLastRow();
-            for(YzPrintVO item : yzPrintVOS){
+            for (YzPrintVO item : yzPrintVOS) {
                 ++lastRow;
-                if(lastRow > PRINT_PAGE_SIZE){
+                if (lastRow > PRINT_PAGE_SIZE) {
                     lastRow = 1;
                     ++curPage;
                 }
@@ -417,32 +419,32 @@ public class MedicalManagementService {
             for (Integer pageNo : pageNoGroup.keySet()) {
                 List<Long> collect = pageNoGroup.get(pageNo).stream().map(o -> o.getActOrderNo()).collect(Collectors.toList());
                 String join = CollUtil.join(collect, ",");
-                dao.updatePrintPageNo(join,pageNo,printPageWhere);
+                dao.updatePrintPageNo(join, pageNo, printPageWhere);
             }
         }
     }
 
 
     public ResultVo<String> clearPrintPageNo(YzOrderParam param) {
-        AssertUtil.isnotBlank(param.getPatNo(),"请选择一条病人");
-        dao.updatePrintPage(param, param.getType() == 1 ? "print_page =null" : "print_page_once=null","yz_act_order");
-        dao.updatePrintPage(param, param.getType() == 1 ? "print_page =null" : "print_page_once=null","yz_erase_order");
+        AssertUtil.isnotBlank(param.getPatNo(), "请选择一条病人");
+        dao.updatePrintPage(param, param.getType() == 1 ? "print_page =null" : "print_page_once=null", "yz_act_order");
+        dao.updatePrintPage(param, param.getType() == 1 ? "print_page =null" : "print_page_once=null", "yz_erase_order");
         QueryWrapper query = new QueryWrapper();
-        query.eq("inpatient_no",param.getPatNo());
-        query.eq("admiss_times",param.getTimes());
-        query.eq("print_name", param.getType() == 1 ? PRINT_NAME_ORD_LONG :PRINT_NAME_ORD_ONCE);
+        query.eq("inpatient_no", param.getPatNo());
+        query.eq("admiss_times", param.getTimes());
+        query.eq("print_name", param.getType() == 1 ? PRINT_NAME_ORD_LONG : PRINT_NAME_ORD_ONCE);
         yzPrintRecDao.delete(query);
-        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE,"成功");
+        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE, "成功");
     }
 
 
     public List<YzActOrder> queryYzCheckData(YzQueryBase yzQueryBase) {
-        if(NumberEnum.ThREE.getCode().equals(yzQueryBase.getQueryRange())){
+        if (NumberEnum.ThREE.getCode().equals(yzQueryBase.getQueryRange())) {
             Date now = new Date();
-            yzQueryBase.setStartTime(DateUtil.formatDate(now)+" 00:00:00");
-            yzQueryBase.setEndTime(DateUtil.formatDate(now)+" 23:59:59");
+            yzQueryBase.setStartTime(DateUtil.formatDate(now) + " 00:00:00");
+            yzQueryBase.setEndTime(DateUtil.formatDate(now) + " 23:59:59");
         }
-        List<YzActOrder> list =  dao.listYzCheckData(yzQueryBase);
+        List<YzActOrder> list = dao.listYzCheckData(yzQueryBase);
         CommonUtil.BeanTrim(list);
         if (CollUtil.isNotEmpty(list)) {
             //组号填充
@@ -450,23 +452,23 @@ public class MedicalManagementService {
             Map<BigDecimal, List<YzActOrder>> parentNoMap = list.stream().collect(Collectors.groupingBy(item -> item.getParentNo()));
             for (BigDecimal parentNo : parentNoMap.keySet()) {
                 List<YzActOrder> temp = parentNoMap.get(parentNo);
-                if(temp.size() > 1){
+                if (temp.size() > 1) {
                     for (int i = 0; i < temp.size(); i++) {
-                        if( i==0 ){
+                        if (i == 0) {
                             orderGroupMap.put(temp.get(i).getActOrderNo(), "┑");
-                        }else if(i ==  temp.size()-1){
+                        } else if (i == temp.size() - 1) {
                             orderGroupMap.put(temp.get(i).getActOrderNo(), "┚");
                         }
                     }
                 }
             }
-            for(YzActOrder yzActOrder : list){
-                if("00".equals(yzActOrder.getGroupNo())){
-                    yzActOrder.setOrderName(yzActOrder.getOrderName() +"  "+ yzActOrder.getFrequCode());
-                }else {
-                    yzActOrder.setOrderName(yzActOrder.getOrderName() +" "+ yzActOrder.getDose() + yzActOrder.getDoseUnit() + " " + yzActOrder.getFrequCode()+ " " + yzActOrder.getSupplyCode());
+            for (YzActOrder yzActOrder : list) {
+                if ("00".equals(yzActOrder.getGroupNo())) {
+                    yzActOrder.setOrderName(yzActOrder.getOrderName() + "  " + yzActOrder.getFrequCode());
+                } else {
+                    yzActOrder.setOrderName(yzActOrder.getOrderName() + " " + yzActOrder.getDose() + yzActOrder.getDoseUnit() + " " + yzActOrder.getFrequCode() + " " + yzActOrder.getSupplyCode());
                 }
-                if(orderGroupMap.get(yzActOrder.getActOrderNo()) != null ){
+                if (orderGroupMap.get(yzActOrder.getActOrderNo()) != null) {
                     yzActOrder.setOrderGroup(orderGroupMap.get(yzActOrder.getActOrderNo()));
                 }
             }

+ 3 - 1
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/yizhuverify/YiZhuCheckData.java

@@ -193,7 +193,9 @@ public class YiZhuCheckData {
                 repel.setDate(item.getStartTime());
             }
 
-            if (item.getOrderCode().equals("06026")) {
+            Set<String> strings = extraCache.getYzZdOrderItemMap().get("出院");
+
+            if (strings.contains(item.getOrderCode())) {
                 Date admissDate = cn.hutool.core.date.DateUtil.beginOfDay(patientInformation.getAdmissDate());
                 Date orderTime = cn.hutool.core.date.DateUtil.beginOfDay(item.getOrderTime());