lihong 1 year ago
parent
commit
b2401a6ec6

+ 3 - 1
src/main/java/cn/hnthyy/thmz/controller/mz/MzPatientMiController.java

@@ -863,7 +863,9 @@ public class MzPatientMiController {
 
     @PostMapping("/queryVisitTypeName")
     public R queryVisitTypeName(@RequestBody MzPatientMi mzPatientMi){
-        return R.ok().put("data", shareholderCardService.queryVisitTypeName(mzPatientMi.getPatientId()));
+      //  慢病身份
+        String crmTypeName =  mzPatientMiService.getCrmTypeName(mzPatientMi.getPatientId());
+        return R.ok().put("data", shareholderCardService.queryVisitTypeName(mzPatientMi.getPatientId())).put("crmTypeName",crmTypeName);
     }
 
     @PostMapping("/deleteShareholderCard")

+ 4 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzPatientMiMapper.java

@@ -302,4 +302,8 @@ public interface MzPatientMiMapper {
     Integer selectCount(MzPatientMi mzPatientMi);
     @Select(" select * from mz_patient_mi where social_no =#{keyWard} or patient_id =#{keyWard} or name =#{keyWard} or ic_card_no =#{keyWard} or phone_no=#{keyWard} ")
     List<MzPatientMi> selectBykeyWard(String keyWard);
+    @Select(" select top 1 chronic_disease_type from crm_patient_mi where social_no=#{socialNo} ")
+    String selectChronicDiseaseType(MzPatientMi mzPatientMi);
+    @Select(" select name from crm_zd_visit_type where code in (${code}) ")
+    List<String> selectCrmTypeName(String code);
 }

+ 2 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/zy/ZyActpatientMapper.java

@@ -432,4 +432,6 @@ public interface ZyActpatientMapper {
     @Select(" select t2.inpatient_no from zy_actpatient t1 join a_patient_mi t2 on t1.inpatient_no=t2.inpatient_no " +
             "      where t2.social_no =#{socialNo} ")
     List<String> selectBySocialNo(String socialNo);
+    @Select(" select max(admiss_times) from zy_inactpatient where inpatient_no=#{inpatientNo} ")
+    Integer selectMaxTimes(String inpatientNo);
 }

+ 8 - 0
src/main/java/cn/hnthyy/thmz/service/his/mz/MzPatientMiService.java

@@ -118,4 +118,12 @@ public interface MzPatientMiService {
      * @return: java.util.List<cn.hnthyy.thmz.entity.his.mz.MzPatientMi>
      **/
     List<MzPatientMi> queryMzPatientInfoBykeyWard(String keyWard);
+    /**
+     * @description: 获取慢病身份类型
+     * @author: lihong
+     * @date: 2024/2/27 16:03
+     * @param: patientId
+     * @return: java.lang.String
+     **/
+    String getCrmTypeName(String patientId);
 }

+ 20 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzPatientMiServiceImpl.java

@@ -23,6 +23,7 @@ import cn.hnthyy.thmz.service.his.ResponceTypeService;
 import cn.hnthyy.thmz.service.his.mz.MzPatientMiService;
 import cn.hnthyy.thmz.service.his.mz.MzSerialNoService;
 import cn.hnthyy.thmz.service.thmz.HaiCiAdapterService;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -267,4 +268,23 @@ public class MzPatientMiServiceImpl implements MzPatientMiService {
         Tools.trimCollectionStrField(mzPatientMis);
         return mzPatientMis;
     }
+
+    /**
+     * @param patientId
+     * @description: 获取慢病身份类型
+     * @author: lihong
+     * @date: 2024/2/27 16:03
+     * @param: patientId
+     * @return: java.lang.String
+     */
+    @Override
+    public String getCrmTypeName(String patientId) {
+        MzPatientMi mzPatientMi = mzPatientMiMapper.selectByPatientId(patientId);
+        String chronicDiseaseType = mzPatientMiMapper.selectChronicDiseaseType(mzPatientMi);
+        if (StrUtil.isNotBlank(chronicDiseaseType)) {
+            List<String> crmTypeName = mzPatientMiMapper.selectCrmTypeName(Tools.toInStringSql(CollUtil.newArrayList(chronicDiseaseType.split(","))));
+            return CollUtil.join(crmTypeName, ",");
+        }
+        return null;
+    }
 }

+ 7 - 1
src/main/java/cn/hnthyy/thmz/service/impl/his/zy/ZyActpatientServiceImpl.java

@@ -114,7 +114,8 @@ public class ZyActpatientServiceImpl implements ZyActpatientService {
             aPatientMiDb.setLastadmissTimes(0);
         }
         Date now = new Date();
-        aPatientMiDb.setLastadmissTimes(aPatientMiDb.getLastadmissTimes() + 1);
+        Integer lastTimes = getLastadmissTimes(aPatientMiDb.getLastadmissTimes(),zyActpatient.getInpatientNo());
+        aPatientMiDb.setLastadmissTimes(lastTimes + 1);
         aPatientMiMapper.updateLastadmissTimes(aPatientMiDb);
         zyActpatient.setChargeType(YesNoEnum.YES.code.toString());
         zyActpatient.setInpatientNo(aPatientMiDb.getInpatientNo());
@@ -255,6 +256,11 @@ public class ZyActpatientServiceImpl implements ZyActpatientService {
         return num;
     }
 
+    private Integer getLastadmissTimes(Integer lastadmissTimes, String inpatientNo) {
+        Integer maxTimes = zyActpatientMapper.selectMaxTimes(inpatientNo);
+        return Convert.toInt(lastadmissTimes, 0) <= Convert.toInt(maxTimes, 0) ? Convert.toInt(maxTimes, 0) : Convert.toInt(lastadmissTimes, 0);
+    }
+
     @Override
     public int queryCountByInpatientNo(String inpatientNo) {
         return zyActpatientMapper.selectCountByInpatientNo(inpatientNo);

+ 37 - 0
src/main/resources/static/js/mz/clinic.js

@@ -2049,6 +2049,7 @@ function setVisitTypeName(patientId) {
         if(res.code ==0 && res.data != '' && res.data !=null){
             $("#patientVisitType").html(res.data);
         }
+        $("#crmType").text(res.crmTypeName);
     })
 }
 
@@ -2096,6 +2097,42 @@ function deleteShareholderCard() {
     })
 }
 
+//慢病建档
+function cmrCreate() {
+    $.ajax({
+        type: "GET",
+        url: '/thmz/getMzjsdHost',
+        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;
+            }
+            if (res.code == 0) {
+                let patientId = $("#patientId").text();
+                if(stringIsBlank(patientId)){
+                    return  errorMesageSimaple('门诊号不能为空,请先接诊')
+                }
+                getAjaxRequst("/thmz/getByPatientId",{patientId:patientId},true,function (ress) {
+                    if(ress.code ==0){
+                        let cmrType ;
+                        let  userIdCode = localStorage.getItem("userIdCode");
+                        if(stringIsBlank($("#crmType").text())){
+                            cmrType = '2'
+                        }else {
+                            cmrType = '1'
+                        }
+                        window.open(`${res.data}/outpatient/chronicDisease/chronicDiseaseRegister?socialNo=${ress.data.socialNo}&type=${cmrType}&userCode=${userIdCode}`, '_blank');
+                    }
+                })
+            }
+        }
+    });
+}
+
+
+
 /**
  * 特门详情
  * @param patientId

+ 4 - 0
src/main/resources/templates/mz/clinic.html

@@ -380,6 +380,7 @@
                                 id="patientPhone"></span></label>&nbsp;&nbsp;</label>
                         <span>病人性质: </span> <label><span id="patientResponseType"></span></label>
                         <span>病人身份: </span> <label><a class="fa fa-futbol-o"></a>&nbsp;&nbsp;<span id="patientVisitType" style="color: red;font-weight:bold"></span></label>
+                        <span>慢病类型: </span> <label><span id="crmType"></span></label>
                         <!--当前接诊病人id-->
                         <!--  <input id="patientId" type="hidden"/>-->
                        <!--就诊次数-->
@@ -392,6 +393,9 @@
                         <input type="hidden" id="turnToConsultationIdInClick"/>
                     </div>
                     <div class="col-md-4 col-sm-4 col-xs-12" style="text-align: right;">
+                        <a style="cursor: pointer;font-size: 14px;color: #2e69eb!important;margin-right: 10px;"
+                           onclick="cmrCreate()" ><i
+                                class="fa fa-plus-square">&nbsp;&nbsp;慢病建档</i></a>
                         <a style="cursor: pointer;font-size: 14px;color: #2e69eb!important;margin-right: 10px;"
                            onclick="deleteShareholderCard()" ><i
                                 class="fa fa-minus">&nbsp;&nbsp;删除股东卡</i></a>