Browse Source

查看户口本

lihong 1 year ago
parent
commit
822b99f3e0

+ 9 - 4
src/main/java/cn/hnthyy/thmz/controller/mz/MzPatientMiController.java

@@ -64,18 +64,23 @@ public class MzPatientMiController {
                 return resultMap;
             }
             int num = zyActpatientService.queryCountByInpatientNo(icCardNo);
+            MzPatientMi mzPatientMi = null;
             if(num > 0){
              //住院号
                 APatientMi aPatientMi = aPatientMiService.queryPatientMiByInPatientNo(icCardNo);
                 if(StrUtil.isNotBlank(aPatientMi.getMzNo())){
-                    icCardNo = aPatientMi.getMzNo();
-                }else if (StrUtil.isNotBlank(aPatientMi.getSocialNo()) && IdcardUtil.isValidCard(aPatientMi.getSocialNo())){
-                    icCardNo = aPatientMi.getSocialNo();
+                    mzPatientMi = mzPatientMiService.queryByIcCardNo(icCardNo);
+                }else {
+                    if (StrUtil.isNotBlank(aPatientMi.getSocialNo())) {
+                        mzPatientMi = mzPatientMiService.queryByIcCardNo(icCardNo);
+                    }
                 }
+            }else {
+                mzPatientMi = mzPatientMiService.queryByIcCardNo(icCardNo);
             }
             resultMap.put("code", 0);
             resultMap.put("message", "查询病人信息成功");
-            resultMap.put("data", mzPatientMiService.queryByIcCardNo(icCardNo));
+            resultMap.put("data", mzPatientMi);
             return resultMap;
         } catch (Exception e) {
             e.printStackTrace();

+ 15 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/PatientMiSzController.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.controller.mz;
 
 
+import cn.hnthyy.thmz.Utils.AssertUtil;
 import cn.hnthyy.thmz.Utils.R;
 import cn.hnthyy.thmz.Utils.WindowsUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
@@ -221,5 +222,19 @@ public class PatientMiSzController {
         patientMiSfzService.saveZyXnhRecord(zyXnhRecord);
         return R.ok();
     }
+   /**
+    * @description: 查询上传的户口本记录
+    * @author: lihong
+    * @date: 2023/12/4 14:28
+    * @param: patNo
+    * @return: cn.hnthyy.thmz.Utils.R
+    **/
+   @UserLoginToken
+   @GetMapping("/queryZyXnhRecord")
+    public R queryZyXnhRecord(@RequestParam("patNo")String patNo){
+        AssertUtil.isNotBlank(patNo,"住院号不能为空");
+        ZyXnhRecord data = patientMiSfzService.queryZyXnhRecord(patNo);
+        return R.ok().put("data",data);
+    }
 
 }

+ 26 - 7
src/main/java/cn/hnthyy/thmz/controller/zy/APatientMiController.java

@@ -5,10 +5,13 @@ import cn.hnthyy.thmz.Utils.IDCardUtil;
 import cn.hnthyy.thmz.Utils.R;
 import cn.hnthyy.thmz.Utils.StringUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
+import cn.hnthyy.thmz.entity.his.mz.MzPatientMi;
 import cn.hnthyy.thmz.entity.his.zy.APatientMi;
+import cn.hnthyy.thmz.service.his.mz.MzPatientMiService;
 import cn.hnthyy.thmz.service.his.zy.APatientMiService;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.StrUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,6 +27,8 @@ import java.util.Map;
 public class APatientMiController {
     @Autowired
     private APatientMiService aPatientMiService;
+    @Autowired
+    private MzPatientMiService mzPatientMiService;
 
 
 
@@ -83,9 +88,16 @@ public class APatientMiController {
                 resultMap.put("message", "病人门诊id不能为空");
                 return resultMap;
             }
+            List<APatientMi> aPatientMis = aPatientMiService.queryAPatientByMzNo(mzNo);
+            if(CollUtil.isEmpty(aPatientMis)){
+                MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(mzNo);
+                if(mzPatientMi !=null && StrUtil.isNotBlank(mzPatientMi.getSocialNo())){
+                    aPatientMis = aPatientMiService.queryAPatientBySocialNo(mzPatientMi.getSocialNo());
+                }
+            }
             resultMap.put("code", 0);
             resultMap.put("message", "查询病人信息成功");
-            resultMap.put("data", aPatientMiService.queryAPatientByMzNo(mzNo));
+            resultMap.put("data", aPatientMis);
             return resultMap;
         } catch (Exception e) {
             e.printStackTrace();
@@ -112,14 +124,21 @@ public class APatientMiController {
             if (checkPatient(aPatientMi, resultMap)){
                 return resultMap;
             }
-            List<APatientMi> aPatientMiDb=aPatientMiService.queryAPatientByMzNo(aPatientMi.getMzNo());
             int num=0;
-            if(CollUtil.isEmpty(aPatientMiDb)){
-               //新增
-                num=aPatientMiService.saveMzPatientMi(aPatientMi);
+            if(StrUtil.isNotBlank(aPatientMi.getInpatientNo())){
+                APatientMi tempAPatientMi = aPatientMiService.queryPatientMiByInPatientNo(aPatientMi.getInpatientNo());
+                if(tempAPatientMi != null){
+                    num=aPatientMiService.modifyMzPatientMi(aPatientMi);
+                }else {
+                    num=aPatientMiService.saveMzPatientMi(aPatientMi);
+                }
             }else {
-                //修改
-                num=aPatientMiService.modifyMzPatientMi(aPatientMi);
+                List<APatientMi> aPatientMiDb=aPatientMiService.queryAPatientByMzNo(aPatientMi.getMzNo());
+                if(CollUtil.isEmpty(aPatientMiDb)){
+                    num=aPatientMiService.saveMzPatientMi(aPatientMi);
+                }else {
+                    num=aPatientMiService.modifyMzPatientMi(aPatientMi);
+                }
             }
             if(num >=1){
                 resultMap.put("code", 0);

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

@@ -58,4 +58,6 @@ public interface PatientMiSfzMapper {
     Integer insertZyXnhRecord(ZyXnhRecord zyXnhRecord);
     @Select(" select max(item_no)  from zy_xnh_record where inpatient_no =#{inpatientNo} and admiss_times=#{admissTimes} ")
     String selectZyXnhRecord(ZyXnhRecord zyXnhRecord);
+    @Select(" select inpatient_no,admiss_times,ledger_sn,file_xnh,item_no  from zy_xnh_record where inpatient_no =#{inpatientNo} and file_xnh is not null ")
+    List<ZyXnhRecord> selectZyXnhRecordByPatNo(String patNo);
 }

+ 8 - 0
src/main/java/cn/hnthyy/thmz/service/his/zy/PatientMiSfzService.java

@@ -39,4 +39,12 @@ public interface PatientMiSfzService {
     Integer saveZyXnhRecord(ZyXnhRecord zyXnhRecord);
 
     PatientMiSfz queryByInpatient(String inpatient);
+    /**
+     * @description: 查询上传的户口本记录
+     * @author: lihong
+     * @date: 2023/12/4 14:21
+     * @param: patNo
+     * @return: cn.hnthyy.thmz.entity.his.zy.ZyXnhRecord
+     **/
+    ZyXnhRecord queryZyXnhRecord(String patNo);
 }

+ 23 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/zy/PatientMiSfzServiceImpl.java

@@ -8,6 +8,7 @@ import cn.hnthyy.thmz.mapper.his.zy.PatientMiSfzMapper;
 import cn.hnthyy.thmz.service.his.zy.APatientMiService;
 import cn.hnthyy.thmz.service.his.zy.PatientMiSfzService;
 import cn.hnthyy.thmz.service.his.zy.ZyActpatientService;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.StrUtil;
@@ -17,6 +18,7 @@ import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Comparator;
 import java.util.List;
 
 @Service
@@ -96,4 +98,25 @@ public class PatientMiSfzServiceImpl implements PatientMiSfzService {
     public PatientMiSfz queryByInpatient(String inpatient) {
         return patientMiSfzMapper.selectByPatNo(inpatient);
     }
+
+    /**
+     * @param patNo
+     * @description: 查询上传的户口本记录
+     * @author: lihong
+     * @date: 2023/12/4 14:21
+     * @param: patNo
+     * @return: cn.hnthyy.thmz.entity.his.zy.ZyXnhRecord
+     */
+    @Override
+    public ZyXnhRecord queryZyXnhRecord(String patNo) {
+        List<ZyXnhRecord> zyXnhRecords = patientMiSfzMapper.selectZyXnhRecordByPatNo(patNo);
+        if(CollUtil.isNotEmpty(zyXnhRecords)) {
+            if(zyXnhRecords.size() == 1){
+                return zyXnhRecords.get(0);
+            }else {
+                return zyXnhRecords.stream().max(Comparator.comparing(item -> item.getAdmissTimes()+item.getItemNo())).get();
+            }
+        }
+        return null;
+    }
 }

+ 1 - 1
src/main/resources/static/js/jBox/common.js

@@ -109,11 +109,11 @@ function setCertificateData(result) {
         $('#gender').selectpicker('refresh');
     }
     //$("#nation").val(result.Certificate.Nation);
-    $("#sfzAddress").val(result.Certificate.Address);
     //$("#idAddress").val(result.Certificate.Address);
     $("#copyAddress").attr("data-clipboard-text", result.Certificate.Address);
     $("#copyAddress").show();
     try {
+        $("#sfzAddress").val(result.Certificate.Address);
         $('#certificateType').selectpicker('val', '01');
         $('#certificateType').selectpicker('refresh');
         $("#imageIdCard").val(result.Certificate.Base64Photo);

+ 30 - 3
src/main/resources/static/js/zy/hospitalized.js

@@ -150,6 +150,33 @@ $(function () {
         });
     });
 
+    //查看户口本
+    $("#seeHkb").on("click", function (t) {
+        $.ajax({
+            type: "GET",
+            url: '/thmz/queryZyXnhRecord?patNo=' + $("#admissionNumber").val(),
+            contentType: "application/json;charset=UTF-8",
+            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) {
+                    if(res.data == null){
+                        warningMesageSimaple("没有查询到数据")
+                    }else {
+                        $("#seeHkbModal").modal("show");
+                        $("#hkbImage").attr("src", "data:image/jpeg;base64," + res.data.fileXnh);
+                    }
+                } else {
+                    errorMesage(res);
+                }
+            }
+        });
+    });
+
     /**
      * 初始化病区与小科室
      */
@@ -1504,11 +1531,11 @@ function fillZyPatientInfo(patNo,checkFlag,infoFlag) {
                                     $("#idCard").val(resp.data.socialNo);
                                     $("#idCard").attr("title", resp.data.socialNo);
                                     $("#idCard").blur();
-                                    $("#addresps").val(resp.data.detail);
-                                    $("#addresps").blur();
+                                    $("#address").val(resp.data.detail);
+                                    $("#address").blur();
                                     $("#patientId").val(resp.data.patientId);
                                     if(stringNotBlank(resp.data.provinceCode) && resp.data.provinceCode!="-1" && resp.data.provinceCode.length >=6){
-                                        initAddresps(resp)
+                                        initAddress(resp)
                                     }
                                     if (resp.data.name != null && resp.data.name != "") {
                                         $("#saveUser").show();

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

@@ -62,6 +62,7 @@
                         <a id="siReadCardFace"><i class="fa fa-github-alt">&nbsp;医保刷脸</i></a>
                         <a id="uploadIdCard"><i class="fa fa-arrow-up">&nbsp;上传身份证</i></a>
                         <a id="hkbUploadFile"><i class="fa fa-arrow-up">&nbsp;户口本上传</i></a>
+                        <a id="seeHkb"><i class="fa fa-eye">&nbsp;查看户口本</i></a>
                         <a id="seeIdCard"><i class="fa fa-eye">&nbsp;查看身份证</i></a>
                         <a id="updateInpatientNo"><i class="fa fa-check-square-o">&nbsp;修改住院号</i></a>
                         <a onclick="saveZyPatient(false)" id="saveUser" hidden><i
@@ -666,6 +667,28 @@
 </div>
 <!--查看患者身份证弹窗结尾-->
 
+<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true" id="seeHkbModal">
+    <div class="modal-dialog modal-lg">
+        <div class="modal-content" style="width: 600px;margin-left: 200px;">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
+                </button>
+                <h4 class="modal-title modal-title-thmz">查看身份证</h4>
+            </div>
+            <div class="modal-body">
+                <form class="form-horizontal form-label-left" novalidate autocomplete="off">
+                    <img src="" id="hkbImage" width="350px" style="clear: both;display: block;margin: auto;">
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
+            </div>
+        </div>
+    </div>
+</div>
+
+
+
 <object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>
     <embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0></embed>
 </object>