ソースを参照

修复一些问题

lighter 3 年 前
コミット
c8b0e9b960

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

@@ -97,7 +97,6 @@ public class MarkMtFeesController {
         payInfo.put("cashPay", fund.getCashPay());
         payInfo.put("acctPay", fund.getAcctPay());
         payInfo.put("selfPay", fund.getSelfPay());
-
         map.put("payInfo", payInfo);
         log.info("{}:参数:{},结果:{}", logText, param, map);
         return map;

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

@@ -1,5 +1,6 @@
 package thyyxxk.webserver.controller.medicalinsurance;
 
+import com.alibaba.fastjson.JSONObject;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
@@ -59,12 +60,11 @@ public class SiManageController {
     }
 
     @PassToken
-    @GetMapping("/upldCollection")
-    public ResultVo<String> upldCollection(@RequestParam("patNo") String patNo,
-                                           @RequestParam("times") Integer times,
-                                           @RequestParam("ledgerSn") Integer ledgerSn) throws Exception {
-        return service.upldCollection(patNo, times, ledgerSn);
-
+    @GetMapping("/upldSetlList")
+    public ResultVo<JSONObject> upldSetlList(@RequestParam("patNo") String patNo,
+                                               @RequestParam("times") Integer times,
+                                               @RequestParam("ledgerSn") Integer ledgerSn) throws Exception {
+        return service.upldSetlList(patNo, times, ledgerSn);
     }
 
 }

+ 0 - 2
src/main/java/thyyxxk/webserver/controller/yibao/DismissController.java

@@ -12,12 +12,10 @@ import thyyxxk.webserver.entity.yibao.dismiss.*;
 import thyyxxk.webserver.entity.yibao.patient.Patient;
 import thyyxxk.webserver.service.medicalinsurance.SiZyService;
 import thyyxxk.webserver.service.yibao.DismissService;
-import thyyxxk.webserver.service.yibao.SettleService;
 import thyyxxk.webserver.utils.ResultVoUtil;
 import thyyxxk.webserver.utils.TokenUtil;
 
 import java.util.List;
-import java.util.concurrent.atomic.AtomicReference;
 
 /**
  * @author dj

+ 0 - 98
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiZyDao.java

@@ -6,7 +6,6 @@ import thyyxxk.webserver.entity.medicalinsurance.inpatient.ZyPatientInfo;
 import thyyxxk.webserver.entity.medicalinsurance.inpatient.*;
 
 import java.util.Date;
-import java.util.LinkedList;
 import java.util.List;
 
 /**
@@ -90,103 +89,6 @@ public interface SiZyDao {
     Integer selectMaxLedgerSn(@Param("inpatientNo") String inpatientNo,
                            @Param("admissTimes") int admissTimes);
 
-    /**
-     * HIS费用接收重算
-     *
-     * @param inpatientNo 住院号
-     * @param admissTimes 住院次数
-     * @param ledgerSn    账页号
-     */
-    @Update("EXEC zy_calc_balance #{inpatientNo}, #{admissTimes}, #{ledgerSn}")
-    void hisRecount(@Param("inpatientNo") String inpatientNo,
-                    @Param("admissTimes") int admissTimes,
-                    @Param("ledgerSn") int ledgerSn);
-
-    /**
-     * 获取未上传至医保中心的收费费用明细
-     *
-     * @param inpatientNo 住院号
-     * @param admissTimes 住院次数
-     * @param ledgerSn    账页号
-     * @return 费用明细
-     */
-    @Select("select detail_sn as feedetlSn, " +
-            "order_no as drordNo, " +
-            "initFeedetlSn=case when ori_detail_sn=-1 then null else ori_detail_sn end, " +
-            "charge_date as feeOcurTime, " +
-            "charge_code_mx as medinsListCodg, " +
-            "charge_fee as detItemFeeSumamt, " +
-            "charge_amount as cnt, " +
-            "pric=charge_fee/charge_amount, " +
-            "ward_code as bilgDeptCodg, " +
-            "hospApprFlag=case when yb_self_flag='1' then '2' else '1' end," +
-            "mdtrtId=(select mdtrt_id from t_si_pat_info b where b.pat_no=inpatient_no and b.times=admiss_times and b.ledger_sn=a.ledger_sn), " +
-            "psnNo=(select psn_no from t_si_pat_info b where b.pat_no=inpatient_no and b.times=admiss_times and b.ledger_sn=a.ledger_sn), " +
-            "medType=(select med_type from t_si_pat_info b where b.pat_no=inpatient_no and b.times=admiss_times and b.ledger_sn=a.ledger_sn), " +
-            "medListCodg=isnull((select max(national_code) from yp_zd_dict where code=charge_code_mx),(select max(national_code) from zd_charge_item where code=charge_code_mx)), " +
-            "bilgDeptName=(select name from zd_unit_code where code=ward_code), " +
-            "bilgDrCodg=isnull(isnull(doctor_code,refer_physician), op_id_code), " +
-            "bilgDrName=isnull(isnull((select rtrim(name) from a_employee_mi where code=doctor_code), " +
-            "(select rtrim(name) from a_employee_mi where code=refer_physician)),(select rtrim(name) from a_employee_mi where code=op_id_code)) " +
-            "from zy_detail_charge a where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes} and " +
-            "ledger_sn=#{ledgerSn} and charge_amount>0 and isnull(infant_flag,0)=0 and isnull(trans_flag_yb,0) in ('',0) " +
-            "and charge_date<=#{today}")
-    LinkedList<FeeDtle> selectNotUploadedPositiveFees(@Param("inpatientNo") String inpatientNo,
-                                                      @Param("admissTimes") int admissTimes,
-                                                      @Param("ledgerSn") int ledgerSn,
-                                                      @Param("today") String today);
-
-    /**
-     * 获取未上传至医保中心的退费费用明细
-     *
-     * @param inpatientNo 住院号
-     * @param admissTimes 住院次数
-     * @param ledgerSn    账页号
-     * @return 费用明细
-     */
-    @Select("select detail_sn as feedetlSn, " +
-            "order_no as drordNo, " +
-            "initFeedetlSn=case when ori_detail_sn=-1 then null else ori_detail_sn end, " +
-            "charge_date as feeOcurTime, " +
-            "charge_code_mx as medinsListCodg, " +
-            "charge_fee as detItemFeeSumamt, " +
-            "charge_amount as cnt, " +
-            "pric=charge_fee/charge_amount, " +
-            "ward_code as bilgDeptCodg, " +
-            "hospApprFlag=case when yb_self_flag='1' then '2' else '1' end," +
-            "mdtrtId=(select mdtrt_id from t_si_pat_info b where b.pat_no=inpatient_no and b.times=admiss_times and b.ledger_sn=a.ledger_sn), " +
-            "psnNo=(select psn_no from t_si_pat_info b where b.pat_no=inpatient_no and b.times=admiss_times and b.ledger_sn=a.ledger_sn), " +
-            "medType=(select med_type from t_si_pat_info b where b.pat_no=inpatient_no and b.times=admiss_times and b.ledger_sn=a.ledger_sn), " +
-            "medListCodg=isnull((select max(national_code) from yp_zd_dict where code=charge_code_mx),(select max(national_code) from zd_charge_item where code=charge_code_mx)), " +
-            "bilgDeptName=(select name from zd_unit_code where code=ward_code), " +
-            "bilgDrCodg=isnull(isnull(doctor_code,refer_physician), op_id_code), " +
-            "bilgDrName=isnull(isnull((select rtrim(name) from a_employee_mi where code=doctor_code), " +
-            "(select rtrim(name) from a_employee_mi where code=refer_physician)),(select rtrim(name) from a_employee_mi where code=op_id_code)) " +
-            "from zy_detail_charge a where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes} and " +
-            "ledger_sn=#{ledgerSn} and charge_amount<0 and isnull(infant_flag,0)=0 and ori_detail_sn is not null and " +
-            "isnull(trans_flag_yb,0) in ('',0) and charge_date<=#{today}")
-    LinkedList<FeeDtle> selectNotUploadedNegativeFees(@Param("inpatientNo") String inpatientNo,
-                                                      @Param("admissTimes") int admissTimes,
-                                                      @Param("ledgerSn") int ledgerSn,
-                                                      @Param("today") String today);
-
-    /**
-     * 更新住院费用表的上传状态
-     *
-     * @param inpatientNo 住院号
-     * @param admissTimes 住院次数
-     * @param fees   要更新的费用
-     */
-    @Update("<script>" +
-            "update zy_detail_charge set trans_flag_yb=1 where inpatient_no=#{inpatientNo} and " +
-            "admiss_times=#{admissTimes} and detail_sn in " +
-            "<foreach collection='fees' item='fee' separator=',' open='(' close=')'>" +
-            "#{fee.feedetlSn}</foreach>" +
-            "</script>")
-    void updateTransFlag(@Param("inpatientNo") String inpatientNo,
-                         @Param("admissTimes") int admissTimes,
-                         @Param("fees") List<FeeDtle> fees);
-
     /**
      * 撤销医保费用上传后,更改上传标志为0
      *

+ 6 - 29
src/main/java/thyyxxk/webserver/dao/his/yibao/Routines.java

@@ -32,12 +32,13 @@ public interface Routines {
             "charge_name=(select top 1 rtrim(name) from ${zdTable} where code=charge_code_mx) " +
             "from zy_detail_charge where inpatient_no=#{patNo} and admiss_times=#{times} and " +
             "ledger_sn=#{ledgerSn} and isnull(trans_flag_yb,0)=0 and isnull(infant_flag,0)=0 " +
-            "and isnull(serial,'') in (#{serial1},#{serial2})")
+            "and charge_date<=#{today} and isnull(serial,'') in (#{serial1},#{serial2})")
     IPage<NotUploadedFee> selectNotUploadedFees(IPage<NotUploadedFee> iPage,
                                                 @Param("zdTable") String zdTable,
                                                 @Param("patNo") String patNo,
                                                 @Param("times") int times,
                                                 @Param("ledgerSn") int ledgerSn,
+                                                @Param("today") String today,
                                                 @Param("serial1") String serial1,
                                                 @Param("serial2") String serial2);
 
@@ -46,46 +47,22 @@ public interface Routines {
             "charge_name=(select top 1 rtrim(name) from ${zdTable} where code=charge_code_mx) " +
             "from zy_detail_charge where inpatient_no=#{patNo} and admiss_times=#{times} and " +
             "ledger_sn=#{ledgerSn} and isnull(trans_flag_yb,0)=0 and isnull(infant_flag,0)=0 " +
-            "and isnull(serial,'') in (#{serial1},#{serial2})")
+            "and charge_date<=#{today} and isnull(serial,'') in (#{serial1},#{serial2})")
     IPage<NotUploadedFee> selectInjuryNotUploadedFees(IPage<NotUploadedFee> iPage,
                                                 @Param("zdTable") String zdTable,
                                                 @Param("patNo") String patNo,
                                                 @Param("times") int times,
                                                 @Param("ledgerSn") int ledgerSn,
+                                                @Param("today") String today,
                                                 @Param("serial1") String serial1,
                                                 @Param("serial2") String serial2);
 
     @Select("select sum(charge_fee) from zy_detail_charge where inpatient_no=#{patNo} and admiss_times=#{times} and " +
-            "ledger_sn=#{ledgerSn} and isnull(trans_flag_yb,0)=0 and isnull(serial,'') in (#{serial1},#{serial2})")
+            "ledger_sn=#{ledgerSn} and isnull(trans_flag_yb,0)=0 and charge_date<=#{today} and isnull(serial,'') in (#{serial1},#{serial2})")
     String selectSumChargeFee(@Param("patNo") String patNo,
                               @Param("times") int times,
                               @Param("ledgerSn") int ledgerSn,
+                              @Param("today") String today,
                               @Param("serial1") String serial1,
                               @Param("serial2") String serial2);
-
-
-    @Select("select charge_amount,detail_sn,ori_detail_sn from zy_detail_charge " +
-            "where inpatient_no=#{zyh} and admiss_times=#{zycs} and ledger_sn=#{sn} " +
-            "and isnull(infant_flag,0)!=1 and isnull(trans_flag_yb,0) not in (1,2) " +
-            "and isnull(ori_detail_sn,-1)!=-1")
-    List<FeeCounteract> selectNegativeFeesWithOriDetlSn(@Param("zyh") String zyh,
-                                                        @Param("zycs") Integer zycs,
-                                                        @Param("sn") Integer sn);
-
-    @Select("<script>" +
-            "select detail_sn from zy_detail_charge " +
-            "where inpatient_no=#{zyh} and admiss_times=#{zycs} and ledger_sn=#{sn} " +
-            "and isnull(trans_flag_yb,0) not in (1,2) and detail_sn in " +
-            "<foreach collection='list' item='detailSn' open='(' separator=',' close=')'>" +
-            "#{detailSn}" +
-            "</foreach>" +
-            "</script>")
-    List<Integer> selectPositiveFeesByDetlSn(@Param("zyh") String zyh,
-                                             @Param("zycs") Integer zycs,
-                                             @Param("sn") Integer sn,
-                                             @Param("list") List<Integer> list);
-
-    @Update("update zy_detail_charge set trans_flag_yb=2 where inpatient_no=#{zyh} and " +
-            "admiss_times=#{zycs} and detail_sn in (#{sn}, #{sn2})")
-    void updateYbTransFlagInPair(@Param("zyh") String zyh, @Param("zycs") Integer zycs, @Param("sn") Integer sn, @Param("sn2") Integer sn2);
 }

+ 23 - 22
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiManageService.java

@@ -306,7 +306,7 @@ public class SiManageService {
         return ResultVoUtil.success(map);
     }
 
-    public ResultVo<String> upldCollection(String patNo, Integer times, Integer ledgerSn) throws Exception {
+    public ResultVo<JSONObject> upldSetlList(String patNo, Integer times, Integer ledgerSn) throws Exception {
         log.info("入参 住院/门诊:{},次数:{}", patNo, times);
         SetlinfoUpld setlinfoUpld = upIdCollectionDao.setlinfo1(patNo, times);
         if (StringUtil.isBlank(setlinfoUpld.getSetlId())) {
@@ -393,26 +393,27 @@ public class SiManageService {
             }
         }
 
-        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.UPLOAD_SI_SETTLE_INFO, setlinfoUpld.getInsuplc());
-        input.getJSONObject("input").put("setlinfo", JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(setlinfoUpld, "yyyy-MM-dd HH:mm:ss")));
-        input.getJSONObject("input").put("payinfo", JSONArray.parseArray(JSONArray.toJSONString(upIdCollectionDao.payinfoUpld(patNo, times, ledgerSn))));
-        input.getJSONObject("input").put("opspdiseinfo", new JSONArray());
-        input.getJSONObject("input").put("diseinfo", JSONArray.parseArray(JSONArray.toJSONString(upIdCollectionDao.diseinfo(patNo, times))));
-        input.getJSONObject("input").put("iteminfo", JSONArray.parseArray(JSONArray.toJSONString(amtAndOthAmt)));
-        input.getJSONObject("input").put("oprninfo", JSONArray.parseArray(JSONArray.toJSONString(upIdCollectionDao.oprninfoUplds(patNo, times))));
-        input.getJSONObject("input").put("icuinfo", JSONArray.parseArray(JSONArray.toJSONString(zhongZhenJianHu)));
-
-        JSONObject result = exec.executeTrade(input, SiFunction.UPLOAD_SI_SETTLE_INFO);
-        log.info("医保结算信息上传:\n参数:{} \n结果:{}", input, result);
-        if (null == result) {
-            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
-        }
-        if (null == result.getInteger(RESULT_CODE)) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
-        }
-        if (result.getIntValue(RESULT_CODE) == 0) {
-            return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "上传成功");
-        }
-        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("err_msg"));
+        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(upIdCollectionDao.oprninfoUplds(patNo, times))));
+        input.put("icuinfo", JSONArray.parseArray(JSONArray.toJSONString(zhongZhenJianHu)));
+        log.info("查询结算单上传信息:{}", input);
+        return ResultVoUtil.success(input);
+//        JSONObject result = exec.executeTrade(input, SiFunction.UPLOAD_SI_SETTLE_INFO);
+//        log.info("医保结算信息上传:\n参数:{} \n结果:{}", input, result);
+//        if (null == result) {
+//            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+//        }
+//        if (null == result.getInteger(RESULT_CODE)) {
+//            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
+//        }
+//        if (result.getIntValue(RESULT_CODE) == 0) {
+//            return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "上传成功");
+//        }
+//        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("err_msg"));
     }
 }

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

@@ -183,15 +183,9 @@ public class SiZyService {
         return zySrvc.uploadFeeDetail(o);
     }
 
-    private String getTodayEndTime() {
-        SimpleDateFormat smdate = new SimpleDateFormat("yyyy-MM-dd");
-        String date = smdate.format(new Date());
-        return date + " 23:59:59.999";
-    }
-
     public ResultVo<String> hospitalizationPreSettlement(ZyPatientInfo p) {
         PreSetlmt preSetlmt = dao.selectPreSetlmt(p.getInpatientNo(), p.getAdmissTimes(),
-                p.getLedgerSn(), getTodayEndTime());
+                p.getLedgerSn(), DateUtil.getTodayEndTime());
         if (null == preSetlmt || StringUtil.isBlank(preSetlmt.getMdtrtId())) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保在院信息!");
         }

+ 4 - 3
src/main/java/thyyxxk/webserver/service/yibao/PatientService.java

@@ -85,12 +85,13 @@ public class PatientService {
             serial2 = "99";
         }
         iPage = param.getInjuryMode() ? routines.selectInjuryNotUploadedFees(iPage, param.getZdTable(),
-                param.getPatNo(), param.getTimes(), ledgerSn, serial1, serial2) :
+                param.getPatNo(), param.getTimes(), ledgerSn, DateUtil.getTodayEndTime(), serial1, serial2) :
                 routines.selectNotUploadedFees(iPage, param.getZdTable(), param.getPatNo(), param.getTimes(),
-                ledgerSn, serial1, serial2);
+                ledgerSn, DateUtil.getTodayEndTime(), serial1, serial2);
         map.put("totalSize", iPage.getTotal());
         map.put("list", iPage.getRecords());
-        map.put("sum", routines.selectSumChargeFee(param.getPatNo(), param.getTimes(), ledgerSn, serial1, serial2));
+        map.put("sum", routines.selectSumChargeFee(param.getPatNo(), param.getTimes(), ledgerSn,
+                DateUtil.getTodayEndTime(), serial1, serial2));
         return ResultVoUtil.success(map);
     }
 

+ 0 - 57
src/main/java/thyyxxk/webserver/service/yibao/SettleService.java

@@ -1,57 +0,0 @@
-package thyyxxk.webserver.service.yibao;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import thyyxxk.webserver.dao.his.yibao.Routines;
-import thyyxxk.webserver.entity.yibao.patient.FeeCounteract;
-import thyyxxk.webserver.entity.yibao.patient.Overview;
-
-import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * @author dj
- */
-@Slf4j
-@Service
-public class SettleService {
-    private final Routines routines;
-
-    @Autowired
-    public SettleService(Routines routines) {
-        this.routines = routines;
-    }
-
-    public void beforeUpload(Overview o) {
-        List<FeeCounteract> negative = routines.selectNegativeFeesWithOriDetlSn(
-                o.getInpatientNo(), o.getAdmissTimes(), o.getLedgerSn());
-        if (null == negative || negative.isEmpty()) {
-            log.info("正负相抵完成,抵消费用总条目:0");
-            return;
-        }
-        List<Integer> positive = new ArrayList<>();
-        List<Integer> tempSn = new ArrayList<>();
-        for (FeeCounteract feeCounteract : negative) {
-            tempSn.add(feeCounteract.getOriDetailSn());
-            if (tempSn.size() == 20) {
-                positive.addAll(routines.selectPositiveFeesByDetlSn(
-                        o.getInpatientNo(), o.getAdmissTimes(), o.getLedgerSn(), tempSn));
-                tempSn.clear();
-            }
-        }
-        if (tempSn.size() > 0) {
-            positive.addAll(routines.selectPositiveFeesByDetlSn(
-                    o.getInpatientNo(), o.getAdmissTimes(), o.getLedgerSn(), tempSn));
-        }
-        AtomicInteger count = new AtomicInteger();
-        negative.forEach(itm -> {
-            if (positive.contains(itm.getOriDetailSn())) {
-                routines.updateYbTransFlagInPair(o.getInpatientNo(),
-                        o.getAdmissTimes(), itm.getDetailSn(), itm.getOriDetailSn());
-                count.addAndGet(2);
-            }
-        });
-        log.info("正负相抵完成,抵消费用总条目:{}", count.get());
-    }
-}

+ 6 - 0
src/main/java/thyyxxk/webserver/utils/DateUtil.java

@@ -58,6 +58,12 @@ public class DateUtil {
         return da.format(now.getTime());
     }
 
+    public static String getTodayEndTime() {
+        SimpleDateFormat smdate = new SimpleDateFormat("yyyy-MM-dd");
+        String date = smdate.format(new Date());
+        return date + " 23:59:59.999";
+    }
+
     public static Date getDatetimeAfterCentury(Date date) {
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(date);