소스 검색

自费患者费用上传

lighter 2 년 전
부모
커밋
3b65f8ac68

+ 5 - 0
src/main/java/thyyxxk/webserver/controller/inpatient/ChargeListController.java

@@ -54,4 +54,9 @@ public class ChargeListController {
         }
         return ResultVoUtil.success(resultMap);
     }
+
+    @PostMapping("/executeSelfpayUpload")
+    public ResultVo<String> executeSelfpayUpload(@RequestBody BriefPatInfo patInfo) {
+        return service.executeSelfpayUpload(patInfo);
+    }
 }

+ 11 - 2
src/main/java/thyyxxk/webserver/dao/his/inpatient/ChargeListDao.java

@@ -20,11 +20,11 @@ public interface ChargeListDao {
             "from zy_actpatient where inpatient_no=#{patNo}")
     List<PatOverview> selectPatOverviews(String patNo);
 
-    @Select("select rtrim(inpatient_no) as patNo,rtrim(name) as name,rtrim(a.bed_no) as bedNo, " +
+    @Select("select rtrim(inpatient_no) as patNo,admiss_times as times,rtrim(name) as name, " +
+            "rtrim(a.bed_no) as bedNo,datediff(day,admiss_date,isnull(dis_date,getdate())) as days, " +
             "gender=(case when sex='1' then '男' when sex='2' then '女' else '未知' end), " +
             "rtrim(admiss_dept) as dept,admiss_date as admdate,med_type as medtype, " +
             "admiss_date as begndate,isnull(dis_date,getdate()) as enddate, " +
-            "datediff(day,admiss_date,isnull(dis_date,getdate())) as days, " +
             "balance=(select ((select isnull(sum(t.depo_amount),0) from zy_deposit_file t where t.inpatient_no=a.inpatient_no " +
             "and t.admiss_times=a.admiss_times and t.status in (1,2))- " +
             "(select isnull(sum(t.charge_fee),0) from zy_detail_charge t where t.inpatient_no=a.inpatient_no " +
@@ -36,4 +36,13 @@ public interface ChargeListDao {
             "execute zy_receive_one #{patNo},#{times},#{patNo},'0';" +
             "execute dbo.zy_cxtj_mxqd_new #{patNo},#{times}")
     List<ChargeItem> selectChargeList(String patNo, int times);
+
+    @Select("select count(1) from zy_actpatient where inpatient_no=#{patNo} and admiss_times=#{times}")
+    int selectInhospCount(String patNo, int times);
+
+    @Select("select ledger_sn from t_si_setlinfo where pat_no=#{patNo} and times=#{times} and revoked=0")
+    List<Integer> selectSiLedgers(String patNo, int times);
+
+    @Select("select ledger_sn from zy_ledger_file where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn>0")
+    List<Integer> selectAllLedgers(String patNo, int times);
 }

+ 2 - 0
src/main/java/thyyxxk/webserver/entity/inpatient/chargelist/BriefPatInfo.java

@@ -11,6 +11,8 @@ import java.util.Date;
 public class BriefPatInfo {
     private String bedNo;
     private String patNo;
+    private Integer times;
+    private Integer ledgerSn;
     private String name;
     private String gender;
     private String dept;

+ 7 - 2
src/main/java/thyyxxk/webserver/service/externalhttp/SiZySrvc.java

@@ -1,18 +1,23 @@
 package thyyxxk.webserver.service.externalhttp;
 
+import com.alibaba.fastjson.JSONObject;
 import com.dtflys.forest.annotation.JSONBody;
 import com.dtflys.forest.annotation.Post;
 import com.dtflys.forest.annotation.Var;
 import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.inpatient.chargelist.BriefPatInfo;
 import thyyxxk.webserver.entity.inpatient.patient.Overview;
 
 import java.util.List;
 
 public interface SiZySrvc {
 
-    @Post("{url}/upload")
+    @Post("{url}/zyFee/upload")
     ResultVo<String> uploadFeeDetail(@Var("url") String url, @JSONBody Overview o);
 
-    @Post("{url}/uploadMultiplePatientFees")
+    @Post("{url}/zyFee/uploadMultiplePatientFees")
     ResultVo<String> uploadMultiplePatientFees(@Var("url") String url, @JSONBody List<Overview> overviews);
+
+    @Post("{url}/selfpay/uploadSelfpayMedfee")
+    JSONObject uploadSelfpayFees(@Var("url") String url, @JSONBody BriefPatInfo patInfo);
 }

+ 40 - 1
src/main/java/thyyxxk/webserver/service/inpatient/ChargeListService.java

@@ -1,13 +1,20 @@
 package thyyxxk.webserver.service.inpatient;
 
+import com.alibaba.fastjson.JSONObject;
+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.ExceptionEnum;
 import thyyxxk.webserver.constants.sidicts.MedType;
 import thyyxxk.webserver.dao.his.inpatient.ChargeListDao;
+import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.inpatient.chargelist.BriefPatInfo;
 import thyyxxk.webserver.entity.inpatient.chargelist.ChargeItem;
 import thyyxxk.webserver.entity.inpatient.chargelist.PatOverview;
+import thyyxxk.webserver.service.externalhttp.SiZySrvc;
 import thyyxxk.webserver.service.redislike.RedisLikeService;
+import thyyxxk.webserver.utils.ResultVoUtil;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
@@ -16,15 +23,20 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+@Slf4j
 @Service
 public class ChargeListService {
     private final ChargeListDao dao;
     private final RedisLikeService redis;
+    private final SiZySrvc zySrvc;
+    @Value("${si-zy-fee-url}")
+    private String siZyFeeUrl;
 
     @Autowired
-    public ChargeListService(ChargeListDao dao, RedisLikeService redis) {
+    public ChargeListService(ChargeListDao dao, RedisLikeService redis, SiZySrvc zySrvc) {
         this.dao = dao;
         this.redis = redis;
+        this.zySrvc = zySrvc;
     }
 
     public List<PatOverview> selectPatOverviews(String patNo) {
@@ -73,4 +85,31 @@ public class ChargeListService {
         resultMap.put("sumsMap", sumsMap);
         return resultMap;
     }
+
+    public ResultVo<String> executeSelfpayUpload(BriefPatInfo patInfo) {
+        String patNo = patInfo.getPatNo();
+        int times = patInfo.getTimes();
+        int inhospCount = dao.selectInhospCount(patNo, times);
+        if (inhospCount > 0) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者本次住院没有出院,不允许上传自费费用。");
+        }
+        List<Integer> siLedgers = dao.selectSiLedgers(patNo, times);
+        List<Integer> allLedgers = dao.selectAllLedgers(patNo, times);
+        allLedgers.removeIf(siLedgers::contains);
+        if (allLedgers.isEmpty()) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者本次住院不是自费住院,不允许上传自费费用。");
+        }
+        StringBuilder message = new StringBuilder();
+        for (int ledgerSn : allLedgers) {
+            patInfo.setLedgerSn(ledgerSn);
+            JSONObject uploadResult = zySrvc.uploadSelfpayFees(siZyFeeUrl, patInfo);
+            if (null != uploadResult && null != uploadResult.getInteger("code") && uploadResult.getInteger("code") == 0) {
+                message.append("【账页").append(ledgerSn).append("】上传成功。");
+            } else {
+                message.append("【账页").append(ledgerSn).append("】上传失败。");
+            }
+        }
+        return ResultVoUtil.success(message.toString());
+    }
+
 }

+ 1 - 1
src/main/resources/application-prod.yml

@@ -61,7 +61,7 @@ si-tj-url: http://jkglcsx.server.zhongmeihealth.com/openInter
 si-api-url: http://dms.hun.hsip.gov.cn/isp-api/powercsb/1101
 si-access-key: 04eMGRg7beAO6vqwrZiLacV8Uy3jNn7QGDUcBO
 si-secret-key: SK3Oip3a2R3NLz2xm58Mpmi69oFu96KrdKNRKglN
-si-zy-fee-url: http://172.16.32.166:1000/zyFee
+si-zy-fee-url: http://172.16.32.166:1000
 si-mz-fee-url: http://172.16.32.166:1100/mzFee
 si-injury-fee-url: http://172.16.32.163:2100/siInjury
 si-injury-systm-url: http://172.16.32.163:2000/siInjury

+ 6 - 6
src/main/resources/application.yml

@@ -8,7 +8,7 @@ spring:
     cache: false
   datasource:
     dynamic:
-      primary: dev
+      primary: his
       strict: false
       datasource:
         his:
@@ -72,7 +72,7 @@ si-tj-url: http://jkglcsx.server.zhongmeihealth.com/openInter
 si-api-url: http://dms.hun.hsip.gov.cn/isp-api/powercsb/1101
 si-access-key: 04eMGRg7beAO6vqwrZiLacV8Uy3jNn7QGDUcBO
 si-secret-key: SK3Oip3a2R3NLz2xm58Mpmi69oFu96KrdKNRKglN
-si-zy-fee-url: http://172.16.32.166:1000/zyFee
+si-zy-fee-url: http://172.16.32.166:1000
 si-mz-fee-url: http://172.16.32.166:1100/mzFee
 si-injury-fee-url: http://172.16.32.163:2100/siInjury
 si-injury-systm-url: http://172.16.32.163:2000/siInjury
@@ -82,12 +82,12 @@ thmz-api-url: http://172.16.32.160:81/thmz/api/v1
 #si-api-url: http://10.93.30.130:20001/isp-api/powercsb/1101
 #si-access-key: Zgs5jfxaKb86XbCuUzLK9EhFjiQfHR1vydaPzp
 #si-secret-key: SKT2ETMT3XkAYApqh79DCnN9ZjfbQEBMPU0GyLz9
-#si-zy-fee-url: http://localhost:1000/zyFee
+#si-zy-fee-url: http://localhost:1000
 #si-mz-fee-url: http://localhost:1100/mzFee
 #si-injury-fee-url: http://localhost:2100/siInjury
 #si-injury-systm-url: http://localhost:2000/siInjury
 #thmz-api-url: http://172.16.30.33:81/thmz/api/v1
 
-logging:
-  level:
-    thyyxxk.webserver.dao: debug
+#logging:
+#  level:
+#    thyyxxk.webserver.dao: debug