Ver código fonte

Merge remote-tracking branch 'origin/master'

XU 9 meses atrás
pai
commit
de5c0ebd2e

+ 0 - 10
src/main/java/thyyxxk/webserver/dao/his/inpatient/DismissDao.java

@@ -424,14 +424,4 @@ public interface DismissDao {
             "and admiss_times=#{times} and ledger_sn>0 and isnull(charge_status,'1')!='1' ")
     String selectTotalCharge(@Param("patNo") String patNo,
                              @Param("times") int times);
-
-    @Select("select datediff(day,#{begn},#{end}) ")
-    int selectInhospdays(@Param("begn") Date begn, @Param("end") Date end);
-
-    @Select("select b.bill_item_zy as code,sum(a.charge_amount) as name from zy_detail_charge a, zd_charge_item b " +
-            "where a.inpatient_no=#{patNo} and a.admiss_times=#{times} and a.charge_status!='1' and b.bill_item_zy " +
-            "in ('003') and a.charge_code_mx not in ('017623','011062','010437','010435','011193') " +
-            "and a.charge_code=b.code group by b.bill_item_zy")
-    List<CodeName> selectChargeQuantities(@Param("patNo") String patNo,
-                                          @Param("times") int times);
 }

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

@@ -280,4 +280,8 @@ public interface SiZyDao {
     void updateChargeStatus(@Param("patNo") String patNo,
                             @Param("times") int times,
                             @Param("ledgerSn") int ledgerSn);
+
+    @Select("select settle_datetime from t_si_settle_apply where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn}")
+    Date selectDisdate(@Param("patNo") String patNo, @Param("times") int times, @Param("ledgerSn") int ledgerSn);
+
 }

+ 9 - 1
src/main/java/thyyxxk/webserver/entity/medicalinsurance/setlinfo/SiSetldetail.java

@@ -10,7 +10,15 @@ import lombok.Data;
 @TableName(value = "t_si_setldetail")
 public class SiSetldetail implements Serializable {
 
-	private static final long serialVersionUID =  1691016964788042310L;
+	/**
+	 * 结算ID
+	 * */
+	private String setlId;
+
+	/**
+	 * 序号
+	 * */
+	private Integer sortNo;
 
 	/**
 	 * 住院号/门诊号

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

@@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import thyyxxk.webserver.config.exception.BizException;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.constants.sidicts.*;
 import thyyxxk.webserver.constants.YesOrNo;
@@ -522,6 +523,13 @@ public class SiZyService {
             Date beginTime = dismissService.getBegntime(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn(), "zy_actpatient");
             p.setYbRegisterDate(beginTime);
         }
+        if (null == p.getDismissDate()) {
+            Date disdate = dao.selectDisdate(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
+            if (null == disdate) {
+                throw new BizException(ExceptionEnum.LOGICAL_ERROR, "请先提交出院申请!");
+            }
+            p.setDismissDate(disdate);
+        }
     }
 
     private ResultVo<String> inpatientSettlement(ZyPatientInfo p) {
@@ -602,6 +610,7 @@ public class SiZyService {
     }
 
     private ResultVo<String> executeHisSettlement(JSONObject output, ZyPatientInfo p) {
+        dao.deleteSetlDetail(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
         JSONObject setlinfo = output.getJSONObject("setlinfo");
         SiSetlinfo setlinfoEntity = JSONObject.parseObject(setlinfo.toJSONString(), SiSetlinfo.class);
         setlinfoEntity.setPatNo(p.getInpatientNo());
@@ -615,10 +624,19 @@ public class SiZyService {
         setlinfoEntity.setEndtime(p.getDismissDate());
         setlinfoEntity.setHiPaymtd(CommonUtil.calcHiPaymtd(setlinfoEntity.getInsuplcAdmdvs(),setlinfoEntity.getMedType(),setlinfoEntity.getInsutype(),setlinfoEntity.getSetlTime()));
         setlinfoEntity.setMedinsType(MedInsTypeUtil.getMedInsType(setlinfoEntity));
+        if (null == setlinfoEntity.getPsnPartAmt() && null == setlinfoEntity.getPsnCashPay()) {
+            Double psnPay = output.getDouble("psn_pay");
+            if (null != psnPay) {
+                setlinfoEntity.setPsnPartAmt(psnPay);
+                setlinfoEntity.setPsnCashPay(psnPay);
+            }
+        }
         JSONArray setldetail = output.getJSONArray("setldetail");
         BigDecimal hospitalPart = BigDecimal.ZERO;
         for (int i = 0; i < setldetail.size(); i++) {
             SiSetldetail setldetailEntity = JSONObject.parseObject(setldetail.getJSONObject(i).toJSONString(), SiSetldetail.class);
+            setldetailEntity.setSetlId(setlinfoEntity.getSetlId());
+            setldetailEntity.setSortNo(i + 1);
             setldetailEntity.setPatNo(p.getInpatientNo());
             setldetailEntity.setTimes(p.getAdmissTimes());
             setldetailEntity.setLedgerSn(p.getLedgerSn());