Selaa lähdekoodia

结算清单优化

xiaochan 3 vuotta sitten
vanhempi
commit
a0b14b6f0a

+ 4 - 0
src/main/java/thyyxxk/webserver/constants/sidicts/FundPayType.java

@@ -33,8 +33,12 @@ public enum FundPayType {
 
     HOSP_PAY("999996", "医院垫付"),
 
+    EX_GRATIA_COMPENSATION("620100","特惠保补偿金"),
+
     OTHERS("999997", "其他基金");
 
+    // 620100  310301
+
     private final String code;
     private final String name;
 

+ 49 - 22
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/UpIdCollectionDao.java

@@ -55,7 +55,10 @@ public interface UpIdCollectionDao {
             "       a.insutype as hi_type," + // -- 险种类型
             "       (select rytj from batj_ba1 where zyh = #{patNo} and zycs = #{times})  as admWay,  " +  // 入院途径
             "       a.setl_time as  setl_end_date, " +  //结算时间
-            "       a.ipt_med_type, a.hi_paymtd " + "from t_si_setlinfo a," +
+            "       a.ipt_med_type, a.hi_paymtd, " +
+            "       cast(fund_pay_sumamt as decimal(16,2)) as  fund_pay_sumamt," +
+            "       cast(maf_pay as decimal(16,2)) as maf_pay  " +
+            "from t_si_setlinfo a," +
             " t_si_pat_info b " + "where a.pat_no=b.pat_no and a.times=b.times " +
             "and a.ledger_sn = b.ledger_sn  " + "and a.pat_no = #{patNo} and a.times = #{times} " + "and a.ledger_sn = #{ledgerSn} " + "and a.revoked = 0 ")
     SetlinfoUpld setlinfo1(@Param("patNo") String patNo, @Param("times") Integer times, @Param("ledgerSn") Integer ledgerSn);
@@ -69,7 +72,7 @@ public interface UpIdCollectionDao {
             "                     unit_place                                 as emp_addr /*单位地址*/,\n" +
             "                     unit_phone                                 as emp_tel /*工作单位手机*/,\n" +
             "                     addr_zip_code                              as poscode /* 邮编*/,\n" +
-            "                     nation                                     as naty/*民族*/,\n" +
+            "                     (select wjw_code from zd_nation_code where code = nation)          as naty/*民族*/,\n" +
             "                     contact_name                               as coner_name/*联系人姓名*/,\n" +
             "                     (select rtrim(yb_code)\n" +
             "                      from zy_zd_relative_code\n" +
@@ -118,10 +121,10 @@ public interface UpIdCollectionDao {
             "                         when '-' then 0\n" +
             "                         else new_born_weight\n" +
             "                         end                                    as nwb_bir_wt/*新生儿体重*/,\n" +
-            "                     case new_born_admiss_weight\n" +
-            "                         when '-' then 0\n" +
-            "                         else new_born_admiss_weight\n" +
-            "                         end                                    as nwb_adm_wt/*新生儿入院体重*/,\n" +
+//            "                     case new_born_admiss_weight\n" +
+//            "                         when '-' then 0\n" +
+//            "                         else new_born_admiss_weight\n" +
+//            "                         end                                    as nwb_adm_wt/*新生儿入院体重*/,\n" +
             "    resp_nurs_code = (select yb_code\n" +
             "                      from a_employee_mi\n" +
             "                      where a_employee_mi.code = job_nurse) /*责任护士*/,\n" +
@@ -141,7 +144,7 @@ public interface UpIdCollectionDao {
 
 
     @Select("select home_street as currAddr," +
-            "       nation_code as naty," +
+            "(select wjw_code from zd_nation_code where code = nation_code)          as naty/*民族*/,\n" +
             "       relation_name                                                        as coner_name,\n" +
             "       (select yb_code from zy_zd_relative_code where code = relation_code) as patn_rlts,\n" +
             "       relation_street                                                      as conerAddr," +
@@ -264,21 +267,51 @@ public interface UpIdCollectionDao {
     // 总金额 和 全自费 和 医疗收费项目
     @Select("select med_chrgitm_type as med_chrgitm," +
             "amt=cast(sum(det_item_fee_sumamt) as decimal(16,2)), " +
-            "fulamt_ownpay_amt=cast(sum(fulamt_ownpay_amt) as decimal(16,2)), " +
+            "fulamt_ownpay_amt=cast(sum(det_item_fee_sumamt * (selfpay_prop)) as decimal(16,2)), " +
             "claa_sumfee = 0,clab_amt = 0,oth_amt = 0 from t_si_setl_fee_detl " +
             "where setl_id = #{setlId} group by med_chrgitm_type")
     List<IteminfoUpld> amtAndOthAmt(@Param("setlId") String setlId);
 
+    @Select("select med_chrgitm_type as med_chrgitm," +
+            " sum(det_item_fee_sumamt) as amt\n" +
+            "from t_si_setl_fee_detl\n" +
+            "where setl_id = #{setlId}\n" +
+            "group by med_chrgitm_type")
+    List<IteminfoUpld> totalCost(@Param("setlId") String setlId);
+
+    @Select("select med_chrgitm_type as med_chrgitm," +
+            " sum(det_item_fee_sumamt * (1 - selfpay_prop)) as ${feeName} " +
+            "from t_si_setl_fee_detl " +
+            "where setl_id = #{setlId} " +
+            "  and chrgitm_lv = #{chrgitmLv} " +
+            "group by med_chrgitm_type")
+    List<IteminfoUpld> aAndBFees(@Param("setlId") String setlId,
+                                 @Param("chrgitmLv") String chrgitmLv,
+                                 @Param("feeName") String feeName);
+
+    @Select("select med_chrgitm_type as med_chrgitm,\n" +
+            "       sum(case\n" +
+            "               when chrgitm_lv = '03' then det_item_fee_sumamt\n" +
+            "               else det_item_fee_sumamt * selfpay_prop end) as fulamtOwnpayAmt\n" +
+            "from t_si_setl_fee_detl\n" +
+            "where setl_id = #{setlId}\n" +
+            "group by med_chrgitm_type")
+    List<IteminfoUpld> fulamtOwnpayAmt(@Param("setlId") String setlId);
+
     // -- 01 甲类
     @Select("select med_chrgitm_type as med_chrgitm," +
-            "claa_sumfee=cast(sum(det_item_fee_sumamt) as decimal(16,2)) " +
+            "claa_sumfee=cast(sum(det_item_fee_sumamt * (1- selfpay_prop)) as decimal(16,2)) " +
             "from t_si_setl_fee_detl " +
             "where setl_id = #{setlId} and chrgitm_lv = '01' " +
             "group by med_chrgitm_type")
     List<IteminfoUpld> jiaLeiFeiYong(@Param("setlId") String setlId);
 
     // -- 02 乙类
-    @Select("select med_chrgitm_type as med_chrgitm," + "clab_amt=cast(sum(det_item_fee_sumamt) as decimal(16,2)) " + "from t_si_setl_fee_detl " + "where setl_id = #{setlId} and chrgitm_lv = '02' " + "group by med_chrgitm_type")
+    @Select("select med_chrgitm_type as med_chrgitm," +
+            "clab_amt=cast(sum(det_item_fee_sumamt * (1- selfpay_prop)) as decimal(16,2)) " +
+            "from t_si_setl_fee_detl " +
+            "where setl_id = #{setlId} and chrgitm_lv = '02' " +
+            "group by med_chrgitm_type")
     List<IteminfoUpld> yiLeiFeiYong(@Param("setlId") String setlId);
 
 
@@ -389,14 +422,6 @@ public interface UpIdCollectionDao {
     @Update("update t_yb_setl_modify_req set audit_flag = #{auditFlag} where id = #{id}")
     void upAuditFlag(@Param("id") Integer id, @Param("auditFlag") Integer auditFlag);
 
-    @Delete("delete zy_dis_diag_yb where inpatient_no = #{patNo} and admiss_times = #{times};" + "delete batj_ba4 where zyh = #{patNo} and zycs = #{times}")
-    void delYuanShuJu(@Param("patNo") String patNo, @Param("times") Integer times);
-
-
-    @Insert("insert into zy_dis_diag_yb (inpatient_no, admiss_times, dis_diag_no, dis_diag_type, dis_diag, " + "                            dis_diag_comment, op_id_code, op_diag_date, dis_diag_bzfx, dis_diag_status, " + "                            operation, si_diag_type) " + "select inpatient_no, admiss_times, dis_diag_no, dis_diag_type, dis_diag, " + "       dis_diag_comment, op_id_code, op_diag_date, dis_diag_bzfx, dis_diag_status, " + "       operation, si_diag_type from zy_dis_diag_yb_modify " + "where inpatient_no = #{patNo} and admiss_times = #{times}; " + "insert into batj_ba4 (bah, zyh, zycs, ssxh, ssrq, sstj, ssys, sszs1, sszs2, mzys, ssbm, ssmc, mzff, qkjb, " + "                      yhqk, ssbfz, fhqk, ssjb, cut_heal) " + "select bah, zyh, zycs, ssxh, ssrq, sstj, ssys, sszs1, sszs2, mzys, ssbm, ssmc, mzff, qkjb, yhqk, ssbfz, fhqk, ssjb, cut_heal " + "from batj_ba4_modify where zyh = #{patNo} and zycs = #{times};")
-    void auditTongGuo(@Param("patNo") String patNo, @Param("times") Integer times);
-
-
     @Update("update t_yb_setl_modify_req set audit_staff = #{auditStaff},audit_remark = #{remark},audit_name = #{auditName}," + "audit_date = getdate() " + "where id = #{id}")
     void updateReq(@Param("id") Integer id, @Param("remark") String remark, @Param("auditStaff") String auditStaff, @Param("auditName") String auditName);
 
@@ -421,7 +446,7 @@ public interface UpIdCollectionDao {
     @Select("select rtrim(name) from zd_country_code where si_code = #{ntly}")
     String getNtlyName(String ntly);
 
-    @Select("select rtrim(name) from zd_nation_code where code = #{naty}")
+    @Select("select rtrim(name) from zd_nation_code where wjw_code = #{naty}")
     String getNatyName(String naty);
 
     @Select("select rtrim(name) from t_zd_psn_cert_type where code = #{cert}")
@@ -430,7 +455,7 @@ public interface UpIdCollectionDao {
     @Select("select rtrim(name) name from zy_occupation_code where code = #{prfs}")
     String getPrfsName(String prfs);
 
-    @Select("select  rtrim(name) name from zy_zd_relative_code where yb_code = #{code}")
+    @Select("select rtrim(name) name from zy_zd_relative_code where yb_code = #{code}")
     String getPatnRltsName(String code);
 
     @Select("select rtrim(name) from t_si_admdvs where code = #{code} ")
@@ -480,10 +505,12 @@ public interface UpIdCollectionDao {
             "       relation_district                                    as coner_addr, " +
             "       relation_tel                                         as coner_tel, " +
             "       c.insuplc_admdvs                                     as insuplc," +
-            "       b.nation_code                                        as naty," +
+            " (select wjw_code from zd_nation_code where code =  b.nation_code)   as naty/*民族*/,\n" +
             "       '01'                                                 as patnRlts," +
             "       a.adress                                             as conerAddr," +
-            "       '1'                                                  as hiPaymtd " +
+            "       '1'                                                  as hiPaymtd, " +
+            "       cast(fund_pay_sumamt as decimal(16,2)) as  fund_pay_sumamt," +
+            "       cast(maf_pay as decimal(16,2)) as maf_pay  " +
             "from mz_patient_mi a " +
             "         left join " +
             "     a_patient_mi b on (a.patient_id = b.mz_no) " +

+ 3 - 3
src/main/java/thyyxxk/webserver/entity/datamodify/SelectValueObject.java

@@ -31,17 +31,17 @@ public class SelectValueObject {
 
     }
 
-    public Map<String, String> getValue() {
+    public String getValue() {
         if (StringUtil.isBlank(value)) {
             return null;
         }
         Map<String, String> map = new HashMap<>(2);
         map.put("value", value);
         map.put("label", label);
-        return map;
+        return JSON.toJSONString(map);
     }
 
-    public String getKey() {
+    public String getId() {
         return value;
     }
 }

+ 8 - 3
src/main/java/thyyxxk/webserver/entity/medicalinsurance/setllistupld/PayinfoUpld.java

@@ -8,19 +8,24 @@ import java.math.BigDecimal;
 
 /**
  * 基金支付信息
- * */
+ */
 @Data
 public class PayinfoUpld implements Serializable {
     private static final long serialVersionUID = -5902819820011916088L;
     /**
      * 基金支付类型
-     * */
+     */
     @JSONField(name = "fund_pay_type")
     private String fundPayType;
 
     /**
      * 基金支付金额
-     * */
+     */
     @JSONField(name = "fund_payamt")
     private String fundPayamt;
+
+    public PayinfoUpld(String fundPayType, String fundPayamt) {
+        this.fundPayamt = fundPayamt;
+        this.fundPayType = fundPayType;
+    }
 }

+ 8 - 0
src/main/java/thyyxxk/webserver/entity/medicalinsurance/setllistupld/SetlinfoUpld.java

@@ -485,6 +485,14 @@ public class SetlinfoUpld implements Serializable {
     @JSONField(name = "stas_type")
     private String stasType;
 
+    /**
+     * 医保统筹基金支付
+     */
+    private String fundPaySumamt;
 
+    /**
+     * 医疗救助
+     */
+    private String mafPay;
 
 }

+ 11 - 1
src/main/java/thyyxxk/webserver/entity/medicalinsurance/setllistupldTemp/SetlinfoUpldTemp.java

@@ -117,7 +117,6 @@ public class SetlinfoUpldTemp {
     /**
      * 民族
      */
-    @JSONField(name = "naty")
     private String natyName;
 
     /**
@@ -566,4 +565,15 @@ public class SetlinfoUpldTemp {
     @JSONField(name = "stas_type")
     private String stasType;
 
+
+    /**
+     * 医保统筹基金支付
+     */
+    private String fundPaySumamt;
+
+    /**
+     * 医疗救助
+     */
+    private String mafPay;
+
 }

+ 12 - 7
src/main/java/thyyxxk/webserver/service/medicalinsurance/SetlListUpldService.java

@@ -227,7 +227,7 @@ public class SetlListUpldService {
         setlinfoUpld.setHiSetlLv("3");
 
         String setlId = setlinfoUpld.getSetlId();
-        List<IteminfoUpld> amtAndOthAmt = dao.amtAndOthAmt(setlId);
+        List<IteminfoUpld> amtAndOthAmt = dao.totalCost(setlId);
         if (ListUtil.isBlank(amtAndOthAmt)) {
             ResultVo<String> chrgitems = getChrgitems(patNo, setlId, setlinfoUpld.getMdtrtId(), setlinfoUpld.getInsuplc());
             if (chrgitems.getCode() != 200) {
@@ -239,9 +239,11 @@ public class SetlListUpldService {
         setlinfoUpld.setBillCode("143001913350");
         setlinfoUpld.setBizSn(SnowFlakeId.instance().nextId());
         // 甲类费用
-        Map<String, IteminfoUpld> jiaLeiFeiYong = dao.jiaLeiFeiYong(setlId).stream().collect(Collectors.toMap(IteminfoUpld::getMedChrgitm, a -> a, (k1, k2) -> k1));
+        Map<String, IteminfoUpld> jiaLeiFeiYong = dao.aAndBFees(setlId, "01", "claaSumfee").stream().collect(Collectors.toMap(IteminfoUpld::getMedChrgitm, a -> a, (k1, k2) -> k1));
         // 乙类费用
-        Map<String, IteminfoUpld> yiLeiFeiYong = dao.yiLeiFeiYong(setlId).stream().collect(Collectors.toMap(IteminfoUpld::getMedChrgitm, a -> a, (k1, k2) -> k1));
+        Map<String, IteminfoUpld> yiLeiFeiYong = dao.aAndBFees(setlId, "02", "clabAmt").stream().collect(Collectors.toMap(IteminfoUpld::getMedChrgitm, a -> a, (k1, k2) -> k1));
+        // 自费
+        Map<String, IteminfoUpld> fulamtOwnpayAmt = dao.fulamtOwnpayAmt(setlId).stream().collect(Collectors.toMap(IteminfoUpld::getMedChrgitm, a -> a, (k1, k2) -> k1));
         if (ListUtil.notBlank(amtAndOthAmt)) {
             for (IteminfoUpld item : amtAndOthAmt) {
                 String key = item.getMedChrgitm();
@@ -251,6 +253,9 @@ public class SetlListUpldService {
                 if (yiLeiFeiYong.containsKey(key)) {
                     item.setClabAmt(yiLeiFeiYong.get(key).getClabAmt());
                 }
+                if (fulamtOwnpayAmt.containsKey(key)) {
+                    item.setFulamtOwnpayAmt(fulamtOwnpayAmt.get(key).getFulamtOwnpayAmt());
+                }
                 String a = DecimalUtil.minus(item.getAmt(), item.getClaaSumfee());
                 a = DecimalUtil.minus(a, item.getClabAmt());
                 a = DecimalUtil.minus(a, item.getFulamtOwnpayAmt());
@@ -263,14 +268,15 @@ public class SetlListUpldService {
                     item.setFulamtOwnpayAmt(DecimalUtil.add(item.getFulamtOwnpayAmt(), item.getOthAmt()));
                     item.setOthAmt("0.00");
                 }
-                if (item.getOthAmt() == null) {
-                    item.setOthAmt("0.00");
-                }
             }
         }
         // 重症监护时间
         List<IcuinfoUpld> zhongZhenJianHu = getIcuinfoUplds(patNo, times);
         List<PayinfoUpld> payinfo = dao.payinfoUpld(patNo, times, ledgerSn);
+
+        // 310100
+
+
         List<DiseinfoUpld> diseinfos = dao.diseinfo(patNo, times, flag == 1 ? "zy_dis_diag_yb_modify" : "zy_dis_diag_yb");
         setlinfoUpld.setDiagCodeCnt(String.valueOf(diseinfos.size()));
 
@@ -287,7 +293,6 @@ public class SetlListUpldService {
             setlinfoUpld.setHiPaymtd("1");
         }
 
-
         UpldCollection upldCollection = new UpldCollection();
         // 患者的基本信息
         upldCollection.setSetlinfo(setlinfoUpld);