浏览代码

优化查询参保信息时的证件类型字段

lighter 2 年之前
父节点
当前提交
e61235f398

+ 4 - 1
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiQueryDao.java

@@ -139,9 +139,12 @@ public interface SiQueryDao {
                            @Param("ledgerSn") int ledgerSn,
                            @Param("nullCtnt") String nullCtnt);
 
-    @Select("select isnull(psn_cert_type,'01') from a_patient_mi where inpatient_no=#{patNo}")
+    @Select("select psn_cert_type from a_patient_mi where inpatient_no=#{patNo}")
     String selectPsnCertType(@Param("patNo") String patNo);
 
+    @Select("select top 1 psn_cert_type from a_patient_mi where social_no=#{socialNo} and psn_cert_type is not null")
+    String selectPsnCertTypeBoSocialNo(@Param("socialNo") String socialNo);
+
     @Select("select setl_id from t_si_setlinfo where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn} and revoked=0")
     String selectSetlId(@Param("patNo") String patNo, @Param("times") int times, @Param("ledgerSn") int ledgerSn);
 

+ 1 - 0
src/main/java/thyyxxk/webserver/entity/medicalinsurance/query/QryPsnBsInfo.java

@@ -13,6 +13,7 @@ public class QryPsnBsInfo {
     private Integer times;
     private Integer ledgerSn;
     private String medType;
+    private String psnCertType;
     private String socialNo;
     private String name;
     private String admdvs;

+ 10 - 5
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiQueryService.java

@@ -72,7 +72,9 @@ public class SiQueryService {
         JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.OBTAIN_BASIC_PERSON_INFO, admdvs);
         JSONObject data = new JSONObject();
         data.put("mdtrt_cert_type", MdtrtCertType.RESIDENT_IDENTITY_CARD.getCode());
-        data.put("psn_cert_type", "01");
+        String psnCertType = dao.selectPsnCertTypeBoSocialNo(socialNo);
+        psnCertType = StringUtil.isBlank(psnCertType) ? PsnCertType.RESIDENT_IDENTITY_CARD.getCode() : psnCertType;
+        data.put("psn_cert_type", psnCertType);
         data.put("mdtrt_cert_no", socialNo);
         data.put("certno", socialNo);
         input.getJSONObject("input").put("data", data);
@@ -99,13 +101,14 @@ public class SiQueryService {
         if (null == qryPsnBsInfo.getOnlyQry() && StringUtil.isBlank(qryPsnBsInfo.getMedType())) {
             return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "请选择患者的医疗类别!");
         }
-        if (StringUtil.isBlank(qryPsnBsInfo.getSocialNo()) && StringUtil.notBlank(qryPsnBsInfo.getPatNo()) && qryPsnBsInfo.getPatNo().length() >= 15) {
+        if (StringUtil.isBlank(qryPsnBsInfo.getSocialNo()) && StringUtil.notBlank(qryPsnBsInfo.getPatNo())
+                && qryPsnBsInfo.getPatNo().length() >= 15) {
             qryPsnBsInfo.setSocialNo(qryPsnBsInfo.getPatNo());
         }
         if (StringUtil.isBlank(qryPsnBsInfo.getSocialNo())) {
             QryPsnBsInfo qpbi = dao.selectMzSocialAndName(qryPsnBsInfo.getPatNo());
-            if (StringUtil.isBlank(qpbi.getSocialNo())) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "患者的身份证不能为空,请补充!");
+            if (null == qpbi || StringUtil.isBlank(qpbi.getSocialNo())) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "患者的证件号码不能为空,请补充!");
             }
             if (null == qryPsnBsInfo.getTimes()) {
                 qryPsnBsInfo.setTimes(qpbi.getTimes());
@@ -122,7 +125,9 @@ public class SiQueryService {
         }
         JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.OBTAIN_BASIC_PERSON_INFO, qryPsnBsInfo.getAdmdvs());
         JSONObject data = new JSONObject();
-        String psnCertType = dao.selectPsnCertType(qryPsnBsInfo.getPatNo());
+        String psnCertType = StringUtil.isBlank(qryPsnBsInfo.getPsnCertType()) ?
+                dao.selectPsnCertType(qryPsnBsInfo.getPatNo()) : qryPsnBsInfo.getPsnCertType();
+        psnCertType = StringUtil.isBlank(psnCertType) ? PsnCertType.RESIDENT_IDENTITY_CARD.getCode() : psnCertType;
         data.put("psn_cert_type", psnCertType);
         data.put("mdtrt_cert_type", psnCertType.equals("01") ? MdtrtCertType.RESIDENT_IDENTITY_CARD.getCode() : MdtrtCertType.OTHER.getCode());
         data.put("mdtrt_cert_no", qryPsnBsInfo.getSocialNo());