Browse Source

修复对账问题。

lighter 3 years ago
parent
commit
e6f76013bb

+ 7 - 8
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiManageDao.java

@@ -5,10 +5,8 @@ import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 import thyyxxk.webserver.entity.medicalinsurance.manage.InstSetlLdgChkBrf;
-import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetldetail;
 
 import java.math.BigDecimal;
-import java.util.Date;
 import java.util.List;
 
 /**
@@ -37,8 +35,9 @@ public interface SiManageDao {
     @Select("select pat_no,times,ledger_sn,medfee_sumamt,acct_pay,fund_pay_sumamt, " +
             "hospPay=(select sum(b.fund_payamt) from t_si_setldetail b where b.pat_no=a.pat_no " +
             "and b.times=a.times and b.ledger_sn=a.ledger_sn and (b.fund_pay_type='999996' or b.setl_proc_info='999996'))" +
-            "from t_si_setlinfo a where insutype=#{insutype} and " +
-            "setl_type=#{setlType} and revoked=0 and clr_optins=#{clrOptins} and setl_time>=#{start} and setl_time<=#{end}")
+            "from t_si_setlinfo a where insutype=#{insutype} and setl_type=#{setlType} and revoked=0 " +
+            "and clr_optins=#{clrOptins} and setl_time>=#{start} and setl_time<=#{end} and fund_pay_sumamt!=0 " +
+            "and (insuplc_admdvs='439900' or insuplc_admdvs like '4301%')")
     List<InstSetlLdgChkBrf> selectSetlChkBrfsWithInsutype(@Param("setlType") String setlType,
                                               @Param("insutype") String insutype,
                                               @Param("clrOptins") String clrOptins,
@@ -46,10 +45,10 @@ public interface SiManageDao {
                                               @Param("end") String end);
 
     @Select("select pat_no,times,ledger_sn,setl_id,mdtrt_id,psn_no,medfee_sumamt,acct_pay,fund_pay_sumamt,psn_cash_pay, " +
-            "hospPay=(select sum(b.fund_payamt) from t_si_setldetail b where b.pat_no=a.pat_no " +
-            "and b.times=a.times and b.ledger_sn=a.ledger_sn and (b.fund_pay_type='999996' or b.setl_proc_info='999996'))" +
-            "from t_si_setlinfo a where setl_type=#{setlType} and revoked=0 and clr_optins=#{clrOptins} " +
-            "and setl_time>=#{start} and setl_time<=#{end}")
+            "hospPay=(select sum(b.fund_payamt) from t_si_setldetail b where b.pat_no=a.pat_no and b.times=a.times " +
+            "and b.ledger_sn=a.ledger_sn and (b.fund_pay_type='999996' or b.setl_proc_info='999996'))" +
+            "from t_si_setlinfo a where setl_type=#{setlType} and revoked=0 and clr_optins=#{clrOptins} and fund_pay_sumamt!=0 " +
+            "and setl_time>=#{start} and setl_time<=#{end} and (insuplc_admdvs='439900' or insuplc_admdvs like '4301%')")
     List<InstSetlLdgChkBrf> selectSetlChkBrfs(@Param("setlType") String setlType,
                                               @Param("clrOptins") String clrOptins,
                                               @Param("start") String start,

+ 17 - 0
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiSetlinfoDao.java

@@ -3,9 +3,12 @@ package thyyxxk.webserver.dao.his.medicalinsurance;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetlinfo;
 
+import java.util.List;
+
 /**
  * @description: 结算基本信息
  * @author: DingJie
@@ -31,4 +34,18 @@ public interface SiSetlinfoDao extends BaseMapper<SiSetlinfo> {
                               @Param("setlId") String setlId,
                               @Param("medinsSetlId") String medinsSetlId,
                               @Param("setlMsgid") String setlMsgid);
+
+    @Select("select a.*,b.insuplc_admdvs from t_si_setlinfo a, t_si_pat_info b where setl_type=#{setlType} " +
+            "and revoked=0 and setl_time>=#{begndate} and setl_time<=#{enddate} and a.setl_id=b.setl_id")
+    List<SiSetlinfo> selectSetlinfos(@Param("setlType") String setlType,
+                                     @Param("begndate") String begndate,
+                                     @Param("enddate") String enddate);
+
+    @Select("select a.*,b.insuplc_admdvs from t_si_setlinfo a, t_si_pat_info b where setl_type=#{setlType} " +
+            "and revoked=0 and a.insutype=#{insutype} and setl_time>=#{begndate} " +
+            "and setl_time<=#{enddate} and a.setl_id=b.setl_id")
+    List<SiSetlinfo> selectSetlinfosWithInsutype(@Param("setlType") String setlType,
+                                     @Param("insutype") String insutype,
+                                     @Param("begndate") String begndate,
+                                     @Param("enddate") String enddate);
 }

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

@@ -2,7 +2,9 @@ package thyyxxk.webserver.entity.medicalinsurance.setlinfo;
 
 import java.io.Serializable;
 
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
@@ -36,9 +38,12 @@ public class SiSetlinfo implements Serializable {
 	 */
 	private String mdtrtId;
 
+	private String insuplcAdmdvs;
+
 	/**
 	 * 结算ID
 	 */
+	@TableId(type = IdType.ASSIGN_ID)
 	private String setlId;
 
 	/**

+ 2 - 1
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiManageService.java

@@ -286,7 +286,6 @@ public class SiManageService {
     }
 
     public ResultVo<Map<String, Object>> selectSetlinfos(SlctSetlPrm prm) {
-        log.info("查询结算信息:{}", prm);
         QueryWrapper<SiSetlinfo> wrapper = new QueryWrapper<>();
         if (StringUtil.notBlank(prm.getInsutype())) {
             wrapper.eq("insutype", prm.getInsutype());
@@ -295,8 +294,10 @@ public class SiManageService {
         String enddate = DateUtil.formatDatetime(prm.getStmtEnddate(), "yyyy-MM-dd") + " 23:59:59";
         wrapper.eq("setl_type", prm.getClrType());
         wrapper.eq("revoked", YesOrNo.NO.getCode());
+        wrapper.apply("fund_pay_sumamt!=0");
         wrapper.apply("setl_time>='" + begndate + "'");
         wrapper.apply("setl_time<='" + enddate + "'");
+        wrapper.apply("(insuplc_admdvs='439900' or insuplc_admdvs like '4301%') ");
         List<SiSetlinfo> list = setlinfoDao.selectList(wrapper);
         if (null == list || list.isEmpty()) {
             return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有查询到符合条件的数据。");

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

@@ -394,6 +394,7 @@ public class SiZyService {
             setlEntity.setStaffId(TokenUtil.getTokenUserId());
             setlEntity.setRevoked(YesOrNo.NO.getCode());
             setlEntity.setSetlType(ClrType.INPATIENT.getCode());
+            setlEntity.setInsuplcAdmdvs(preSetlmt.getInsuplcAdmdvs());
             setlinfodao.insert(setlEntity);
             setlinfodao.updateSiZyInfoSetlId(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn(),
                     setlEntity.getSetlId(), setlEntity.getMedinsSetlId(), input.getString("msgid"));
@@ -405,7 +406,6 @@ public class SiZyService {
                 setldetailEntity.setLedgerSn(p.getLedgerSn());
                 setldetldao.insert(setldetailEntity);
             }
-            // todo 结算,需要改造,慢慢删除responceType字段
             YbSettleFee settleFee = new YbSettleFee();
             if (p.getMidSetl()) {
                 settleFee.setZjdzDatetime(p.getZjdzDatetime());