Просмотр исходного кода

危机消息处理回执和入院优化

lihong 1 год назад
Родитель
Сommit
6543be2032

+ 32 - 2
src/main/java/cn/hnthyy/thmz/controller/mz/CriticalValueController.java

@@ -8,11 +8,14 @@ import cn.hnthyy.thmz.entity.his.mz.CriticalMessage;
 import cn.hnthyy.thmz.entity.thmz.CriticalValue;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.service.his.mz.CriticalMessageService;
+import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
 import cn.hnthyy.thmz.service.thmz.CriticalValueService;
-import cn.hnthyy.thmz.service.thmz.UserRoleRelationService;
+import cn.hnthyy.thmz.service.thmz.HaiCiAdapterService;
+import cn.hnthyy.thmz.service.thmz.UserDeptRelationService;
 import cn.hnthyy.thmz.service.thmz.UserService;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -30,6 +33,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 @Slf4j
@@ -41,6 +45,13 @@ public class CriticalValueController {
     private CriticalMessageService service;
     @Resource
     private UserService userService;
+    @Resource
+    private HaiCiAdapterService haiCiAdapterService;
+    @Resource
+    private UserDeptRelationService userDeptRelationService;
+    @Resource
+    private ZdUnitCodeService zdUnitCodeService;
+
 
     /**
      * 获取危急值列表
@@ -110,12 +121,31 @@ public class CriticalValueController {
     public R dealCriticalMessage(@RequestBody Map<String,Object> param) {
         Integer id = Convert.toInt(param.get("id"));
         AssertUtil.isNotBlank(id,"id 不能为空");
+        Date now = new Date();
         CriticalMessage criticalMessage = CriticalMessage.builder()
                 .id(id)
                 .handleStaff(TokenUtil.getUser().getUserIdCode())
-                .handleTime(new Date())
+                .handleTime(now)
                 .build();
         service.updateById(criticalMessage);
+        Map<String, Object> receiptParam = new HashMap<>();
+        User user = userService.queryUserByUserIdCode(TokenUtil.getUser().getUserIdCode());
+        String deptCode = "";
+        String deptName = "";
+        List<String> depts = userDeptRelationService.queryAllByUserIdCode(TokenUtil.getUser().getUserIdCode());
+        if(CollUtil.isNotEmpty(depts)){
+            deptCode = depts.get(0);
+            deptName = zdUnitCodeService.queryDeptNameByIdInCache(deptCode);
+        }
+        CriticalMessage temp = service.getById(id);
+        receiptParam.put("msgId", temp.getMsgId());
+        receiptParam.put("departKey", deptCode);
+        receiptParam.put("departName", deptName);
+        receiptParam.put("doctorKey", user == null ? "": user.getUserCode());
+        receiptParam.put("doctorName",user == null ? "": user.getUserName());
+        receiptParam.put("receiptTime", DateUtil.formatDateTime(now));
+        receiptParam.put("content", "已处理");
+        haiCiAdapterService.criticalMessageReceipt(receiptParam);
         return R.ok();
     }
 

+ 9 - 3
src/main/java/cn/hnthyy/thmz/service/impl/his/zy/ZyActpatientServiceImpl.java

@@ -36,7 +36,9 @@ import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -82,6 +84,8 @@ public class ZyActpatientServiceImpl implements ZyActpatientService {
     private ZyDetailChargeService zyDetailChargeService;
     @Autowired
     private MzPatientMiService mzPatientMiService;
+    @Resource
+    DictDataService dictDataService;
 
 
     @Override
@@ -127,7 +131,7 @@ public class ZyActpatientServiceImpl implements ZyActpatientService {
         zyActpatient.setTimesBilled(1);
         zyActpatient.setBedStatus(BedStatusEnum.ADMISSION.code);
         zyActpatient.setZySerialNo(zyConfigService.getZySerialNo());
-        zyActpatient.setResponceType(Constants.SELF_PAYING_RESPONCE_TYPE);
+        zyActpatient.setResponceType(StrUtil.isBlank(zyActpatient.getResponceType()) ? Constants.SELF_PAYING_RESPONCE_TYPE : zyActpatient.getResponceType());
         zyActpatient.setBalance(BigDecimal.ZERO);
         zyActpatient.setTotalCharge(BigDecimal.ZERO);
         zyActpatient.setCharge1(BigDecimal.ZERO);
@@ -611,12 +615,14 @@ public class ZyActpatientServiceImpl implements ZyActpatientService {
     public boolean checkZaiYuan(String patientId) {
         if(StrUtil.isBlank(patientId)) return false;
         List<String> inPatientNoList = aPatientMiMapper.selectInPatientNoByMzNo(patientId);
+        String dictVlaue = dictDataService.queryDictVlaue("2.4", "responce_type", "ae,11");
+        List<String> dictVlaues = CollUtil.newArrayList(dictVlaue.split(","));
         if (CollUtil.isNotEmpty(inPatientNoList)) {
             for (String inPatientNo : inPatientNoList) {
                 if (zyActpatientMapper.selectCountByInpatientNo(inPatientNo) > 0) {
                     ZyActpatient zyActpatient = zyActpatientMapper.selectByInpatientNo(ZyActpatient.ZY_ACTPATIENT, inPatientNo, null);
                     //单病种可以开处方
-                    if(Constants.DBZ_CODE.equals(zyActpatient.getResponceType())){
+                    if(dictVlaues.contains(zyActpatient.getResponceType())){
                         return false;
                     }
                     return true;
@@ -632,7 +638,7 @@ public class ZyActpatientServiceImpl implements ZyActpatientService {
                             if (zyActpatientMapper.selectCountByInpatientNo(aPatientMi.getInpatientNo()) > 0) {
                                 ZyActpatient zyActpatient = zyActpatientMapper.selectByInpatientNo(ZyActpatient.ZY_ACTPATIENT, aPatientMi.getInpatientNo(), null);
                                 //单病种可以开处方
-                                if(Constants.DBZ_CODE.equals(zyActpatient.getResponceType())){
+                                if(dictVlaues.contains(zyActpatient.getResponceType())){
                                     return false;
                                 }
                                 return true;

+ 11 - 0
src/main/java/cn/hnthyy/thmz/service/impl/thmz/HaiCiAdapterServiceImpl.java

@@ -161,4 +161,15 @@ public class HaiCiAdapterServiceImpl implements HaiCiAdapterService {
                 + "<channel>WX</channel>\n"
                 + "</Request>";
     }
+
+    /**
+     * @description: 处理危机消息回执
+     * @author: lihong
+     * @date: 2024/4/11 9:30
+     * @param: param
+     */
+    @Override
+    public void criticalMessageReceipt(Map<String, Object> param) {
+
+    }
 }

+ 23 - 0
src/main/java/cn/hnthyy/thmz/service/impl/thmz/HaiCiAdapterServiceTaiheImpl.java

@@ -2,12 +2,14 @@ package cn.hnthyy.thmz.service.impl.thmz;
 
 import cn.hnthyy.thmz.Utils.HttpUtil;
 import cn.hnthyy.thmz.Utils.JsonUtil;
+import cn.hnthyy.thmz.service.his.zd.DictDataService;
 import cn.hnthyy.thmz.service.thmz.HaiCiAdapterService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.io.IOException;
 import java.util.Date;
 import java.util.Map;
@@ -27,6 +29,8 @@ public class HaiCiAdapterServiceTaiheImpl implements HaiCiAdapterService {
     //通用服务地址
     @Value("${wxPayOrderServiceUrl}")
     private String wxPayOrderServiceUrl;
+    @Resource
+    private DictDataService dictDataService;
 
     //private ExecutorService executor = Executors.newFixedThreadPool(5);
 
@@ -212,4 +216,23 @@ public class HaiCiAdapterServiceTaiheImpl implements HaiCiAdapterService {
     private String getCommonMessageJsonString(String cardNo, String message) {
         return "{\"cardNo\":\"" + cardNo + "\",\"msgContext\":" + message + "}";
     }
+
+    /**
+     * @param param
+     * @description: 处理危机消息回执
+     * @author: lihong
+     * @date: 2024/4/11 9:30
+     * @param: param
+     */
+    @Override
+    @Async("asyncServiceExecutor")
+    public void criticalMessageReceipt(Map<String, Object> param) {
+        try {
+            log.info("处理危机消息回执,入参{}", JsonUtil.object2Json(param));
+            String url = dictDataService.queryDictVlaue("2.5", "critical_message_receipt_url", "http://172.16.32.178/apis/elims/critical/message/receipt");
+            HttpUtil.httpPost(url, JsonUtil.object2Json(param), "application/json", 8000);
+        } catch (Exception e) {
+            log.error("[criticalMessageReceipt]报错信息:", e);
+        }
+    }
 }

+ 8 - 0
src/main/java/cn/hnthyy/thmz/service/thmz/HaiCiAdapterService.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.service.thmz;
 
 import java.util.Date;
+import java.util.Map;
 
 public interface HaiCiAdapterService {
     /**
@@ -65,4 +66,11 @@ public interface HaiCiAdapterService {
      * @param visitDate
      */
     void preAllocationBed(String patientId,String  visitDate);
+    /**
+     * @description: 处理危机消息回执
+     * @author: lihong
+     * @date: 2024/4/11 9:30
+     * @param: param
+     **/
+    void criticalMessageReceipt(Map<String, Object> param);
 }

+ 28 - 0
src/main/resources/static/js/zy/hospitalized.js

@@ -574,6 +574,8 @@ function queryMzZyReq(patientId) {
                 $("#inpatientWard").selectpicker('refresh');
                 $("#admissStatus").selectpicker('val', resZyz.data.admissStatus);
                 $("#admissStatus").selectpicker('refresh');
+                $("#responce_type").selectpicker('val', resZyz.data.responceType);
+                $("#responce_type").selectpicker('refresh');
                 initSmallDeptByDept();
                 $("#smallWard").selectpicker('val', resZyz.data.smallDept);
                 $("#smallWard").selectpicker('refresh');
@@ -658,6 +660,7 @@ function saveZyActpatient(inpatientNo) {
             "smallDept": $("#smallWard").val(),
             "bedNo": $("#bedNum").val(),
             "admissStatus": $("#admissStatus").val(),
+            "responceType": $("#responce_type").val(),
             inpatientNo:inpatientNo
         }),
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
@@ -707,6 +710,7 @@ function initListSelect() {
     initRelationSelect();
     initOccupationSelect();
     iniAdmissStatus();
+    initZyResponceType();
 }
 
 /**
@@ -983,6 +987,30 @@ function iniAdmissStatus() {
     });
 }
 
+/**
+ * 初始化病人身份信息
+ */
+function initZyResponceType() {
+    $.ajax({
+        type: "GET",
+        url: '/thmz/getZyResponceType',
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            var html = '';
+            $.each(res.data, function (commentIndex, comment) {
+                html += '<option value="' + comment.code + '">' + comment.name + '</option>';
+            });
+            $('#responce_type').empty();
+            $('#responce_type').html(html);
+            $('#responce_type').selectpicker('destroy').selectpicker('refresh');
+        }
+    });
+}
 
 /**
  * 清空信息

+ 9 - 0
src/main/resources/templates/zy/hospitalized.html

@@ -504,6 +504,15 @@
                         </select>
                     </div>
                 </div>
+                <div class="col-md-3 col-sm-3 col-xs-12 item">
+                    <label class="control-label col-md-4 col-sm-4 col-xs-12" for="responce_type">病人身份 <span
+                            class="required">*</span>
+                    </label>
+                    <div class="col-md-8 col-sm-8 col-xs-12">
+                        <select class="form-control selectpicker show-tick" required="required" id="responce_type">
+                        </select>
+                    </div>
+                </div>
             </div>
             <div class="item form-group" style="margin-top: 80px;">
                 <div class="col-md-12 col-sm-12 col-xs-12">