lighter 3 роки тому
батько
коміт
258e82dc57

+ 2 - 2
src/main/java/thyyxxk/webserver/constants/sidicts/SetlType.java

@@ -7,9 +7,9 @@ package thyyxxk.webserver.constants.sidicts;
  */
 public enum SetlType {
 
-    INPATIENT(1, "住院"),
+    INPATIENT(21, "住院"),
 
-    OUTPATIENT(2, "门诊");
+    OUTPATIENT(11, "门诊");
 
     private final int code;
     private final String name;

+ 3 - 9
src/main/java/thyyxxk/webserver/controller/medicalinsurance/SiQueryController.java

@@ -9,9 +9,9 @@ import thyyxxk.webserver.entity.medicalinsurance.inpatient.InHspPsnInfo;
 import thyyxxk.webserver.entity.medicalinsurance.outpatient.SpcChrDiseAcct;
 import thyyxxk.webserver.entity.medicalinsurance.query.*;
 import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetlinfo;
+import thyyxxk.webserver.entity.medicalinsurance.setlinfo.TimesList;
 import thyyxxk.webserver.entity.yibao.ZyActpatient;
 import thyyxxk.webserver.service.medicalinsurance.SiQueryService;
-import thyyxxk.webserver.utils.ResultVoUtil;
 
 import java.util.List;
 import java.util.Map;
@@ -107,11 +107,6 @@ public class SiQueryController {
         return service.queryPersonnelAssignmentInfo(q);
     }
 
-    @PostMapping("/querySiSetlIndex")
-    public ResultVo<List<SetlIndex>> querySiSetlIndex(@RequestBody @Validated QrySetlListPrm q) {
-        return service.querySiSetlIndex(q);
-    }
-
     @PassToken
     @PostMapping("/querySiSetlList")
     public ResultVo querySiSetlList(@RequestBody @Validated SetlIndex index) {
@@ -124,8 +119,8 @@ public class SiQueryController {
     }
 
     @GetMapping("/fetchSiTimesList")
-    public ResultVo<List<Integer>> fetchSiTimesList(@RequestParam("patNo") String patNo) {
-        return service.fetchSiTimesList(patNo);
+    public ResultVo<List<TimesList>> fetchSiTimesList(@RequestParam("patNo") String patNo, @RequestParam("type") Integer type) {
+        return service.fetchSiTimesList(patNo, type);
     }
 
     @PostMapping("/selectSetlinfoStatistics")
@@ -152,5 +147,4 @@ public class SiQueryController {
                                                                  @RequestParam("certno") String certno) {
         return service.weiJieSuanZaiYuanHuanZhe(patNo, startTime, endTime, name, certno);
     }
-
 }

+ 11 - 34
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiQueryDao.java

@@ -3,6 +3,7 @@ package thyyxxk.webserver.dao.his.medicalinsurance;
 import org.apache.ibatis.annotations.*;
 import thyyxxk.webserver.entity.dictionary.PureCodeName;
 import thyyxxk.webserver.entity.medicalinsurance.query.*;
+import thyyxxk.webserver.entity.medicalinsurance.setlinfo.TimesList;
 import thyyxxk.webserver.entity.medicalinsurance.setllist.BrfChrgitm;
 import thyyxxk.webserver.entity.medicalinsurance.setllist.InptntSetlmtLst;
 import thyyxxk.webserver.entity.medicalinsurance.setllist.OtptntSetlmtLst;
@@ -131,9 +132,8 @@ public interface SiQueryDao {
                            @Param("ledgerSn") int ledgerSn,
                            @Param("nullCtnt") String nullCtnt);
 
-    @Select("select type=#{type},pat_no,times,ledger_sn,psn_name,setl_id,gend,setl_time,medfee_sumamt,psn_no " +
-            "from t_si_setlinfo where pat_no=#{patNo} and times=#{times} and revoked=0")
-    List<SetlIndex> selectSetlIndex(QrySetlListPrm q);
+    @Select("select setl_id from t_si_setlinfo where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn} and revoked=0")
+    String selectSetlId(@Param("patNo") String patNo, @Param("times") int times, @Param("ledgerSn") int ledgerSn);
 
     @Select("select * from t_si_pat_info where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn}")
     SiPatInfo selectSiPatInfo(@Param("patNo") String patNo, @Param("times") int times, @Param("ledgerSn") int ledgerSn);
@@ -152,44 +152,21 @@ public interface SiQueryDao {
             "and insuplc_admdvs is not null order by times desc")
     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, " +
+    @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, " +
             "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,c.admiss_date as begntime,a.certno,a.mdtrt_cert_type, b.psn_idet_type,  " +
-            "endtime=(select account_date from zy_ledger_file d where d.inpatient_no=a.pat_no and d.admiss_times=a.times and " +
-            "d.ledger_sn=a.ledger_sn), " +
+            "c.bed_no as admBed,a.begntime,a.endtime,a.certno,a.mdtrt_cert_type,b.psn_idet_type, " +
             "dscgMaindiagName=(select rtrim(dis_diag_comment) from zy_dis_diag_yb where zy_dis_diag_yb.inpatient_no=a.pat_no " +
             "and zy_dis_diag_yb.admiss_times=a.times and zy_dis_diag_yb.dis_diag_no=1), " +
-            "a.med_type,a.setl_time,a.hifes_pay, " +
             "chfpdrName=(select rtrim(name) from a_employee_mi where code=c.refer_physician), " +
             "staffName=(select rtrim(name) from a_employee_mi where a_employee_mi.code=a.staff_id), " +
             "a.balc,a.medfee_sumamt,a.hifp_pay,a.acct_pay,a.cvlserv_pay,a.psn_cash_pay, " +
             "a.hifob_pay,a.oth_pay,a.hifmi_pay,a.maf_pay " +
-            "from t_si_setlinfo a, t_si_pat_info b, zy_inactpatient c where a.setl_id=#{setlId} " +
+            "from t_si_setlinfo a, t_si_pat_info b, ${table} c where a.setl_id=#{setlId} " +
             "and a.pat_no=b.pat_no and a.times=b.times and a.ledger_sn=b.ledger_sn and a.pat_no=c.inpatient_no " +
             "and a.times=c.admiss_times")
-    InptntSetlmtLst selectZySetlinfo(@Param("setlId") String setlId);
-
-    @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,  " +
-            "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,c.admiss_date as begntime, " +
-            "endtime=(select account_date from zy_ledger_file d where d.inpatient_no=a.pat_no and d.admiss_times=a.times and " +
-            "d.ledger_sn=a.ledger_sn), " +
-            "a.certno,a.mdtrt_cert_type, b.psn_idet_type,  " +
-            "dscgMaindiagName=(select rtrim(dis_diag_comment) from zy_dis_diag_yb where zy_dis_diag_yb.inpatient_no=a.pat_no  " +
-            "and zy_dis_diag_yb.admiss_times=a.times and zy_dis_diag_yb.dis_diag_no=1),  " +
-            "a.med_type,a.setl_time,a.hifes_pay,  " +
-            "chfpdrName=(select rtrim(name) from a_employee_mi where code=c.refer_physician),  " +
-            "staffName=(select rtrim(name) from a_employee_mi where a_employee_mi.code=a.staff_id),  " +
-            "a.balc,a.medfee_sumamt,a.hifp_pay,a.acct_pay,a.cvlserv_pay,a.psn_cash_pay,  " +
-            "a.hifob_pay,a.oth_pay,a.hifmi_pay,a.maf_pay  " +
-            "from t_si_setlinfo a, t_si_pat_info b, zy_actpatient c where a.setl_id=#{setlId} " +
-            "and a.pat_no=b.pat_no and a.times=b.times and a.ledger_sn=b.ledger_sn and a.pat_no=c.inpatient_no  " +
-            "and a.times=c.admiss_times")
-    InptntSetlmtLst selectZyMidSetlinfo(@Param("setlId") String setlId);
+    InptntSetlmtLst selectZySetlinfo(@Param("setlId") String setlId, @Param("table") String table);
 
     @Select("select account_date from zy_ledger_file where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{sn}")
     Date selectAccountDate(@Param("patNo") String patNo,
@@ -218,8 +195,9 @@ public interface SiQueryDao {
     @Select("select insuplc_admdvs from t_si_pat_info where mdtrt_id=#{mdtrtId}")
     String selectInsuplcAdmdvsByMdtrtId(@Param("mdtrtId") String mdtrtId);
 
-    @Select("select times from t_si_setlinfo where pat_no=#{patNo} and revoked=0")
-    List<Integer> fetchSiTimesList(@Param("patNo") String patNo);
+    @Select("select setl_id,times,ledger_sn,endtime from t_si_setlinfo where pat_no=#{patNo} and revoked=0 " +
+            "and setl_type=#{type} order by endtime desc")
+    List<TimesList> fetchSiTimesList(@Param("patNo") String patNo, @Param("type") int type);
 
     @Select("select * from t_si_setl_fee_detl where mdtrt_id=#{mdtrtId}")
     List<SiSetlFeeDetl> selectAllSetlFeeDtle(@Param("mdtrtId") String mdtrtId);
@@ -438,5 +416,4 @@ public interface SiQueryDao {
                                            @Param("endTime") String endTime,
                                            @Param("name") String name,
                                            @Param("certno") String certno);
-
 }

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

@@ -4,7 +4,6 @@ import lombok.Data;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
-import java.util.Date;
 
 /**
  * @description: 住院结算单列表
@@ -17,14 +16,8 @@ public class SetlIndex {
     private Integer type;
     @NotBlank(message = "住院号/门诊号不能为空!")
     private String patNo;
-    @NotNull(message = "住院次数/门诊次数不能为空!")
     private Integer times;
     private Integer ledgerSn;
     private String setlId;
-    private String psnNo;
-    private String psnName;
-    private String gend;
-    private String gendName;
-    private Date setlTime;
-    private Double medfeeSumamt;
+    private String label;
 }

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

@@ -0,0 +1,22 @@
+package thyyxxk.webserver.entity.medicalinsurance.setlinfo;
+
+import lombok.Data;
+import thyyxxk.webserver.utils.DateUtil;
+
+import java.util.Date;
+
+@Data
+public class TimesList {
+    private String setlId;
+    private Integer times;
+    private Integer ledgerSn;
+    private Date endtime;
+    private String label;
+
+    public String getLabel() {
+        if (null != ledgerSn && ledgerSn > 0) {
+            return setlId + "_" + times + "_" + ledgerSn + "_" + DateUtil.formatDatetime(endtime, "yyyyMMddHHmmss");
+        }
+        return setlId + "_" + times + "_" + DateUtil.formatDatetime(endtime, "yyyyMMddHHmmss");
+    }
+}

+ 22 - 21
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiQueryService.java

@@ -2,6 +2,7 @@ package thyyxxk.webserver.service.medicalinsurance;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -19,6 +20,7 @@ import thyyxxk.webserver.entity.medicalinsurance.outpatient.SpcChrDiseAcct;
 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.*;
 import thyyxxk.webserver.entity.yibao.ZyActpatient;
 import thyyxxk.webserver.service.wxapi.SendWxInfoService;
@@ -786,8 +788,8 @@ public class SiQueryService {
         return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
     }
 
-    public ResultVo<List<Integer>> fetchSiTimesList(String patNo) {
-        List<Integer> list = dao.fetchSiTimesList(patNo);
+    public ResultVo<List<TimesList>> fetchSiTimesList(String patNo, Integer type) {
+        List<TimesList> list = dao.fetchSiTimesList(patNo, type);
         if (null == list || list.isEmpty()) {
             return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "此患者没有有效的结算信息。");
         }
@@ -798,20 +800,22 @@ public class SiQueryService {
         return ResultVoUtil.success(dao.selectInsuplcAdmdvsByMdtrtId(mdtrtId));
     }
 
-    public ResultVo<List<SetlIndex>> querySiSetlIndex(QrySetlListPrm q) {
-        List<SetlIndex> list = dao.selectSetlIndex(q);
-        if (null == list || list.isEmpty()) {
-            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
-        }
-        for (SetlIndex index : list) {
-            index.setGendName(Gend.get(index.getGend()).getName());
-        }
-        return ResultVoUtil.success(list);
-    }
-
     public ResultVo querySiSetlList(SetlIndex index) {
-        if (null == index.getLedgerSn()) {
+        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]));
+            if (index.getType() == SetlType.INPATIENT.getCode()) {
+                index.setLedgerSn(Integer.parseInt(arr[2]));
+            } else {
+                index.setLedgerSn(0);
+            }
+        } 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) {
@@ -822,17 +826,13 @@ public class SiQueryService {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, cuminfo.getMessage());
         }
         if (index.getType() == SetlType.INPATIENT.getCode()) {
-            InptntSetlmtLst lst = dao.selectZySetlinfo(index.getSetlId());
+            InptntSetlmtLst lst = dao.selectZySetlinfo(index.getSetlId(), "zy_inactpatient");
             if (null == lst) {
-                lst = dao.selectZyMidSetlinfo(index.getSetlId());
+                lst = dao.selectZySetlinfo(index.getSetlId(), "zy_actpatient");
                 if (null == lst) {
                     return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到此患者的结算信息!");
                 }
             }
-            if (siPatInfo.getLedgerSn() > 1) {
-                Date accountdate = dao.selectAccountDate(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn() - 1);
-                lst.setBegntime(accountdate);
-            }
             lst.setInHospdays(DateUtil.daysBetween(lst.getBegntime(), lst.getEndtime()) + 1);
             PsnIdetType psnIdetType = PsnIdetType.get(lst.getPsnIdetType());
             if (null != psnIdetType) {
@@ -845,7 +845,7 @@ public class SiQueryService {
                 lst.setInsuplcAdmdvsName(admdvs.getName());
             }
             lst.setFixmedinsName(SiUtil.INSTITUTION_NAME);
-            lst.setGendName(index.getGendName());
+            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())) {
@@ -1619,4 +1619,5 @@ public class SiQueryService {
         }
         return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保登记日期不能小于断账日期,请联系病房修改。");
     }
+
 }