浏览代码

患者开出院医嘱时校验住院时间是否小于等于4天

xiaochan 4 月之前
父节点
当前提交
54862fb5c3

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

@@ -18,6 +18,8 @@ import thyyxxk.webserver.entity.inpatient.patient.Patient;
 import thyyxxk.webserver.entity.login.UserInfo;
 import thyyxxk.webserver.entity.medicalinsurance.inpatient.SiLimitRequest;
 import thyyxxk.webserver.entity.zhuyuanyisheng.OneClickOrder;
+import thyyxxk.webserver.entity.zhuyuanyisheng.dto.doctorAuth.DoctorAuthParams;
+import thyyxxk.webserver.entity.zhuyuanyisheng.vo.doctorAuth.DoctorAuthRest;
 import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.*;
 import thyyxxk.webserver.service.zhuyuanyisheng.YiZhuLuRuServer;
 import thyyxxk.webserver.utils.ResultVoUtil;
@@ -220,7 +222,7 @@ public class YizhuLuRuController {
     }
 
     @PostMapping("/doctorAuthorizationLogin")
-    public ResultVo<UserInfo> doctorAuthorizationLogin(@RequestBody UserInfo userInfo) {
+    public ResultVo<DoctorAuthRest> doctorAuthorizationLogin(@RequestBody DoctorAuthParams userInfo) {
         return server.doctorAuthorizationLogin(userInfo);
     }
 

+ 11 - 3
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/YiZhuLuRuDao.java

@@ -14,6 +14,8 @@ import thyyxxk.webserver.entity.login.UserInfo;
 import thyyxxk.webserver.entity.zhuyuanyisheng.DoctorSOrderFee;
 import thyyxxk.webserver.entity.zhuyuanyisheng.OneClickOrder;
 import thyyxxk.webserver.entity.zhuyuanyisheng.ZyOrderZk;
+import thyyxxk.webserver.entity.zhuyuanyisheng.dto.doctorAuth.DoctorAuthParams;
+import thyyxxk.webserver.entity.zhuyuanyisheng.vo.doctorAuth.DoctorAuthRest;
 import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.*;
 
 import java.math.BigDecimal;
@@ -975,7 +977,7 @@ public interface YiZhuLuRuDao {
             "                rtrim(name)         as name, " +
             "                rtrim(dept)         as dept_code, " +
             "                rtrim(zk_ward)      as ward_code, " +
-            "                refer_physician, " +
+            "                refer_physician,dept_director, " +
             "                times_billed, " +
             "                admiss_date, " +
             "                small_dept, " +
@@ -1431,9 +1433,15 @@ public interface YiZhuLuRuDao {
             "     a_employee_mi a " +
             "where dj.code = a.code " +
             "  and isnull(a.del_flag, '0') = '0' " +
-            "  and a.code_rs = #{us.codeRs} " +
+            "  and a.code = #{us.code} " +
             "  and dj.password = #{us.password} ")
-    UserInfo doctorAuthorizationLogin(@Param("us") UserInfo us);
+    DoctorAuthRest doctorAuthorizationLogin(@Param("us") DoctorAuthParams us);
+
+    @Select("select code_rs, code, name, cast(isnull(NULLIF(doctor_xz_yp, ''), 0) as int) + 1 as doctorLevel\n" +
+            "from a_employee_mi\n" +
+            "where code = #{us.code}\n" +
+            "  and emr_sign_pwd = #{us.signCode}")
+    DoctorAuthRest doctorAuthorizationLoginByEmrSignPwd(@Param("us") DoctorAuthParams us);
 
     @Select("select isnull(yp_level, 0) " +
             "from yp_zd_dict " +

+ 11 - 0
src/main/java/thyyxxk/webserver/entity/zhuyuanyisheng/dto/doctorAuth/DoctorAuthParams.java

@@ -0,0 +1,11 @@
+package thyyxxk.webserver.entity.zhuyuanyisheng.dto.doctorAuth;
+
+import lombok.Data;
+
+@Data
+public class DoctorAuthParams {
+    private String code;
+    private String password;
+    private String drugCode;
+    private String signCode;
+}

+ 14 - 0
src/main/java/thyyxxk/webserver/entity/zhuyuanyisheng/vo/doctorAuth/DoctorAuthRest.java

@@ -0,0 +1,14 @@
+package thyyxxk.webserver.entity.zhuyuanyisheng.vo.doctorAuth;
+
+import lombok.Data;
+
+@Data
+public class DoctorAuthRest {
+    private String codeRs;
+    private String code;
+    private String name;
+    private Integer doctorLevel;
+
+    // 这个是药品的等级
+    private Integer drugLeven;
+}

+ 1 - 0
src/main/java/thyyxxk/webserver/entity/zhuyuanyisheng/yizhuluru/XinZhenYiZhu.java

@@ -47,6 +47,7 @@ public class XinZhenYiZhu {
      * 婴儿标志
      */
     private Integer infantFlag;
+    private String deptDirector;
 
     public String getInfantFlag() {
         return inpatientNo == null ? null : String.valueOf(PublicServer.getInfantFlag(inpatientNo));

+ 17 - 4
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/YiZhuLuRuServer.java

@@ -34,6 +34,8 @@ import thyyxxk.webserver.entity.medicalinsurance.inpatient.SiLimitRequest;
 import thyyxxk.webserver.entity.zhuyuanyisheng.DoctorSOrderFee;
 import thyyxxk.webserver.entity.zhuyuanyisheng.OneClickOrder;
 import thyyxxk.webserver.entity.zhuyuanyisheng.ZyOrderZk;
+import thyyxxk.webserver.entity.zhuyuanyisheng.dto.doctorAuth.DoctorAuthParams;
+import thyyxxk.webserver.entity.zhuyuanyisheng.vo.doctorAuth.DoctorAuthRest;
 import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.*;
 import thyyxxk.webserver.service.PublicServer;
 import thyyxxk.webserver.service.inpatient.casefrontsheet.CaseFrontSheetMainService;
@@ -68,6 +70,8 @@ public class YiZhuLuRuServer {
     private final SqlSessionFactory sqlSessionFactory;
     private final SiChargeLimitService siChargeLimitService;
 
+    private static String CHU_YUAN = "06026";
+
     private final String ITEM = "00";
 
     public ResultVo<String> getOrderNo() {
@@ -1386,21 +1390,30 @@ public class YiZhuLuRuServer {
      *
      * @return 信息
      */
-    public ResultVo<UserInfo> doctorAuthorizationLogin(UserInfo userInfo) {
-        userInfo.setPassword(SecureUtil.md5(userInfo.getPassword()));
-        UserInfo u = dao.doctorAuthorizationLogin(userInfo);
+    public ResultVo<DoctorAuthRest> doctorAuthorizationLogin(DoctorAuthParams userInfo) {
+        DoctorAuthRest u;
+        if (StrUtil.isNotBlank(userInfo.getPassword())) {
+            userInfo.setPassword(SecureUtil.md5(userInfo.getPassword()));
+            u = dao.doctorAuthorizationLogin(userInfo);
+        } else {
+            u = dao.doctorAuthorizationLoginByEmrSignPwd(userInfo);
+        }
 
         if (u == null) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "密码错误或用户不存在。");
         }
 
+        // 如果是项目
+        if (userInfo.getDrugCode().endsWith("_00")) {
+            return ResultVoUtil.success(u);
+        }
+
         Integer drugLeven = dao.selectYpLevel(userInfo.getDrugCode());
 
         if (drugLeven > (u.getDoctorLevel() + 1)) {
             return ResultVoUtil.success(ExceptionEnum.LOGICAL_ERROR, StrUtil.format("该医生等级不足,药品等级【{}】,医生等级:【{}】", drugLeven, u.getDoctorLevel()));
         }
 
-        u.setPassword("");
         return ResultVoUtil.success(u);
     }
 

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

@@ -166,15 +166,28 @@ public class YiZhuCheckData {
             }
         }
 
+        // 是否是排斥医嘱
         if (repel != null) {
             Integer paiChiYiZhu = dao.shiFouPaiChiYiZhu(item.getOrderCode());
-
             if (paiChiYiZhu != null && paiChiYiZhu.equals(1)) {
                 repel.setCount(repel.getCount() + 1);
                 repel.setOrderNo(item.getActOrderNo());
                 repel.setDate(item.getStartTime());
             }
 
+            if (item.getOrderCode().equals("06026")) {
+                Date admissDate = patientInformation.getAdmissDate();
+                Date orderTime = item.getOrderTime();
+
+                long betweenDay = cn.hutool.core.date.DateUtil.betweenDay(orderTime, admissDate, false);
+
+                if (betweenDay <= 4) {
+                    if (item.getSuperiorDoctor() == null || !item.getSuperiorDoctor().equals(patientInformation.getDeptDirector())) {
+                        errorMessage.add("患者的住院天数小于等于4请科主任授权,开出院医嘱。");
+                    }
+                }
+            }
+
         }
         item.setDrugOcc(item.getDrugQuan());
     }

+ 3 - 2
src/main/resources/application-cytest.yml

@@ -15,7 +15,7 @@ spring:
     cache: false
   datasource:
     dynamic:
-      primary: his
+      primary: dev
       strict: false
       datasource:
         his:
@@ -193,5 +193,6 @@ thyy:
     path: "Z:\\"
   #    archive-url: "http://172.16.32.167:20921/thyy/api/archive"
   other:
-    mobile-address: "https://emr.hnthyy.cn:8081"
+    #    mobile-address: "https://emr.hnthyy.cn:8081"
+    mobile-address: "https://localhost:9204"
     mobile-agentid: 1000051