Преглед изворни кода

优化危急值状态更新

lighter пре 1 година
родитељ
комит
bb1d81001b

+ 3 - 0
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/PatientCriticalValuesDao.java

@@ -44,6 +44,9 @@ public interface PatientCriticalValuesDao {
             "(select isnull(ward,admiss_ward) from zy_actpatient where inpatient_no=#{patNo})")
     CodeName selectTargetDept(String patNo);
 
+    @Select("select top 1 code,name from zd_unit_code where name=#{name}")
+    CodeName selectTargetDeptByName(String name);
+
     @Select("select code,name from zd_unit_code where code=" +
             "(select visit_dept_code from mz_visit_table " +
             "where patient_id=#{patNo} and times=#{times})")

+ 1 - 1
src/main/java/thyyxxk/webserver/entity/criticalValue/request/CriticalValueFromTest.java

@@ -5,7 +5,6 @@ import lombok.Data;
 @Data
 public class CriticalValueFromTest {
     private String patNo;
-    private Integer times;
     private String message;
     private Integer flag;
     private String patientName;
@@ -13,6 +12,7 @@ public class CriticalValueFromTest {
     private String patientSex;
     private String bednum;
     private String sentByDepartment;
+    private String sentByDepartmentCode;
     private String roomcood;
     private String commitman;
     private String reqName;

+ 19 - 9
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/PatientCriticalValuesService.java

@@ -68,8 +68,9 @@ public class PatientCriticalValuesService {
         }
         String touser = codeRsBuilder.substring(1);
         String wxMessage = criticalValue.getContent() +
-                "<a href=\"https://emr.hnthyy.cn/hospitalAppsApi/criticalValue/updateState?id=" +
-                criticalValue.getId() + "\">点击更新危急值状态</a>";
+                "<a href=\"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wwf0b23c8b36012b34&redirect_uri=https://emr.hnthyy.cn/handleCriticalValue?id="
+                + criticalValue.getId()
+                + "&response_type=code&scope=snsapi_privateinfo&state=STATE&agentid=1000052#wechat_redirect\">点击更新危急值状态</a>";
         int sendWxRes = wxInfoService.sendCriticalValue(touser, wxMessage);
         if (sendWxRes == 0) {
             dao.updateSentState(criticalValue.getId());
@@ -150,11 +151,15 @@ public class PatientCriticalValuesService {
         return employeeList;
     }
 
-    public CodeName getTargetDept(String patNo, int times, PatientType patientType) {
+    public CodeName getTargetDept(String patNo, String sentDept, PatientType patientType) {
+        CodeName targetDept = null;
         if (patientType == PatientType.INPATIENT) {
-            return dao.selectTargetDept(patNo);
+            targetDept = dao.selectTargetDept(patNo);
         }
-        return dao.selectTargetDept2(patNo, times);
+        if (null == targetDept) {
+            targetDept = dao.selectTargetDeptByName(sentDept);
+        }
+        return targetDept;
     }
 
     public ResultVo<String> checkTheCriticalValue(CriticalValueFromTest value) {
@@ -163,18 +168,23 @@ public class PatientCriticalValuesService {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR,
                     "flag 门诊住院标志不存在 1=住院 2=门诊");
         }
+        if (StringUtil.isBlank(value.getSentByDepartment())) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "送检科室不能为空。");
+        }
         PatientType patientType = value.getFlag() == 1 ?
                 PatientType.INPATIENT : PatientType.OUTPATIENT;
-        CodeName targetDept = getTargetDept(value.getPatNo(), value.getTimes(), patientType);
+        CodeName targetDept = getTargetDept(value.getPatNo(), value.getSentByDepartment(), patientType);
         if (null == targetDept) {
-            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "没有患者的就诊信息");
+            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "无法找到患者的送检科室。");
         }
 
         String label = patientType == PatientType.INPATIENT ? "住院号" : "门诊号";
         if (StringUtil.isBlank(value.getBednum())) {
             value.setBednum("无");
         }
-        String message = StrUtil.format("在【{}】就诊患者 【{}:{},姓名:{},性别:{},年龄:{},床号:{}】的【{}】检查结果出现危急值情况--【{}】。报告者:{},来自:【{}】。",
+        String message = StrUtil.format("在【{}】就诊患者 【{}:{},姓名:{},性别:{}," +
+                        "年龄:{},床号:{}】的【{}】检查结果出现危急值情况--【{}】。报告者:{}," +
+                        "来自:【{}】。",
                 targetDept.getName(), label, value.getPatNo(), value.getPatientName(),
                 value.getPatientSex(), value.getPatientAge(), value.getBednum(),
                 value.getReqName(), value.getMessage(), value.getCommitman(),
@@ -185,7 +195,7 @@ public class PatientCriticalValuesService {
         CriticalValue criticalValue = new CriticalValue.Builder()
                 .patNo(value.getPatNo()).msgId(msgId)
                 .msgType("dept_critical_msg")
-                .sourceCode(value.getSentByDepartment())
+                .sourceCode(value.getRoomcood())
                 .sourceName(value.getRoomcood())
                 .targetDeptCode(targetDept.getCode())
                 .targetDeptName(targetDept.getName())