Browse Source

移动医保支付结算单

lighter 1 year ago
parent
commit
1a1e35f7b9

+ 0 - 3
pom.xml

@@ -223,7 +223,6 @@
             <version>8.1.3.140</version>
         </dependency>
 
-
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-redis</artifactId>
@@ -242,8 +241,6 @@
             <artifactId>reflections</artifactId>
             <version>0.10.2</version>
         </dependency>
-
-
     </dependencies>
     <build>
         <plugins>

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

@@ -72,7 +72,7 @@ public class SiMzController {
 
     @PostMapping("/getHistoryReceiptDetail")
     public ResultVo<Map<String, Object>> getHistoryReceiptDetail(@RequestBody MzDepositFile depositFile) {
-        return service.getHistoryReceiptDetail(depositFile);
+        return ResultVoUtil.success(service.getHistoryReceiptDetail(depositFile));
     }
 
     @PassToken

+ 1 - 1
src/main/java/thyyxxk/webserver/controller/view/Patient360Controller.java

@@ -107,7 +107,7 @@ public class Patient360Controller {
 
     @PostMapping("/mz/getHistoryReceiptDetail")
     public ResultVo<Map<String, Object>> getHistoryReceiptDetail(@RequestBody MzDepositFile mzDepositFile) {
-        return siMzService.getHistoryReceiptDetail(mzDepositFile);
+        return ResultVoUtil.success(siMzService.getHistoryReceiptDetail(mzDepositFile));
     }
 
 

+ 6 - 1
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiMzDao.java

@@ -39,12 +39,17 @@ public interface SiMzDao {
             "doctorName=(select rtrim(name) from a_employee_mi where code=a.doctor_code), " +
             "doctorYbCode=(select rtrim(yb_code) from a_employee_mi where code=a.doctor_code), " +
             "icdText=case when nullif(a.icd_code_new,'') is null then rtrim(a.icd_text) else rtrim(a.icd_text_new) end, " +
-            "settledFlag=(select count(1) from t_si_setlinfo where pat_no=#{patientId} and times=#{times} and revoked=0), " +
             "admdvs=(select insuplc_admdvs from t_si_pat_info where pat_no=#{patientId} and times=#{times} and ledger_sn=0) " +
             "FROM mz_visit_table a, mz_patient_mi b " +
             "WHERE a.patient_id=#{patientId} AND a.times=#{times} and a.patient_id=b.patient_id")
     MzVisit selectMzVisit(String patientId, int times);
 
+    @Select("select count(1) from t_si_setlinfo where pat_no=#{patNo} and times=#{times} and revoked=0")
+    int selectSiCount(String patNo, int times);
+
+    @Select("select count(1) from powersi_mip_setlinfo where med_org_ord=#{hisOrdNum} and ord_state='SETTLED'")
+    int selectMipayCount(String hisOrdNum);
+
     @Select("select count(1) from t_mt_receipt where patient_id=#{patientId} and times=#{times} and " +
             "receipt_no=#{receiptNo} and order_no=#{orderNo}")
     int selectFeeCount(String patientId, int times, int receiptNo, int orderNo);

+ 59 - 103
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiQueryDao.java

@@ -1,8 +1,8 @@
 package thyyxxk.webserver.dao.his.medicalinsurance;
 
 import org.apache.ibatis.annotations.*;
-import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.dictionary.CodeName;
+import thyyxxk.webserver.entity.markmtfees.MzVisit;
 import thyyxxk.webserver.entity.medicalinsurance.query.*;
 import thyyxxk.webserver.entity.medicalinsurance.setlinfo.TimesList;
 import thyyxxk.webserver.entity.medicalinsurance.setllist.BrfChrgitm;
@@ -24,8 +24,7 @@ public interface SiQueryDao {
 
     @Select("select isnull(max(ledger_sn), isnull(min(ledger_sn), 1)) from zy_ledger_file where " +
             "inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes}")
-    Integer selectMaxLedgerSn(@Param("inpatientNo") String inpatientNo,
-                              @Param("admissTimes") int admissTimes);
+    Integer selectMaxLedgerSn(String inpatientNo, int admissTimes);
 
     /**
      * 查询门诊患者的身份证和姓名
@@ -35,7 +34,7 @@ public interface SiQueryDao {
      */
     @Select("select rtrim(social_no) as socialNo,rtrim(name) as name,times, " +
             "rtrim(certificate_type) as psnCertType from mz_patient_mi where patient_id=#{patNo}")
-    QryPsnBsInfo selectMzSocialAndName(@Param("patNo") String patNo);
+    QryPsnBsInfo selectMzSocialAndName(String patNo);
 
     /**
      * 是否已保存过此患者的医保基本信息
@@ -47,9 +46,7 @@ public interface SiQueryDao {
      */
     @Select("select count(1) from t_si_pat_info where pat_no=#{inpatientNo} " +
             "and times=#{admissTimes} and ledger_sn=#{ledgerSn}")
-    int selectSiZyInfoCount(@Param("inpatientNo") String inpatientNo,
-                            @Param("admissTimes") int admissTimes,
-                            @Param("ledgerSn") int ledgerSn);
+    int selectSiZyInfoCount(String inpatientNo, int admissTimes, int ledgerSn);
 
     /**
      * 新增患者的医保基本信息(个人编码)
@@ -75,13 +72,14 @@ public interface SiQueryDao {
     void updateZyActpatient(PsnBaseInfo psnBaseInfo);
 
     @Update("update t_si_pat_info set psn_idet_type=#{psnIdetType} where psn_no=#{psnNo} ")
-    void updatePsnIdetType(@Param("psnIdetType") String psnIdetType,
-                           @Param("psnNo") String psnNo);
-
+    void updatePsnIdetType(String psnIdetType, String psnNo);
 
     @Select("select * from t_si_pat_info where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn}")
-    SiPatInfo selectSiPatInfo(@Param("patNo") String patNo, @Param("times") int times, @Param("ledgerSn") int ledgerSn);
+    SiPatInfo selectSiPatInfo(String patNo, int times, int ledgerSn);
 
+    @Select("select psn_no,insu_code as insuplc_admdvs from powersi_mip_setlinfo " +
+            "where med_org_ord=#{hisOrdNum} and ord_state='SETTLED'")
+    SiPatInfo selectSiPatInfo2(String hisOrdNum);
 
     /**
      * 获取患者的医保个人编号
@@ -90,10 +88,10 @@ public interface SiQueryDao {
      * @return 患者的医保个人编号
      */
     @Select("select top 1 psn_no from t_si_pat_info where pat_no=#{patNo} order by times desc")
-    String selectPsnNo(@Param("patNo") String patNo);
+    String selectPsnNo(String patNo);
 
     @Select("select * from t_si_pat_info where mdtrt_id=#{mdtrtId}")
-    SiPatInfo selectSiPatInfoByMdtrtId(@Param("mdtrtId") String mdtrtId);
+    SiPatInfo selectSiPatInfoByMdtrtId(String mdtrtId);
 
     /**
      * 获取患者的医保个人编号
@@ -104,8 +102,7 @@ public interface SiQueryDao {
      */
     @Select("select top 1 insuplc_admdvs as code, psn_no as name from t_si_pat_info where pat_no=#{patNo} and med_type=#{medType} " +
             "and insuplc_admdvs is not null ")
-    CodeName selectPsnNoByPatNoAndMedType(@Param("patNo") String patNo,
-                                          @Param("medType") String medType);
+    CodeName selectPsnNoByPatNoAndMedType(String patNo, String medType);
 
     /**
      * 取消入院登记后清空就诊id
@@ -116,33 +113,30 @@ public interface SiQueryDao {
      */
     @Update("update t_si_pat_info set mdtrt_id=#{nullCtnt}, adm_reg_msgid=#{nullCtnt}, setl_id=#{nullCtnt} " +
             "where pat_no=#{inpatientNo} and times=#{admissTimes} and ledger_sn=#{ledgerSn}")
-    void clearMdtrtIdForZy(@Param("inpatientNo") String inpatientNo,
-                           @Param("admissTimes") int admissTimes,
-                           @Param("ledgerSn") int ledgerSn,
-                           @Param("nullCtnt") String nullCtnt);
+    void clearMdtrtIdForZy(String inpatientNo, int admissTimes, int ledgerSn, String nullCtnt);
 
     @Select("select psn_cert_type from a_patient_mi where inpatient_no=#{patNo}")
-    String selectPsnCertType(@Param("patNo") String patNo);
+    String selectPsnCertType(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);
+    String selectPsnCertTypeBoSocialNo(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);
+    String selectSetlId(String patNo, int times, int ledgerSn);
 
     @Select("select top 1 insuplc_admdvs from t_si_pat_info where pat_no=#{patNo} and times=#{times} " +
             "and insuplc_admdvs is not null order by ledger_sn desc")
-    String selectAdmdvs(@Param("patNo") String patNo, @Param("times") int times);
+    String selectAdmdvs(String patNo, int times);
 
     @Select("select top 1 insuplc_admdvs from t_si_pat_info where pat_no=#{patNo} and insuplc_admdvs is not null order by times desc")
-    String selectAdmdvsByPatNo(@Param("patNo") String patNo);
+    String selectAdmdvsByPatNo(String patNo);
 
     @Select("select top 1 insuplc_admdvs from t_si_pat_info where psn_no=#{psnNo} and insuplc_admdvs is not null order by times desc")
-    String selectAdmdvsByPsnNo(@Param("psnNo") String psnNo);
+    String selectAdmdvsByPsnNo(String psnNo);
 
     @Select("select top 1 insuplc_admdvs from t_si_pat_info where pat_no=#{patNo} and psn_no=#{psnNo} " +
             "and insuplc_admdvs is not null order by times desc")
-    String selectAdmdvsByPatNoAndPsnNo(@Param("patNo") String patNo, @Param("psnNo") String psnNo);
+    String selectAdmdvsByPatNoAndPsnNo(String patNo, String psnNo);
 
     @Select("select a.mdtrt_id,a.psn_name,a.gend,a.age,a.psn_no,b.emp_name,a.psn_type,a.cvlserv_flag,a.pat_no," +
             "a.setl_id,b.insuplc_admdvs,a.med_type,a.setl_time,a.hifes_pay,a.insutype, " +
@@ -158,7 +152,7 @@ public interface SiQueryDao {
             "from t_si_setlinfo a, t_si_pat_info b, ${table} c where a.setl_id=#{setlId} " +
             "and a.pat_no=b.pat_no and a.times=b.times and a.ledger_sn=b.ledger_sn and a.pat_no=c.inpatient_no " +
             "and a.times=c.admiss_times")
-    InptntSetlmtLst selectZySetlinfo(@Param("setlId") String setlId, @Param("table") String table);
+    InptntSetlmtLst selectZySetlinfo(String setlId, String table);
 
     @Select("select a.mdtrt_id,a.psn_name,a.gend,a.age,a.psn_no,b.emp_name,a.psn_type,a.cvlserv_flag,a.pat_no, " +
             "a.setl_id,b.insuplc_admdvs,a.med_type,a.setl_time,a.hifes_pay,a.insutype, " +
@@ -174,7 +168,7 @@ public interface SiQueryDao {
             "from t_si_setlinfo a, t_si_pat_info b, mz_visit_table c where a.setl_id=#{setlId} " +
             "and a.pat_no=b.pat_no and a.times=b.times and a.ledger_sn=b.ledger_sn and a.pat_no=c.patient_id " +
             "and a.times=c.times")
-    InptntSetlmtLst selectJzSetlinfo(@Param("setlId") String setlId);
+    InptntSetlmtLst selectJzSetlinfo(String setlId);
     
     @Select("select a.mdtrt_id,a.setl_id,a.psn_name,a.gend,a.age,a.cvlserv_flag,a.psn_type,a.pat_no,a.setl_time, " +
             "b.dise_name,b.emp_name,a.certno,a.med_type,b.dise_code,a.medfee_sumamt,a.psn_no,a.begntime, " +
@@ -188,23 +182,33 @@ public interface SiQueryDao {
             "from t_si_setlinfo a, t_si_pat_info b where a.pat_no=#{patNo} " +
             "and a.times=#{times} and isnull(a.revoked,0)!=1 " +
             "and a.pat_no=b.pat_no and a.times=b.times")
-    OtptntSetlmtLst selectMzSetlifo(@Param("patNo") String patNo,
-                                    @Param("times") int times);
-    
+    OtptntSetlmtLst selectMzSetlifo(String patNo, int times);
+
+    @Select("select hi_ext_data from powersi_mip_setlinfo where med_org_ord=#{hisOrdNum} and ord_state='SETTLED'")
+    String getHiExtData(String hisOrdNum);
+
+    @Select("select isnull(icd_text_new,'') as icdText,visit_date,rtrim(doctor_code) as doctorCode, " +
+            "visitDeptName=(select rtrim(d.name) from zd_unit_code d where d.code=visit_dept_code) " +
+            "from mz_visit_table where patient_id=#{patNo} and times=#{times}")
+    MzVisit getMzVisit(SetlIndex index);
+
     @Select("select charge_fee,med_chrgitm_type,chrgitm_lv from t_mt_receipt where patient_id=#{patNo} " +
             "and times=#{times} and yb_trans_flag=1")
-    List<BrfChrgitm> selectMzBrfChrgitms(@Param("patNo") String patNo,
-                                         @Param("times") int times);
+    List<BrfChrgitm> selectMzBrfChrgitms(String patNo, int times);
 
     @Select("select insuplc_admdvs from t_si_pat_info where mdtrt_id=#{mdtrtId}")
-    String selectInsuplcAdmdvsByMdtrtId(@Param("mdtrtId") String mdtrtId);
+    String selectInsuplcAdmdvsByMdtrtId(String mdtrtId);
 
     @Select("select setl_id,times,ledger_sn,endtime from t_si_setlinfo where pat_no=#{patNo} and revoked=0 " +
             "and setl_type=#{type} order by endtime desc")
-    List<TimesList> fetchSiTimesList(@Param("patNo") String patNo, @Param("type") int type);
+    List<TimesList> fetchSiTimesList(String patNo, int type);
 
+    @Select("select hi_doc_sn as setlId,med_org_ord as hisOrdNum,trace_time as endtime from powersi_mip_setlinfo " +
+            "where med_org_ord like #{patNo} and ord_state='SETTLED' order by trace_time desc")
+    List<TimesList> getMipayTimesList(String patNo);
+    
     @Select("select * from t_si_setl_fee_detl where mdtrt_id=#{mdtrtId}")
-    List<SiSetlFeeDetl> selectAllSetlFeeDtle(@Param("mdtrtId") String mdtrtId);
+    List<SiSetlFeeDetl> selectAllSetlFeeDtle(String mdtrtId);
 
     @Select("select a.feedetl_sn,a.fee_ocur_time,a.cnt,cast(a.pric as decimal(16,2)) as pric," +
             "cast(a.det_item_fee_sumamt as decimal(16,2)) as det_item_fee_sumamt, " +
@@ -216,23 +220,8 @@ public interface SiQueryDao {
             "rtrim(b.charge_code_mx) as medins_list_codg from t_si_setl_fee_detl a, " +
             "zy_detail_charge b where mdtrt_id=#{mdtrtId} and b.inpatient_no=#{patNo}  " +
             "and b.admiss_times=#{times} and b.ledger_sn=#{sn} and b.detail_sn=a.feedetl_sn")
-    List<SiSetlFeeDetl> selectFeeDetlList(@Param("mdtrtId") String mdtrtId,
-                                          @Param("patNo") String patNo,
-                                          @Param("times") int times,
-                                          @Param("sn") int sn);
-
-    @Select("<script>" +
-            "select national_code, national_name " +
-            "from yp_zd_dict " +
-            "where code in " +
-            "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
-            "#{item}" +
-            "</foreach>" +
-            "and national_code is not null" +
-            "</script>")
-    List<GetDropdownBox> getDrugCountryCode(@Param("list") List<String> list);
-
-
+    List<SiSetlFeeDetl> selectFeeDetlList(String mdtrtId, String patNo, int times, int sn);
+    
     @Select("select a.feedetl_sn,b.charge_date as fee_ocur_time,a.cnt," +
             "cast(a.pric as decimal(16,2)) as pric, cast(a.det_item_fee_sumamt as decimal(16,2)) as det_item_fee_sumamt, " +
             "a.selfpay_prop,cast(a.fulamt_ownpay_amt as decimal(16,2)) as fulamt_ownpay_amt, " +
@@ -254,9 +243,7 @@ public interface SiQueryDao {
             "zy_detail_charge b where a.pat_no=#{patNo} and a.times=#{times} and a.ledger_sn=#{sn} " +
             "and a.pat_no=b.inpatient_no and a.times=b.admiss_times and a.ledger_sn=b.ledger_sn " +
             "and a.feedetl_sn=b.detail_sn order by a.feedetl_sn")
-    List<SiSetlFeeDetl> selectTempCharge(@Param("patNo") String patNo,
-                                         @Param("times") int times,
-                                         @Param("sn") int sn);
+    List<SiSetlFeeDetl> selectTempCharge(String patNo, int times, int sn);
 
     @Insert("<script>" +
             "insert into t_si_setl_fee_detl (mdtrt_id, setl_id, feedetl_sn, fee_ocur_time, cnt, pric, " +
@@ -286,11 +273,7 @@ public interface SiQueryDao {
 
     @Update("update t_si_pat_info set mdtrt_id=#{mdtrtId},insutype=#{insutype} where pat_no=#{patNo} " +
             "and times=#{times} and ledger_sn=#{sn}")
-    void updateInhospInfo(@Param("patNo") String patNo,
-                          @Param("times") int times,
-                          @Param("sn") int sn,
-                          @Param("mdtrtId") String mdtrtId,
-                          @Param("insutype") String insutype);
+    void updateInhospInfo(String patNo, int times, int sn, String mdtrtId, String insutype);
 
     @Select("SELECT pat_no, " +
             "   times, " +
@@ -331,10 +314,7 @@ public interface SiQueryDao {
             "  AND setl_time>=#{begntime} " +
             "  AND setl_time<=#{endtime} " +
             "  AND insuplc_admdvs='439900' ")
-    List<BaseSetlStatistics> selectBaseSetlStatisticsInProvinceLevel(@Param("begntime") String begntime,
-                                                                     @Param("endtime") String endtime,
-                                                                     @Param("insutype") String insutype,
-                                                                     @Param("setlType") String setlType);
+    List<BaseSetlStatistics> selectBaseSetlStatisticsInProvinceLevel(String begntime, String endtime, String insutype, String setlType);
 
     @Select("select pat_no,times,ledger_sn,insuplc_admdvs,medfee_sumamt,insutype,hifmi_pay,hifp_pay,cvlserv_pay,setl_list_id,psn_name, " +
             "psn_cash_pay,setl_time,a.med_type,maf_pay,endtime as dis_date,begntime as admiss_date, " +
@@ -357,10 +337,7 @@ public interface SiQueryDao {
             "    and zy.admiss_times = a.times) " +
             "where revoked=0 and setl_type=#{setlType} and insutype like #{insutype} and setl_time>=#{begntime} " +
             "and setl_time<=#{endtime} and insuplc_admdvs not in ('439900','430121','430181') and insuplc_admdvs like '4301%' ")
-    List<BaseSetlStatistics> selectBaseSetlStatisticsInChangshaCity(@Param("begntime") String begntime,
-                                                                    @Param("endtime") String endtime,
-                                                                    @Param("insutype") String insutype,
-                                                                    @Param("setlType") String setlType);
+    List<BaseSetlStatistics> selectBaseSetlStatisticsInChangshaCity(String begntime, String endtime, String insutype, String setlType);
 
     @Select("select pat_no,times,ledger_sn,insuplc_admdvs,medfee_sumamt,insutype,hifmi_pay,hifp_pay,cvlserv_pay,setl_list_id,psn_name, " +
             "psn_cash_pay,setl_time,a.med_type, " +
@@ -386,10 +363,7 @@ public interface SiQueryDao {
             "    and zy.admiss_times = a.times) " +
             "where revoked=0 and setl_type=#{setlType} and insutype like #{insutype} and setl_time>=#{begntime} " +
             "and setl_time<=#{endtime} and insuplc_admdvs='430121' ")
-    List<BaseSetlStatistics> selectBaseSetlStatisticsInChangshaCounty(@Param("begntime") String begntime,
-                                                                      @Param("endtime") String endtime,
-                                                                      @Param("insutype") String insutype,
-                                                                      @Param("setlType") String setlType);
+    List<BaseSetlStatistics> selectBaseSetlStatisticsInChangshaCounty(String begntime, String endtime, String insutype, String setlType);
 
     @Select("select pat_no,times,ledger_sn,insuplc_admdvs,medfee_sumamt,insutype,hifmi_pay,hifp_pay,cvlserv_pay,setl_list_id,psn_name, " +
             "psn_cash_pay,setl_time,a.med_type, " +
@@ -415,10 +389,7 @@ public interface SiQueryDao {
             "    and zy.admiss_times = a.times) " +
             "where revoked=0 and setl_type=#{setlType} and insutype like #{insutype} and setl_time>=#{begntime} " +
             "and setl_time<=#{endtime} and insuplc_admdvs='430181' ")
-    List<BaseSetlStatistics> selectBaseSetlStatisticsInLiuYangCity(@Param("begntime") String begntime,
-                                                                   @Param("endtime") String endtime,
-                                                                   @Param("insutype") String insutype,
-                                                                   @Param("setlType") String setlType);
+    List<BaseSetlStatistics> selectBaseSetlStatisticsInLiuYangCity(String begntime, String endtime, String insutype, String setlType);
 
     @Select("select pat_no,times,ledger_sn,insuplc_admdvs,medfee_sumamt,insutype,hifmi_pay,hifp_pay,cvlserv_pay,setl_list_id,psn_name, " +
             "psn_cash_pay,setl_time,a.med_type, " +
@@ -444,10 +415,7 @@ public interface SiQueryDao {
             "    and zy.admiss_times = a.times) " +
             "where revoked=0 and setl_type=#{setlType} and insutype like #{insutype} and setl_time>=#{begntime} " +
             "and setl_time<=#{endtime} and insuplc_admdvs!='439900' and insuplc_admdvs like '43%' and insuplc_admdvs not like '4301%' ")
-    List<BaseSetlStatistics> selectBaseSetlStatisticsInProvinceOtherCities(@Param("begntime") String begntime,
-                                                                           @Param("endtime") String endtime,
-                                                                           @Param("insutype") String insutype,
-                                                                           @Param("setlType") String setlType);
+    List<BaseSetlStatistics> selectBaseSetlStatisticsInProvinceOtherCities(String begntime, String endtime, String insutype, String setlType);
 
     @Select("select pat_no,times,ledger_sn,insuplc_admdvs,medfee_sumamt,insutype,hifmi_pay,hifp_pay,cvlserv_pay,setl_list_id,psn_name, " +
             "psn_cash_pay,setl_time,a.med_type, " +
@@ -473,10 +441,7 @@ public interface SiQueryDao {
             "    and zy.admiss_times = a.times) " +
             "where revoked=0 and setl_type=#{setlType} and insutype like #{insutype} and setl_time>=#{begntime} " +
             "and setl_time<=#{endtime} and insuplc_admdvs!='439900' and insuplc_admdvs not like '43%' ")
-    List<BaseSetlStatistics> selectBaseSetlStatisticsOutProvince(@Param("begntime") String begntime,
-                                                                 @Param("endtime") String endtime,
-                                                                 @Param("insutype") String insutype,
-                                                                 @Param("setlType") String setlType);
+    List<BaseSetlStatistics> selectBaseSetlStatisticsOutProvince(String begntime, String endtime, String insutype, String setlType);
 
     @Select("select pat_no,times,ledger_sn,insuplc_admdvs,medfee_sumamt,insutype,hifmi_pay,hifp_pay,cvlserv_pay,setl_list_id,psn_name, " +
             "psn_cash_pay,setl_time,a.med_type, " +
@@ -502,27 +467,22 @@ public interface SiQueryDao {
             "    and zy.admiss_times = a.times) " +
             "where revoked=0 and setl_type=#{setlType} and insutype like #{insutype} and setl_time>=#{begntime} " +
             "and setl_time<=#{endtime} ")
-    List<BaseSetlStatistics> selectBaseSetlStatisticsInAllPlaces(@Param("begntime") String begntime,
-                                                                 @Param("endtime") String endtime,
-                                                                 @Param("insutype") String insutype,
-                                                                 @Param("setlType") String setlType);
+    List<BaseSetlStatistics> selectBaseSetlStatisticsInAllPlaces(String begntime, String endtime, String insutype, String setlType);
 
     @Select("select code=(select b.name from t_region b where b.code=a.parent_code),a.name from t_region a where code=#{code}")
-    CodeName selectAdmdvsNameAndParentName(@Param("code") String code);
+    CodeName selectAdmdvsNameAndParentName(String code);
 
     @Select("select name,code='' from t_si_admdvs where code=#{code}")
-    CodeName selectAdmdvsName(@Param("code") String code);
+    CodeName selectAdmdvsName(String code);
 
     @Select("select count(1) from zy_ledger_file where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn>0 ")
-    Integer selectLedgerCount(@Param("patNo") String patNo,
-                              @Param("times") int times);
+    Integer selectLedgerCount(String patNo, int times);
 
     @Select("select max(account_date) from zy_ledger_file where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn>0")
-    Date selectMaxLedgerAccountDate(@Param("patNo") String patNo,
-                                    @Param("times") int times);
+    Date selectMaxLedgerAccountDate(String patNo, int times);
 
     @Select("select yb_register_date from zy_actpatient where inpatient_no=#{patNo}")
-    Date selectRegisterDate(@Param("patNo") String patNo);
+    Date selectRegisterDate(String patNo);
 
     @Select("<script>" +
             "select                     " +
@@ -563,17 +523,13 @@ public interface SiQueryDao {
             "and certno = '' /*身份证号码*/" +
             "</if>" +
             "</script>")
-    List<ZyActpatient> zaiYuanHuanZheXinXi(@Param("patNo") String patNo,
-                                           @Param("startTime") String startTime,
-                                           @Param("endTime") String endTime,
-                                           @Param("name") String name,
-                                           @Param("certno") String certno);
+    List<ZyActpatient> zaiYuanHuanZheXinXi(String patNo, String startTime, String endTime, String name, String certno);
 
     @Select("select count(1) from t_si_cum_info where setl_id=#{setlId}")
-    int selectCumInfoCount(@Param("setlId") String setlId);
+    int selectCumInfoCount(String setlId);
 
     @Select("select * from t_si_cum_info where setl_id=#{setlId}")
-    CuminfoInYear selectCumInfo(@Param("setlId") String setlId);
+    CuminfoInYear selectCumInfo(String setlId);
 
     @Insert("insert into t_si_cum_info (setl_id, year_big_dss_legal_fee, year_admtimes_zy, year_admtimes_mz, " +
             "year_period_fee_sum_zy, year_period_fee_sum_mz, year_medfee_sum_zy, year_medfee_sum_mz, year_payed_begnline_zy, " +

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

@@ -20,4 +20,5 @@ public class SetlIndex {
     private Integer ledgerSn;
     private String setlId;
     private String label;
+    private String hisOrdNum;
 }

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

@@ -12,11 +12,16 @@ public class TimesList {
     private Integer ledgerSn;
     private Date endtime;
     private String label;
+    private String hisOrdNum;
 
     public String getLabel() {
         if (null != ledgerSn && ledgerSn > 0) {
             return setlId + "_" + times + "_" + ledgerSn + "_" + DateUtil.formatDatetime(endtime, "yyyyMMddHHmmss");
         }
+        if (null != hisOrdNum && !hisOrdNum.isEmpty()) {
+            String temp = hisOrdNum.replaceAll("_", "^");
+            return setlId + "_" + times + "_" + temp;
+        }
         return setlId + "_" + times + "_" + DateUtil.formatDatetime(endtime, "yyyyMMddHHmmss");
     }
 }

+ 22 - 8
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiMzService.java

@@ -3,7 +3,6 @@ package thyyxxk.webserver.service.medicalinsurance;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.ibatis.annotations.Select;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -47,23 +46,19 @@ import java.util.concurrent.atomic.AtomicInteger;
 public class SiMzService {
     private final SiMzDao dao;
     private final DigitalReceiptDao rxDao;
-    private final ExecService exec;
     private final ThmzSystem thmz;
     private final SiMzSrvc mzSrvc;
     private final SiQueryService qryService;
     private final RedisLikeService redis;
-    private static final String RESULT_CODE = "infcode";
-    private static final String OUTPUT = "output";
     @Value("${si-mz-fee-url}")
     private String siMzFeeUrl;
     @Value("${thmz-api-url}")
     private String thmzApiUrl;
 
     @Autowired
-    public SiMzService(SiMzDao dao, DigitalReceiptDao rxDao, ExecService exec, ThmzSystem thmz, SiMzSrvc mzSrvc, SiQueryService qryService, RedisLikeService redis) {
+    public SiMzService(SiMzDao dao, DigitalReceiptDao rxDao, ThmzSystem thmz, SiMzSrvc mzSrvc, SiQueryService qryService, RedisLikeService redis) {
         this.dao = dao;
         this.rxDao = rxDao;
-        this.exec = exec;
         this.thmz = thmz;
         this.mzSrvc = mzSrvc;
         this.qryService = qryService;
@@ -72,6 +67,11 @@ public class SiMzService {
 
     public ResultVo<String> outpatientRegistration(MzPatientInfo p) {
         p.setStaffId(TokenUtil.getInstance().getTokenUserId());
+        String hisOrdNum = p.getPatNo() + "_" + p.getTimes() + "_" + 1;
+        int mipCount = dao.selectMipayCount(hisOrdNum);
+        if (mipCount > 0) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "患者已进行移动医保支付,请勿重复登记。");
+        }
         return mzSrvc.outpatientRegistration(siMzFeeUrl, p);
     }
 
@@ -170,15 +170,29 @@ public class SiMzService {
         return ResultVoUtil.success(mzChargeList);
     }
 
-    public ResultVo<Map<String, Object>> getHistoryReceiptDetail(MzDepositFile mzDepositFile) {
+    public Map<String, Object> getHistoryReceiptDetail(MzDepositFile mzDepositFile) {
         MzVisit mzVisit = dao.selectMzVisit(mzDepositFile.getPatNo(), mzDepositFile.getTimes());
+        if (null == mzVisit) {
+            throw new BizException(ExceptionEnum.NULL_POINTER, "没有找到患者的就诊信息。");
+        }
+        mzVisit.setSettledFlag(calSettleFlag(mzDepositFile));
         List<MzReceipt> mzReceipts = dao.selectMzCharge(mzDepositFile.getPatNo(),
                 mzDepositFile.getTimes(), mzDepositFile.getReceiptNo());
         mzReceipts.forEach(itm -> itm.setChecked(StringUtil.notBlank(itm.getNationalCode())));
         Map<String, Object> map = new HashMap<>();
         map.put("mzVisit", mzVisit);
         map.put("mzReceipts", mzReceipts);
-        return ResultVoUtil.success(map);
+        return map;
+    }
+
+    private int calSettleFlag(MzDepositFile f) {
+        int siCount = dao.selectSiCount(f.getPatNo(), f.getTimes());
+        if (siCount > 0) {
+            return 1;
+        }
+        String hisOrdNum = f.getPatNo() + "_" + f.getTimes() + "_" + f.getReceiptNo();
+        int mipay = dao.selectMipayCount(hisOrdNum);
+        return mipay == 0 ? 0 : 2;
     }
 
     private MzReceipt fillMzReceipt(Map<String, Object> detail) {

+ 41 - 6
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiQueryService.java

@@ -13,6 +13,7 @@ import thyyxxk.webserver.dao.his.medicalinsurance.SiQueryDao;
 import thyyxxk.webserver.dao.his.medicalinsurance.SiSetlinfoDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.dictionary.CodeName;
+import thyyxxk.webserver.entity.markmtfees.MzVisit;
 import thyyxxk.webserver.entity.medicalinsurance.inpatient.InHspPsnInfo;
 import thyyxxk.webserver.entity.medicalinsurance.outpatient.SpcChrDiseAcct;
 import thyyxxk.webserver.entity.medicalinsurance.query.*;
@@ -855,7 +856,16 @@ public class SiQueryService {
 
     public ResultVo<List<TimesList>> fetchSiTimesList(String patNo, Integer type) {
         List<TimesList> list = dao.fetchSiTimesList(patNo, type);
-        if (null == list || list.isEmpty()) {
+        if (type == 11) {
+            List<TimesList> mipList = dao.getMipayTimesList(patNo + "%");
+            for (TimesList mip : mipList) {
+                String[] arr = mip.getHisOrdNum().split("_");
+                mip.setTimes(Integer.parseInt(arr[1]));
+                mip.setLedgerSn(0);
+                list.add(mip);
+            }
+        }
+        if (list.isEmpty()) {
             return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "此患者没有有效的结算信息。");
         }
         return ResultVoUtil.success(list);
@@ -932,16 +942,23 @@ public class SiQueryService {
         if (null == index.getTimes() && StringUtil.isBlank(index.getLabel())) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "结算条目不能为空!");
         }
+        index.setLedgerSn(0);
         if (StringUtil.notBlank(index.getLabel())) {
             String[] arr = index.getLabel().split("_");
             index.setSetlId(arr[0]);
             index.setTimes(Integer.parseInt(arr[1]));
-            index.setLedgerSn(0);
+            if (arr[2].contains("^")) {
+                index.setHisOrdNum(arr[2].replaceAll("\\^", "_"));
+            }
         } else {
-            index.setLedgerSn(0);
             index.setSetlId(dao.selectSetlId(index.getPatNo(), index.getTimes(), index.getLedgerSn()));
         }
-        SiPatInfo siPatInfo = dao.selectSiPatInfo(index.getPatNo(), index.getTimes(), index.getLedgerSn());
+        SiPatInfo siPatInfo;
+        if (StringUtil.isBlank(index.getHisOrdNum())) {
+            siPatInfo = dao.selectSiPatInfo(index.getPatNo(), index.getTimes(), index.getLedgerSn());
+        } else {
+            siPatInfo = dao.selectSiPatInfo2(index.getHisOrdNum());
+        }
         if (null == siPatInfo) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到此患者的结算信息!");
         }
@@ -949,8 +966,26 @@ public class SiQueryService {
         if (cuminfo.getCode() != ExceptionEnum.SUCCESS.getCode()) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, cuminfo.getMessage());
         }
-        index.setLedgerSn(0);
-        OtptntSetlmtLst lst = dao.selectMzSetlifo(index.getPatNo(), index.getTimes());
+        OtptntSetlmtLst lst;
+        if (StringUtil.isBlank(index.getHisOrdNum())) {
+            lst = dao.selectMzSetlifo(index.getPatNo(), index.getTimes());
+        } else {
+            String hiExtData = dao.getHiExtData(index.getHisOrdNum());
+            if (StringUtil.isBlank(hiExtData)) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到此患者的结算信息!");
+            }
+            MzVisit mzVisit = dao.getMzVisit(index);
+            if (null == mzVisit) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到此患者的就诊信息!");
+            }
+            JSONObject obj = JSONObject.parseObject(hiExtData);
+            JSONObject setlObj = obj.getJSONObject("setlinfo");
+            lst = JSONObject.toJavaObject(setlObj, OtptntSetlmtLst.class);
+            lst.setAdmDeptName(mzVisit.getVisitDeptName());
+            lst.setBegntime(mzVisit.getVisitDate());
+            lst.setDiseName(mzVisit.getIcdText().split(",")[0]);
+            lst.setChfpdrName(mzVisit.getDoctorCode());
+        }
         if (null == lst) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到此患者的结算信息!");
         }

+ 0 - 5
src/main/java/thyyxxk/webserver/utils/TreeUtil.java

@@ -1,14 +1,11 @@
 package thyyxxk.webserver.utils;
 
 import cn.hutool.core.util.ReflectUtil;
-import com.sun.org.apache.regexp.internal.RE;
-import io.lettuce.core.cluster.pubsub.api.async.PubSubAsyncNodeSelection;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.poi.ss.formula.functions.T;
 
 import java.util.*;
 import java.util.stream.Collectors;
@@ -84,7 +81,6 @@ public class TreeUtil {
         return resultList;
     }
 
-
     public static <T> List<T> objectTree(List<T> tempList, TowFunction<T, T> addCallback) {
         return objectTree(tempList, "id", "parentId", addCallback);
     }
@@ -139,5 +135,4 @@ public class TreeUtil {
                 .build();
     }
 
-
 }