Browse Source

增加医保电子凭证挂号功能

hurugang 3 years ago
parent
commit
6fd0dd1b60

+ 46 - 0
src/main/java/cn/hnthyy/thmz/controller/CommonController.java

@@ -4,10 +4,13 @@ import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.enums.*;
 import cn.hnthyy.thmz.service.his.mz.*;
 import cn.hnthyy.thmz.service.his.zd.*;
+import cn.hnthyy.thmz.service.thmz.PaidForZZService;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.*;
@@ -33,6 +36,8 @@ public class CommonController {
     private YshZdPartCodeService yshZdPartCodeService;
     @Autowired
     private JcZdClassService jcZdClassService;
+    @Autowired
+    private PaidForZZService paidForZZService;
     /**
      * 查询科室分类
      *
@@ -681,4 +686,45 @@ public class CommonController {
         resultMap.put("data", data);
         return resultMap;
     }
+
+
+    /**
+     * 读取医保电子凭证信息
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/siReadCard", method = {RequestMethod.GET})
+    public Map<String, Object> siReadCard(@RequestParam String prm) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if(StringUtils.isBlank(prm)){
+                resultMap.put("code", -1);
+                resultMap.put("message", "读取医保电子凭证信息失败,参数为空");
+                return resultMap;
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "读取医保电子凭证信息成功");
+            Map<String,Object> map=paidForZZService.siReadCard(prm);
+            if(map==null || !Integer.valueOf(200).equals(map.get("code"))){
+                resultMap.put("code", -1);
+                resultMap.put("message", map.get("message"));
+                return resultMap;
+            }
+            Map<String,Object> data=(Map<String,Object>)map.get("data");
+            if(data==null || !Integer.valueOf(0).equals(data.get("code"))){
+                resultMap.put("code", -1);
+                resultMap.put("message", data.get("message"));
+                return resultMap;
+            }
+            resultMap.put("data", data.get("data"));
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("读取医保电子凭证信息失败,错误信息{}", e);
+            resultMap.put("code", -1);
+            resultMap.put("message", "读取医保电子凭证信息失败");
+            return resultMap;
+        }
+    }
 }

+ 13 - 0
src/main/java/cn/hnthyy/thmz/service/impl/thmz/PaidForZZServiceImpl.java

@@ -84,4 +84,17 @@ public class PaidForZZServiceImpl implements PaidForZZService {
         }
         return null;
     }
+
+    @Override
+    public Map<String, Object> siReadCard(String prm) {
+        try {
+            RestTemplate restTemplate = new RestTemplate();
+            Map<String, Object> resultMap =restTemplate.getForObject(wxPayOrderServiceUrl + "/siReadCard/request?prm="+prm, Map.class);
+            log.info("{}", resultMap);
+            return  resultMap;
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return null;
+    }
 }

+ 13 - 0
src/main/java/cn/hnthyy/thmz/service/thmz/PaidForZZService.java

@@ -21,4 +21,17 @@ public interface PaidForZZService {
      * @return
      */
     Map<String,Object> refundOrder(WxPayOrder wxPayOrder);
+
+    /**
+     * 读取医保电子凭证接口回调
+     * 读身份证:
+     * {code:0, type:"idcard", message:"读取身份证成功。", patNo:"0393849", data:"430624198412073629^黄敏^^女^汉族^19841207^湖南省湘阴县东塘镇小桥村十组10号^湘阴县公安局^2016082920360829^/9j/4AAQSkZJRgABAQEAeAB4AAaSexuG1ZUxXDjfwrDbWHZi57FN"}
+     * 读社保卡:
+     * {code:0, type:"sicard", message:"读取社保卡成功。", patNo:"0407575", data:"430100|430122198506154526|A12361383|430100D156000005243E1265D8599A73|谢盼|0081544436866043010004E2D5|2.00|20150226|20250226|439900900045|00010501202011005091|3|", sign:"HyOH7hTWWHD7WxDmbaDJFY3DS/5DgpnjwIOx6ICRz6lGIlNlEVoJBSgOJmHQ7uk0uF24nHpbAyQeSidowK7Q56L8o9L6"}
+     * 读医保电子凭证:
+     * {code:0, type:"qrcode", message:"读取医保电子凭证成功。", patNo:"0407208", data:{authNo:null, birthday:null, chnlId:null, ecIndexNo:"6D43880DB1749A54CBECC48EA6A6330F", ecQrCode:null, ecToken:"430000ec0vmp77ijkcc33e5d0a00005c3cfd2f", email:null, gender:null, idNo:"432326197506210616", idType:"01", insuOrg:"430923", nationality:null, userName:"曹论文"}, sign:null}
+     * @param prm
+     * @return
+     */
+    Map<String,Object> siReadCard(String prm);
 }

+ 129 - 131
src/main/resources/static/js/jBox/common.js

@@ -64,7 +64,7 @@ function setCertificateData(result) {
     }
     //$("#nation").val(result.Certificate.Nation);
     $("#address").val(result.Certificate.Address);
-    try{
+    try {
         $("#imageIdCard").val(result.Certificate.Base64Photo);
         setNation(result.Certificate.Nation);
         $("#nationToUpload").val(result.Certificate.Nation);
@@ -72,8 +72,8 @@ function setCertificateData(result) {
         $("#issuedData").val(result.Certificate.IssuedData);
         $("#validDate").val(result.Certificate.ValidDate);
 
-    }catch (e) {
-        
+    } catch (e) {
+
     }
 }
 
@@ -81,125 +81,125 @@ function setCertificateData(result) {
  * 设置民族
  */
 function setNation(nation) {
-    var nationKey=null;
-    if(nation=="阿昌"){
-        nationKey="AC";
-    }else if(nation=="白"){
-        nationKey="BA";
-    }else if(nation=="崩龙"){
-        nationKey="BE";
-    }else if(nation=="布朗"){
-        nationKey="BL";
-    }else if(nation=="保安"){
-        nationKey="BN";
-    }else if(nation=="布依"){
-        nationKey="BY";
-    }else if(nation=="穿青人"){
-        nationKey="CQ";
-    }else if(nation=="朝鲜"){
-        nationKey="CX";
-    }else if(nation=="傣"){
-        nationKey="DA";
-    }else if(nation=="侗"){
-        nationKey="DO";
-    }else if(nation=="独龙"){
-        nationKey="DR";
-    }else if(nation=="达斡尔"){
-        nationKey="DU";
-    }else if(nation=="东乡"){
-        nationKey="DX";
-    }else if(nation=="鄂温克"){
-        nationKey="EW";
-    }else if(nation=="京"){
-        nationKey="GI";
-    }else if(nation=="仡佬"){
-        nationKey="GL";
-    }else if(nation=="高山"){
-        nationKey="GS";
-    }else if(nation=="汉"){
-        nationKey="HA";
-    }else if(nation=="哈尼"){
-        nationKey="HN";
-    }else if(nation=="回"){
-        nationKey="HU";
-    }else if(nation=="赫哲"){
-        nationKey="HZ";
-    }else if(nation=="基诺"){
-        nationKey="JN";
-    }else if(nation=="景颇"){
-        nationKey="JP";
-    }else if(nation=="柯尔克孜"){
-        nationKey="KG";
-    }else if(nation=="哈萨克"){
-        nationKey="KZ";
-    }else if(nation=="珞巴"){
-        nationKey="LB";
-    }else if(nation=="拉祜"){
-        nationKey="LH";
-    }else if(nation=="黎"){
-        nationKey="LI";
-    }else if(nation=="傈僳"){
-        nationKey="LS";
-    }else if(nation=="满"){
-        nationKey="MA";
-    }else if(nation=="门巴"){
-        nationKey="MB";
-    }else if(nation=="蒙古"){
-        nationKey="MG";
-    }else if(nation=="苗"){
-        nationKey="MI";
-    }else if(nation=="仫佬"){
-        nationKey="ML";
-    }else if(nation=="毛难"){
-        nationKey="MN";
-    }else if(nation=="怒族"){
-        nationKey="NU";
-    }else if(nation=="纳西"){
-        nationKey="NX";
-    }else if(nation=="鄂伦春"){
-        nationKey="OR";
-    }else if(nation=="普米族"){
-        nationKey="PM";
-    }else if(nation=="羌"){
-        nationKey="QI";
-    }else if(nation=="其他"){
-        nationKey="QT";
-    }else if(nation=="俄罗斯"){
-        nationKey="RS";
-    }else if(nation=="畲"){
-        nationKey="SH";
-    }else if(nation=="撒拉"){
-        nationKey="SL";
-    }else if(nation=="水"){
-        nationKey="SU";
-    }else if(nation=="塔吉克"){
-        nationKey="TA";
-    }else if(nation=="土家"){
-        nationKey="TJ";
-    }else if(nation=="塔塔尔"){
-        nationKey="TT";
-    }else if(nation=="土"){
-        nationKey="TU";
-    }else if(nation=="维吾尔"){
-        nationKey="UG";
-    }else if(nation=="乌孜别克"){
-        nationKey="UZ";
-    }else if(nation=="佤"){
-        nationKey="VA";
-    }else if(nation=="外国血统"){
-        nationKey="WG";
-    }else if(nation=="锡伯"){
-        nationKey="XB";
-    }else if(nation=="瑶"){
-        nationKey="YA";
-    }else if(nation=="裕固"){
-        nationKey="YG";
-    }else if(nation=="彝"){
-        nationKey="YI";
-    }else if(nation=="藏"){
-        nationKey="ZA";
-    }else if(nation=="壮"){
-        nationKey="ZH";
+    var nationKey = null;
+    if (nation == "阿昌") {
+        nationKey = "AC";
+    } else if (nation == "白") {
+        nationKey = "BA";
+    } else if (nation == "崩龙") {
+        nationKey = "BE";
+    } else if (nation == "布朗") {
+        nationKey = "BL";
+    } else if (nation == "保安") {
+        nationKey = "BN";
+    } else if (nation == "布依") {
+        nationKey = "BY";
+    } else if (nation == "穿青人") {
+        nationKey = "CQ";
+    } else if (nation == "朝鲜") {
+        nationKey = "CX";
+    } else if (nation == "傣") {
+        nationKey = "DA";
+    } else if (nation == "侗") {
+        nationKey = "DO";
+    } else if (nation == "独龙") {
+        nationKey = "DR";
+    } else if (nation == "达斡尔") {
+        nationKey = "DU";
+    } else if (nation == "东乡") {
+        nationKey = "DX";
+    } else if (nation == "鄂温克") {
+        nationKey = "EW";
+    } else if (nation == "京") {
+        nationKey = "GI";
+    } else if (nation == "仡佬") {
+        nationKey = "GL";
+    } else if (nation == "高山") {
+        nationKey = "GS";
+    } else if (nation == "汉") {
+        nationKey = "HA";
+    } else if (nation == "哈尼") {
+        nationKey = "HN";
+    } else if (nation == "回") {
+        nationKey = "HU";
+    } else if (nation == "赫哲") {
+        nationKey = "HZ";
+    } else if (nation == "基诺") {
+        nationKey = "JN";
+    } else if (nation == "景颇") {
+        nationKey = "JP";
+    } else if (nation == "柯尔克孜") {
+        nationKey = "KG";
+    } else if (nation == "哈萨克") {
+        nationKey = "KZ";
+    } else if (nation == "珞巴") {
+        nationKey = "LB";
+    } else if (nation == "拉祜") {
+        nationKey = "LH";
+    } else if (nation == "黎") {
+        nationKey = "LI";
+    } else if (nation == "傈僳") {
+        nationKey = "LS";
+    } else if (nation == "满") {
+        nationKey = "MA";
+    } else if (nation == "门巴") {
+        nationKey = "MB";
+    } else if (nation == "蒙古") {
+        nationKey = "MG";
+    } else if (nation == "苗") {
+        nationKey = "MI";
+    } else if (nation == "仫佬") {
+        nationKey = "ML";
+    } else if (nation == "毛难") {
+        nationKey = "MN";
+    } else if (nation == "怒族") {
+        nationKey = "NU";
+    } else if (nation == "纳西") {
+        nationKey = "NX";
+    } else if (nation == "鄂伦春") {
+        nationKey = "OR";
+    } else if (nation == "普米族") {
+        nationKey = "PM";
+    } else if (nation == "羌") {
+        nationKey = "QI";
+    } else if (nation == "其他") {
+        nationKey = "QT";
+    } else if (nation == "俄罗斯") {
+        nationKey = "RS";
+    } else if (nation == "畲") {
+        nationKey = "SH";
+    } else if (nation == "撒拉") {
+        nationKey = "SL";
+    } else if (nation == "水") {
+        nationKey = "SU";
+    } else if (nation == "塔吉克") {
+        nationKey = "TA";
+    } else if (nation == "土家") {
+        nationKey = "TJ";
+    } else if (nation == "塔塔尔") {
+        nationKey = "TT";
+    } else if (nation == "土") {
+        nationKey = "TU";
+    } else if (nation == "维吾尔") {
+        nationKey = "UG";
+    } else if (nation == "乌孜别克") {
+        nationKey = "UZ";
+    } else if (nation == "佤") {
+        nationKey = "VA";
+    } else if (nation == "外国血统") {
+        nationKey = "WG";
+    } else if (nation == "锡伯") {
+        nationKey = "XB";
+    } else if (nation == "瑶") {
+        nationKey = "YA";
+    } else if (nation == "裕固") {
+        nationKey = "YG";
+    } else if (nation == "彝") {
+        nationKey = "YI";
+    } else if (nation == "藏") {
+        nationKey = "ZA";
+    } else if (nation == "壮") {
+        nationKey = "ZH";
     }
     $('#nation').selectpicker('val', nationKey);
     $('#nation').selectpicker('refresh');
@@ -380,7 +380,12 @@ function queryUserInfoBySocialNo() {
                 }
                 if (res.code == 0) {
                     if (res.data != null && res.data.length > 0) {
-                        fitPatient(res);
+                        //如果只有一条数据的时候,直接加载当前病人信息
+                        if(res.data.length==1){
+                            fillPatinet(res.data[0].patientId);
+                        }else {
+                            fitPatient(res);
+                        }
                     } else {
                         var birthday = idCard.substring(6, 14);
                         birthday = birthday.substring(0, 4) + "-" + birthday.substring(4, 6) + "-" + birthday.substring(6);
@@ -396,13 +401,7 @@ function queryUserInfoBySocialNo() {
                         $('#gender').selectpicker('refresh');
                     }
                 } else {
-                    new PNotify({
-                        title: '错误提示',
-                        text: res.message,
-                        type: 'error',
-                        hide: true,
-                        styling: 'bootstrap3'
-                    });
+                    errorMesage(res);
                 }
             }
         });
@@ -411,7 +410,6 @@ function queryUserInfoBySocialNo() {
 }
 
 
-
 /**
  * 查询患者信息
  */

+ 38 - 0
src/main/resources/static/js/mz/registration.js

@@ -168,6 +168,13 @@ $(function () {
         chargeFeeHybridTest();
     });
 
+    /**
+     * 医保电子凭证读卡
+     */
+    $("#siReadCard").on("click", function (t) {
+        siReadCard();
+    });
+
     /**
      * 清空
      */
@@ -1646,6 +1653,37 @@ function saveBackNo() {
     });
 }
 
+/**
+ * 医保电子凭证读卡
+ */
+function siReadCard() {
+    var prm="qrcode_"+getUID()+"_01101";
+    $.ajax({
+        type: "GET",
+        url: '/thmz/siReadCard?prm='+ prm,
+        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) {
+                $('#certificateType').selectpicker('val', res.data.idType);
+                $('#certificateType').selectpicker('refresh');
+                $("#idCard").val(res.data.idNo);
+                $("#userName").val(res.data.userName);
+                queryUserInfoBySocialNo();
+                successMesage(res);
+            } else {
+                errorMesage(res);
+            }
+        }
+    });
+    window.open('ReadCard://'+prm, '_self')
+}
+
 
 /**
  * 清空挂号信息

+ 1 - 0
src/main/resources/templates/mz/registration.html

@@ -63,6 +63,7 @@
                                 class="fa fa-chain-broken">&nbsp;销卡</i></a>
                         <a onclick="savePatient(false)" id="saveUser" hidden><i class="fa fa-user">&nbsp;患者建档</i></a>
                         <a onclick="editUserModal(null)" id="editUser" hidden><i class="fa fa-edit">&nbsp;修改患者</i></a>
+                        <a id="siReadCard"><i class="fa fa-barcode">&nbsp;医保电子凭证读卡</i></a>
                         <a id="clearRegistration"><i class="fa fa-trash">&nbsp;清空</i></a>
                     </div>
                 </div>