Procházet zdrojové kódy

结算单入库前计算出医院垫付部分

lighter před 3 roky
rodič
revize
79fe646989

+ 12 - 3
src/main/java/thyyxxk/simzfeeoprnsystm/service/SiMzFeeService.java

@@ -17,6 +17,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.ArrayList;
 import java.util.List;
@@ -464,9 +465,8 @@ public class SiMzFeeService {
             setlEntity.setBegntime(mzDao.selectBegntime(p.getPatNo(), p.getTimes()));
             setlEntity.setEndtime(setlEntity.getSetlTime());
             setlEntity.setMzSaved(p.getSaved());
-            setlinfoDao.insert(setlEntity);
-            setlinfoDao.updateSiZyInfoSetlId(p.getPatNo(), p.getTimes(), 0, setlEntity.getSetlId(),
-                    setlEntity.getMedinsSetlId(), input.getString("msgid"));
+
+            BigDecimal hospitalPart = BigDecimal.ZERO;
             JSONArray setldetail = result.getJSONObject(OUTPUT).getJSONArray("setldetail");
             for (int i = 0; i < setldetail.size(); i++) {
                 SiSetldetail setldetailEntity = JSONObject.parseObject(setldetail.getJSONObject(i).toJSONString(),
@@ -474,8 +474,17 @@ public class SiMzFeeService {
                 setldetailEntity.setPatNo(p.getPatNo());
                 setldetailEntity.setTimes(p.getTimes());
                 setldetailEntity.setLedgerSn(0);
+                if (setldetailEntity.getFundPayType().equals("999996") || setldetailEntity.getSetlProcInfo().equals("999996")) {
+                    hospitalPart = hospitalPart.add(BigDecimal.valueOf(setldetailEntity.getFundPayamt()));
+                }
                 setldetailDao.insert(setldetailEntity);
             }
+
+            setlEntity.setHospPartAmt(hospitalPart.doubleValue());
+            setlinfoDao.insert(setlEntity);
+            setlinfoDao.updateSiZyInfoSetlId(p.getPatNo(), p.getTimes(), 0, setlEntity.getSetlId(),
+                    setlEntity.getMedinsSetlId(), input.getString("msgid"));
+
             webHisSrvc.saveCumInfo(webHisUrl, setlEntity);
             return getFundDetailFromSetlinfo(setlEntity);
         }