فهرست منبع

出院审核可以查看已结算的申请

lighter 2 سال پیش
والد
کامیت
0e9bba3c33

+ 8 - 1
src/main/java/thyyxxk/webserver/controller/medicalinsurance/SiSettleApplyController.java

@@ -1,9 +1,11 @@
 package thyyxxk.webserver.controller.medicalinsurance;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import thyyxxk.webserver.entity.ResultVo;
-import thyyxxk.webserver.entity.medicalinsurance.inpatient.SiSettleApply;
+import thyyxxk.webserver.entity.medicalinsurance.inpatient.settleapply.request.SettledApplyInquiry;
+import thyyxxk.webserver.entity.medicalinsurance.inpatient.settleapply.response.SiSettleApply;
 import thyyxxk.webserver.entity.inpatient.patient.Patient;
 import thyyxxk.webserver.service.medicalinsurance.SiSettleApplyService;
 
@@ -49,4 +51,9 @@ public class SiSettleApplyController {
     public ResultVo<List<SiSettleApply>> selectApplyHistories(@RequestBody SiSettleApply apply) {
         return service.selectApplyHistories(apply);
     }
+
+    @PostMapping("/selectSettledApplies")
+    public ResultVo<List<SiSettleApply>> selectSettledApplies(@RequestBody @Validated SettledApplyInquiry inquiry) {
+        return service.selectSettledApplies(inquiry);
+    }
 }

+ 2 - 1
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiSetlinfoDao.java

@@ -37,7 +37,8 @@ public interface SiSetlinfoDao extends BaseMapper<SiSetlinfo> {
                               @Param("medinsSetlId") String medinsSetlId,
                               @Param("setlMsgid") String setlMsgid);
 
-    @Update("update t_si_settle_apply set settled=#{settled} where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn}")
+    @Update("update t_si_settle_apply set settled=#{settled} where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn} and " +
+            "sort_no=(select max(sort_no) from t_si_settle_apply d where d.pat_no=#{patNo} and d.times=#{times} and d.ledger_sn=#{ledgerSn})")
     void updateApplySettled(@Param("patNo") String patNo,
                             @Param("times") int times,
                             @Param("ledgerSn") int ledgerSn,

+ 9 - 2
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiSettleApplyDao.java

@@ -1,7 +1,7 @@
 package thyyxxk.webserver.dao.his.medicalinsurance;
 
 import org.apache.ibatis.annotations.*;
-import thyyxxk.webserver.entity.medicalinsurance.inpatient.SiSettleApply;
+import thyyxxk.webserver.entity.medicalinsurance.inpatient.settleapply.response.SiSettleApply;
 import thyyxxk.webserver.entity.inpatient.dismiss.ZyDisYbSrgry;
 
 import java.util.Date;
@@ -49,7 +49,7 @@ public interface SiSettleApplyDao {
             "and c.admiss_times=a.times and c.ledger_sn=a.ledger_sn), " +
             "medinsTotalCharge=(select isnull(sum(charge_fee),0) from zy_detail_charge c with(nolock) where c.inpatient_no=a.pat_no " +
             "and c.admiss_times=a.times and c.ledger_sn=a.ledger_sn and trans_flag_yb=1), " +
-            "fundpay=(select isnull(charge_yb,0) from zy_ledger_file c with(nolock) where c.inpatient_no=a.pat_no " +
+            "fundpay=(select isnull(nullif(charge_yb,0), isnull(fund_pay_sumamt,0)) from zy_ledger_file c with(nolock) where c.inpatient_no=a.pat_no " +
             "and c.admiss_times=a.times and c.ledger_sn=a.ledger_sn),death_flag " +
             "from t_si_settle_apply a with(nolock), t_si_pat_info b with(nolock) where a.pat_no=#{patNo} and a.times=#{times} and " +
             "a.ledger_sn=#{ledgerSn} and a.type=#{type} and a.sort_no=#{sortNo} and a.pat_no=b.pat_no and a.times=b.times and a.ledger_sn=b.ledger_sn")
@@ -73,4 +73,11 @@ public interface SiSettleApplyDao {
     @Select("select * from t_si_settle_apply where pat_no=#{patNo} and times=#{times} and " +
             "ledger_sn=#{ledgerSn} and type=#{type} order by sort_no")
     List<SiSettleApply> selectApplyHistories(SiSettleApply apply);
+
+    @Select("select a.*,c.sex as gender,rtrim(c.name) as name,b.med_type, " +
+            "wardName=(select rtrim(name) from zd_unit_code with(nolock) where code=c.ward)  " +
+            "from t_si_settle_apply a with(nolock), t_si_pat_info b with(nolock), zy_actpatient c with(nolock) " +
+            "where a.settled=1 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.settle_datetime>=#{start} and a.settle_datetime<=#{end}")
+    List<SiSettleApply> selectSettledApplies(String start, String end);
 }

+ 13 - 0
src/main/java/thyyxxk/webserver/entity/medicalinsurance/inpatient/settleapply/request/SettledApplyInquiry.java

@@ -0,0 +1,13 @@
+package thyyxxk.webserver.entity.medicalinsurance.inpatient.settleapply.request;
+
+import lombok.Data;
+import javax.validation.constraints.NotBlank;
+
+@Data
+public class SettledApplyInquiry {
+    @NotBlank(message = "开始日期不能为空")
+    private String start;
+
+    @NotBlank(message = "结束日期不能为空")
+    private String end;
+}

+ 6 - 1
src/main/java/thyyxxk/webserver/entity/medicalinsurance/inpatient/SiSettleApply.java → src/main/java/thyyxxk/webserver/entity/medicalinsurance/inpatient/settleapply/response/SiSettleApply.java

@@ -1,4 +1,4 @@
-package thyyxxk.webserver.entity.medicalinsurance.inpatient;
+package thyyxxk.webserver.entity.medicalinsurance.inpatient.settleapply.response;
 
 import java.io.Serializable;
 
@@ -40,6 +40,11 @@ public class SiSettleApply implements Serializable {
 	 */
 	private Integer type;
 
+	/**
+	 * 在院标志:1-未结算,2-已结算
+	 */
+	private Integer inOutFlag;
+
 	/**
 	 * 出院结算或中间断账时间
 	 */

+ 19 - 3
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiSettleApplyService.java

@@ -7,7 +7,8 @@ import thyyxxk.webserver.constants.sidicts.Insutype;
 import thyyxxk.webserver.constants.sidicts.MedType;
 import thyyxxk.webserver.dao.his.medicalinsurance.SiSettleApplyDao;
 import thyyxxk.webserver.entity.ResultVo;
-import thyyxxk.webserver.entity.medicalinsurance.inpatient.SiSettleApply;
+import thyyxxk.webserver.entity.medicalinsurance.inpatient.settleapply.request.SettledApplyInquiry;
+import thyyxxk.webserver.entity.medicalinsurance.inpatient.settleapply.response.SiSettleApply;
 import thyyxxk.webserver.entity.inpatient.dismiss.ZyDisYbDiag;
 import thyyxxk.webserver.entity.inpatient.dismiss.ZyDisYbSrgry;
 import thyyxxk.webserver.entity.inpatient.patient.Patient;
@@ -96,7 +97,8 @@ public class SiSettleApplyService {
     }
 
     public ResultVo<Map<String, Object>> selectPatientInfo(SiSettleApply param) {
-        ResultVo<Patient> ptntRsvo = ptntSrvc.getPatientInfo(param.getPatNo());
+        ResultVo<Patient> ptntRsvo = param.getInOutFlag() == 1 ?
+                ptntSrvc.getPatientInfo(param.getPatNo()) : ptntSrvc.getDisPatient(param.getPatNo(), param.getTimes());
         if (ptntRsvo.getCode() != ExceptionEnum.SUCCESS.getCode()) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, ptntRsvo.getMessage());
         }
@@ -128,7 +130,7 @@ public class SiSettleApplyService {
             itm.setSszs2Name(redis.getEmployeeName(itm.getSszs2()));
             itm.setMzysName(redis.getEmployeeName(itm.getMzys()));
         }
-        if (DecimalUtil.compare(apply.getDetailTotalCharge(), apply.getLedgerTotalCharge()) != 0) {
+        if (param.getInOutFlag() == 1 && DecimalUtil.compare(apply.getDetailTotalCharge(), apply.getLedgerTotalCharge()) != 0) {
             ptntSrvc.receiveAndRecalculateCost(patient);
             SiSettleApply chrgs = dao.selectTotalChargeAgain(apply);
             apply.setDetailTotalCharge(chrgs.getDetailTotalCharge());
@@ -141,6 +143,9 @@ public class SiSettleApplyService {
         map.put("indiags", inYbDiags);
         map.put("disdiags", disYbDiags);
         map.put("surgeries", disYbSrgries);
+        if (param.getInOutFlag() == 2) {
+            return ResultVoUtil.success(map);
+        }
         String message = "";
         if (DecimalUtil.compare(apply.getDetailTotalCharge(), apply.getMedinsTotalCharge()) != 0) {
            message += "此患者明细总费用与医保上传总费用不一致;";
@@ -168,4 +173,15 @@ public class SiSettleApplyService {
         list.forEach(item -> item.setHandleStaffName(redis.getEmployeeName(item.getHandleStaff())));
         return ResultVoUtil.success(list);
     }
+
+    public ResultVo<List<SiSettleApply>> selectSettledApplies(SettledApplyInquiry inquiry) {
+        String start = inquiry.getStart() + " 00:00:00";
+        String end = inquiry.getEnd() + " 23:59:59";
+        List<SiSettleApply> list = dao.selectSettledApplies(start, end);
+        if (list.isEmpty()) {
+            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
+        }
+        list.forEach(item -> item.setHandleStaffName(redis.getEmployeeName(item.getHandleStaff())));
+        return ResultVoUtil.success(list);
+    }
 }