Browse Source

住院医生优化

DESKTOP-0GD05B0\Administrator 2 years ago
parent
commit
0f30bf23ce

+ 8 - 0
src/main/java/thyyxxk/webserver/controller/zhuyuanyizheng/EmrController.java

@@ -9,6 +9,7 @@ import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrPatientData;
 import thyyxxk.webserver.service.zhuyuanyisheng.EmrServer;
 
 import java.util.List;
+import java.util.Map;
 
 @RequestMapping("/Emr")
 @RestController
@@ -77,4 +78,11 @@ public class EmrController {
         return server.getDischargeTimes(patNo);
     }
 
+
+    @GetMapping("/getExtractDataElement")
+    public ResultVo<JSONObject> getExtractDataElement(@RequestParam("patNo") String patNo,
+                                                               @RequestParam("times") Integer times) {
+        return server.getExtractDataElement(patNo, times);
+    }
+
 }

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

@@ -154,7 +154,7 @@ public class JianYanJianChaController {
 
     @GetMapping("/getJyJcZdTree")
     @PassToken
-    public ResultVo< Map<String,List<JyJcItem>>> getJyJcZdTree() {
+    public ResultVo<Map<String,List<JyJcItem>>> getJyJcZdTree() {
         return server.getJyJcZdTree();
     }
 

+ 5 - 1
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/EmrPatientDao.java

@@ -149,7 +149,11 @@ public interface EmrPatientDao {
 
     @Select("select max(admiss_times) " +
             "from zy_inactpatient " +
-            "where inpatient_no = #{patNo} " )
+            "where inpatient_no = #{patNo} ")
     Integer getMaxTimes(String patNo);
 
+
+    @Select("select data_element from emr_data_element where pat_no = #{patNo} and times = #{times}")
+    Map<String, String> selectEmrDataElement(String patNo, Integer times);
+
 }

+ 13 - 18
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/JianYanJianChaDao.java

@@ -297,15 +297,6 @@ public interface JianYanJianChaDao {
             "and (yb_code like #{name} or yb_name like #{name} or yb_py_code like #{name})")
     List<GetDropdownBox> diagnosisInOurHospital(String name);
 
-    @Select("SELECT rtrim(a.code) as code, " +
-            "       rtrim(a.name) as name " +
-            "FROM zd_icd_code a with (NOLOCK) " +
-            "where (a.py_code like #{name} " +
-            "    or a.code like #{name} " +
-            "    or a.name like #{name}) " +
-            "  and isnull(a.del_flag, '') <> '1'")
-    List<GetDropdownBox> benYuanLinChuangZhenDuan(String name);
-
     @Select("select tc_no " +
             "from zy_tc_yj with (NOLOCK) " +
             "where op_id = #{code} " +
@@ -500,15 +491,19 @@ public interface JianYanJianChaDao {
      *
      * @return
      */
-    @Select("select rtrim(zy_order_code)  as code, " +
-            "       rtrim(name)  as name, " +
-            "       rtrim(class) as classes, " +
-            "       exec_unit," +
-            "       exec_unit_name = (select name from zd_unit_code where zd_unit_code.code = exec_unit), " +
-            "       '2'          as type " +
-            "from jy_zd_item " +
-            "where isnull(del_flag, '0') = '0' " +
-            "  and isnull(zy_flag, '0') = '0' ")
+    @Select("select distinct        rtrim(zy_order_code) as code,\n" +
+            "                       rtrim(name)          as name,\n" +
+            "                       rtrim(class)         as classes,\n" +
+            "                       exec_unit,\n" +
+            "    exec_unit_name   = (select name from zd_unit_code where zd_unit_code.code = exec_unit),\n" +
+            "                       '2'                  as type,\n" +
+            "                       inspect_stuff        as inspectStuff,\n" +
+            "    inspectStuffName = (select rtrim(name) from jy_zd_sample with (NOLOCK) where code = inspect_stuff)\n" +
+            "from jy_zd_item a,\n" +
+            "     zy_tc_detail_yj b\n" +
+            "where isnull(del_flag, '0') = '0'\n" +
+            "  and isnull(zy_flag, '0') = '0'\n" +
+            "  and a.zy_order_code = b.order_code")
     List<JyJcItem> getJyDetailedItems();
 
 

+ 13 - 1
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/YiZhuLuRuDao.java

@@ -759,7 +759,8 @@ public interface YiZhuLuRuDao {
             "       isnull(volum,1)                   drug_volume, " +
             "       vol_unit                          drug_vol_unit," +
             "       isnull(pack_size,1) pack_size,  " +
-            "       pack_unit,  " +
+            "       pack_unit," +
+            "       a.pack_retprice,  " +
             "       national_code," +
             "       cast(isnull(NULLIF(kjyw_flag, ''), 0) as int) as kjyw_flag," +
             "       cast(isnull(NULLIF(yp_level, ''), 0) as int)  as yp_level," +
@@ -1474,4 +1475,15 @@ public interface YiZhuLuRuDao {
     void updateTheThirdLevelDoctor(@Param("param") Overview param);
 
 
+    @Insert("insert into yz_yp_page_no (page_no, dept_code, ward_code, submit_time, " +
+            "                           submit_name, submit_flag, " +
+            "                           page_class, page_name, " +
+            "                           start_date, end_date, group_no) " +
+            "values (#{pageNo}, '#{patInfo.deptCode}', #{patInfo.wardCode}, getdate()," +
+            " #{userCode}, 1, 1, '出院带药', getdate(), getdate(), #{groupNo})")
+    void summarySheetOfDrugs(Integer pageNo, XinZhenYiZhu patInfo, String userCode, String groupNo);
+
+
+    void insertDetailedMedicineList();
+
 }

+ 2 - 0
src/main/java/thyyxxk/webserver/entity/datamodify/YzActOrder.java

@@ -243,6 +243,8 @@ public class YzActOrder implements Serializable {
                 return "嘱托";
             case "3":
                 return "基数药";
+            case "4":
+                return "出院带药";
             default:
                 return "未知";
         }

+ 8 - 0
src/main/java/thyyxxk/webserver/entity/zhuyuanyisheng/jianyanjiancha/JyJcItem.java

@@ -40,6 +40,14 @@ public class JyJcItem {
      */
     private String bw;
 
+    /**
+     * 检验标本
+     */
+    private String inspectStuff;
+    private String inspectStuffName;
 
+    /**
+     * 子节点
+     */
     private List<JyJcItem> children;
 }

+ 25 - 0
src/main/java/thyyxxk/webserver/entity/zhuyuanyisheng/yizhuluru/XinZhenYzActOrder.java

@@ -55,6 +55,11 @@ public class XinZhenYzActOrder {
      */
     private String nationalCode;
 
+    /**
+     * 药品的包装单价
+     */
+    private BigDecimal packRetprice;
+
     /**
      * 频次
      */
@@ -172,8 +177,28 @@ public class XinZhenYzActOrder {
     private Date statusTime;
     /**
      * 费用标志
+     * 1-自备 2-嘱托 3-基数药 4-出院带药
      */
     private String selfBuy;
+
+    public String getSelfBuyName() {
+        if (selfBuy == null) {
+            return "";
+        }
+        switch (selfBuy) {
+            case "1":
+                return "自备";
+            case "2":
+                return "嘱托";
+            case "3":
+                return "基数药";
+            case "4":
+                return "出院带药";
+            default:
+                return "未知";
+        }
+    }
+
     /**
      * 一次剂量
      */

+ 1 - 1
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/CaoYaoYiZhuServer.java

@@ -128,7 +128,7 @@ public class CaoYaoYiZhuServer {
         log.info("插入模板草药模板:{}", JSON.toJSONString(param));
 
         dao.chaRuMuBan(param.getList(), param.getPatternName(), TokenUtil.getTokenUserId(),
-                PingYinUtils.pyShouZiMuDaXie(param.getPatternName()), PingYinUtils.getWBCode(param.getPatternName()),
+                PingYinUtils.pyShouZiMuDaXie(param.getPatternName()).substring(0, 8), PingYinUtils.getWBCode(param.getPatternName()).substring(0, 8),
                 param.getDeptCode());
         return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
     }

+ 17 - 8
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/EmrServer.java

@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.baomidou.dynamic.datasource.annotation.DS;
-import com.google.gson.JsonObject;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
@@ -14,17 +13,16 @@ import thyyxxk.webserver.constants.EmrType;
 import thyyxxk.webserver.dao.his.zhuyuanyisheng.EmrPatientDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.drg.AuxiliaryFillingOfDiagnosis;
+import thyyxxk.webserver.entity.inpatient.patient.Patient;
 import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrDataElement;
 import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrDataExtract;
 import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrPatientData;
 import thyyxxk.webserver.service.PublicServer;
 import thyyxxk.webserver.service.externalhttp.emr.EmrEditor;
+import thyyxxk.webserver.service.inpatient.PatientService;
+import thyyxxk.webserver.service.redislike.RedisLikeService;
 import thyyxxk.webserver.utils.*;
 
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -35,15 +33,17 @@ import java.util.stream.Collectors;
 public class EmrServer {
 
     private final EmrPatientDao dao;
-
     private final EmrEditor emr;
-
     private final PublicServer publicServer;
+    private final PatientService patientService;
+    private final RedisLikeService realtimeService;
 
-    public EmrServer(EmrPatientDao dao, EmrEditor emr, PublicServer publicServer) {
+    public EmrServer(EmrPatientDao dao, EmrEditor emr, PublicServer publicServer, PatientService patientService, RedisLikeService realtimeService) {
         this.dao = dao;
         this.emr = emr;
         this.publicServer = publicServer;
+        this.patientService = patientService;
+        this.realtimeService = realtimeService;
     }
 
     /**
@@ -375,5 +375,14 @@ public class EmrServer {
         return ResultVoUtil.success(times);
     }
 
+    public ResultVo<JSONObject> getExtractDataElement(String patNo, Integer times) {
+        Map<String, String> map = dao.selectEmrDataElement(patNo, times);
+        if (map == null) {
+            return ResultVoUtil.success();
+        } else {
+            return ResultVoUtil.success(JSONObject.parseObject(map.get("data_element")));
+        }
+    }
+
 
 }

+ 0 - 1
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/JianYanJianChaShenQingServer.java

@@ -190,7 +190,6 @@ public class JianYanJianChaShenQingServer {
      * @param jianCha true 检查 false 检验
      * @return 返回详细的内容
      */
-    @DS("his")
     public ResultVo<List<Map<String, String>>> chaKanFenLeiXiangQing(String code, String bwCode, Boolean jianCha) {
         if (jianCha) {
             if (StringUtil.notBlank(bwCode) && bwCode.equals("mb")) {

+ 32 - 6
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/YiZhuLuRuServer.java

@@ -208,6 +208,7 @@ public class YiZhuLuRuServer {
      * @param param 数据
      * @return 返回提示
      */
+    @Transactional(rollbackFor = Exception.class)
     public ResultVo<Map<String, Object>> confirmOrders(XinZhenYiZhu param) {
         QueryWrapper<?> qw = new QueryWrapper<>();
         qw.eq("a.inpatient_no", param.getInpatientNo()).eq("a.admiss_times", param.getAdmissTimes());
@@ -217,15 +218,29 @@ public class YiZhuLuRuServer {
         if (ListUtil.isBlank(yiZhuList)) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有需要确认的医嘱.");
         }
+        // 药品 code
         Set<String> yaoPingCode = new HashSet<>();
         // 项目的 code
         Set<String> xiangMuCode = new HashSet<>();
+        // 出院带药需要生成药单
+        Map<String, List<XinZhenYzActOrder>> takeTheMedicineList = new HashMap<>(Capacity.TWO);
+
         for (XinZhenYzActOrder item : yiZhuList) {
             if (ITEM.equals(item.getSerial())) {
                 xiangMuCode.add(item.getOrderCode());
             } else {
                 yaoPingCode.add(item.getOrderCode().trim() + item.getSerial().trim());
             }
+            // 费用标志为 4 的就是出院带药
+            if ("4".equals(item.getSelfBuy())) {
+                if (takeTheMedicineList.containsKey(item.getGroupNo())) {
+                    takeTheMedicineList.get(item.getGroupNo()).add(item);
+                } else {
+                    List<XinZhenYzActOrder> temp = new ArrayList<>();
+                    temp.add(item);
+                    takeTheMedicineList.put(item.getGroupNo(), temp);
+                }
+            }
         }
         String userCode = TokenUtil.getTokenUserId();
         // 获取医生开药品的权限
@@ -252,7 +267,6 @@ public class YiZhuLuRuServer {
                     excludeOrders = item.getStartTime();
                     orderNo = item.getActOrderNo();
                 }
-
             }
 
             confirmOrderInformation.add(item.getActOrderNo());
@@ -272,17 +286,27 @@ public class YiZhuLuRuServer {
         if (excludeOrders != null) {
             int count = dao.thereAreUnexecutedOrders(param.getInpatientNo(), param.getAdmissTimes(), orderNo);
             if (count > 0) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "有未确认和未执行的医嘱,无法确认。");
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "有未确认和未执行的医嘱,无法确认全排斥医嘱。");
             }
             dao.stopOrder(param.getInpatientNo(), param.getAdmissTimes(), excludeOrders, userCode);
         }
-
+        // TODO 出院带药的问题
+//        dischargeMedicineList(takeTheMedicineList, huanZheXinXi);
         dao.confirmOrders(confirmOrderInformation, TokenUtil.getTokenUserId(), param.getInpatientNo(), param.getAdmissTimes());
-
         log.info("确认的医嘱:{}", JSON.toJSONString(yiZhuList));
         return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
     }
 
+    private void dischargeMedicineList(Map<String, List<XinZhenYzActOrder>> map, XinZhenYiZhu huanZheXinXi) {
+        log.info("出院带药药单:{}", JSON.toJSONString(map));
+        String userCode = TokenUtil.getTokenUserId();
+        for (Map.Entry<String, List<XinZhenYzActOrder>> entry : map.entrySet()) {
+            Integer pageNo = publicServer.getTheDrugListNo();
+            dao.summarySheetOfDrugs(pageNo, huanZheXinXi, userCode, entry.getKey());
+        }
+
+    }
+
 
     /**
      * 录入单条医嘱  新的 下面的保存医嘱的都无效了
@@ -399,6 +423,7 @@ public class YiZhuLuRuServer {
 
         param.getList().forEach(item -> {
             String key = item.getParentNo() != null ? item.getParentNo().stripTrailingZeros().toPlainString() : "";
+            item.setGroupNo(param.getGroupNo());
             if (StringUtil.notBlank(key)) {
                 if (fatherAndSonDoctorSAdvice.containsKey(key)) {
                     item.setParentNo(fatherAndSonDoctorSAdvice.get(key).getActOrderNo());
@@ -722,6 +747,7 @@ public class YiZhuLuRuServer {
      * @param param 医嘱数据
      * @return 返回错误提示或者别的
      */
+    @Deprecated
     public ResultVo<Map<String, Object>> saveTheDoctorSOrder(XinZhenYiZhu param) {
         log.info("上传数据:{}", JSON.toJSONStringWithDateFormat(param, DateUtil.DEFAULT_PATTERN));
         // 获取医生开药品的权限
@@ -892,7 +918,7 @@ public class YiZhuLuRuServer {
     }
 
     private Map<String, Object> checkData(XinZhenYzActOrder item, Map<String, XinZhenYzActOrder> drug, Map<String, List<XinZhenYzActOrder>> project, XinZhenYiZhu huanZheXinXi, Integer 医生级别) {
-        Boolean 严格校验 = huanZheXinXi != null;
+        boolean 严格校验 = huanZheXinXi != null;
         List<String> 错误信息 = new ArrayList<>();
         List<String> 警告信息 = new ArrayList<>();
 
@@ -940,7 +966,7 @@ public class YiZhuLuRuServer {
                         if (item.getYyfs() == null) {
                             错误信息.add("请填写抗菌药物医嘱附注信息录入");
                         } else if (item.getYyfs() == 1 || item.getYyfs() == 2) {
-                            if (item.getSsqk() == null || item.getYyfs() == null) {
+                            if (item.getSsqk() == null) {
                                 错误信息.add("当用药方式为 1 或 2 时,手术切口和用药时间不能为空");
                             }
                         }