Browse Source

优化医保支付方式的计算。

lighter 3 years ago
parent
commit
79b85fd96e

+ 1 - 4
src/main/java/thyyxxk/webserver/controller/medicalinsurance/SiZyController.java

@@ -1,10 +1,7 @@
 package thyyxxk.webserver.controller.medicalinsurance;
 
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import thyyxxk.webserver.config.auth.PassToken;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.medicalinsurance.inpatient.ZyPatientInfo;

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

@@ -4,6 +4,7 @@ import org.apache.ibatis.annotations.*;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.dictionary.PureCodeName;
 import thyyxxk.webserver.entity.medicalinsurance.query.*;
+import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetlinfo;
 import thyyxxk.webserver.entity.medicalinsurance.setlinfo.TimesList;
 import thyyxxk.webserver.entity.medicalinsurance.setllist.BrfChrgitm;
 import thyyxxk.webserver.entity.medicalinsurance.setllist.InptntSetlmtLst;
@@ -436,4 +437,7 @@ public interface SiQueryDao {
                                            @Param("endTime") String endTime,
                                            @Param("name") String name,
                                            @Param("certno") String certno);
+
+    @Select("select * from t_si_setlinfo where hi_paymtd is null")
+    List<SiSetlinfo> test2();
 }

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

@@ -52,7 +52,7 @@ 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.ipt_med_type, a.hi_paymtd " +
             "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);
 
@@ -88,7 +88,8 @@ public interface UpIdCollectionDao {
     SiPatInfo huoQuZhiFuFangShi(@Param("patNo") String patNo, @Param("times") Integer times, @Param("ledgerSn") Integer ledgerSn);
 
     @Update("update t_si_setlinfo set hi_paymtd = #{hiPaymtd} where pat_no = #{patNo} and times = #{times} and ledger_sn = #{ledgerSn}")
-    void genXingYiBaoZhiFuFangShi(@Param("patNo") String patNo, @Param("times") Integer times, @Param("ledgerSn") Integer ledgerSn, @Param("hiPaymtd") Integer hiPaymtd);
+    void genXingYiBaoZhiFuFangShi(@Param("patNo") String patNo, @Param("times") Integer times, @Param("ledgerSn") Integer ledgerSn,
+                                  @Param("hiPaymtd") Integer hiPaymtd);
 
     @Select("select receipt_no from zy_receipt where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn} and receipt_no<>'0000000'" + "and receipt_sn = 1")
     String billNo(@Param("patNo") String patNo, @Param("times") Integer times, @Param("ledgerSn") Integer ledgerSn);

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

@@ -273,6 +273,11 @@ public class SiSetlinfo implements Serializable {
 	 * */
 	private Date endtime;
 
+	/**
+	 * 医保支付方式
+	 * */
+	private Integer hiPaymtd;
+
 	@TableField(exist = false)
 	private String gendName;
 	@TableField(exist = false)

+ 0 - 40
src/main/java/thyyxxk/webserver/service/medicalinsurance/SetlListUpldService.java

@@ -26,7 +26,6 @@ import thyyxxk.webserver.entity.medicalinsurance.inpatient.YbZyDisDiag;
 import thyyxxk.webserver.entity.medicalinsurance.inpatient.ZyDisDiagYb;
 import thyyxxk.webserver.entity.medicalinsurance.inpatient.ZyInactpatient;
 import thyyxxk.webserver.entity.medicalinsurance.log.SiLog;
-import thyyxxk.webserver.entity.medicalinsurance.query.SiPatInfo;
 import thyyxxk.webserver.entity.medicalinsurance.query.SiSetlFeeDetl;
 import thyyxxk.webserver.entity.medicalinsurance.setllistupld.*;
 import thyyxxk.webserver.entity.medicalinsurance.setllistupldTemp.*;
@@ -208,9 +207,6 @@ public class SetlListUpldService {
         // 因为我们是三级医院 所以就是三
         setlinfoUpld.setHiSetlLv("3");
 
-        // TODO: 2021/12/17 住院医疗类型 不知道
-        // setlinfoUpld.setIptMedType("1");
-
         String setlId = setlinfoUpld.getSetlId();
         List<IteminfoUpld> amtAndOthAmt = dao.amtAndOthAmt(setlId);
         if (ListUtil.isBlank(amtAndOthAmt)) {
@@ -292,8 +288,6 @@ public class SetlListUpldService {
 //        if (ListUtil.notBlank(amtAndOthAmt)) {
 //            amtAndOthAmt.sort(Comparator.comparing(IteminfoUpld::getMedChrgitm));
 //        }
-        // 计算医保的支付方式
-        setlinfoUpld.setHiPaymtd(yiBaoZhiFuFangShi(patNo, times, ledgerSn));
         //  基金支付信息
         upldCollection.setPayinfo(payinfo);
         // 门特慢特病诊断信息 目前还没有
@@ -309,39 +303,6 @@ public class SetlListUpldService {
         return ResultVoUtil.success(upldCollection);
     }
 
-    public String yiBaoZhiFuFangShi(String patNo, Integer times, Integer ledgerSn) {
-        SiPatInfo patInfo = dao.huoQuZhiFuFangShi(patNo, times, ledgerSn);
-        String hiPaymtd = "3";
-        String insuplcAdmdvs = patInfo.getInsuplcAdmdvs();
-        String insutype = patInfo.getInsutype();
-        String medType = patInfo.getMedType();
-        // 参保地
-        List<String> chanBaoDi = new ArrayList<>();
-        chanBaoDi.add("430121");
-        chanBaoDi.add("430181");
-        //  医疗保障类型
-        List<String> mdcsType = new ArrayList<>();
-        mdcsType.add("340");
-        mdcsType.add("350");
-        // 险种类型
-        List<String> insutypeList = new ArrayList<>();
-        insutypeList.add("340");
-        insutypeList.add("350");
-        if (medType.equals("2101") || medType.equals("22")) {
-            if (!insuplcAdmdvs.startsWith("4301") || chanBaoDi.contains(insuplcAdmdvs) || mdcsType.contains(insuplcAdmdvs) || insutypeList.contains(insutype)) {
-                hiPaymtd = "1";
-            }
-        }
-        if (medType.equals("2106") || medType.equals("2107") || medType.equals("52")) {
-            hiPaymtd = "7";
-        }
-        if (medType.equals("2102")) {
-            hiPaymtd = "2";
-        }
-        dao.genXingYiBaoZhiFuFangShi(patNo, times, ledgerSn, Integer.parseInt(hiPaymtd));
-        return hiPaymtd;
-    }
-
     /**
      * 这里是获取打印结算单的信息,需要重新分装一下
      *
@@ -859,7 +820,6 @@ public class SetlListUpldService {
                 if (item.getSsrq() == null) {
                     return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "手术日期不能为空。");
                 }
-                log.info("item:{}", item);
                 if (StringUtil.isBlank(item.getSsys())) {
                     return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "手术医生不能为空");
                 }

+ 24 - 1
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiZyService.java

@@ -22,6 +22,7 @@ import thyyxxk.webserver.service.externalhttp.SiZySrvc;
 import thyyxxk.webserver.service.yibao.DismissService;
 import thyyxxk.webserver.utils.*;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -442,7 +443,6 @@ public class SiZyService {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
         }
         if (infcode == 0) {
-            setlListUpldService.yiBaoZhiFuFangShi(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
             JSONObject setlinfo = result.getJSONObject(OUTPUT).getJSONObject("setlinfo");
             SiSetlinfo setlEntity = JSONObject.parseObject(setlinfo.toJSONString(), SiSetlinfo.class);
             setlEntity.setPatNo(p.getInpatientNo());
@@ -454,6 +454,7 @@ public class SiZyService {
             setlEntity.setInsuplcAdmdvs(preSetlmt.getInsuplcAdmdvs());
             setlEntity.setBegntime(begntime);
             setlEntity.setEndtime(p.getDismissDate());
+            setlEntity.setHiPaymtd(calculateHiPaymtd(preSetlmt.getInsuplcAdmdvs(), setlEntity.getInsutype(), setlEntity.getMedType()));
             setlinfodao.insert(setlEntity);
             setlinfodao.updateSiZyInfoSetlId(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn(),
                     setlEntity.getSetlId(), setlEntity.getMedinsSetlId(), input.getString("msgid"));
@@ -490,6 +491,28 @@ public class SiZyService {
         return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
     }
 
+    private int calculateHiPaymtd(String insuplcAdmdvs, String insutype, String medType) {
+        int hiPaymtd = 3;
+        List<String> insuplcAdmdvses = new ArrayList<>();
+        insuplcAdmdvses.add("430121");
+        insuplcAdmdvses.add("430181");
+        List<String> insutypes = new ArrayList<>();
+        insutypes.add("340");
+        insutypes.add("350");
+        if (medType.equals("2101") || medType.equals("22")) {
+            if (!insuplcAdmdvs.startsWith("4301") || insuplcAdmdvses.contains(insuplcAdmdvs) || insutypes.contains(insutype)) {
+                hiPaymtd = 1;
+            }
+        }
+        if (medType.equals("2106") || medType.equals("2107") || medType.equals("52")) {
+            hiPaymtd = 7;
+        }
+        if (medType.equals("2102")) {
+            hiPaymtd = 2;
+        }
+        return hiPaymtd;
+    }
+
     public ResultVo<String> revokeSettlement(ZyPatientInfo p) {
         SiPatInfo siPatInfo = qrydao.selectSiPatInfoForZy(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
         if (null == p.getStaffId()) {