瀏覽代碼

初步完成医保结算上传页面。

xiaochan 3 年之前
父節點
當前提交
a4385c38ca

+ 21 - 0
src/main/java/thyyxxk/webserver/controller/medicalinsurance/SiManageController.java

@@ -1,5 +1,6 @@
 package thyyxxk.webserver.controller.medicalinsurance;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
@@ -8,6 +9,9 @@ import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.medicalinsurance.manage.*;
 import thyyxxk.webserver.entity.medicalinsurance.query.SiPatInfo;
 import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SlctSetlPrm;
+import thyyxxk.webserver.entity.medicalinsurance.setllistupload.UpldCollection;
+import thyyxxk.webserver.entity.querydata.JieSuanDanChaXun;
+import thyyxxk.webserver.entity.querydata.TSiSetlinfo;
 import thyyxxk.webserver.service.medicalinsurance.SiManageService;
 
 import java.util.List;
@@ -71,4 +75,21 @@ public class SiManageController {
                                               @RequestParam("insutype") String insutype) {
         return service.upldSetlListTimes(startTime, endTime, insutype);
     }
+
+    @GetMapping("/getMedType")
+    public ResultVo<List<Object>> getMedType() {
+        return service.getMedType();
+    }
+
+    @PostMapping("/huoQuJieSuanRenYuan")
+    public ResultVo<IPage<TSiSetlinfo>> huoQuJieSuanRenYuan(@RequestBody JieSuanDanChaXun param) {
+        return service.huoQuJieSuanRenYuan(param);
+    }
+
+    @GetMapping("/getUploadInfo")
+    public ResultVo<UpldCollection> getUploadInfo(@RequestParam("patNo") String patNo,
+                                                  @RequestParam("times") Integer times,
+                                                  @RequestParam("ledgerSn") Integer ledgerSn) throws Exception {
+        return service.getUploadInfo(patNo, times, ledgerSn);
+    }
 }

+ 3 - 1
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiManageDao.java

@@ -25,8 +25,10 @@ public interface SiManageDao {
 
     @Update("update ${table} set uploaded_flag=0 where code=#{code}")
     void updateUploadedFlag2(@Param("table") String table,
-                            @Param("code") String codes);
+                             @Param("code") String codes);
 
     @Select("select name from t_region where code=#{code}")
     String selectRegion(@Param("code") String code);
+
+
 }

+ 102 - 1
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/UpIdCollectionDao.java

@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Update;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.medicalinsurance.query.SiPatInfo;
 import thyyxxk.webserver.entity.medicalinsurance.setllistupload.*;
+import thyyxxk.webserver.entity.querydata.TSiSetlinfo;
 
 import java.util.Date;
 import java.util.List;
@@ -82,7 +83,7 @@ public interface UpIdCollectionDao {
             "       adm_caty = (select rtrim(si_caty) from zd_unit_code where code = b.small_dept),  " + // -- 入院科别
             "       refldept_dept = (select rtrim(si_caty) from zd_unit_code where code = b.zk_ward),  " + //--转科科别
             "        b.dis_date as dscg_time,  " + // -- 出院时间
-            "       dscg_caty = (select rtrim(si_caty) from zd_unit_code where code = b.dis_dept), " + // -- 出院科别
+            "       dscg_caty = (select rtrim(si_caty) from zd_unit_code where code=isnull(isnull(zk_dept,zk_ward),small_dept)), " + // -- 出院科别
             "       datediff(day ,b.admiss_date ,b.dis_date) as  act_ipt_days,  " +  // 实际住院天数
             "       zy_serial_no as biz_sn," +// 业务流水号
             "       operation as trt_type    " +   //  治疗类别
@@ -223,4 +224,104 @@ public interface UpIdCollectionDao {
     List<SiPatInfo> getHuanZheXinXi(@Param("startTime") String startTime,
                                     @Param("endTime") String endTime,
                                     @Param("insutype") String insutype);
+
+    @Select("<script>" +
+            "select top ${pageSize} * from (" +
+            "select " +
+            "row_number() over (order by setl_time) as rowNumber," +
+            "pat_no,times,ledger_sn,psn_name,gend,brdy,insutype,psn_type,mdtrt_id,setl_id,setl_time, " +
+            "       a.med_type,medfee_sumamt,fund_pay_sumamt, " +
+            "       acct_pay,psn_cash_pay,clr_optins, " +
+            "       outDeptName=(select rtrim(name) from zd_unit_code where code=small_dept), " +
+            "       setl_list_id " +
+            "from t_si_setlinfo a left join  zy_inactpatient b on (a.pat_no = b.inpatient_no and a.times = b.admiss_times) " +
+            "where " +
+            "  setl_time &gt;= #{startTime} and setl_time &lt;= #{endTime} " +
+            "<if test=\"setlType !=null and setlType != '' \">" +
+            "  and setl_type = #{setlType} " +
+            "</if>" +
+            "<if test=\"patNo !=null and patNo != '' \">" +
+            "  and pat_no = #{patNo} " +
+            "</if>" +
+            "<if test=\"insutype.size > 0 \">" +
+            "  and insutype in " +
+            "<foreach collection='insutype' item='item' index='index' open='(' close=')' separator=','>" +
+            "#{item}" +
+            "</foreach>" +
+            "</if>" +
+            "<if test=\"outDept.size > 0 \">" +
+            "and small_dept in " +
+            "<foreach collection='outDept' item='item' index='index' open='(' close=')' separator=','>" +
+            "#{item} " +
+            "</foreach>" +
+            "</if>" +
+            "<if test=\"medType.size > 0 \">" +
+            "  and a.med_type in " +
+            "<foreach collection='outDept' item='item' index='index' open='(' close=')' separator=','>" +
+            "#{item}" +
+            "</foreach>" +
+            "</if>" +
+            "<if test=\"psnType.size > 0 \">" +
+            "  and psn_type in " +
+            "<foreach collection='psnType' item='item' index='index' open='(' close=')' separator=','>" +
+            "#{item}" +
+            "</foreach>" +
+            "</if>" +
+            " ) temp where rowNumber > ${pageSize} * (${currentPage} - 1)" +
+            "</script>")
+    List<TSiSetlinfo> huoQuJieSuanRenYuan(@Param("startTime") String startTime,
+                                          @Param("endTime") String endTime,
+                                          @Param("setlType") String setlTyle,
+                                          @Param("patNo") String patNo,
+                                          @Param("insutype") List<String> insutypes,
+                                          @Param("outDept") List<String> outDepts,
+                                          @Param("medType") List<String> medTypes,
+                                          @Param("psnType") List<String> psnTypes,
+                                          @Param("currentPage") long currentPage,
+                                          @Param("pageSize") long pageSize);
+
+    @Select("<script>" +
+            "select count(*) " +
+            "from t_si_setlinfo a left join  zy_inactpatient b on (a.pat_no = b.inpatient_no and a.times = b.admiss_times) " +
+            "where  " +
+            " setl_time &gt;= #{startTime} and setl_time &lt;= #{endTime} " +
+            "<if test=\"setlType !=null and setlType != '' \">" +
+            "  and setl_type = #{setlType} " +
+            "</if>" +
+            "<if test=\"patNo !=null and patNo != '' \">" +
+            "  and pat_no = #{patNo} " +
+            "</if>" +
+            "<if test=\"insutype.size > 0 \">" +
+            "  and insutype in " +
+            "<foreach collection='insutype' item='item' index='index' open='(' close=')' separator=','>" +
+            "#{item}" +
+            "</foreach>" +
+            "</if>" +
+            "<if test=\"outDept.size > 0 \">" +
+            "and small_dept in " +
+            "<foreach collection='outDept' item='item' index='index' open='(' close=')' separator=','>" +
+            "#{item} " +
+            "</foreach>" +
+            "</if>" +
+            "<if test=\"medType.size > 0 \">" +
+            "  and a.med_type in " +
+            "<foreach collection='outDept' item='item' index='index' open='(' close=')' separator=','>" +
+            "#{item}" +
+            "</foreach>" +
+            "</if>" +
+            "<if test=\"psnType.size > 0 \">" +
+            "  and psn_type in " +
+            "<foreach collection='psnType' item='item' index='index' open='(' close=')' separator=','>" +
+            "#{item}" +
+            "</foreach>" +
+            "</if>" +
+            "</script>")
+    long huoQuJieSuanRenYuanTotal(@Param("startTime") String startTime,
+                                  @Param("endTime") String endTime,
+                                  @Param("setlType") String setlTyle,
+                                  @Param("patNo") String patNo,
+                                  @Param("insutype") List<String> insutypes,
+                                  @Param("outDept") List<String> outDepts,
+                                  @Param("medType") List<String> medTypes,
+                                  @Param("psnType") List<String> psnTypes);
 }

+ 1 - 1
src/main/java/thyyxxk/webserver/dao/his/querydata/KeShiShouRuDao.java

@@ -56,7 +56,7 @@ public interface KeShiShouRuDao {
             "<when test=\"reqDept != null and reqDept != '' \">" +
             " and a.ward_code = #{reqDept,jdbcType=CHAR} " +
             "</when>" +
-            ") temp where RowNumber > ${pageSize} * (${currentPage} - 1) order by RowNumber " +
+            ") temp where RowNumber > ${pageSize} * (${currentPage} - 1) " +
             "</script>"})
     List<KeShiFeiiYongTongJi> getKeShiFeiYongZhuYuan(@Param("currentPage") long currentPage,
                                                      @Param("pageSize") long pageSize,

+ 48 - 0
src/main/java/thyyxxk/webserver/entity/querydata/JieSuanDanChaXun.java

@@ -0,0 +1,48 @@
+package thyyxxk.webserver.entity.querydata;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 描述: 结算单
+ * </p>
+ *
+ * @author xc
+ * @date 2021-12-07 10:14
+ */
+@Data
+public class JieSuanDanChaXun {
+    private String startTime;
+    private String endTime;
+    /**
+     * 结算类型
+     */
+    private String clrType;
+    /**
+     * 住院号
+     */
+    private String patNo;
+    /**
+     * 险种类型
+     */
+    private List<String> insutype;
+    /**
+     * 出院科室
+     */
+    private List<String> outDept;
+    /**
+     * 医疗类别
+     */
+    private List<String> medType;
+    /**
+     * 人员类别
+     */
+    private List<String> psnType;
+
+
+    private long currentPage;
+    private long pageSize;
+    private long total;
+}

+ 281 - 0
src/main/java/thyyxxk/webserver/entity/querydata/TSiSetlinfo.java

@@ -0,0 +1,281 @@
+package thyyxxk.webserver.entity.querydata;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class TSiSetlinfo implements Serializable {
+
+    private static final long serialVersionUID = 392179028308989459L;
+
+    /**
+     * 住院号/门诊号
+     */
+    private String patNo;
+
+    /**
+     * 住院次数/门诊次数
+     */
+    private Integer times;
+
+    /**
+     * 账页号(门诊固定为0)
+     */
+    private Integer ledgerSn;
+
+    /**
+     * 就诊ID
+     */
+    private String mdtrtId;
+
+    /**
+     * 结算ID
+     */
+    private String setlId;
+
+    /**
+     * 人员编号
+     */
+    private String psnNo;
+
+    /**
+     * 人员姓名
+     */
+    private String psnName;
+
+    /**
+     * 人员证件类型
+     */
+    private String psnCertType;
+
+    /**
+     * 证件号码
+     */
+    private String certno;
+
+    /**
+     * 性别
+     */
+    private String gend;
+
+    /**
+     * 性别
+     */
+    private String gendName;
+
+    /**
+     * 民族
+     */
+    private String naty;
+
+    /**
+     * 出生日期
+     */
+    private Date brdy;
+
+    /**
+     * 年龄
+     */
+    private Double age;
+
+    /**
+     * 险种类型
+     */
+    private String insutype;
+
+    /**
+     * 险种类型
+     */
+    private String insutypeName;
+
+    /**
+     * 人员类别
+     */
+    private String psnType;
+
+    /**
+     * 人员类别
+     */
+    private String psnTypeName;
+
+    /**
+     * 公务员标志
+     */
+    private String cvlservFlag;
+
+    /**
+     * 结算时间
+     */
+    private Date setlTime;
+
+    /**
+     * 就诊凭证类型
+     */
+    private String mdtrtCertType;
+
+    /**
+     * 医疗类别
+     */
+    private String medType;
+
+    /**
+     * 医疗类别
+     */
+    private String medTypeName;
+
+    /**
+     * 医疗费总额
+     */
+    private String medfeeSumamt;
+
+    /**
+     * 全自费金额
+     */
+    private String fulamtOwnpayAmt;
+
+    /**
+     * 超限价自费费用
+     */
+    private String overlmtSelfpay;
+
+    /**
+     * 先行自付金额
+     */
+    private String preselfpayAmt;
+
+    /**
+     * 符合政策范围金额
+     */
+    private String inscpScpAmt;
+
+    /**
+     * 实际支付起付线
+     */
+    private String actPayDedc;
+
+    /**
+     * 基本医疗保险统筹基金支出
+     */
+    private String hifpPay;
+
+    /**
+     * 基本医疗保险统筹基金支付比例
+     */
+    private String poolPropSelfpay;
+
+    /**
+     * 公务员医疗补助资金支出
+     */
+    private String cvlservPay;
+
+    /**
+     * 企业补充医疗保险基金支出
+     */
+    private String hifesPay;
+
+    /**
+     * 居民大病保险资金支出
+     */
+    private String hifmiPay;
+
+    /**
+     * 职工大额医疗费用补助基金支出
+     */
+    private String hifobPay;
+
+    /**
+     * 医疗救助基金支出
+     */
+    private String mafPay;
+
+    /**
+     * 医院负担金额
+     */
+    private String hospPartAmt;
+
+    /**
+     * 其他支出
+     */
+    private String othPay;
+
+    /**
+     * 基金支付总额
+     */
+    private String fundPaySumamt;
+
+    /**
+     * 个人负担总金额
+     */
+    private String psnPartAmt;
+
+    /**
+     * 个人账户支出
+     */
+    private String acctPay;
+
+    /**
+     * 个人现金支出
+     */
+    private String psnCashPay;
+
+    /**
+     * 余额
+     */
+    private String balc;
+
+    /**
+     * 个人账户共济支付金额
+     */
+    private String acctMulaidPay;
+
+    /**
+     * 医药机构结算ID
+     */
+    private String medinsSetlId;
+
+    /**
+     * 清算经办机构
+     */
+    private String clrOptins;
+    /**
+     * 清算经办机构
+     */
+    private String clrOptinsName;
+
+
+    /**
+     * 清算方式
+     */
+    private String clrWay;
+
+    /**
+     * 清算类别
+     */
+    private String clrType;
+
+    /**
+     * 结算操作员
+     */
+    private String staffId;
+
+    /**
+     * revoked
+     */
+    private Integer revoked;
+
+    /**
+     * 结算类别:21-住院,11-门诊
+     */
+    private String setlType;
+
+    /**
+     * 结算清单上传成功后中心返回的流水号
+     */
+    private String setlListId;
+
+
+    private String outDeptName;
+
+}

+ 123 - 41
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiManageService.java

@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.ListUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,10 +27,9 @@ import thyyxxk.webserver.entity.medicalinsurance.query.SiPatInfo;
 import thyyxxk.webserver.entity.medicalinsurance.query.SiSetlFeeDetl;
 import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetlinfo;
 import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SlctSetlPrm;
-import thyyxxk.webserver.entity.medicalinsurance.setllistupload.IcuinfoUpld;
-import thyyxxk.webserver.entity.medicalinsurance.setllistupload.IteminfoUpld;
-import thyyxxk.webserver.entity.medicalinsurance.setllistupload.OprninfoUpld;
-import thyyxxk.webserver.entity.medicalinsurance.setllistupload.SetlinfoUpld;
+import thyyxxk.webserver.entity.medicalinsurance.setllistupload.*;
+import thyyxxk.webserver.entity.querydata.JieSuanDanChaXun;
+import thyyxxk.webserver.entity.querydata.TSiSetlinfo;
 import thyyxxk.webserver.service.PublicServer;
 import thyyxxk.webserver.utils.*;
 import thyyxxk.webserver.websocket.WebSocketServer;
@@ -316,6 +317,46 @@ public class SiManageService {
     }
 
     public ResultVo<String> upldSetlList(String patNo, Integer times, Integer ledgerSn) throws Exception {
+        ResultVo<UpldCollection> upldCollection = getUploadInfo(patNo, times, ledgerSn);
+        if (upldCollection.getCode() != 200) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, upldCollection.getMessage());
+        }
+        JSONObject input = new JSONObject();
+        input.put("setlinfo", JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(upldCollection.getData().getSetlinfo(), "yyyy-MM-dd HH:mm:ss")));
+        input.put("payinfo", JSONArray.parseArray(JSONArray.toJSONString(upldCollection.getData().getPayinfo())));
+        input.put("opspdiseinfo", new JSONArray());
+        input.put("diseinfo", JSONArray.parseArray(JSONArray.toJSONString(upldCollection.getData().getDiseinfo())));
+        input.put("iteminfo", JSONArray.parseArray(JSONArray.toJSONString(upldCollection.getData().getIteminfo())));
+        input.put("oprninfo", JSONArray.parseArray(JSONArray.toJSONString(upldCollection.getData().getOprninfo())));
+        input.put("icuinfo", JSONArray.parseArray(JSONArray.toJSONString(upldCollection.getData().getIcuinfo())));
+        JSONObject jsonObject = exec.makeTradeHeaderWithInsureArea(SiFunction.UPLOAD_SI_SETTLE_INFO, upldCollection.getData().getSetlinfo().getInsuplc());
+        jsonObject.replace("input", input);
+        // 这里是上传
+        JSONObject result = exec.executeTrade(jsonObject, SiFunction.UPLOAD_SI_SETTLE_INFO);
+
+//        JSONObject result = new JSONObject();
+//        if (times % 2 == 0) {
+//            result.put("infcode", 0);
+//        } else {
+//            result.put("infcode", -1);
+//            result.put("err_msg", "知道你为啥失败吗?");
+//        }
+        log.info("医保结算信息上传 \n操作人:{}\n参数:{} \n结果:{}", TokenUtil.getTokenUserId(), jsonObject, result);
+        if (null == result) {
+            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+        }
+        if (null == result.getInteger(RESULT_CODE)) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("医保中心报错:【%s】 ", result.getString("message")));
+        }
+        if (result.getIntValue(RESULT_CODE) == 0) {
+            upIdCollectionDao.fanHuiLiuShuiHao(result.getJSONObject(OUTPUT).getString("setl_list_id"), upldCollection.getData().getSetlinfo().getSetlId());
+            return ResultVoUtil.success(ExceptionEnum.SUCCESS, "上传成功");
+        }
+        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("医保中心报错:【%s】 ", result.getString("err_msg")));
+    }
+
+    public ResultVo<UpldCollection> getUploadInfo(String patNo, Integer times, Integer ledgerSn) throws Exception {
+        log.info("住院号:{},次数:{},账页:{}", patNo, times, ledgerSn);
         SetlinfoUpld setlinfoUpld = upIdCollectionDao.setlinfo1(patNo, times, ledgerSn);
         if (StringUtil.isBlank(setlinfoUpld.getSetlId())) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "结算id为空");
@@ -372,7 +413,7 @@ public class SiManageService {
         if (null == amtAndOthAmt || amtAndOthAmt.isEmpty()) {
             ResultVo<String> chrgitems = getChrgitems(patNo, setlId, setlinfoUpld.getMdtrtId(), setlinfoUpld.getInsuplc());
             if (chrgitems.getCode() != 200) {
-                return chrgitems;
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, chrgitems.getMessage());
             }
         }
         setlinfoUpld.setSetlBegnDate(setlinfoUpld.getAdmTime());
@@ -427,48 +468,34 @@ public class SiManageService {
                 long days = diff / (1000 * 60 * 60 * 24); // 天
                 long hours = (diff - days * (1000 * 60 * 60 * 24)) / (1000 * 60 * 60); // 小时
                 long minutes = (diff - days * (1000 * 60 * 60 * 24) - hours * (1000 * 60 * 60)) / (1000 * 60); // 分钟
-                String heJi = days + "/" + hours + "/" + minutes;
+                String zhongZhengJianHuShiJian = days + "/" + hours + "/" + minutes;
                 IcuinfoUpld icuinfoUpld = new IcuinfoUpld();
                 icuinfoUpld.setScsCutdWardType("1");
                 icuinfoUpld.setScsCutdInpoolTime(inpoolTime);
                 icuinfoUpld.setScsCutdExitTime(exitTime);
-                icuinfoUpld.setScsCutdSumDura(heJi);
+                icuinfoUpld.setScsCutdSumDura(zhongZhengJianHuShiJian);
                 zhongZhenJianHu.add(icuinfoUpld);
             }
         }
-
-
-        JSONObject input = new JSONObject();
-        input.put("setlinfo", JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(setlinfoUpld, "yyyy-MM-dd HH:mm:ss")));
-        input.put("payinfo", JSONArray.parseArray(JSONArray.toJSONString(upIdCollectionDao.payinfoUpld(patNo, times, ledgerSn))));
-        input.put("opspdiseinfo", new JSONArray());
-        input.put("diseinfo", JSONArray.parseArray(JSONArray.toJSONString(upIdCollectionDao.diseinfo(patNo, times))));
-        input.put("iteminfo", JSONArray.parseArray(JSONArray.toJSONString(amtAndOthAmt)));
-        input.put("oprninfo", JSONArray.parseArray(JSONArray.toJSONString(oprninfoUpld)));
-        input.put("icuinfo", JSONArray.parseArray(JSONArray.toJSONString(zhongZhenJianHu)));
-        JSONObject jsonObject = exec.makeTradeHeaderWithInsureArea(SiFunction.UPLOAD_SI_SETTLE_INFO, setlinfoUpld.getInsuplc());
-        jsonObject.replace("input", input);
-        //JSONObject result = exec.executeTrade(jsonObject, SiFunction.UPLOAD_SI_SETTLE_INFO);
-
-        JSONObject result = new JSONObject();
-        if (times % 2 == 0) {
-            result.put("infcode", 0);
-        } else {
-            result.put("infcode", -1);
-            result.put("err_msg", "知道你为啥失败吗?");
-        }
-        log.info("医保结算信息上传 \n操作人:{}\n参数:{} \n结果:{}", TokenUtil.getTokenUserId(), jsonObject, result);
-        if (null == result) {
-            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
-        }
-        if (null == result.getInteger(RESULT_CODE)) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("医保中心报错:【%s】 ", result.getString("message")));
-        }
-        if (result.getIntValue(RESULT_CODE) == 0) {
-            //upIdCollectionDao.fanHuiLiuShuiHao(result.getJSONObject(OUTPUT).getString("setl_list_id"), setlinfoUpld.getSetlId());
-            return ResultVoUtil.success(ExceptionEnum.SUCCESS, "上传成功");
-        }
-        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("医保中心报错:【%s】 ", result.getString("err_msg")));
+        List<PayinfoUpld> payinfo = upIdCollectionDao.payinfoUpld(patNo, times, ledgerSn);
+        List<DiseinfoUpld> diseinfos = upIdCollectionDao.diseinfo(patNo, times);
+
+        UpldCollection upldCollection = new UpldCollection();
+        // 患者的基本信息
+        upldCollection.setSetlinfo(setlinfoUpld);
+        // 基金支付信息
+        upldCollection.setPayinfo(payinfo);
+        // 门特慢特病诊断信息 目前还没有
+        // upldCollection.setOpspdiseinfo(new ArrayList<>());
+        // 住院诊断信息
+        upldCollection.setDiseinfo(diseinfos);
+        //  收费项目信息
+        upldCollection.setIteminfo(amtAndOthAmt);
+        // 手术操作信息
+        upldCollection.setOprninfo(oprninfoUpld);
+        // 重症监护信息
+        upldCollection.setIcuinfo(zhongZhenJianHu);
+        return ResultVoUtil.success(upldCollection);
     }
 
     /**
@@ -540,6 +567,12 @@ public class SiManageService {
         return (int) (per * 100);
     }
 
+    /**
+     * 获取最大值的下标
+     *
+     * @param arr int 数组
+     * @return 返回下标
+     */
     public int getMaxIndex(int[] arr) {
         int maxIndex = 0;    //获取到的最大值的角标
         for (int i = 0; i < arr.length; i++) {
@@ -551,7 +584,6 @@ public class SiManageService {
     }
 
     private ResultVo<String> getChrgitems(String patNo, String setlId, String mdtrtId, String admdvs) {
-
         JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.QUERY_FEE_DETAILS, admdvs);
         JSONObject data = new JSONObject();
         data.put("psn_no", queryDao.selectPsnNo(patNo));
@@ -586,4 +618,54 @@ public class SiManageService {
         }
         return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, result.getString(ERROR_MESSAGE));
     }
+
+
+    public ResultVo<IPage<TSiSetlinfo>> huoQuJieSuanRenYuan(JieSuanDanChaXun param) {
+        log.info("参数:{}", JSONObject.toJSONString(param));
+        IPage<TSiSetlinfo> page = new Page<>();
+        page.setRecords(upIdCollectionDao.huoQuJieSuanRenYuan(param.getStartTime(), param.getEndTime(), param.getClrType(), param.getPatNo(),
+                param.getInsutype(), param.getOutDept(), param.getMedType(), param.getPsnType(), param.getCurrentPage(), param.getPageSize()));
+        if (ListUtil.isBlank(page.getRecords())) {
+            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
+        }
+        for (TSiSetlinfo item : page.getRecords()) {
+            item.setGendName(item.getGend().equals("1") ? "男" : "女");
+            Admdvs admdvs = Admdvs.get(item.getClrOptins());
+            if (null == admdvs) {
+                item.setClrOptinsName(dao.selectRegion(item.getClrOptins()));
+            } else {
+                item.setClrOptinsName(admdvs.getName());
+            }
+            Insutype insutype = Insutype.get(item.getInsutype());
+            if (null != insutype) {
+                item.setInsutypeName(insutype.getName());
+            }
+            PsnType psnType = PsnType.get(item.getPsnType());
+            if (null != psnType) {
+                item.setPsnTypeName(psnType.getName());
+            }
+            MedType medType = MedType.get(item.getMedType());
+            if (null != medType) {
+                item.setMedTypeName(medType.getName());
+            }
+        }
+        if (param.getTotal() == 0) {
+            page.setTotal(upIdCollectionDao.huoQuJieSuanRenYuanTotal(param.getStartTime(), param.getEndTime(), param.getClrType(), param.getPatNo(),
+                    param.getInsutype(), param.getOutDept(), param.getMedType(), param.getPsnType()));
+        }
+        return ResultVoUtil.success(page);
+    }
+
+
+    public ResultVo<List<Object>> getMedType() {
+        JSONArray jsonArray = new JSONArray();
+        for (MedType e : MedType.values()) {
+            JSONObject object = new JSONObject();
+            object.put("code", e.getCode());
+            object.put("name", e.getName());
+            jsonArray.add(object);
+        }
+        return ResultVoUtil.success(jsonArray);
+    }
+
 }