Browse Source

参保信息分析

lighter 3 năm trước cách đây
mục cha
commit
8cb6c19e7b

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

@@ -65,7 +65,7 @@ public interface SiSetlinfoDao extends BaseMapper<SiSetlinfo> {
                                   @Param("begntime") String begntime,
                                   @Param("endtime") String endtime);
 
-    @Select("select psn_no,setl_id,mdtrt_id,insuplc_admdvs,charges_analyzed from t_si_setlinfo with(nolock) " +
+    @Select("select psn_no,setl_id,mdtrt_id,insuplc_admdvs,insutype,med_type,charges_analyzed from t_si_setlinfo with(nolock) " +
             "where revoked=0 and setl_type=21 and charges_analyzed=0")
     List<SiSetlinfo> selectUnAnalyzedData();
 
@@ -76,6 +76,6 @@ public interface SiSetlinfoDao extends BaseMapper<SiSetlinfo> {
             "charge_sanitary_material=#{chargeSanitaryMaterial},charge_assay=#{chargeAssay}, " +
             "charge_general_diagnosis=#{chargeGeneralDiagnosis},charge_inspection=#{chargeInspection}, " +
             "charge_registration=#{chargeRegistration},charge_bed=#{chargeBed},charge_others=#{chargeOthers}, " +
-            "charges_analyzed=#{chargesAnalyzed} where setl_id=#{setlId}")
+            "medins_type=#{medinsType},charges_analyzed=#{chargesAnalyzed} where setl_id=#{setlId}")
     void fillAnalyzedData(SiSetlinfo setlinfo);
 }

+ 5 - 0
src/main/java/thyyxxk/webserver/entity/medicalinsurance/setlinfo/SiSetlinfo.java

@@ -354,6 +354,11 @@ public class SiSetlinfo implements Serializable {
 	 * */
 	private Integer chargesAnalyzed;
 
+	/**
+	 * 参保信息
+	 * */
+	private String medinsType;
+
 	@TableField(exist = false)
 	private String gendName;
 	@TableField(exist = false)

+ 4 - 4
src/main/java/thyyxxk/webserver/scheduled/AnalyzeSiInpatientCharges.java

@@ -13,6 +13,7 @@ import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.medicalinsurance.query.SiSetlFeeDetl;
 import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetlinfo;
 import thyyxxk.webserver.service.medicalinsurance.SiQueryService;
+import thyyxxk.webserver.utils.MedInsTypeUtil;
 
 import java.math.BigDecimal;
 import java.util.HashMap;
@@ -34,7 +35,7 @@ public class AnalyzeSiInpatientCharges {
     }
 
     @Scheduled(cron = "0 0 3 * * ?")
-    public void notifyDailyCount() {
+    public void analyzeSetlData() {
         if (executeScheduled) {
             startAnalyze();
         }
@@ -42,16 +43,15 @@ public class AnalyzeSiInpatientCharges {
 
     private void startAnalyze() {
         List<SiSetlinfo> unAnalyzedData = dao.selectUnAnalyzedData();
-        for (int i = 0; i < unAnalyzedData.size(); i++) {
-            SiSetlinfo setlinfo = unAnalyzedData.get(i);
+        for (SiSetlinfo setlinfo : unAnalyzedData) {
             ResultVo<List<SiSetlFeeDetl>> chargeList = service.getChrgitems(setlinfo.getPsnNo(), setlinfo.getSetlId(),
                     setlinfo.getMdtrtId(), setlinfo.getInsuplcAdmdvs());
             if (chargeList.getCode() == ExceptionEnum.SUCCESS.getCode()) {
                 analyzeChargeItems(setlinfo, chargeList.getData());
             }
             setlinfo.setChargesAnalyzed(YesOrNo.YES.getCode());
+            setlinfo.setMedinsType(MedInsTypeUtil.getMedInsDetail(setlinfo));
             dao.fillAnalyzedData(setlinfo);
-            log.info("【序号:{}】结算ID为【{}】的医保患者结算收费类别已分析完成。", i+1, setlinfo.getSetlId());
         }
     }
 

+ 90 - 0
src/main/java/thyyxxk/webserver/utils/MedInsTypeUtil.java

@@ -0,0 +1,90 @@
+package thyyxxk.webserver.utils;
+
+import thyyxxk.webserver.constants.sidicts.Insutype;
+import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetlinfo;
+
+import java.util.*;
+
+public class MedInsTypeUtil {
+
+    static class Judge {
+        List<String> admdvs;
+        Insutype insutype;
+        List<String> medtype;
+
+        public List<String> getAdmdvs() {
+            return admdvs;
+        }
+
+        public Insutype getInsutype() {
+            return insutype;
+        }
+
+        public List<String> getMedtype() {
+            return medtype;
+        }
+
+        public Judge(List<String> admdvs, Insutype insutype, List<String> medtype) {
+            this.admdvs = admdvs;
+            this.insutype = insutype;
+            this.medtype = medtype;
+        }
+    }
+
+    private static final Map<String, Judge> map = new HashMap<>();
+
+    static {
+        List<String> cssbj = Arrays.asList("430102", "430103", "430104", "430105", "430111", "430112", "430140", "430199");
+        List<String> cssdbz = Arrays.asList("430102", "430103", "430104", "430105", "430111", "430112", "430140", "430199", "430121", "430181");
+        List<String> csxdq = Collections.singletonList("430121");
+        List<String> lysdq = Collections.singletonList("430181");
+        List<String> hnsbj = Collections.singletonList("439900");
+        List<String> ptzyMedtypes = Arrays.asList("2101", "22");
+        List<String> matnMedtypes = Arrays.asList("52", "2106", "2107");
+        List<String> dbzMedtypes = Collections.singletonList("2102");
+
+        map.put("长沙市城职普通住院", new Judge(cssbj, Insutype.BASIC_MEDICAL_INSURANCE_FOR_EMPLOYEES, ptzyMedtypes));
+        map.put("长沙市城居普通住院", new Judge(cssbj, Insutype.BASIC_MEDICAL_INSURANCE_FOR_RURAL_RESIDENTS, ptzyMedtypes));
+        map.put("长沙市离休", new Judge(cssbj, Insutype.MEDICAL_SECURITY_FOR_RETIRED_PERSONNEL, ptzyMedtypes));
+        map.put("长沙市生育", new Judge(cssbj, null, matnMedtypes));
+        map.put("长沙县城职普通住院", new Judge(csxdq, Insutype.BASIC_MEDICAL_INSURANCE_FOR_EMPLOYEES, ptzyMedtypes));
+        map.put("长沙县城居普通住院", new Judge(csxdq, Insutype.BASIC_MEDICAL_INSURANCE_FOR_RURAL_RESIDENTS, ptzyMedtypes));
+        map.put("长沙县离休", new Judge(csxdq, Insutype.MEDICAL_SECURITY_FOR_RETIRED_PERSONNEL, ptzyMedtypes));
+        map.put("长沙县生育", new Judge(csxdq, null, matnMedtypes));
+        map.put("浏阳市城职普通住院", new Judge(lysdq, Insutype.BASIC_MEDICAL_INSURANCE_FOR_EMPLOYEES, ptzyMedtypes));
+        map.put("浏阳市城居普通住院", new Judge(lysdq, Insutype.BASIC_MEDICAL_INSURANCE_FOR_RURAL_RESIDENTS, ptzyMedtypes));
+        map.put("浏阳市离休", new Judge(lysdq, Insutype.MEDICAL_SECURITY_FOR_RETIRED_PERSONNEL, ptzyMedtypes));
+        map.put("浏阳市生育", new Judge(lysdq, null, matnMedtypes));
+        map.put("湖南省城职普通住院", new Judge(hnsbj, Insutype.BASIC_MEDICAL_INSURANCE_FOR_EMPLOYEES, ptzyMedtypes));
+        map.put("湖南省城居普通住院", new Judge(hnsbj, Insutype.BASIC_MEDICAL_INSURANCE_FOR_RURAL_RESIDENTS, ptzyMedtypes));
+        map.put("湖南省离休", new Judge(hnsbj, Insutype.MEDICAL_SECURITY_FOR_RETIRED_PERSONNEL, ptzyMedtypes));
+        map.put("湖南省生育", new Judge(hnsbj, null, matnMedtypes));
+        map.put("省城职单病种", new Judge(hnsbj, null, dbzMedtypes));
+        map.put("长沙市单病种", new Judge(cssdbz, null, dbzMedtypes));
+    }
+
+    public static String getMedInsDetail(SiSetlinfo setlinfo) {
+        String admdvs = setlinfo.getInsuplcAdmdvs();
+        Insutype insutype = Insutype.get(setlinfo.getInsutype());
+        String medtype = setlinfo.getMedType();
+        if (!admdvs.startsWith("43")) {
+            return  "省外异地";
+        }
+        if (!admdvs.equals("439900") && admdvs.startsWith("43") && !admdvs.startsWith("4301")) {
+            return medtype.equals("2102") ? "省内异地单病种" : "省内异地";
+        }
+        for (Map.Entry<String, Judge> entry : map.entrySet()) {
+            Judge judge = entry.getValue();
+            if (null == judge.getInsutype()) {
+                if (judge.getAdmdvs().contains(admdvs) && judge.getMedtype().contains(medtype)) {
+                    return entry.getKey();
+                }
+            }
+            if (judge.getAdmdvs().contains(admdvs) && Objects.equals(judge.getInsutype(), insutype)
+                    && judge.getMedtype().contains(medtype)) {
+                return entry.getKey();
+            }
+        }
+        return null;
+    }
+}