Browse Source

混检功能优化

hurugang 2 năm trước cách đây
mục cha
commit
a6b50474b4

+ 5 - 0
src/main/java/cn/hnthyy/thmz/Utils/IDCardUtil.java

@@ -1,6 +1,8 @@
 package cn.hnthyy.thmz.Utils;
 
 
+import org.apache.commons.lang3.StringUtils;
+
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.GregorianCalendar;
@@ -30,6 +32,9 @@ public class IDCardUtil {
         String[] checkCode = {"7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7", "9", "10", "5", "8", "4", "2"};
         String iDCardNo = "";
         try {
+            if(StringUtils.isBlank(idStr)){
+                return "身份证号码为空";
+            }
             //判断号码的长度 15位或18位
             if (idStr.length() != 15 && idStr.length() != 18) {
                 return "身份证号码长度应该为15位或18位";

+ 1 - 0
src/main/java/cn/hnthyy/thmz/common/Constants.java

@@ -240,6 +240,7 @@ public class Constants {
      * 核酸检测混检收费员编码  (因为核酸混检是在每个人的时候收费,然后再集中一次去进行医技申请,
      * 所以,医技申请的时候不能收费,但是系统需要进行收费操作,所以采用核酸收费员工号收费,这样可以进行收费操作,
      * 改变了处方状态吗,又不进行日结,就不会影响报表)
+     * 在患者缴费的时候,收费员是自助或者实际收费员,但是在需要开申请单的时候,是混检收费员
      */
     public static final String HSJCHJSFY_CODE="99997";
 

+ 171 - 113
src/main/resources/static/js/mz/hybrid_test.js

@@ -14,8 +14,6 @@ $(function () {
     cardNoChange();
 
 
-
-
     /**
      * 清空
      */
@@ -29,35 +27,12 @@ $(function () {
      */
     $("#saveHybird").on("click", function (t) {
         var hybirdType = $("#hybirdType").val();
-        if(hybirdType==null){
+        if (hybirdType == null) {
             $("#messageModal").modal();
             $("#messageContent").html("请选择混采类型!");
             return;
         }
-        $.ajax({
-            type: "GET",
-            url: '/thmz/saveHybirdTestPatient?number='+hybirdType,
-            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) {
-                    $("#hybirdPatientName").text(res.data.name);
-                    $("#hybirdPatientId").text(res.data.patientId);
-                    //$("#creatHybird").hide();
-                    $("#hc_number").val(hybirdType);
-                    $("#hybirdTypeModal").modal('hide');
-                    $("#messageButton").attr("data-clipboard-text",'');
-                } else {
-                    errorMesage(res);
-                }
-            }
-        });
-
+        creatHyBird(hybirdType);
     });
 
 
@@ -68,52 +43,19 @@ $(function () {
         $("#messageContent").html("确定要提交当前操作吗?");
         $("#messageButton").off("click").on("click", function (t) {
             $("#messageModal").modal("hide");
-            $.ajax({
-                type: "POST",
-                url: '/thmz/saveHybirdTestPatientRelation',
-                contentType: "application/json;charset=UTF-8",
-                dataType: "json",
-                async: false,
-                data: JSON.stringify({
-                    "parentPatientId": $("#hybirdPatientId").text(),
-                    "patientId": $("#fullPatientIds").val()
-                }),
-                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) {
-                        //将混检主体的ID设置到复制区域
-                        $("#messageButton").attr("data-clipboard-text",$("#hybirdPatientId").text());
-                        copyParentPatient();
-                        successMesage(res);
-                        $("#hybirdList").empty();
-                        $("#hybirdPatientId").text(null);
-                        $("#hybirdPatientName").text(null);
-                        $("#fullPatientIds").val(null);
-                        $("#hc_number").val(null);
-                    } else {
-                        errorMesage(res);
-                    }
-                }
-            });
+            saveHybirdTestPatientRelation();
         });
     });
 
 
-
-
     //每隔三秒读一次身份证
     setInterval(function () {
         new Device().startFun();
+        // //默认光标在卡号输入框
+        // $("#cardNo").focus();
     }, 3000);
 
 
-
-
-
     $("#idCard").change(function (e) {
         queryUserInfoBySocialNo();
     });
@@ -142,9 +84,90 @@ $(function () {
         queryUserInfoByName();
     });
 
+    //将缓存中未提交的数据展示到页面
+    recoverLocalStorageData();
 });
 
 
+/**
+ * 创建混采主体
+ * @param hybirdType 主体类型 试管人数
+ */
+function creatHyBird(hybirdType) {
+    $.ajax({
+        type: "GET",
+        url: '/thmz/saveHybirdTestPatient?number=' + hybirdType,
+        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) {
+                $("#hybirdPatientName").text(res.data.name);
+                $("#hybirdPatientId").text(res.data.patientId);
+                //$("#creatHybird").hide();
+                $("#hc_number").val(hybirdType);
+                $("#hybirdTypeModal").modal('hide');
+                $("#messageButton").attr("data-clipboard-text", '');
+                //创建混采主体的时候,默认添加一次
+                addToList();
+                localStorage.setItem("hybirdPatientName", res.data.name);
+                localStorage.setItem("hybirdPatientId", res.data.patientId);
+                localStorage.setItem("hc_number", hybirdType);
+            } else {
+                errorMesage(res);
+            }
+        }
+    });
+}
+
+/**
+ * 提交混采记录
+ */
+function saveHybirdTestPatientRelation() {
+    $.ajax({
+        type: "POST",
+        url: '/thmz/saveHybirdTestPatientRelation',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        async: false,
+        data: JSON.stringify({
+            "parentPatientId": $("#hybirdPatientId").text(),
+            "patientId": $("#fullPatientIds").val()
+        }),
+        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) {
+                var hybirdType = $("#hc_number").val();
+                //将混检主体的ID设置到复制区域
+                $("#messageButton").attr("data-clipboard-text", $("#hybirdPatientId").text());
+                copyParentPatient();
+                successMesage(res);
+                $("#hybirdList").empty();
+                $("#hybirdPatientId").text(null);
+                $("#hybirdPatientName").text(null);
+                $("#fullPatientIds").val(null);
+                $("#hc_number").val(null);
+                localStorage.removeItem("hybirdPatientName");
+                localStorage.removeItem("hybirdPatientId");
+                localStorage.removeItem("fullPatientIds");
+                localStorage.removeItem("hc_number");
+                localStorage.removeItem("hybirdList");
+                //提交完默认创建一个与上次相同的混采主体
+                creatHyBird(hybirdType);
+            } else {
+                errorMesage(res);
+            }
+        }
+    });
+}
 
 
 /**
@@ -238,9 +261,6 @@ function initCertificateTypeSelect() {
 }
 
 
-
-
-
 /**
  * 打开编辑用户信息窗口
  * @param data
@@ -276,8 +296,6 @@ function editUserModal(data) {
 }
 
 
-
-
 /**
  * checkBox样式
  */
@@ -313,7 +331,7 @@ function queryUserInfoByCardNo() {
                 }
                 if (res.code == 0) {
                     if (res.data != null) {
-                        extracted(res);
+                        setPatientValue(res);
                     } else {
                         $("#messageModal").modal();
                         $("#messageButton").addClass("hide");
@@ -359,7 +377,6 @@ function userNameChange() {
 }
 
 
-
 /**
  * 按照病人id查询病人信息
  * @param patientId
@@ -381,7 +398,7 @@ function fillPatinet(patientId) {
             }
             if (res.code == 0) {
                 if (res.data != null) {
-                    extracted(res);
+                    setPatientValue(res);
                 }
             } else {
                 errorMesage(res);
@@ -390,8 +407,11 @@ function fillPatinet(patientId) {
     });
 }
 
-
-function extracted(res) {
+/**
+ * 填充患者信息
+ * @param res
+ */
+function setPatientValue(res) {
     $("#cardNo").val(res.data.icCardNo);
     $("#cardNo").attr("title", res.data.icCardNo);
     $("#cardNo").blur();
@@ -431,7 +451,8 @@ function extracted(res) {
         $("#nucleicAcid").show();
         $("#editUser").show();
     }
-    $("#saveUser").hide();
+    //自动添加进列表
+    addToList();
 }
 
 
@@ -473,9 +494,6 @@ function fillPlusPatinet(patinet) {
 }
 
 
-
-
-
 /**
  * 给某些域增加title或者清除title
  * @param obj
@@ -493,9 +511,6 @@ function clearTextOrTitle(obj) {
 }
 
 
-
-
-
 /**
  * 清空挂号信息
  */
@@ -521,16 +536,12 @@ function clearRegistration() {
     $("#nucleicAcid").hide();
     //默认光标在卡号输入框
     $("#cardNo").focus();
-    initMzWorkTime();
     $('#certificateType').selectpicker('val', '01');
     $('#certificateType').selectpicker('refresh');
     $("#saveUser").hide();
 }
 
 
-
-
-
 /**
  * 根据手机号码查询病人信息
  */
@@ -628,25 +639,28 @@ function setAge() {
  */
 function hybirdTypeModal() {
     var hcNumber = $("#hc_number").val();
-    if(hcNumber!=null && hcNumber!=''){
+    if (hcNumber != null && hcNumber != '') {
         $("#messageModal").modal();
         $("#messageButton").removeClass("hide");
-        $("#messageContent").html("已经创建了【核酸混检"+hcNumber+"人】主体,是否仍要继续创建?");
+        $("#messageContent").html("已经创建了【核酸混检" + hcNumber + "人】主体,是否仍要继续创建?");
         $("#messageButton").off("click").on("click", function (t) {
             $("#messageModal").modal("hide");
             $("#hybirdTypeModal").modal();
         });
-    }else {
+    } else {
         $("#hybirdTypeModal").modal();
     }
 }
 
 
 /**
- * 将当前病人就诊人添加到混采列表
+ *  将当前病人就诊人添加到混采列表
  */
 function addToList() {
-    var patientId=$("#patientId").val();
+    var patientId = $("#patientId").val();
+    if (patientId == null || patientId == "") {
+        return;
+    }
     $.ajax({
         type: "GET",
         url: '/thmz/verifyHybridTestStatus?patientId=' + patientId,
@@ -659,58 +673,69 @@ function addToList() {
                 return;
             }
             if (res.code == 0) {
-                var userName=$("#userName").val();
-                var gender=$('#gender option:selected').text();
-                var age=$("#age").val();
-                var phoneNum=$("#phoneNum").val();
-                var idCard=$("#idCard").val();
-                var hybirdPatientId =$("#hybirdPatientId").text();
-                if(hybirdPatientId==null || hybirdPatientId==""){
+                var userName = $("#userName").val();
+                var gender = $('#gender option:selected').text();
+                var age = $("#age").val();
+                var phoneNum = $("#phoneNum").val();
+                var idCard = $("#idCard").val();
+                var hybirdPatientId = $("#hybirdPatientId").text();
+                if (hybirdPatientId == null || hybirdPatientId == "") {
                     $("#messageModal").modal();
                     $("#messageButton").addClass("hide");
                     $("#messageContent").html("请先创建混检主体再执行该操作!");
                     return;
                 }
-                if(patientId==null){
+                if (patientId == null) {
                     $("#messageModal").modal();
                     $("#messageButton").addClass("hide");
                     $("#messageContent").html("未选择任何待检人,无法进行该操作!");
                     return;
                 }
-                var fullPatientIds=$("#fullPatientIds").val();
-                if(fullPatientIds!=null && fullPatientIds.indexOf(patientId)>0){
+                var fullPatientIds = $("#fullPatientIds").val();
+                if (fullPatientIds != null && fullPatientIds.indexOf(patientId) > 0) {
                     $("#messageModal").modal();
                     $("#messageButton").addClass("hide");
                     $("#messageContent").html("请不要重复添加该待检人!");
                     clearRegistration();
                     return;
                 }
-                var length=$("#hybirdList").children().length;
+                var length = $("#hybirdList").children().length;
                 var hc_number = $("#hc_number").val();
-                if(length>=hc_number){
+                if (length >= hc_number) {
                     $("#messageModal").modal();
                     $("#messageButton").addClass("hide");
                     $("#messageContent").html("当前混检主体已经达到最大人数,请提交后创建新混检主体再继续操作!");
                     //clearRegistration();
                     return;
                 }
-                fullPatientIds+=","+patientId+"_"+res.times;
+                fullPatientIds += "," + patientId + "_" + res.times;
                 $("#fullPatientIds").val(fullPatientIds);
-                var html= '<div class="col-md-6 col-sm-6 col-xs-12 item">';
-                html+=userName+" "+gender+" "+age+"岁 "+phoneNum+" "+idCard+" ";
-                html+='<a style="cursor: pointer;color: #337AB7 !important;" onclick="editUserModal(\''+patientId+'\')">详情</a> ';
-                html+='<a style="cursor: pointer;color: #337AB7 !important;" onclick="deleteFromList(this,\''+patientId+'\')">删除</a>';
-                html+=' </div>';
+                localStorage.setItem("fullPatientIds", fullPatientIds);
+                var html = '<div class="col-md-6 col-sm-6 col-xs-12 item">';
+                html += userName + " " + gender + " " + age + "岁 " + phoneNum + " " + idCard + " ";
+                html += '<a style="cursor: pointer;color: #337AB7 !important;" onclick="editUserModal(\'' + patientId + '\')">详情</a> ';
+                html += '<a style="cursor: pointer;color: #337AB7 !important;" onclick="deleteFromList(this,\'' + patientId + '\')">删除</a>';
+                html += ' </div>';
                 $("#hybirdList").append(html);
+                localStorage.setItem("hybirdList", $("#hybirdList").html());
                 clearRegistration();
-            }else {
+                length = $("#hybirdList").children().length;
+                if (length == hc_number) {
+                    $("#messageModal").modal();
+                    $("#messageContent").html("当前混检主体已经达到最大人数,是否立即提交并新增混采主体!");
+                    $("#messageButton").removeClass("hide");
+                    $("#messageButton").off("click").on("click", function (t) {
+                        $("#messageModal").modal("hide");
+                        saveHybirdTestPatientRelation();
+                    });
+                }
+            } else {
                 errorMesage(res);
             }
         }
     });
 
 
-
 }
 
 
@@ -719,15 +744,16 @@ function addToList() {
  * @param obj
  * @param patientId
  */
-function deleteFromList(obj,patientId) {
+function deleteFromList(obj, patientId) {
     $(obj).parent().remove();
-    var fullPatientIds=$("#fullPatientIds").val();
-    fullPatientIds= fullPatientIds.replace(patientId,"");
+    var fullPatientIds = $("#fullPatientIds").val();
+    fullPatientIds = fullPatientIds.replace(patientId, "");
     $("#fullPatientIds").val(fullPatientIds);
+    localStorage.setItem("fullPatientIds", fullPatientIds);
+    localStorage.setItem("hybirdList", $("#hybirdList").html());
 }
 
 
-
 /**
  * 复制混检主体的ID
  */
@@ -742,3 +768,35 @@ function copyParentPatient() {
         }
     });
 }
+
+/**
+ * 将缓存中未提交的数据展示到页面
+ */
+function recoverLocalStorageData() {
+    var fullPatientIds = localStorage.getItem("fullPatientIds");
+    var hybirdPatientName = localStorage.getItem("hybirdPatientName");
+    var hybirdPatientId = localStorage.getItem("hybirdPatientId");
+    var hybirdType=localStorage.getItem("hc_number");
+    $("#hc_number").val(hybirdType);
+    $("#hybirdPatientId").text(hybirdPatientId);
+    $("#hybirdPatientName").text(hybirdPatientName);
+    // var arr = fullPatientIds.split(",");
+    // if (arr == null || arr.length == 0) {
+    //     return;
+    // }
+    // for (var i = 0; i < arr.length; i++) {
+    //     var temp = arr[i];
+    //     if (temp == null || temp.length == 0) {
+    //         continue;
+    //     }
+    //     var tempArr = temp.split("_");
+    //     if (tempArr != null && tempArr.length == 2) {
+    //         var patientId = tempArr[0];
+    //         $("#cardNo").val(patientId);
+    //         queryUserInfoByCardNo(false);
+    //     }
+    // }
+    $("#fullPatientIds").val(fullPatientIds);
+  var hybirdListHtml=  localStorage.getItem("hybirdList");
+    $("#hybirdList").html(hybirdListHtml);
+}

+ 18 - 19
src/main/resources/templates/mz/hybrid_test.html

@@ -57,7 +57,7 @@
                 <div class="col-md-9 col-sm-9 col-xs-12">
                     <div class="clearRegistrationDiv">
                         <a id="creatHybird" onclick="hybirdTypeModal()"><i class="fa fa-eyedropper">&nbsp;创建混检主体</i></a>
-                        <a onclick="addToList()" hidden id="editUser" ><i class="fa fa-plus">&nbsp;添加至列表</i></a>
+                        <a onclick="addToList()" hidden id="editUser"><i class="fa fa-plus">&nbsp;添加至列表</i></a>
                         <a id="clearRegistration"><i class="fa fa-trash">&nbsp;清空</i></a>
                     </div>
                 </div>
@@ -193,28 +193,28 @@
             </div>
             <div class="item form-group thmz_alert" id="hybirdList" style="padding-left: 110px;line-height: 30px;">
                 <!--<div class="col-md-6 col-sm-6 col-xs-12 item">-->
-                   <!--刘阳 女 25 岁 18942524626 340827198806135413 <a style="cursor: pointer;color: #337AB7 !important;" onclick="deleteFromList()">删除</a>-->
+                <!--刘阳 女 25 岁 18942524626 340827198806135413 <a style="cursor: pointer;color: #337AB7 !important;" onclick="deleteFromList()">删除</a>-->
                 <!--</div>-->
                 <!--<div class="col-md-6 col-sm-6 col-xs-12 item">-->
-                    <!--刘阳 女 25 岁 18942524626 340827198806135413 <a>删除</a>-->
+                <!--刘阳 女 25 岁 18942524626 340827198806135413 <a>删除</a>-->
                 <!--</div>-->
                 <!--<div class="col-md-6 col-sm-6 col-xs-12 item">-->
-                    <!--刘阳 女 25 岁 18942524626 340827198806135413 <a>删除</a>-->
+                <!--刘阳 女 25 岁 18942524626 340827198806135413 <a>删除</a>-->
                 <!--</div>-->
                 <!--<div class="col-md-6 col-sm-6 col-xs-12 item">-->
-                    <!--刘阳 女 25 岁 18942524626 340827198806135413 <a>删除</a>-->
+                <!--刘阳 女 25 岁 18942524626 340827198806135413 <a>删除</a>-->
                 <!--</div>-->
                 <!--<div class="col-md-6 col-sm-6 col-xs-12 item">-->
-                    <!--刘阳 女 25 岁 18942524626 340827198806135413 <a>删除</a>-->
+                <!--刘阳 女 25 岁 18942524626 340827198806135413 <a>删除</a>-->
                 <!--</div>-->
                 <!--<div class="col-md-6 col-sm-6 col-xs-12 item">-->
-                    <!--刘阳 女 25 岁 18942524626 340827198806135413 <a>删除</a>-->
+                <!--刘阳 女 25 岁 18942524626 340827198806135413 <a>删除</a>-->
                 <!--</div>-->
                 <!--<div class="col-md-6 col-sm-6 col-xs-12 item">-->
-                    <!--刘阳 女 25 岁 18942524626 340827198806135413 <a>删除</a>-->
+                <!--刘阳 女 25 岁 18942524626 340827198806135413 <a>删除</a>-->
                 <!--</div>-->
                 <!--<div class="col-md-6 col-sm-6 col-xs-12 item">-->
-                    <!--刘阳 女 25 岁 18942524626 340827198806135413 <a>删除</a>-->
+                <!--刘阳 女 25 岁 18942524626 340827198806135413 <a>删除</a>-->
                 <!--</div>-->
             </div>
             <div class="item form-group" style="margin-top: 20px;">
@@ -231,9 +231,6 @@
 </div>
 
 
-
-
-
 <!--查看用户信息弹窗开始-->
 <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true" id="editUserModal">
     <div class="modal-dialog modal-lg">
@@ -241,7 +238,7 @@
             <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>
+                <h4 class="modal-title modal-title-thmz">患者档案【查看】</h4>
             </div>
             <div class="modal-body">
                 <form class="form-horizontal form-label-left" novalidate id="editUserForm" autocomplete="off">
@@ -395,7 +392,8 @@
                     </div>
                     <div class="item form-group thmz_alert">
                         <div class="col-md-12 col-sm-12 col-xs-12">
-                            <label class="control-label col-md-2 col-sm-2 col-xs-12" for="editUserAddress" style="margin-left: -3px;">地址</label>
+                            <label class="control-label col-md-2 col-sm-2 col-xs-12" for="editUserAddress"
+                                   style="margin-left: -3px;">地址</label>
                             <div class="col-md-10 col-sm-10 col-xs-12">
                                 <input id="editUserAddress" class="form-control col-md-7 col-xs-12"
                                        data-validate-length-range="2,10"
@@ -476,7 +474,6 @@
 <!--创建混检主体弹窗结尾-->
 
 
-
 <!--提示弹窗开始-->
 <div class="modal fade bs-example-modal-sm in" tabindex="-1" role="dialog" aria-hidden="true" id="messageModal"
      style="top:20%;">
@@ -493,14 +490,16 @@
                         <i class="fa fa-info-circle blue fa-3x"></i>
                     </div>
                     <div class="col-md-10 col-sm-10 col-xs-12"
-                         style="font-size: 14px;font-weight: 700;min-height: 39px;line-height: 39px;" id="messageContent">
+                         style="font-size: 14px;font-weight: 700;min-height: 39px;line-height: 39px;"
+                         id="messageContent">
                         当前有病人正在接诊,是否切换?
                     </div>
                 </form>
             </div>
             <div class="modal-footer">
                 <button type="button" class="btn btn-primary" id="messageButton">确定</button>
-                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
+                <button type="button" class="btn btn-default" data-dismiss="modal">取消
+                </button>
             </div>
         </div>
     </div>
@@ -508,7 +507,6 @@
 <!--提示弹窗结尾-->
 
 
-
 <!--患者查询弹窗开始-->
 <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true" id="patientModal">
     <div class="modal-dialog modal-lg">
@@ -516,7 +514,8 @@
             <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">患者查询 <span style="font-size: 1px;margin-left: 20px;" id="tip_message">请选择本次需要挂号的患者信息</span>
+                <h4 class="modal-title modal-title-thmz">患者查询 <span style="font-size: 1px;margin-left: 20px;"
+                                                                    id="tip_message">请选择本次需要挂号的患者信息</span>
                 </h4>
             </div>
             <div class="modal-body">