瀏覽代碼

Merge branch 'master' of https://172.16.32.165/lighter/web-server

xiaochan 2 年之前
父節點
當前提交
90037dd00f

+ 51 - 0
src/main/java/thyyxxk/webserver/controller/TestController.java

@@ -0,0 +1,51 @@
+package thyyxxk.webserver.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import thyyxxk.webserver.config.auth.PassToken;
+import thyyxxk.webserver.dao.his.MyTestDao;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.dictionary.PureCodeName;
+import thyyxxk.webserver.utils.BaiduMapGeocoderUtil;
+import thyyxxk.webserver.utils.ResultVoUtil;
+
+import java.util.List;
+
+@Slf4j
+@RestController
+@RequestMapping("/test")
+public class TestController {
+    private final MyTestDao dao;
+
+    @Autowired
+    public TestController(MyTestDao dao) {
+        this.dao = dao;
+    }
+
+    @PassToken
+    @GetMapping("/exec")
+    public ResultVo<String> test() {
+        List<PureCodeName> list = dao.selectPatientRawAddress();
+        int total = list.size();
+        int count = 0;
+        for (PureCodeName item : list) {
+            JSONObject cityinfo = BaiduMapGeocoderUtil.getAddressInfoByLngAndLat(item.getName());
+            if (null == cityinfo) {
+                dao.updateLocation(item.getCode(), null, null, "0");
+                continue;
+            }
+            String adcode = cityinfo.getString("adcode");
+            if (null != adcode && !adcode.equals("0") && cityinfo.getString("district") != null) {
+                log.info("【{}】:{}", item.getName(), cityinfo);
+                dao.updateLocation(item.getCode(), null, null, adcode);
+                count += 1;
+            }
+        }
+        String message = String.format("总数据【%d】条,完成【%d】条。", total, count);
+        return ResultVoUtil.success(message);
+    }
+}

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

@@ -116,7 +116,10 @@ public class SiQueryController {
     @PassToken
     @PostMapping("/querySiSetlList")
     public ResultVo querySiSetlList(@RequestBody @Validated SetlIndex index) {
-        return service.querySiSetlList(index);
+        if (index.getType() == 11) {
+            return service.queryOutpatientSetlList(index);
+        }
+        return service.queryInpatientSetlList(index);
     }
 
     @GetMapping("/queryInsuplcAdmdvsByMdtrtId")

+ 19 - 0
src/main/java/thyyxxk/webserver/dao/his/MyTestDao.java

@@ -0,0 +1,19 @@
+package thyyxxk.webserver.dao.his;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+import thyyxxk.webserver.entity.dictionary.PureCodeName;
+
+import java.util.List;
+
+@Mapper
+public interface MyTestDao {
+    @Select("select top 50000 rtrim(inpatient_no) as code, rtrim(isnull(home_street,relation_street)) as name " +
+            "from a_patient_mi where district_code is null and isnull(home_street,relation_street) is not null " +
+            "and inpatient_no not like 'S%' and LEN(home_street)>=10 and inpatient_no not like 'JT%'")
+    List<PureCodeName> selectPatientRawAddress();
+
+    @Update("update a_patient_mi set province_code=#{province},city_code=#{city},district_code=#{district} where inpatient_no=#{patNo}")
+    void updateLocation(String patNo, String province, String city, String district);
+}

+ 9 - 6
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiQueryDao.java

@@ -160,7 +160,7 @@ public interface SiQueryDao {
     String selectAdmdvsByPatNoAndPsnNo(@Param("patNo") String patNo, @Param("psnNo") 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.setl_id,b.insuplc_admdvs,a.med_type,a.setl_time,a.hifes_pay,a.insutype, " +
             "tel=(select rtrim(home_tel) from a_patient_mi where a_patient_mi.inpatient_no=a.pat_no), " +
             "admDeptName=(select rtrim(name) from zd_unit_code where code=isnull(c.zk_ward,c.small_dept)), " +
             "c.bed_no as admBed,a.begntime,a.endtime,a.certno,a.mdtrt_cert_type,b.psn_idet_type, " +
@@ -175,11 +175,14 @@ public interface SiQueryDao {
             "and a.times=c.admiss_times")
     InptntSetlmtLst selectZySetlinfo(@Param("setlId") String setlId, @Param("table") String table);
 
-    @Select("select a.mdtrt_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.hifp_pay,a.acct_pay,a.cvlserv_pay,a.psn_cash_pay,b.insuplc_admdvs, " +
-            "a.hifmi_pay,a.maf_pay,a.hifob_pay,a.oth_pay,a.staff_id,a.hifes_pay, " +
-            "staffName=(select rtrim(name) from a_employee_mi where code=staff_id) " +
+    @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, " +
+            "a.hifp_pay,a.acct_pay,a.cvlserv_pay,a.psn_cash_pay,b.insuplc_admdvs,a.insutype,a.balc, " +
+            "a.hifmi_pay,a.maf_pay,a.hifob_pay,a.oth_pay,a.staff_id,a.hifes_pay,a.psn_cert_type, " +
+            "staffName=(select rtrim(name) from a_employee_mi where code=staff_id),b.psn_idet_type, " +
+            "admDeptName=(select rtrim(name) from zd_unit_code where code=" +
+            "(select t.visit_dept_code from mz_visit_table t where t.patient_id=#{patNo} and t.times=#{times})), " +
+            "tel=(select rtrim(phone_no) from mz_patient_mi where patient_id=#{patNo}) " +
             "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")

+ 69 - 0
src/main/java/thyyxxk/webserver/entity/medicalinsurance/setllist/ChrgItemLvInfo.java

@@ -0,0 +1,69 @@
+package thyyxxk.webserver.entity.medicalinsurance.setllist;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class ChrgItemLvInfo {
+    private BigDecimal westMedFeeSum;
+    private BigDecimal westMedFeeFrst;
+    private BigDecimal westMedFeeScnd;
+    private BigDecimal westMedFeeThrd;
+    private BigDecimal herbalSum;
+    private BigDecimal herbalFrst;
+    private BigDecimal herbalScnd;
+    private BigDecimal herbalThrd;
+    private BigDecimal chnsPtntSum;
+    private BigDecimal chnsPtntFrst;
+    private BigDecimal chnsPtntScnd;
+    private BigDecimal chnsPtntThrd;
+    private BigDecimal clinicSum;
+    private BigDecimal clinicFrst;
+    private BigDecimal clinicScnd;
+    private BigDecimal clinicThrd;
+    private BigDecimal treatSum;
+    private BigDecimal treatFrst;
+    private BigDecimal treatScnd;
+    private BigDecimal treatThrd;
+    private BigDecimal surgerySum;
+    private BigDecimal surgeryFrst;
+    private BigDecimal surgeryScnd;
+    private BigDecimal surgeryThrd;
+    private BigDecimal nursingSum;
+    private BigDecimal nursingFrst;
+    private BigDecimal nursingScnd;
+    private BigDecimal nursingThrd;
+    private BigDecimal sntryMtrlsSum;
+    private BigDecimal sntryMtrlsFrst;
+    private BigDecimal sntryMtrlsScnd;
+    private BigDecimal sntryMtrlsThrd;
+    private BigDecimal examSum;
+    private BigDecimal examFrst;
+    private BigDecimal examScnd;
+    private BigDecimal examThrd;
+    private BigDecimal nrmlTrtmtSum;
+    private BigDecimal nrmlTrtmtFrst;
+    private BigDecimal nrmlTrtmtScnd;
+    private BigDecimal nrmlTrtmtThrd;
+    private BigDecimal inspectSum;
+    private BigDecimal inspectFrst;
+    private BigDecimal inspectScnd;
+    private BigDecimal inspectThrd;
+    private BigDecimal registerSum;
+    private BigDecimal registerFrst;
+    private BigDecimal registerScnd;
+    private BigDecimal registerThrd;
+    private BigDecimal bedfeeSum;
+    private BigDecimal bedfeeFrst;
+    private BigDecimal bedfeeScnd;
+    private BigDecimal bedfeeThrd;
+    private BigDecimal othfeeSum;
+    private BigDecimal othfeeFrst;
+    private BigDecimal othfeeScnd;
+    private BigDecimal othfeeThrd;
+    private BigDecimal allfeeSum;
+    private BigDecimal allfeeFrst;
+    private BigDecimal allfeeScnd;
+    private BigDecimal allfeeThrd;
+}

+ 5 - 202
src/main/java/thyyxxk/webserver/entity/medicalinsurance/setllist/InptntSetlmtLst.java

@@ -33,6 +33,8 @@ public class InptntSetlmtLst {
      * */
     private String setlId;
 
+    private String insutype;
+
     /**
      * 参保区划
      * */
@@ -160,215 +162,16 @@ public class InptntSetlmtLst {
      * */
     private BigDecimal balc;
 
-    /**
-     * 本年住院次数
-     * */
-    private BigDecimal yrAdmtimes;
-
-    /**
-     * 本年度分段计算费用累计
-     * */
-    private BigDecimal yrAcmltvExpsClted;
-
-    /**
-     * 本年度医疗费合计
-     * */
-    private BigDecimal yrMedfeeSumamt;
-
-    /**
-     * 本年度已付起付线
-     * */
-    private BigDecimal yrPayedBegnLine;
-
-    /**
-     * 本年度统筹支付
-     * */
-    private BigDecimal yrFundPaySumamt;
-
-    /**
-     * 本年政策自费(全自费金额 + 超限价自费费用)
-     * */
-    private BigDecimal yrPolicySelfPay;
-
-    /**
-     * 本年度政策自付(先行自付金额)
-     * */
-    private BigDecimal yrPreSelfPay;
-
-    /**
-     * 本年度大额基金支付
-     * */
-    private BigDecimal yrBigAmtFundPay;
-
-    /**
-     * 本年度大病保险合规费用
-     * */
-    private BigDecimal yrBigDssFee;
-
-    /**
-     * 本年度大病保险支付
-     * */
-    private BigDecimal yrBigDssInsPay;
-
-    /**
-     * 本年度医疗救助支付
-     * */
-    private BigDecimal yrMafPay;
-
     /**
      * 补充医疗保险基金支付
      * */
     private BigDecimal hifesPay;
 
-    private BigDecimal westMedFeeSum;
-    private BigDecimal westMedFeeFrst;
-    private BigDecimal westMedFeeScnd;
-    private BigDecimal herbalSum;
-    private BigDecimal herbalFrst;
-    private BigDecimal herbalScnd;
-    private BigDecimal chnsPtntSum;
-    private BigDecimal chnsPtntFrst;
-    private BigDecimal chnsPtntScnd;
-    private BigDecimal clinicSum;
-    private BigDecimal clinicFrst;
-    private BigDecimal clinicScnd;
-    private BigDecimal treatSum;
-    private BigDecimal treatFrst;
-    private BigDecimal treatScnd;
-    private BigDecimal surgerySum;
-    private BigDecimal surgeryFrst;
-    private BigDecimal surgeryScnd;
-    private BigDecimal nursingSum;
-    private BigDecimal nursingFrst;
-    private BigDecimal nursingScnd;
-    private BigDecimal sntryMtrlsSum;
-    private BigDecimal sntryMtrlsFrst;
-    private BigDecimal sntryMtrlsScnd;
-    private BigDecimal examSum;
-    private BigDecimal examFrst;
-    private BigDecimal examScnd;
-    private BigDecimal nrmlTrtmtSum;
-    private BigDecimal nrmlTrtmtFrst;
-    private BigDecimal nrmlTrtmtScnd;
-    private BigDecimal inspectSum;
-    private BigDecimal inspectFrst;
-    private BigDecimal inspectScnd;
-    private BigDecimal registerSum;
-    private BigDecimal registerFrst;
-    private BigDecimal registerScnd;
-    private BigDecimal bedfeeSum;
-    private BigDecimal bedfeeFrst;
-    private BigDecimal bedfeeScnd;
-    private BigDecimal othfeeSum;
-    private BigDecimal othfeeFrst;
-    private BigDecimal othfeeScnd;
-    private BigDecimal allfeeSum;
-    private BigDecimal allfeeFrst;
-    private BigDecimal allfeeScnd;
+    private CuminfoInYear cuminfo;
 
-    /**
-     * 政策项:全自费
-     * */
-    private BigDecimal selfPayPsnAmt;
-    private String selfPayPsnProp;
-    private BigDecimal selfPayFundAmt;
-    private String selfPayFundProp;
-    private BigDecimal selfPaySum;
-
-    /**
-     * 政策项:乙类先自付
-     * */
-    private BigDecimal scndPrePayPsnAmt;
-    private String scndPrePayPsnProp;
-    private BigDecimal scndPrePayFundAmt;
-    private String scndPrePayFundProp;
-    private BigDecimal scndPrePaySum;
-
-    /**
-     * 政策项:超限额自付
-     * */
-    private BigDecimal ovrlmtSelfPayPsnAmt;
-    private String ovrlmtSelfPayPsnProp;
-    private BigDecimal ovrlmtSelfPayFundAmt;
-    private String ovrlmtSelfPayFundProp;
-    private BigDecimal ovrlmtSelfPaySum;
-
-    /**
-     * 政策项:本次应付起付标准
-     * */
-    private BigDecimal begnlinePsnAmt;
-    private String begnlinePsnProp;
-    private BigDecimal begnlineFundAmt;
-    private String begnlineFundProp;
-    private BigDecimal begnlineSum;
-
-    /**
-     * 政策项:统筹一段
-     * */
-    private BigDecimal fundFrstLvPsnAmt;
-    private String fundFrstLvPsnProp;
-    private BigDecimal fundFrstLvFundAmt;
-    private String fundFrstLvFundProp;
-    private BigDecimal fundFrstLvSum;
-
-    /**
-     * 政策项:统筹二段
-     * */
-    private BigDecimal fundScndLvPsnAmt;
-    private String fundScndLvPsnProp;
-    private BigDecimal fundScndLvFundAmt;
-    private String fundScndLvFundProp;
-    private BigDecimal fundScndLvSum;
-
-    /**
-     * 政策项:统筹三段
-     * */
-    private BigDecimal fundThrdLvPsnAmt;
-    private String fundThrdLvPsnProp;
-    private BigDecimal fundThrdLvFundAmt;
-    private String fundThrdLvFundProp;
-    private BigDecimal fundThrdLvSum;
-
-
-    /**
-     * 政策项:大额一段
-     * */
-    private BigDecimal bigAmtFrstLvPsnAmt;
-    private String bigAmtFrstLvPsnProp;
-    private BigDecimal bigAmtFrstLvFundAmt;
-    private String bigAmtFrstLvFundProp;
-    private BigDecimal bigAmtFrstLvSum;
-
-    /**
-     * 政策项:双通道统筹支付
-     * */
-    private BigDecimal dualChannelFundPsnAmt;
-    private String dualChannelFundPsnProp;
-    private BigDecimal dualChannelFundFundAmt;
-    private String dualChannelFundFundProp;
-    private BigDecimal dualChannelFundSum;
-
-    /**
-     * 政策项:双通道大额支付
-     * */
-    private BigDecimal dualChannelBigAmtPsnAmt;
-    private String dualChannelBigAmtPsnProp;
-    private BigDecimal dualChannelBigAmtFundAmt;
-    private String dualChannelBigAmtFundProp;
-    private BigDecimal dualChannelBigAmtSum;
-
-    /**
-     * 政策项:转外自理
-     * */
-    private BigDecimal externalSelfHandlePsnAmt;
-    private String externalSelfHandlePsnProp;
-    private BigDecimal externalSelfHandleFundAmt;
-    private String externalSelfHandleFundProp;
-    private BigDecimal externalSelfHandleSum;
+    private ChrgItemLvInfo chrgItemLvInfo;
 
-    private BigDecimal allPsnAmt;
-    private BigDecimal allFundAmt;
-    private BigDecimal allSum;
+    private PolItemInfo polItemInfo;
 
     /**
      * 本次医疗费总额

+ 21 - 0
src/main/java/thyyxxk/webserver/entity/medicalinsurance/setllist/OtptntSetlmtLst.java

@@ -22,6 +22,10 @@ public class OtptntSetlmtLst {
      * */
     private String mdtrtId;
 
+    private String setlId;
+
+    private String insutype;
+
     /**
      * 参保区划
      * */
@@ -67,11 +71,22 @@ public class OtptntSetlmtLst {
      * */
     private String empName;
 
+    private Date begntime;
+
+    private String tel;
+
+    private String admDeptName;
+
     /**
      * 证件号码
      * */
     private String certno;
 
+    private String psnCertType;
+    private String psnCertTypeName;
+
+    private String balc;
+
     /**
      * 医疗类别
      * */
@@ -260,4 +275,10 @@ public class OtptntSetlmtLst {
     private String patNo;
 
     private Date setlTime;
+
+    private CuminfoInYear cuminfo;
+
+    private ChrgItemLvInfo chrgItemLvInfo;
+
+    private PolItemInfo polItemInfo;
 }

+ 112 - 0
src/main/java/thyyxxk/webserver/entity/medicalinsurance/setllist/PolItemInfo.java

@@ -0,0 +1,112 @@
+package thyyxxk.webserver.entity.medicalinsurance.setllist;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class PolItemInfo {
+    private BigDecimal allPsnAmt;
+    private BigDecimal allFundAmt;
+    private BigDecimal allSum;
+
+    /**
+     * 政策项:全自费
+     * */
+    private BigDecimal selfPayPsnAmt;
+    private String selfPayPsnProp;
+    private BigDecimal selfPayFundAmt;
+    private String selfPayFundProp;
+    private BigDecimal selfPaySum;
+
+    /**
+     * 政策项:乙类先自付
+     * */
+    private BigDecimal scndPrePayPsnAmt;
+    private String scndPrePayPsnProp;
+    private BigDecimal scndPrePayFundAmt;
+    private String scndPrePayFundProp;
+    private BigDecimal scndPrePaySum;
+
+    /**
+     * 政策项:超限额自付
+     * */
+    private BigDecimal ovrlmtSelfPayPsnAmt;
+    private String ovrlmtSelfPayPsnProp;
+    private BigDecimal ovrlmtSelfPayFundAmt;
+    private String ovrlmtSelfPayFundProp;
+    private BigDecimal ovrlmtSelfPaySum;
+
+    /**
+     * 政策项:本次应付起付标准
+     * */
+    private BigDecimal begnlinePsnAmt;
+    private String begnlinePsnProp;
+    private BigDecimal begnlineFundAmt;
+    private String begnlineFundProp;
+    private BigDecimal begnlineSum;
+
+    /**
+     * 政策项:统筹一段
+     * */
+    private BigDecimal fundFrstLvPsnAmt;
+    private String fundFrstLvPsnProp;
+    private BigDecimal fundFrstLvFundAmt;
+    private String fundFrstLvFundProp;
+    private BigDecimal fundFrstLvSum;
+
+    /**
+     * 政策项:统筹二段
+     * */
+    private BigDecimal fundScndLvPsnAmt;
+    private String fundScndLvPsnProp;
+    private BigDecimal fundScndLvFundAmt;
+    private String fundScndLvFundProp;
+    private BigDecimal fundScndLvSum;
+
+    /**
+     * 政策项:统筹三段
+     * */
+    private BigDecimal fundThrdLvPsnAmt;
+    private String fundThrdLvPsnProp;
+    private BigDecimal fundThrdLvFundAmt;
+    private String fundThrdLvFundProp;
+    private BigDecimal fundThrdLvSum;
+
+
+    /**
+     * 政策项:大额一段
+     * */
+    private BigDecimal bigAmtFrstLvPsnAmt;
+    private String bigAmtFrstLvPsnProp;
+    private BigDecimal bigAmtFrstLvFundAmt;
+    private String bigAmtFrstLvFundProp;
+    private BigDecimal bigAmtFrstLvSum;
+
+    /**
+     * 政策项:双通道统筹支付
+     * */
+    private BigDecimal dualChannelFundPsnAmt;
+    private String dualChannelFundPsnProp;
+    private BigDecimal dualChannelFundFundAmt;
+    private String dualChannelFundFundProp;
+    private BigDecimal dualChannelFundSum;
+
+    /**
+     * 政策项:双通道大额支付
+     * */
+    private BigDecimal dualChannelBigAmtPsnAmt;
+    private String dualChannelBigAmtPsnProp;
+    private BigDecimal dualChannelBigAmtFundAmt;
+    private String dualChannelBigAmtFundProp;
+    private BigDecimal dualChannelBigAmtSum;
+
+    /**
+     * 政策项:转外自理
+     * */
+    private BigDecimal externalSelfHandlePsnAmt;
+    private String externalSelfHandlePsnProp;
+    private BigDecimal externalSelfHandleFundAmt;
+    private String externalSelfHandleFundProp;
+    private BigDecimal externalSelfHandleSum;
+}

+ 63 - 0
src/main/java/thyyxxk/webserver/entity/medicalinsurance/setllist/YearMedicalFee.java

@@ -0,0 +1,63 @@
+package thyyxxk.webserver.entity.medicalinsurance.setllist;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class YearMedicalFee {
+    /**
+     * 本年住院次数
+     * */
+    private BigDecimal yrAdmtimes;
+
+    /**
+     * 本年度分段计算费用累计
+     * */
+    private BigDecimal yrAcmltvExpsClted;
+
+    /**
+     * 本年度医疗费合计
+     * */
+    private BigDecimal yrMedfeeSumamt;
+
+    /**
+     * 本年度已付起付线
+     * */
+    private BigDecimal yrPayedBegnLine;
+
+    /**
+     * 本年度统筹支付
+     * */
+    private BigDecimal yrFundPaySumamt;
+
+    /**
+     * 本年政策自费(全自费金额 + 超限价自费费用)
+     * */
+    private BigDecimal yrPolicySelfPay;
+
+    /**
+     * 本年度政策自付(先行自付金额)
+     * */
+    private BigDecimal yrPreSelfPay;
+
+    /**
+     * 本年度大额基金支付
+     * */
+    private BigDecimal yrBigAmtFundPay;
+
+    /**
+     * 本年度大病保险合规费用
+     * */
+    private BigDecimal yrBigDssFee;
+
+    /**
+     * 本年度大病保险支付
+     * */
+    private BigDecimal yrBigDssInsPay;
+
+    /**
+     * 本年度医疗救助支付
+     * */
+    private BigDecimal yrMafPay;
+}

+ 0 - 67
src/main/java/thyyxxk/webserver/service/casefrontsheet/GetLocation.java

@@ -1,67 +0,0 @@
-package thyyxxk.webserver.service.casefrontsheet;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-import org.dom4j.Document;
-import org.dom4j.Element;
-import org.dom4j.io.SAXReader;
-
-public class GetLocation {
-
-    public static String[] getlocation(String loc) {
-        String url = "http://api.map.baidu.com/geocoding/v3/?address=" + loc +
-                "&output=xml&ak=ld0uqubVfSTAUlXH5qIMN2F3Snsp16LU&callback=showLocation";
-        Document doc;
-        java.net.HttpURLConnection conn = null;
-        InputStream ins = null;
-        SAXReader reader;
-        String[] result = new String[2];
-        try {
-            URL conURL = new URL(null, url);
-            conn = (HttpURLConnection) conURL.openConnection();
-            conn.setDoInput(true);
-            conn.setDoOutput(true);
-            conn.setUseCaches(false);
-            ins = conn.getInputStream();
-            reader = new SAXReader();
-            doc = reader.read(ins);
-            Element root = doc.getRootElement();
-            Element e = root.element("result");
-            Element location = e.element("location");
-            Element lng = location.element("lng");
-            Element lat = location.element("lat");
-            String lng1 = lng.asXML();
-            String lat1 = lat.asXML();
-            lng1 = lng1.substring(lng1.indexOf("<lng>") + 5, lng1.indexOf("</lng>"));
-            lat1 = lat1.substring(lat1.indexOf("<lat>") + 5, lat1.indexOf("</lat>"));
-
-            result[0] = lng1;
-            result[1] = lat1;
-
-            ins.close();
-            conn.disconnect();
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            try {
-                if (ins != null) {
-                    ins.close();
-                }
-            } catch (IOException e1) {
-                e1.printStackTrace();
-            }
-            try {
-                if (conn != null) {
-                    conn.disconnect();
-                }
-            } catch (Exception e2) {
-                e2.printStackTrace();
-            }
-        }
-        return result;
-    }
-
-}

+ 221 - 177
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiQueryService.java

@@ -18,10 +18,7 @@ import thyyxxk.webserver.entity.medicalinsurance.query.*;
 import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetldetail;
 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.CuminfoInYear;
-import thyyxxk.webserver.entity.medicalinsurance.setllist.InptntSetlmtLst;
-import thyyxxk.webserver.entity.medicalinsurance.setllist.OtptntSetlmtLst;
+import thyyxxk.webserver.entity.medicalinsurance.setllist.*;
 import thyyxxk.webserver.entity.inpatient.ZyActpatient;
 import thyyxxk.webserver.service.redislike.RedisLikeService;
 import thyyxxk.webserver.service.wxapi.SendWxInfoService;
@@ -847,7 +844,7 @@ public class SiQueryService {
         return ResultVoUtil.success(dao.selectInsuplcAdmdvsByMdtrtId(mdtrtId));
     }
 
-    public ResultVo querySiSetlList(SetlIndex index) {
+    public ResultVo<InptntSetlmtLst> queryInpatientSetlList(SetlIndex index) {
         if (null == index.getTimes() && StringUtil.isBlank(index.getLabel())) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "结算条目不能为空!");
         }
@@ -855,11 +852,7 @@ public class SiQueryService {
             String[] arr = index.getLabel().split("_");
             index.setSetlId(arr[0]);
             index.setTimes(Integer.parseInt(arr[1]));
-            if (index.getType() == SetlType.INPATIENT.getCode()) {
-                index.setLedgerSn(Integer.parseInt(arr[2]));
-            } else {
-                index.setLedgerSn(0);
-            }
+            index.setLedgerSn(Integer.parseInt(arr[2]));
         } else {
             index.setLedgerSn(0);
             index.setSetlId(dao.selectSetlId(index.getPatNo(), index.getTimes(), index.getLedgerSn()));
@@ -872,78 +865,105 @@ public class SiQueryService {
         if (cuminfo.getCode() != ExceptionEnum.SUCCESS.getCode()) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, cuminfo.getMessage());
         }
-        if (index.getType() == SetlType.INPATIENT.getCode()) {
-            InptntSetlmtLst lst = dao.selectZySetlinfo(index.getSetlId(), "zy_inactpatient");
+        InptntSetlmtLst lst = dao.selectZySetlinfo(index.getSetlId(), "zy_inactpatient");
+        if (null == lst) {
+            lst = dao.selectZySetlinfo(index.getSetlId(), "zy_actpatient");
             if (null == lst) {
-                lst = dao.selectZySetlinfo(index.getSetlId(), "zy_actpatient");
-                if (null == lst) {
-                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到此患者的结算信息!");
-                }
-            }
-            lst.setInHospdays(DateUtil.daysBetween(lst.getEndtime(), lst.getBegntime()));
-            PsnIdetType psnIdetType = PsnIdetType.get(lst.getPsnIdetType());
-            if (null != psnIdetType) {
-                lst.setPsnIdetTypeName(psnIdetType.getName());
-            }
-            Admdvs admdvs = Admdvs.get(lst.getInsuplcAdmdvs());
-            if (null == admdvs) {
-                lst.setInsuplcAdmdvsName(redis.getRegionName(lst.getInsuplcAdmdvs()));
-            } else {
-                lst.setInsuplcAdmdvsName(admdvs.getName());
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到此患者的结算信息!");
             }
-            lst.setFixmedinsName(SiUtil.INSTITUTION_NAME);
-            lst.setGendName(Gend.get(lst.getGend()).getName());
-            SiEnumReflectUtil.inptntSetlmtLstReflect(lst);
-            ResultVo<List<SiSetlFeeDetl>> chrgrsvo = getChrgitems(lst.getPsnNo(), lst.getSetlId(), lst.getMdtrtId(), lst.getInsuplcAdmdvs());
-            if (!chrgrsvo.getCode().equals(ExceptionEnum.SUCCESS.getCode())) {
-                return chrgrsvo;
-            }
-            analyzeZyChrgitm(lst, chrgrsvo.getData());
-            lst.setYrAdmtimes(cuminfo.getYearAdmtimesZy());
-            lst.setYrAcmltvExpsClted(cuminfo.getYearPeriodfeeSumamtZy());
-            lst.setYrMedfeeSumamt(cuminfo.getYearMedfeesumZy());
-            lst.setYrPayedBegnLine(cuminfo.getYearPayedBegnlineZy());
-            lst.setYrFundPaySumamt(cuminfo.getYearBaseFundPayAmtZy());
-            lst.setYrBigAmtFundPay(cuminfo.getYearBigAmtpaysZy());
-            lst.setYrBigDssInsPay(cuminfo.getYearBigdssFundPayAmtZy());
-            lst.setYrMafPay(cuminfo.getYearMafPayAmtZy());
-            lst.setYrPolicySelfPay(cuminfo.getYearPolicySelfPayZy());
-            lst.setYrPreSelfPay(cuminfo.getYearPreSelfPayZy());
-            lst.setYrBigDssFee(cuminfo.getYearBigDssLegalFee());
-            return listPolItemCodePayInfo(lst);
+        }
+        lst.setInHospdays(DateUtil.daysBetween(lst.getEndtime(), lst.getBegntime()));
+        PsnIdetType psnIdetType = PsnIdetType.get(lst.getPsnIdetType());
+        if (null != psnIdetType) {
+            lst.setPsnIdetTypeName(psnIdetType.getName());
+        }
+        Admdvs admdvs = Admdvs.get(lst.getInsuplcAdmdvs());
+        if (null == admdvs) {
+            lst.setInsuplcAdmdvsName(redis.getRegionName(lst.getInsuplcAdmdvs()));
         } else {
+            lst.setInsuplcAdmdvsName(admdvs.getName());
+        }
+        lst.setFixmedinsName(SiUtil.INSTITUTION_NAME);
+        lst.setGendName(Gend.get(lst.getGend()).getName());
+        SiEnumReflectUtil.inptntSetlmtLstReflect(lst);
+        ResultVo<List<SiSetlFeeDetl>> chrgrsvo = getChrgitems(lst.getPsnNo(), lst.getSetlId(), lst.getMdtrtId(), lst.getInsuplcAdmdvs());
+        if (!chrgrsvo.getCode().equals(ExceptionEnum.SUCCESS.getCode())) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, chrgrsvo.getMessage());
+        }
+        ChrgItemLvInfo chrgItemLvInfo = analyzeParticularChrgitmLv(chrgrsvo.getData());
+        lst.setChrgItemLvInfo(chrgItemLvInfo);
+        lst.setCuminfo(cuminfo);
+        ResultVo<PolItemInfo> polItemRes = listPolItemCodePayInfo(lst.getPsnNo(), lst.getMdtrtId(), lst.getSetlId(), lst.getInsuplcAdmdvs());
+        if (polItemRes.getCode() != ExceptionEnum.SUCCESS.getCode()) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, polItemRes.getMessage());
+        }
+        lst.setPolItemInfo(polItemRes.getData());
+        return ResultVoUtil.success(lst);
+    }
+
+    public ResultVo<OtptntSetlmtLst> queryOutpatientSetlList(SetlIndex index) {
+        if (null == index.getTimes() && StringUtil.isBlank(index.getLabel())) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "结算条目不能为空!");
+        }
+        if (StringUtil.notBlank(index.getLabel())) {
+            String[] arr = index.getLabel().split("_");
+            index.setSetlId(arr[0]);
+            index.setTimes(Integer.parseInt(arr[1]));
             index.setLedgerSn(0);
-            OtptntSetlmtLst lst = dao.selectMzSetlifo(index.getPatNo(), index.getTimes());
-            if (null == lst) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到此患者的结算信息!");
+        } else {
+            index.setLedgerSn(0);
+            index.setSetlId(dao.selectSetlId(index.getPatNo(), index.getTimes(), index.getLedgerSn()));
+        }
+        SiPatInfo siPatInfo = dao.selectSiPatInfo(index.getPatNo(), index.getTimes(), index.getLedgerSn());
+        if (null == siPatInfo) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到此患者的结算信息!");
+        }
+        CuminfoInYear cuminfo = getYearCuminfo(siPatInfo.getPsnNo(), siPatInfo.getInsuplcAdmdvs());
+        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());
+        if (null == lst) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到此患者的结算信息!");
+        }
+        lst.setPsnCertTypeName(PsnCertType.get(lst.getPsnCertType()).getName());
+        lst.setPsnIdetTypeName(PsnIdetType.getName(lst.getPsnIdetType()));
+        Admdvs admdvs = Admdvs.get(lst.getInsuplcAdmdvs());
+        if (null == admdvs) {
+            lst.setInsuplcAdmdvsName(redis.getRegionName(lst.getInsuplcAdmdvs()));
+        } else {
+            lst.setInsuplcAdmdvsName(admdvs.getName());
+        }
+        SiEnumReflectUtil.outptntSetlmtLstReflect(lst);
+        List<BrfChrgitm> chrgitms = dao.selectMzBrfChrgitms(index.getPatNo(), index.getTimes());
+        lst.setCuminfo(cuminfo);
+        lst.setFixmedinsName(SiUtil.INSTITUTION_NAME);
+        Insutype insutype = Insutype.get(lst.getInsutype());
+        if (insutype == Insutype.BASIC_MEDICAL_INSURANCE_FOR_EMPLOYEES) {
+            ResultVo<List<SiSetlFeeDetl>> chrgrsvo = getChrgitems(lst.getPsnNo(), lst.getSetlId(), lst.getMdtrtId(), lst.getInsuplcAdmdvs());
+            if (!chrgrsvo.getCode().equals(ExceptionEnum.SUCCESS.getCode())) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, chrgrsvo.getMessage());
             }
-            Admdvs admdvs = Admdvs.get(lst.getInsuplcAdmdvs());
-            if (null == admdvs) {
-                lst.setInsuplcAdmdvsName(redis.getRegionName(lst.getInsuplcAdmdvs()));
-            } else {
-                lst.setInsuplcAdmdvsName(admdvs.getName());
+            ChrgItemLvInfo chrgItemLvInfo = analyzeParticularChrgitmLv(chrgrsvo.getData());
+            lst.setChrgItemLvInfo(chrgItemLvInfo);
+            ResultVo<PolItemInfo> polItemRes = listPolItemCodePayInfo(lst.getPsnNo(), lst.getMdtrtId(), lst.getSetlId(), lst.getInsuplcAdmdvs());
+            if (polItemRes.getCode() != ExceptionEnum.SUCCESS.getCode()) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, polItemRes.getMessage());
             }
-            SiEnumReflectUtil.outptntSetlmtLstReflect(lst);
-            List<BrfChrgitm> chrgitms = dao.selectMzBrfChrgitms(index.getPatNo(), index.getTimes());
+            lst.setPolItemInfo(polItemRes.getData());
+        } else {
             analyzeMzChrgitm(lst, chrgitms);
-            lst.setYrAdmtimes(cuminfo.getYearAdmtimesMz());
-            lst.setYrMedfeeSumamt(cuminfo.getYearMedfeesumMz());
-            lst.setYrFundPaySumamt(cuminfo.getYearBaseFundPayAmtMz());
-            lst.setYrBigAmtFundPay(cuminfo.getYearBigAmtpaysMz());
-            lst.setYrBigDssFundPay(cuminfo.getYearBigdssFundPayAmtMz());
-            lst.setYrAcctPay(cuminfo.getYearAcctPayMz());
-            lst.setYrMafPay(cuminfo.getYearMafPayAmtMz());
-            lst.setFixmedinsName(SiUtil.INSTITUTION_NAME);
-            return ResultVoUtil.success(lst);
         }
+        return ResultVoUtil.success(lst);
     }
 
-    private ResultVo<InptntSetlmtLst> listPolItemCodePayInfo(InptntSetlmtLst lst) {
-        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.LIST_POL_ITEM_CODE_PAY_INFO, lst.getInsuplcAdmdvs());
+    private ResultVo<PolItemInfo> listPolItemCodePayInfo(String psnNo, String mdtrtId, String setlId, String insuplc) {
+        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.LIST_POL_ITEM_CODE_PAY_INFO, insuplc);
         JSONObject data = new JSONObject();
-        data.put("psn_no", lst.getPsnNo());
-        data.put("mdtrt_id", lst.getMdtrtId());
-        data.put("setl_id", lst.getSetlId());
+        data.put("psn_no", psnNo);
+        data.put("mdtrt_id", mdtrtId);
+        data.put("setl_id", setlId);
         input.getJSONObject("input").put("data", data);
         JSONObject result = exec.executeTrade(input, SiFunction.LIST_POL_ITEM_CODE_PAY_INFO);
         log.info("【操作员:{}】,政策信息查询:\n参数:{},\n结果:{}", TokenUtil.getTokenUserId(), input, result);
@@ -964,6 +984,7 @@ public class SiQueryService {
             }
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心出错:" + message);
         }
+        PolItemInfo polItemInfo = new PolItemInfo();
         JSONArray array = result.getJSONArray("data");
         BigDecimal selfPaySum = new BigDecimal(0);
         BigDecimal fundPaySum = new BigDecimal(0);
@@ -986,88 +1007,88 @@ public class SiQueryService {
             }
             switch (polItemCode) {
                 case QZF:
-                    lst.setSelfPayPsnAmt(selfPayAmt);
-                    lst.setSelfPayPsnProp(selfPayProp);
-                    lst.setSelfPayFundAmt(fundPayAmt);
-                    lst.setSelfPayFundProp(fundPayProp);
-                    lst.setSelfPaySum(polItemPaySum);
+                    polItemInfo.setSelfPayPsnAmt(selfPayAmt);
+                    polItemInfo.setSelfPayPsnProp(selfPayProp);
+                    polItemInfo.setSelfPayFundAmt(fundPayAmt);
+                    polItemInfo.setSelfPayFundProp(fundPayProp);
+                    polItemInfo.setSelfPaySum(polItemPaySum);
                     break;
                 case YLXZF:
-                    lst.setScndPrePayPsnAmt(selfPayAmt);
-                    lst.setScndPrePayPsnProp(selfPayProp);
-                    lst.setScndPrePayFundAmt(fundPayAmt);
-                    lst.setScndPrePayFundProp(fundPayProp);
-                    lst.setScndPrePaySum(polItemPaySum);
+                    polItemInfo.setScndPrePayPsnAmt(selfPayAmt);
+                    polItemInfo.setScndPrePayPsnProp(selfPayProp);
+                    polItemInfo.setScndPrePayFundAmt(fundPayAmt);
+                    polItemInfo.setScndPrePayFundProp(fundPayProp);
+                    polItemInfo.setScndPrePaySum(polItemPaySum);
                     break;
                 case CXEZF:
-                    lst.setOvrlmtSelfPayPsnAmt(selfPayAmt);
-                    lst.setOvrlmtSelfPayPsnProp(selfPayProp);
-                    lst.setOvrlmtSelfPayFundAmt(fundPayAmt);
-                    lst.setOvrlmtSelfPayFundProp(fundPayProp);
-                    lst.setOvrlmtSelfPaySum(polItemPaySum);
+                    polItemInfo.setOvrlmtSelfPayPsnAmt(selfPayAmt);
+                    polItemInfo.setOvrlmtSelfPayPsnProp(selfPayProp);
+                    polItemInfo.setOvrlmtSelfPayFundAmt(fundPayAmt);
+                    polItemInfo.setOvrlmtSelfPayFundProp(fundPayProp);
+                    polItemInfo.setOvrlmtSelfPaySum(polItemPaySum);
                     break;
                 case BCYFQFBZ:
-                    lst.setBegnlinePsnAmt(selfPayAmt);
-                    lst.setBegnlinePsnProp(selfPayProp);
-                    lst.setBegnlineFundAmt(fundPayAmt);
-                    lst.setBegnlineFundProp(fundPayProp);
-                    lst.setBegnlineSum(polItemPaySum);
+                    polItemInfo.setBegnlinePsnAmt(selfPayAmt);
+                    polItemInfo.setBegnlinePsnProp(selfPayProp);
+                    polItemInfo.setBegnlineFundAmt(fundPayAmt);
+                    polItemInfo.setBegnlineFundProp(fundPayProp);
+                    polItemInfo.setBegnlineSum(polItemPaySum);
                     break;
                 case TCYD:
-                    lst.setFundFrstLvPsnAmt(selfPayAmt);
-                    lst.setFundFrstLvPsnProp(selfPayProp);
-                    lst.setFundFrstLvFundAmt(fundPayAmt);
-                    lst.setFundFrstLvFundProp(fundPayProp);
-                    lst.setFundFrstLvSum(polItemPaySum);
+                    polItemInfo.setFundFrstLvPsnAmt(selfPayAmt);
+                    polItemInfo.setFundFrstLvPsnProp(selfPayProp);
+                    polItemInfo.setFundFrstLvFundAmt(fundPayAmt);
+                    polItemInfo.setFundFrstLvFundProp(fundPayProp);
+                    polItemInfo.setFundFrstLvSum(polItemPaySum);
                     break;
                 case TCED:
-                    lst.setFundScndLvPsnAmt(selfPayAmt);
-                    lst.setFundScndLvPsnProp(selfPayProp);
-                    lst.setFundScndLvFundAmt(fundPayAmt);
-                    lst.setFundScndLvFundProp(fundPayProp);
-                    lst.setFundScndLvSum(polItemPaySum);
+                    polItemInfo.setFundScndLvPsnAmt(selfPayAmt);
+                    polItemInfo.setFundScndLvPsnProp(selfPayProp);
+                    polItemInfo.setFundScndLvFundAmt(fundPayAmt);
+                    polItemInfo.setFundScndLvFundProp(fundPayProp);
+                    polItemInfo.setFundScndLvSum(polItemPaySum);
                     break;
                 case TCSD:
-                    lst.setFundThrdLvPsnAmt(selfPayAmt);
-                    lst.setFundThrdLvPsnProp(selfPayProp);
-                    lst.setFundThrdLvFundAmt(fundPayAmt);
-                    lst.setFundThrdLvFundProp(fundPayProp);
-                    lst.setFundThrdLvSum(polItemPaySum);
+                    polItemInfo.setFundThrdLvPsnAmt(selfPayAmt);
+                    polItemInfo.setFundThrdLvPsnProp(selfPayProp);
+                    polItemInfo.setFundThrdLvFundAmt(fundPayAmt);
+                    polItemInfo.setFundThrdLvFundProp(fundPayProp);
+                    polItemInfo.setFundThrdLvSum(polItemPaySum);
                     break;
                 case DEYD:
-                    lst.setBigAmtFrstLvPsnAmt(selfPayAmt);
-                    lst.setBigAmtFrstLvPsnProp(selfPayProp);
-                    lst.setBigAmtFrstLvFundAmt(fundPayAmt);
-                    lst.setBigAmtFrstLvFundProp(fundPayProp);
-                    lst.setBigAmtFrstLvSum(polItemPaySum);
+                    polItemInfo.setBigAmtFrstLvPsnAmt(selfPayAmt);
+                    polItemInfo.setBigAmtFrstLvPsnProp(selfPayProp);
+                    polItemInfo.setBigAmtFrstLvFundAmt(fundPayAmt);
+                    polItemInfo.setBigAmtFrstLvFundProp(fundPayProp);
+                    polItemInfo.setBigAmtFrstLvSum(polItemPaySum);
                     break;
                 case STDTCZF:
-                    lst.setDualChannelFundPsnAmt(selfPayAmt);
-                    lst.setDualChannelFundPsnProp(selfPayProp);
-                    lst.setDualChannelFundFundAmt(fundPayAmt);
-                    lst.setDualChannelFundFundProp(fundPayProp);
-                    lst.setDualChannelFundSum(polItemPaySum);
+                    polItemInfo.setDualChannelFundPsnAmt(selfPayAmt);
+                    polItemInfo.setDualChannelFundPsnProp(selfPayProp);
+                    polItemInfo.setDualChannelFundFundAmt(fundPayAmt);
+                    polItemInfo.setDualChannelFundFundProp(fundPayProp);
+                    polItemInfo.setDualChannelFundSum(polItemPaySum);
                     break;
                 case STDDEZF:
-                    lst.setDualChannelBigAmtPsnAmt(selfPayAmt);
-                    lst.setDualChannelBigAmtPsnProp(selfPayProp);
-                    lst.setDualChannelBigAmtFundAmt(fundPayAmt);
-                    lst.setDualChannelBigAmtFundProp(fundPayProp);
-                    lst.setDualChannelBigAmtSum(polItemPaySum);
+                    polItemInfo.setDualChannelBigAmtPsnAmt(selfPayAmt);
+                    polItemInfo.setDualChannelBigAmtPsnProp(selfPayProp);
+                    polItemInfo.setDualChannelBigAmtFundAmt(fundPayAmt);
+                    polItemInfo.setDualChannelBigAmtFundProp(fundPayProp);
+                    polItemInfo.setDualChannelBigAmtSum(polItemPaySum);
                     break;
                 case ZWZL:
-                    lst.setExternalSelfHandlePsnAmt(selfPayAmt);
-                    lst.setExternalSelfHandlePsnProp(selfPayProp);
-                    lst.setExternalSelfHandleFundAmt(fundPayAmt);
-                    lst.setExternalSelfHandleFundProp(fundPayProp);
-                    lst.setExternalSelfHandleSum(polItemPaySum);
+                    polItemInfo.setExternalSelfHandlePsnAmt(selfPayAmt);
+                    polItemInfo.setExternalSelfHandlePsnProp(selfPayProp);
+                    polItemInfo.setExternalSelfHandleFundAmt(fundPayAmt);
+                    polItemInfo.setExternalSelfHandleFundProp(fundPayProp);
+                    polItemInfo.setExternalSelfHandleSum(polItemPaySum);
                     break;
             }
         }
-        lst.setAllPsnAmt(selfPaySum);
-        lst.setAllFundAmt(fundPaySum);
-        lst.setAllSum(fundPaySum.add(selfPaySum));
-        return ResultVoUtil.success(lst);
+        polItemInfo.setAllPsnAmt(selfPaySum);
+        polItemInfo.setAllFundAmt(fundPaySum);
+        polItemInfo.setAllSum(fundPaySum.add(selfPaySum));
+        return ResultVoUtil.success(polItemInfo);
     }
 
     private CuminfoInYear getYearCuminfo(String psnNo, String admdvs) {
@@ -1319,7 +1340,10 @@ public class SiQueryService {
                 return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "没有查询到费用明细。");
             }
             for (int i = 0; i < output.size(); i++) {
-                SiSetlFeeDetl fee = JSONObject.parseObject(output.getJSONObject(i).toJSONString(), SiSetlFeeDetl.class);
+                JSONObject feeItem = output.getJSONObject(i);
+                String[] mzFeeDetlSn = feeItem.getString("feedetl_sn").split("_");
+                feeItem.replace("feedetl_sn", Integer.parseInt(mzFeeDetlSn[mzFeeDetlSn.length - 1]));
+                SiSetlFeeDetl fee = JSONObject.parseObject(feeItem.toJSONString(), SiSetlFeeDetl.class);
                 if (StringUtil.isBlank(fee.getSetlId())) {
                     fee.setSetlId(setlId);
                 }
@@ -1337,11 +1361,12 @@ public class SiQueryService {
         return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, result.getString(ERROR_MESSAGE));
     }
 
-    private void analyzeZyChrgitm(InptntSetlmtLst lst, List<SiSetlFeeDetl> chrgitms) {
+    private ChrgItemLvInfo analyzeParticularChrgitmLv(List<SiSetlFeeDetl> chrgitms) {
         Map<String, BigDecimal> map = new HashMap<>();
         map.put("allfeeSum", new BigDecimal(0));
         map.put("totalFrst", new BigDecimal(0));
         map.put("totalScnd", new BigDecimal(0));
+        map.put("totalThrd", new BigDecimal(0));
         chrgitms.forEach(itm -> {
             BigDecimal itmfeeSum = new BigDecimal(itm.getDetItemFeeSumamt());
             map.replace("allfeeSum", map.get("allfeeSum").add(itmfeeSum));
@@ -1349,6 +1374,8 @@ public class SiQueryService {
                 map.replace("totalFrst", map.get("totalFrst").add(itmfeeSum));
             } else if (itm.getChrgitmLv().equals(ChrgitmLv.SECOND_CLASS.getCode())) {
                 map.replace("totalScnd", map.get("totalScnd").add(itmfeeSum));
+            } else {
+                map.replace("totalThrd", map.get("totalThrd").add(itmfeeSum));
             }
             String typeKey = itm.getMedChrgitmType();
             String lvKey = typeKey + "-" + itm.getChrgitmLv();
@@ -1363,51 +1390,68 @@ public class SiQueryService {
                 map.put(lvKey, itmfeeSum);
             }
         });
-        lst.setAllfeeSum(map.get("allfeeSum"));
-        lst.setAllfeeFrst(map.get("totalFrst"));
-        lst.setAllfeeScnd(map.get("totalScnd"));
-        lst.setWestMedFeeSum(map.get("09"));
-        lst.setWestMedFeeFrst(map.get("09-01"));
-        lst.setWestMedFeeScnd(map.get("09-02"));
-        lst.setHerbalSum(map.get("10"));
-        lst.setHerbalFrst(map.get("10-01"));
-        lst.setHerbalScnd(map.get("10-02"));
-        lst.setChnsPtntSum(map.get("11"));
-        lst.setChnsPtntFrst(map.get("11-01"));
-        lst.setChnsPtntScnd(map.get("11-02"));
-        lst.setClinicSum(map.get("02"));
-        lst.setClinicFrst(map.get("02-01"));
-        lst.setClinicScnd(map.get("02-02"));
-        lst.setTreatSum(map.get("05"));
-        lst.setTreatFrst(map.get("05-01"));
-        lst.setTreatScnd(map.get("05-02"));
-        lst.setSurgerySum(map.get("06"));
-        lst.setSurgeryFrst(map.get("06-01"));
-        lst.setSurgeryScnd(map.get("06-02"));
-        lst.setNursingSum(map.get("07"));
-        lst.setNursingFrst(map.get("07-01"));
-        lst.setNursingScnd(map.get("07-02"));
-        lst.setSntryMtrlsSum(map.get("08"));
-        lst.setSntryMtrlsFrst(map.get("08-01"));
-        lst.setSntryMtrlsScnd(map.get("08-02"));
-        lst.setExamSum(map.get("04"));
-        lst.setExamFrst(map.get("04-01"));
-        lst.setExamScnd(map.get("04-02"));
-        lst.setNrmlTrtmtSum(map.get("12"));
-        lst.setNrmlTrtmtFrst(map.get("12-01"));
-        lst.setNrmlTrtmtScnd(map.get("12-02"));
-        lst.setInspectSum(map.get("03"));
-        lst.setInspectFrst(map.get("03-01"));
-        lst.setInspectScnd(map.get("03-02"));
-        lst.setRegisterSum(map.get("13"));
-        lst.setRegisterFrst(map.get("13-01"));
-        lst.setRegisterScnd(map.get("13-02"));
-        lst.setBedfeeSum(map.get("01"));
-        lst.setBedfeeFrst(map.get("01-01"));
-        lst.setBedfeeScnd(map.get("01-02"));
-        lst.setOthfeeSum(map.get("14"));
-        lst.setOthfeeFrst(map.get("14-01"));
-        lst.setOthfeeScnd(map.get("14-02"));
+        ChrgItemLvInfo chrgItemLvInfo = new ChrgItemLvInfo();
+        chrgItemLvInfo.setAllfeeSum(map.get("allfeeSum"));
+        chrgItemLvInfo.setAllfeeFrst(map.get("totalFrst"));
+        chrgItemLvInfo.setAllfeeScnd(map.get("totalScnd"));
+        chrgItemLvInfo.setAllfeeThrd(map.get("totalThrd"));
+        chrgItemLvInfo.setWestMedFeeSum(map.get("09"));
+        chrgItemLvInfo.setWestMedFeeFrst(map.get("09-01"));
+        chrgItemLvInfo.setWestMedFeeScnd(map.get("09-02"));
+        chrgItemLvInfo.setWestMedFeeThrd(map.get("09-03"));
+        chrgItemLvInfo.setHerbalSum(map.get("10"));
+        chrgItemLvInfo.setHerbalFrst(map.get("10-01"));
+        chrgItemLvInfo.setHerbalScnd(map.get("10-02"));
+        chrgItemLvInfo.setHerbalThrd(map.get("10-03"));
+        chrgItemLvInfo.setChnsPtntSum(map.get("11"));
+        chrgItemLvInfo.setChnsPtntFrst(map.get("11-01"));
+        chrgItemLvInfo.setChnsPtntScnd(map.get("11-02"));
+        chrgItemLvInfo.setChnsPtntThrd(map.get("11-03"));
+        chrgItemLvInfo.setClinicSum(map.get("02"));
+        chrgItemLvInfo.setClinicFrst(map.get("02-01"));
+        chrgItemLvInfo.setClinicScnd(map.get("02-02"));
+        chrgItemLvInfo.setClinicThrd(map.get("02-03"));
+        chrgItemLvInfo.setTreatSum(map.get("05"));
+        chrgItemLvInfo.setTreatFrst(map.get("05-01"));
+        chrgItemLvInfo.setTreatScnd(map.get("05-02"));
+        chrgItemLvInfo.setTreatThrd(map.get("05-03"));
+        chrgItemLvInfo.setSurgerySum(map.get("06"));
+        chrgItemLvInfo.setSurgeryFrst(map.get("06-01"));
+        chrgItemLvInfo.setSurgeryScnd(map.get("06-02"));
+        chrgItemLvInfo.setSurgeryThrd(map.get("06-03"));
+        chrgItemLvInfo.setNursingSum(map.get("07"));
+        chrgItemLvInfo.setNursingFrst(map.get("07-01"));
+        chrgItemLvInfo.setNursingScnd(map.get("07-02"));
+        chrgItemLvInfo.setNursingThrd(map.get("07-03"));
+        chrgItemLvInfo.setSntryMtrlsSum(map.get("08"));
+        chrgItemLvInfo.setSntryMtrlsFrst(map.get("08-01"));
+        chrgItemLvInfo.setSntryMtrlsScnd(map.get("08-02"));
+        chrgItemLvInfo.setSntryMtrlsThrd(map.get("08-03"));
+        chrgItemLvInfo.setExamSum(map.get("04"));
+        chrgItemLvInfo.setExamFrst(map.get("04-01"));
+        chrgItemLvInfo.setExamScnd(map.get("04-02"));
+        chrgItemLvInfo.setExamThrd(map.get("04-03"));
+        chrgItemLvInfo.setNrmlTrtmtSum(map.get("12"));
+        chrgItemLvInfo.setNrmlTrtmtFrst(map.get("12-01"));
+        chrgItemLvInfo.setNrmlTrtmtScnd(map.get("12-02"));
+        chrgItemLvInfo.setNrmlTrtmtThrd(map.get("12-03"));
+        chrgItemLvInfo.setInspectSum(map.get("03"));
+        chrgItemLvInfo.setInspectFrst(map.get("03-01"));
+        chrgItemLvInfo.setInspectScnd(map.get("03-02"));
+        chrgItemLvInfo.setInspectThrd(map.get("03-03"));
+        chrgItemLvInfo.setRegisterSum(map.get("13"));
+        chrgItemLvInfo.setRegisterFrst(map.get("13-01"));
+        chrgItemLvInfo.setRegisterScnd(map.get("13-02"));
+        chrgItemLvInfo.setRegisterThrd(map.get("13-03"));
+        chrgItemLvInfo.setBedfeeSum(map.get("01"));
+        chrgItemLvInfo.setBedfeeFrst(map.get("01-01"));
+        chrgItemLvInfo.setBedfeeScnd(map.get("01-02"));
+        chrgItemLvInfo.setBedfeeThrd(map.get("01-03"));
+        chrgItemLvInfo.setOthfeeSum(map.get("14"));
+        chrgItemLvInfo.setOthfeeFrst(map.get("14-01"));
+        chrgItemLvInfo.setOthfeeScnd(map.get("14-02"));
+        chrgItemLvInfo.setOthfeeThrd(map.get("14-03"));
+        return chrgItemLvInfo;
     }
 
     private void analyzeMzChrgitm(OtptntSetlmtLst lst, List<BrfChrgitm> chrgitms) {

+ 114 - 0
src/main/java/thyyxxk/webserver/utils/BaiduMapGeocoderUtil.java

@@ -0,0 +1,114 @@
+package thyyxxk.webserver.utils;
+
+import com.alibaba.fastjson.JSONObject;
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.charset.StandardCharsets;
+
+public class BaiduMapGeocoderUtil {
+
+    /**
+     * 百度地图 Api调用相关的百度AK
+     */
+    public final static String BAIDU_MAP_AK = "1AHRtXQ262qbxqBj7tTmFRn4r61jmTSz";
+
+    public static JSONObject getAddressInfoByLngAndLat(String rawAddress){
+        String[] points = getlocation(rawAddress);
+        if (null == points) {
+            return null;
+        }
+        JSONObject obj;
+        String location=points[1]+","+points[0];
+        String url ="http://api.map.baidu.com/reverse_geocoding/v3/?ak="+BAIDU_MAP_AK+"&output=json&coordtype=wgs84ll&location="+location;
+        try {
+            String json = loadJSON(url);
+            obj = JSONObject.parseObject(json);
+            String success="0";
+            String status = String.valueOf(obj.get("status"));
+            if(success.equals(status)){
+                JSONObject result = obj.getJSONObject("result");
+                return result.getJSONObject("addressComponent");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public static String loadJSON(String url) {
+        StringBuilder json = new StringBuilder();
+        try {
+            URL oracle = new URL(url);
+            URLConnection yc = oracle.openConnection();
+            BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream(), StandardCharsets.UTF_8));
+            String inputLine;
+            while ((inputLine = in.readLine()) != null) {
+                json.append(inputLine);
+            }
+            in.close();
+        } catch (IOException ignored) {}
+        return json.toString();
+    }
+
+    public static String[] getlocation(String rawAddress) {
+        rawAddress = rawAddress.replaceAll(" ", "").replaceAll("\u007F", "");
+        String url = "http://api.map.baidu.com/geocoding/v3/?address=" + rawAddress +
+                "&output=xml&ak=" + BAIDU_MAP_AK + "&callback=showLocation";
+        Document doc;
+        java.net.HttpURLConnection conn = null;
+        InputStream ins = null;
+        SAXReader reader;
+        String[] result = new String[2];
+        try {
+            URL conURL = new URL(null, url);
+            conn = (HttpURLConnection) conURL.openConnection();
+            conn.setDoInput(true);
+            conn.setDoOutput(true);
+            conn.setUseCaches(false);
+            ins = conn.getInputStream();
+            reader = new SAXReader();
+            doc = reader.read(ins);
+            Element root = doc.getRootElement();
+            Element e = root.element("result");
+            Element location = e.element("location");
+            Element lng = location.element("lng");
+            Element lat = location.element("lat");
+            String lng1 = lng.asXML();
+            String lat1 = lat.asXML();
+            lng1 = lng1.substring(lng1.indexOf("<lng>") + 5, lng1.indexOf("</lng>"));
+            lat1 = lat1.substring(lat1.indexOf("<lat>") + 5, lat1.indexOf("</lat>"));
+
+            result[0] = lng1;
+            result[1] = lat1;
+
+            ins.close();
+            conn.disconnect();
+        } catch (Exception e) {
+            System.out.println("报错:" + rawAddress);
+            e.printStackTrace();
+            return null;
+        } finally {
+            try {
+                if (ins != null) {
+                    ins.close();
+                }
+                if (conn != null) {
+                    conn.disconnect();
+                }
+            } catch (IOException e1) {
+                e1.printStackTrace();
+            }
+        }
+        return result;
+    }
+}
+