浏览代码

优化读卡办业务

lighter 3 年之前
父节点
当前提交
0532211df5

+ 30 - 0
src/main/java/thyyxxk/webserver/constants/sidicts/ReadCardBizType.java

@@ -0,0 +1,30 @@
+package thyyxxk.webserver.constants.sidicts;
+
+import thyyxxk.webserver.utils.StringUtil;
+
+public enum ReadCardBizType {
+    ADMISSION("01103"),
+    SETTLEMENT("01301");
+
+    private final String code;
+
+    public String getCode() {
+        return code;
+    }
+
+    ReadCardBizType(String code) {
+        this.code = code;
+    }
+
+    public static ReadCardBizType get(String code) {
+        if (StringUtil.isBlank(code)) {
+            return null;
+        }
+        for (ReadCardBizType readCardBizType : ReadCardBizType.values()) {
+            if (code.trim().equals(readCardBizType.getCode())) {
+                return readCardBizType;
+            }
+        }
+        return null;
+    }
+}

+ 2 - 2
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiZyDao.java

@@ -138,7 +138,7 @@ public interface SiZyDao {
      * @param ledgerSn 账页号
      * @return 预结算参数
      */
-    @Select("select psn_no,certno as mdtrtCertNo,certno, " +
+    @Select("select psn_no,certno as mdtrtCertNo,certno,mdtrtCertType='02', " +
             "psn_cert_type,psn_type,mdtrt_id,insutype,insuplc_admdvs, " +
             "medfeeSumamt=(select sum(charge_fee) from zy_detail_charge b where b.inpatient_no=a.pat_no " +
             "and b.admiss_times=a.times and b.ledger_sn=a.ledger_sn and isnull(b.infant_flag,0)=0 " +
@@ -149,7 +149,7 @@ public interface SiZyDao {
                               @Param("ledgerSn") int ledgerSn,
                               @Param("today") String today);
 
-    @Select("select psn_no,certno as mdtrtCertNo,certno, " +
+    @Select("select psn_no,certno as mdtrtCertNo,certno,mdtrtCertType='02', " +
             "psn_cert_type,psn_type,mdtrt_id,insutype,insuplc_admdvs, " +
             "medfeeSumamt=(select sum(charge_fee) from zy_detail_charge b where b.inpatient_no=a.pat_no " +
             "and b.admiss_times=a.times and b.ledger_sn=a.ledger_sn and isnull(b.infant_flag,0)=0 " +

+ 2 - 0
src/main/java/thyyxxk/webserver/entity/medicalinsurance/inpatient/ZyPatientInfo.java

@@ -53,6 +53,8 @@ public class ZyPatientInfo {
 
     private String mdtrtCertType;
     private String mdtrtCertNo;
+    private String readCardResult;
+    private String readCardBizType;
 
     private Integer feeSize;
 

+ 48 - 11
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiZyService.java

@@ -88,6 +88,31 @@ public class SiZyService {
         if (null == admDiseinfos || admDiseinfos.isEmpty()) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请填写医保入院诊断!");
         }
+        ReadCardBizType readCardBizType = ReadCardBizType.get(p.getReadCardBizType());
+        if (readCardBizType == ReadCardBizType.ADMISSION) {
+            MdtrtCertType mdtrtCertType = MdtrtCertType.getByLabel(p.getMdtrtCertType());
+            admMdtrtinfo.setMdtrtCertType(mdtrtCertType.getCode());
+            if (mdtrtCertType == MdtrtCertType.SOCIAL_SECURITY_CARD) {
+                String[] out = p.getReadCardResult().split("\\|");
+                if (!p.getName().trim().equals(out[4].trim())) {
+                    revokeDischarge(p);
+                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "社保卡姓名与HIS姓名不一致,请确认是否人证相符。");
+                }
+                admMdtrtinfo.setMdtrtCertNo(out[2]);
+                admMdtrtinfo.setCardSn(out[3]);
+            } else if (mdtrtCertType == MdtrtCertType.MEDICAL_INSURANCE_ELECTRONIC_VOUCHER) {
+                JSONObject qrinfo = JSONObject.parseObject(p.getReadCardResult());
+                if (!p.getName().trim().equals(qrinfo.getString("userName").trim())) {
+                    revokeDischarge(p);
+                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "电子医保凭证姓名与HIS姓名不一致,请确认是否人证相符。");
+                }
+                if (!p.getSocialNo().trim().equals(qrinfo.getString("idNo").trim())) {
+                    revokeDischarge(p);
+                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "电子医保凭证身份证与HIS身份证不一致,请确认是否人证相符。");
+                }
+                admMdtrtinfo.setMdtrtCertNo(qrinfo.getString("ecToken"));
+            }
+        }
         admMdtrtinfo.setInsutype(p.getInsutype());
         admMdtrtinfo.setAdmDiagDscr(admDiseinfos.get(0).getDiagName());
         admMdtrtinfo.setDscgMaindiagCode(admDiseinfos.get(0).getDiagCode());
@@ -371,18 +396,30 @@ public class SiZyService {
             revokeDischarge(p);
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保在院信息!");
         }
-        MdtrtCertType mdtrtCertType = MdtrtCertType.getByLabel(p.getMdtrtCertType());
-        preSetlmt.setMdtrtCertType(mdtrtCertType.getCode());
-        if (mdtrtCertType == MdtrtCertType.SOCIAL_SECURITY_CARD) {
-            String[] out = p.getMdtrtCertNo().split("\\|");
-            if (!p.getName().trim().equals(out[4].trim())) {
-                revokeDischarge(p);
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "社保卡姓名与HIS姓名不一致,请确认是否人证相符。");
+        ReadCardBizType readCardBizType = ReadCardBizType.get(p.getReadCardBizType());
+        if (readCardBizType == ReadCardBizType.SETTLEMENT) {
+            MdtrtCertType mdtrtCertType = MdtrtCertType.getByLabel(p.getMdtrtCertType());
+            preSetlmt.setMdtrtCertType(mdtrtCertType.getCode());
+            if (mdtrtCertType == MdtrtCertType.SOCIAL_SECURITY_CARD) {
+                String[] out = p.getReadCardResult().split("\\|");
+                if (!p.getName().trim().equals(out[4].trim())) {
+                    revokeDischarge(p);
+                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "社保卡姓名与HIS姓名不一致,请确认是否人证相符。");
+                }
+                preSetlmt.setMdtrtCertNo(out[2]);
+                preSetlmt.setCardSn(out[3]);
+            } else if (mdtrtCertType == MdtrtCertType.MEDICAL_INSURANCE_ELECTRONIC_VOUCHER) {
+                JSONObject qrinfo = JSONObject.parseObject(p.getReadCardResult());
+                if (!p.getName().trim().equals(qrinfo.getString("userName").trim())) {
+                    revokeDischarge(p);
+                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "电子医保凭证姓名与HIS姓名不一致,请确认是否人证相符。");
+                }
+                if (!p.getSocialNo().trim().equals(qrinfo.getString("idNo").trim())) {
+                    revokeDischarge(p);
+                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "电子医保凭证身份证与HIS身份证不一致,请确认是否人证相符。");
+                }
+                preSetlmt.setMdtrtCertNo(qrinfo.getString("ecToken"));
             }
-            preSetlmt.setMdtrtCertNo(out[2]);
-            preSetlmt.setCardSn(out[3]);
-        } else if (mdtrtCertType == MdtrtCertType.MEDICAL_INSURANCE_ELECTRONIC_VOUCHER) {
-            preSetlmt.setMdtrtCertNo(p.getMdtrtCertNo());
         }
         preSetlmt.setPsnSetlway(p.getDbg() ? PsnSetlWay.SETTLE_BY_QUOTA.getCode() : PsnSetlWay.SETTLE_BY_ITEMS.getCode());
         preSetlmt.setAcctUsedFlag(YesOrNo.NO.getCodeStr());