Browse Source

拆分门特部分到159服务器。

lighter 3 years ago
parent
commit
27d2ae9350

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>web-server</artifactId>
-    <version>10.4.5</version>
+    <version>10.4.6</version>
     <name>web-server</name>
     <description>server for yibao-web</description>
     <properties>

+ 11 - 7
src/main/java/thyyxxk/webserver/controller/medicalinsurance/MarkMtFeesController.java

@@ -13,6 +13,7 @@ import thyyxxk.webserver.entity.markmtfees.UploadMtFeeParam;
 import thyyxxk.webserver.entity.medicalinsurance.outpatient.MzPatientInfo;
 import thyyxxk.webserver.entity.medicalinsurance.setlinfo.FundDetail;
 import thyyxxk.webserver.service.medicalinsurance.SiMzService;
+import thyyxxk.webserver.utils.FilterUtil;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -28,6 +29,9 @@ public class MarkMtFeesController {
         this.mzService = mzService;
     }
 
+    /**
+     * HRG调用试算
+     * */
     @PassToken
     @PostMapping("/uploadFees")
     public Map<String, Object> uploadFees(@RequestBody UploadMtFeeParam param) {
@@ -39,6 +43,9 @@ public class MarkMtFeesController {
         return getStringObjectMap(param, result, "收费窗口获取门特报销");
     }
 
+    /**
+     * HRG调用结算
+     * */
     @PassToken
     @PostMapping("/calculateCost")
     public Map<String, Object> settlement(@RequestBody UploadMtFeeParam param) {
@@ -50,6 +57,9 @@ public class MarkMtFeesController {
         return getStringObjectMap(param, result, "收费窗口门特结算");
     }
 
+    /**
+     * HRG调用取消结算
+     * */
     @PassToken
     @PostMapping("/retractFees")
     public Map<String, Object> revokeSettlement(@RequestBody UploadMtFeeParam param) {
@@ -79,14 +89,8 @@ public class MarkMtFeesController {
             map.put("msg", result.getMessage());
             return map;
         }
-        FundDetail fund = result.getData();
         map.put("code", 0);
-        Map<String, String> payInfo = new HashMap<>();
-        payInfo.put("cashPay", fund.getCashPay());
-        payInfo.put("selfPay", fund.getSelfPay());
-        payInfo.put("acctPay", fund.getAcctPay());
-        payInfo.put("fundPay", fund.getFundPay());
-        payInfo.put("totalCost", fund.getTotalCost());
+        Map<String, String> payInfo = FilterUtil.cast(result.getData());
         map.put("payInfo", payInfo);
         log.info("{}:参数:{},结果:{}", logText, param, map);
         return map;

+ 13 - 7
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiQueryDao.java

@@ -97,7 +97,8 @@ public interface SiQueryDao {
      * @param medType 医疗类别
      * @return 患者的医保个人编号
      */
-    @Select("select top 1 insuplc_admdvs as code, psn_no as name from t_si_pat_info where pat_no=#{patNo} and med_type=#{medType} ")
+    @Select("select top 1 insuplc_admdvs as code, psn_no as name from t_si_pat_info where pat_no=#{patNo} and med_type=#{medType} " +
+            "and insuplc_admdvs is not null ")
     PureCodeName selectPsnNoByPatNoAndMedType(@Param("patNo") String patNo,
                                         @Param("medType") String medType);
 
@@ -119,7 +120,7 @@ public interface SiQueryDao {
      * @param admissTimes 住院次数
      * @param ledgerSn    账页号
      */
-    @Update("update t_si_pat_info set mdtrt_id=#{nullCtnt}, adm_reg_msgid=#{nullCtnt} " +
+    @Update("update t_si_pat_info set mdtrt_id=#{nullCtnt}, adm_reg_msgid=#{nullCtnt}, setl_id=#{nullCtnt} " +
             "where pat_no=#{inpatientNo} and times=#{admissTimes} and ledger_sn=#{ledgerSn}")
     void clearMdtrtIdForZy(@Param("inpatientNo") String inpatientNo,
                       @Param("admissTimes") int admissTimes,
@@ -132,7 +133,7 @@ public interface SiQueryDao {
      * @param patientId 门诊号
      * @param times 门诊次数
      */
-    @Update("update t_si_pat_info set mdtrt_id=#{nullCtnt} where pat_no=#{patientId} and times=#{times} ")
+    @Update("update t_si_pat_info set mdtrt_id=#{nullCtnt}, setl_id=#{nullCtnt} where pat_no=#{patientId} and times=#{times} ")
     void clearMdtrtIdForMz(@Param("patientId") String patientId,
                            @Param("times") int times,
                            @Param("nullCtnt") String nullCtnt);
@@ -144,15 +145,20 @@ public interface SiQueryDao {
     @Select("select top 1 * from t_si_pat_info where pat_no=#{patNo} and times=#{times} order by ledger_sn desc")
     SiPatInfo selectSiPatInfo(@Param("patNo") String patNo, @Param("times") int times);
 
-    @Select("select top 1 insuplc_admdvs from t_si_pat_info where pat_no=#{patNo} and times=#{times} order by ledger_sn desc")
+    @Select("select top 1 insuplc_admdvs from t_si_pat_info where pat_no=#{patNo} and times=#{times} " +
+            "and insuplc_admdvs is not null order by ledger_sn desc")
     String selectAdmdvs(@Param("patNo") String patNo, @Param("times") int times);
 
-    @Select("select top 1 insuplc_admdvs from t_si_pat_info where pat_no=#{patNo} and psn_no=#{psnNo} order by times desc")
-    String selectAdmdvsByPatNoAndPsnNo(@Param("patNo") String patNo, @Param("psnNo") String psnNo);
+    @Select("select top 1 insuplc_admdvs from t_si_pat_info where pat_no=#{patNo} and insuplc_admdvs is not null order by times desc")
+    String selectAdmdvsByPatNo(@Param("patNo") String patNo);
 
-    @Select("select top 1 insuplc_admdvs from t_si_pat_info where psn_no=#{psnNo} order by times desc")
+    @Select("select top 1 insuplc_admdvs from t_si_pat_info where psn_no=#{psnNo} and insuplc_admdvs is not null order by times desc")
     String selectAdmdvsByPsnNo(@Param("psnNo") String psnNo);
 
+    @Select("select top 1 insuplc_admdvs from t_si_pat_info where pat_no=#{patNo} and psn_no=#{psnNo} " +
+            "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, " +
             "tel=(select rtrim(home_tel) from a_patient_mi where a_patient_mi.inpatient_no=a.pat_no), " +

+ 2 - 0
src/main/java/thyyxxk/webserver/entity/medicalinsurance/outpatient/SpcChrDiseAcct.java

@@ -28,4 +28,6 @@ public class SpcChrDiseAcct {
     private String opspDiseName;
 
     private String opspDiseCode;
+
+    private String staffId;
 }

+ 348 - 340
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiMzService.java

@@ -1,8 +1,6 @@
 package thyyxxk.webserver.service.medicalinsurance;
 
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -10,22 +8,13 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.constants.Capacity;
-import thyyxxk.webserver.constants.sidicts.ClrType;
-import thyyxxk.webserver.constants.sidicts.SiFunction;
-import thyyxxk.webserver.constants.YesOrNo;
-import thyyxxk.webserver.constants.sidicts.MdtrtCertType;
-import thyyxxk.webserver.constants.sidicts.PsnSetlWay;
 import thyyxxk.webserver.dao.his.medicalinsurance.SiMzDao;
 import thyyxxk.webserver.dao.his.medicalinsurance.SiQueryDao;
-import thyyxxk.webserver.dao.his.medicalinsurance.SiSetldetailDao;
-import thyyxxk.webserver.dao.his.medicalinsurance.SiSetlinfoDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.markmtfees.*;
 import thyyxxk.webserver.entity.medicalinsurance.outpatient.*;
 import thyyxxk.webserver.entity.medicalinsurance.query.SiPatInfo;
 import thyyxxk.webserver.entity.medicalinsurance.setlinfo.FundDetail;
-import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetldetail;
-import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetlinfo;
 import thyyxxk.webserver.utils.*;
 
 import java.math.BigDecimal;
@@ -45,82 +34,80 @@ import java.util.Map;
 public class SiMzService {
     private final SiMzDao dao;
     private final SiQueryDao queryDao;
-    private final SiSetlinfoDao setlinfoDao;
-    private final SiSetldetailDao setldetailDao;
-    private final ExecService exec;
-    private static final String RESULT_CODE = "infcode";
-    private static final String ERROR_MESSAGE = "err_msg";
-    private static final String OUTPUT = "output";
     @Value("${hrg-api-url}")
     private String hrgApiUrl;
+    @Value("${si-fee-url}")
+    private String siFeeUrl;
 
     @Autowired
-    public SiMzService(SiMzDao dao, SiQueryDao queryDao, SiSetlinfoDao setlinfoDao,
-                       SiSetldetailDao setldetailDao, ExecService exec) {
+    public SiMzService(SiMzDao dao, SiQueryDao queryDao) {
         this.dao = dao;
         this.queryDao = queryDao;
-        this.setlinfoDao = setlinfoDao;
-        this.setldetailDao = setldetailDao;
-        this.exec = exec;
     }
 
     public ResultVo<String> outpatientRegistration(MzPatientInfo p) {
-        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.OUTPATIENT_REGISTRATION, p.getInsuplcAdmdvs());
-        Regstrtn regstrtn = dao.selectRegstrtn(p.getPatNo(), p.getTimes());
-        if (null == regstrtn) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "mz_visit_table患者信息为空,请联系医生重开处方。");
-        }
-        regstrtn.setInsutype(p.getInsutype());
-        regstrtn.setMdtrtCertType(MdtrtCertType.RESIDENT_IDENTITY_CARD.getCode());
-        regstrtn.setPsnType(p.getPsnType());
-        regstrtn.setIptOtpNo(p.getPatNo());
-        String ref = JSONObject.toJSONStringWithDateFormat(regstrtn, "yyyy-MM-dd HH:mm:ss");
-        input.getJSONObject("input").put("data", JSONObject.parseObject(ref));
-        JSONObject result = exec.executeTrade(input, SiFunction.OUTPATIENT_REGISTRATION);
-        log.info("【操作员:{}】,门诊挂号:\n参数:{},\n结果:{}", TokenUtil.getTokenUserId(), input, result);
-        if (null == result) {
-            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
-        }
-        if (null == result.getInteger(RESULT_CODE)) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
-        }
-        if (result.getIntValue(RESULT_CODE) == 0) {
-            JSONObject output = result.getJSONObject(OUTPUT).getJSONObject("data");
-            p.setMdtrtId(output.getString("mdtrt_id"));
-            p.setVisitDate(regstrtn.getBegntime());
-            dao.afterRegistrtn(p);
-            return ResultVoUtil.success("挂号成功。");
-        }
-        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
+        p.setStaffId(TokenUtil.getTokenUserId());
+        RestTemplate restTemplate = new RestTemplate();
+        return restTemplate.postForObject(siFeeUrl + "/mzFee/outpatientRegistration", p, ResultVo.class);
+//        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.OUTPATIENT_REGISTRATION, p.getInsuplcAdmdvs());
+//        Regstrtn regstrtn = dao.selectRegstrtn(p.getPatNo(), p.getTimes());
+//        if (null == regstrtn) {
+//            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "mz_visit_table患者信息为空,请联系医生重开处方。");
+//        }
+//        regstrtn.setInsutype(p.getInsutype());
+//        regstrtn.setMdtrtCertType(MdtrtCertType.RESIDENT_IDENTITY_CARD.getCode());
+//        regstrtn.setPsnType(p.getPsnType());
+//        regstrtn.setIptOtpNo(p.getPatNo());
+//        String ref = JSONObject.toJSONStringWithDateFormat(regstrtn, "yyyy-MM-dd HH:mm:ss");
+//        input.getJSONObject("input").put("data", JSONObject.parseObject(ref));
+//        JSONObject result = exec.executeTrade(input, SiFunction.OUTPATIENT_REGISTRATION);
+//        log.info("【操作员:{}】,门诊挂号:\n参数:{},\n结果:{}", TokenUtil.getTokenUserId(), input, result);
+//        if (null == result) {
+//            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+//        }
+//        if (null == result.getInteger(RESULT_CODE)) {
+//            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
+//        }
+//        if (result.getIntValue(RESULT_CODE) == 0) {
+//            JSONObject output = result.getJSONObject(OUTPUT).getJSONObject("data");
+//            p.setMdtrtId(output.getString("mdtrt_id"));
+//            p.setVisitDate(regstrtn.getBegntime());
+//            dao.afterRegistrtn(p);
+//            return ResultVoUtil.success("挂号成功。");
+//        }
+//        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
     }
 
     public ResultVo<String> revokeOutpatientRegistration(MzPatientInfo p) {
-        if (null == p.getTimes()) {
-            p.setTimes(dao.selectMaxTimes(p.getPatNo()));
-        }
-        SiPatInfo siPatInfo = queryDao.selectSiPatInfoForMz(p.getPatNo(), p.getTimes());
-        if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getMdtrtId())) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保挂号信息。");
-        }
-        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.REVOKE_OUTPATIENT_REGISTRATION, siPatInfo.getInsuplcAdmdvs());
-        JSONObject data = new JSONObject();
-        data.put("psn_no", siPatInfo.getPsnNo());
-        data.put("mdtrt_id", siPatInfo.getMdtrtId());
-        data.put("ipt_otp_no", p.getPatNo());
-        input.getJSONObject("input").put("data", data);
-        JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_OUTPATIENT_REGISTRATION);
-        log.info("【操作员:{}】,取消门诊挂号:\n参数:{},\n结果:{}", TokenUtil.getTokenUserId(), input, result);
-        if (null == result) {
-            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
-        }
-        if (null == result.getInteger(RESULT_CODE)) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
-        }
-        if (result.getIntValue(RESULT_CODE) == 0) {
-            queryDao.clearMdtrtIdForMz(p.getPatNo(), p.getTimes(), null);
-            return ResultVoUtil.success("取消门诊挂号成功。");
-        }
-        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
+        p.setStaffId(TokenUtil.getTokenUserId());
+        RestTemplate restTemplate = new RestTemplate();
+        return restTemplate.postForObject(siFeeUrl + "/mzFee/revokeOutpatientRegistration", p, ResultVo.class);
+//        if (null == p.getTimes()) {
+//            p.setTimes(dao.selectMaxTimes(p.getPatNo()));
+//        }
+//        SiPatInfo siPatInfo = queryDao.selectSiPatInfoForMz(p.getPatNo(), p.getTimes());
+//        if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getMdtrtId())) {
+//            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保挂号信息。");
+//        }
+//        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.REVOKE_OUTPATIENT_REGISTRATION, siPatInfo.getInsuplcAdmdvs());
+//        JSONObject data = new JSONObject();
+//        data.put("psn_no", siPatInfo.getPsnNo());
+//        data.put("mdtrt_id", siPatInfo.getMdtrtId());
+//        data.put("ipt_otp_no", p.getPatNo());
+//        input.getJSONObject("input").put("data", data);
+//        JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_OUTPATIENT_REGISTRATION);
+//        log.info("【操作员:{}】,取消门诊挂号:\n参数:{},\n结果:{}", TokenUtil.getTokenUserId(), input, result);
+//        if (null == result) {
+//            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+//        }
+//        if (null == result.getInteger(RESULT_CODE)) {
+//            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
+//        }
+//        if (result.getIntValue(RESULT_CODE) == 0) {
+//            queryDao.clearMdtrtIdForMz(p.getPatNo(), p.getTimes(), null);
+//            return ResultVoUtil.success("取消门诊挂号成功。");
+//        }
+//        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
     }
 
     public ResultVo<List<Map<String, Object>>> getMzReceipts(MzPatientInfo p) {
@@ -320,291 +307,312 @@ public class SiMzService {
         return ResultVoUtil.success("删除成功。");
     }
 
-    private ResultVo<String> uploadOutpatientInfo(SpcChrDiseAcct p, SiPatInfo siPatInfo) {
-        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.UPLOAD_OUTPATIENT_INFO, siPatInfo.getInsuplcAdmdvs());
-        JSONObject mdtrtinfo = new JSONObject();
-        Diseinfo diag = dao.selectDiseinfo(p.getPatNo(), p.getTimes());
-        if (StringUtil.notBlank(p.getOpspDiseCode())) {
-            diag.setDiagCode(p.getOpspDiseCode());
-            diag.setDiagName(p.getOpspDiseName());
-        }
-        if (StringUtil.isBlank(diag.getDiagCode())) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "患者的门诊诊断为空,请联系医生填写!");
-        }
-        dao.updatePatDiseinfo(siPatInfo.getPatNo(), siPatInfo.getTimes(), diag.getDiagCode(), diag.getDiagName());
-        mdtrtinfo.put("mdtrt_id", siPatInfo.getMdtrtId());
-        mdtrtinfo.put("psn_no", siPatInfo.getPsnNo());
-        mdtrtinfo.put("med_type", siPatInfo.getMedType());
-        mdtrtinfo.put("begntime", DateUtil.formatDatetime(siPatInfo.getVisitDatetime()));
-        mdtrtinfo.put("main_cond_dscr", p.getOpspDiseName());
-        mdtrtinfo.put("dise_codg", p.getOpspDiseCode());
-        mdtrtinfo.put("dise_name", p.getOpspDiseName());
-        mdtrtinfo.put("birctrl_type", "");
-        mdtrtinfo.put("birctrl_matn_date", "");
-        List<Diseinfo> diseinfo = new ArrayList<>();
-        diseinfo.add(diag);
-        String ref = JSONObject.toJSONString(diseinfo);
-        input.getJSONObject("input").put("mdtrtinfo", mdtrtinfo);
-        input.getJSONObject("input").put("diseinfo", JSONArray.parse(ref));
-        JSONObject result = exec.executeTrade(input, SiFunction.UPLOAD_OUTPATIENT_INFO);
-        log.info("【操作员:{}】门诊就诊信息上传:\n参数:{},\n结果:{}", TokenUtil.getTokenUserId(), input, result);
-        return SiUtil.makeReturnWithoutOutput(result, "门诊就诊信息上传成功。");
-    }
+//    private ResultVo<String> uploadOutpatientInfo(SpcChrDiseAcct p, SiPatInfo siPatInfo) {
+//        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.UPLOAD_OUTPATIENT_INFO, siPatInfo.getInsuplcAdmdvs());
+//        JSONObject mdtrtinfo = new JSONObject();
+//        Diseinfo diag = dao.selectDiseinfo(p.getPatNo(), p.getTimes());
+//        if (StringUtil.notBlank(p.getOpspDiseCode())) {
+//            diag.setDiagCode(p.getOpspDiseCode());
+//            diag.setDiagName(p.getOpspDiseName());
+//        }
+//        if (StringUtil.isBlank(diag.getDiagCode())) {
+//            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "患者的门诊诊断为空,请联系医生填写!");
+//        }
+//        dao.updatePatDiseinfo(siPatInfo.getPatNo(), siPatInfo.getTimes(), diag.getDiagCode(), diag.getDiagName());
+//        mdtrtinfo.put("mdtrt_id", siPatInfo.getMdtrtId());
+//        mdtrtinfo.put("psn_no", siPatInfo.getPsnNo());
+//        mdtrtinfo.put("med_type", siPatInfo.getMedType());
+//        mdtrtinfo.put("begntime", DateUtil.formatDatetime(siPatInfo.getVisitDatetime()));
+//        mdtrtinfo.put("main_cond_dscr", p.getOpspDiseName());
+//        mdtrtinfo.put("dise_codg", p.getOpspDiseCode());
+//        mdtrtinfo.put("dise_name", p.getOpspDiseName());
+//        mdtrtinfo.put("birctrl_type", "");
+//        mdtrtinfo.put("birctrl_matn_date", "");
+//        List<Diseinfo> diseinfo = new ArrayList<>();
+//        diseinfo.add(diag);
+//        String ref = JSONObject.toJSONString(diseinfo);
+//        input.getJSONObject("input").put("mdtrtinfo", mdtrtinfo);
+//        input.getJSONObject("input").put("diseinfo", JSONArray.parse(ref));
+//        JSONObject result = exec.executeTrade(input, SiFunction.UPLOAD_OUTPATIENT_INFO);
+//        log.info("【操作员:{}】门诊就诊信息上传:\n参数:{},\n结果:{}", TokenUtil.getTokenUserId(), input, result);
+//        return SiUtil.makeReturnWithoutOutput(result, "门诊就诊信息上传成功。");
+//    }
 
     public ResultVo<SiPatInfo> uploadOutpatientFeeDetails(SpcChrDiseAcct p) {
-        String patNo = p.getPatNo();
-        if (null == p.getTimes()) {
-            p.setTimes(dao.selectMaxTimes(patNo));
-        }
-        SiPatInfo siPatInfo = queryDao.selectSiPatInfoForMz(patNo, p.getTimes());
-        if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getMdtrtId())) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【门诊号:" + patNo +
-                    "】未找到此患者的医保挂号信息,请核实。");
-        }
-        ResultVo<String> uplRes = uploadOutpatientInfo(p, siPatInfo);
-        if (null != uplRes && uplRes.getCode() != ExceptionEnum.SUCCESS.getCode()) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, uplRes.getMessage());
-        }
-        List<FeeDetail> feeDetails = dao.selectOutpatientFees(patNo, p.getTimes());
-        if (null == feeDetails || feeDetails.isEmpty()) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有需要上传的费用。");
-        }
-        String batchNo = patNo + "_" + p.getTimes();
-        feeDetails.forEach(item -> {
-            item.setMdtrtId(siPatInfo.getMdtrtId());
-            item.setPsnNo(siPatInfo.getPsnNo());
-            item.setChrgBchno(batchNo);
-            item.setRxCircFlag(YesOrNo.NO.getCodeStr());
-            item.setHospApprFlag(YesOrNo.YES.getCodeStr());
-        });
-        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.UPLOAD_OUTPATIENT_FEE_DETAILS, siPatInfo.getInsuplcAdmdvs());
-        String ref = JSONArray.toJSONString(feeDetails);
-        JSONArray feedetail = JSONArray.parseArray(ref);
-        input.getJSONObject("input").put("feedetail", feedetail);
-        JSONObject result = exec.executeTrade(input, SiFunction.UPLOAD_OUTPATIENT_FEE_DETAILS);
-        log.info("【操作员:{}】门诊费用明细信息上传:\n参数:{},\n结果:{}", TokenUtil.getTokenUserId(), input, result);
-        if (null == result) {
-            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
-        }
-        if (null == result.getInteger(RESULT_CODE)) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
-        }
-        if (result.getIntValue(RESULT_CODE) == 0) {
-            JSONArray feeRes = result.getJSONObject(OUTPUT).getJSONArray("result");
-            double fulamtOwnpayAmt = 0d;
-            double overlmtAmt = 0d;
-            double preselfpayAmt = 0d;
-            double inscpScpAmt = 0d;
-            for (int i = 0; i < feeRes.size(); i++) {
-                JSONObject fee = feeRes.getJSONObject(i);
-                fulamtOwnpayAmt += fee.getDoubleValue("fulamt_ownpay_amt");
-                overlmtAmt += fee.getDoubleValue("overlmt_amt");
-                preselfpayAmt += fee.getDoubleValue("preselfpay_amt");
-                inscpScpAmt += fee.getDoubleValue("inscp_scp_amt");
-
-                String detlSn = fee.getString("feedetl_sn");
-                String chrgLv = fee.getString("chrgitm_lv");
-                String chrgType = fee.getString("med_chrgitm_type");
-                String[] sns = detlSn.split("_");
-                int times = Integer.parseInt(sns[1]);
-                int recNo = Integer.parseInt(sns[2]);
-                int odrNo = Integer.parseInt(sns[3]);
-                int itmNo = Integer.parseInt(sns[4]);
-                dao.afterUploadFees(patNo, times, recNo, odrNo, itmNo, chrgLv, chrgType);
-            }
-            siPatInfo.setFulamtOwnpayAmt(fulamtOwnpayAmt);
-            siPatInfo.setOverlmtAmt(overlmtAmt);
-            siPatInfo.setPreselfpayAmt(preselfpayAmt);
-            siPatInfo.setInscpScpAmt(inscpScpAmt);
-            dao.updateSortOfAmt(siPatInfo);
-            return ResultVoUtil.success(siPatInfo);
-        }
-        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
+        p.setStaffId(TokenUtil.getTokenUserId());
+        RestTemplate restTemplate = new RestTemplate();
+        return restTemplate.postForObject(siFeeUrl + "/mzFee/uploadOutpatientFeeDetails", p, ResultVo.class);
+//        String patNo = p.getPatNo();
+//        if (null == p.getTimes()) {
+//            p.setTimes(dao.selectMaxTimes(patNo));
+//        }
+//        SiPatInfo siPatInfo = queryDao.selectSiPatInfoForMz(patNo, p.getTimes());
+//        if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getMdtrtId())) {
+//            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【门诊号:" + patNo +
+//                    "】未找到此患者的医保挂号信息,请核实。");
+//        }
+//        ResultVo<String> uplRes = uploadOutpatientInfo(p, siPatInfo);
+//        if (null != uplRes && uplRes.getCode() != ExceptionEnum.SUCCESS.getCode()) {
+//            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, uplRes.getMessage());
+//        }
+//        List<FeeDetail> feeDetails = dao.selectOutpatientFees(patNo, p.getTimes());
+//        if (null == feeDetails || feeDetails.isEmpty()) {
+//            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有需要上传的费用。");
+//        }
+//        String batchNo = patNo + "_" + p.getTimes();
+//        feeDetails.forEach(item -> {
+//            item.setMdtrtId(siPatInfo.getMdtrtId());
+//            item.setPsnNo(siPatInfo.getPsnNo());
+//            item.setChrgBchno(batchNo);
+//            item.setRxCircFlag(YesOrNo.NO.getCodeStr());
+//            item.setHospApprFlag(YesOrNo.YES.getCodeStr());
+//        });
+//        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.UPLOAD_OUTPATIENT_FEE_DETAILS, siPatInfo.getInsuplcAdmdvs());
+//        String ref = JSONArray.toJSONString(feeDetails);
+//        JSONArray feedetail = JSONArray.parseArray(ref);
+//        input.getJSONObject("input").put("feedetail", feedetail);
+//        JSONObject result = exec.executeTrade(input, SiFunction.UPLOAD_OUTPATIENT_FEE_DETAILS);
+//        log.info("【操作员:{}】门诊费用明细信息上传:\n参数:{},\n结果:{}", TokenUtil.getTokenUserId(), input, result);
+//        if (null == result) {
+//            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+//        }
+//        if (null == result.getInteger(RESULT_CODE)) {
+//            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
+//        }
+//        if (result.getIntValue(RESULT_CODE) == 0) {
+//            JSONArray feeRes = result.getJSONObject(OUTPUT).getJSONArray("result");
+//            double fulamtOwnpayAmt = 0d;
+//            double overlmtAmt = 0d;
+//            double preselfpayAmt = 0d;
+//            double inscpScpAmt = 0d;
+//            for (int i = 0; i < feeRes.size(); i++) {
+//                JSONObject fee = feeRes.getJSONObject(i);
+//                fulamtOwnpayAmt += fee.getDoubleValue("fulamt_ownpay_amt");
+//                overlmtAmt += fee.getDoubleValue("overlmt_amt");
+//                preselfpayAmt += fee.getDoubleValue("preselfpay_amt");
+//                inscpScpAmt += fee.getDoubleValue("inscp_scp_amt");
+//
+//                String detlSn = fee.getString("feedetl_sn");
+//                String chrgLv = fee.getString("chrgitm_lv");
+//                String chrgType = fee.getString("med_chrgitm_type");
+//                String[] sns = detlSn.split("_");
+//                int times = Integer.parseInt(sns[1]);
+//                int recNo = Integer.parseInt(sns[2]);
+//                int odrNo = Integer.parseInt(sns[3]);
+//                int itmNo = Integer.parseInt(sns[4]);
+//                dao.afterUploadFees(patNo, times, recNo, odrNo, itmNo, chrgLv, chrgType);
+//            }
+//            siPatInfo.setFulamtOwnpayAmt(fulamtOwnpayAmt);
+//            siPatInfo.setOverlmtAmt(overlmtAmt);
+//            siPatInfo.setPreselfpayAmt(preselfpayAmt);
+//            siPatInfo.setInscpScpAmt(inscpScpAmt);
+//            dao.updateSortOfAmt(siPatInfo);
+//            return ResultVoUtil.success(siPatInfo);
+//        }
+//        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
     }
 
     public ResultVo<String> revokeOutpatientFeeDetails(MzPatientInfo p) {
-        if (null == p.getTimes()) {
-            p.setTimes(dao.selectMaxTimes(p.getPatNo()));
-        }
-        SiPatInfo siPatInfo = queryDao.selectSiPatInfoForMz(p.getPatNo(), p.getTimes());
-        log.info("patNo: {}, times: {}, sipatinfo: {}", p.getPatNo(), p.getTimes(), siPatInfo);
-        if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getMdtrtId())) {
-            return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有此患者的医保挂号信息!");
-        }
-        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.REVOKE_OUTPATIENT_FEE_DETAILS, siPatInfo.getInsuplcAdmdvs());
-        JSONObject data = new JSONObject();
-        data.put("mdtrt_id", siPatInfo.getMdtrtId());
-        data.put("psn_no", siPatInfo.getPsnNo());
-        data.put("chrg_bchno", "0000");
-        input.getJSONObject("input").put("data", data);
-        JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_OUTPATIENT_FEE_DETAILS);
-        log.info("【操作员:{}】门诊费用明细信息撤销,参数:{},结果:{}", TokenUtil.getTokenUserId(), input, result);
-        if (null == result) {
-            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
-        }
-        if (null == result.getInteger(RESULT_CODE)) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
-        }
-        if (result.getIntValue(RESULT_CODE) == 0) {
-            dao.afterRevokeFees(p.getPatNo(), p.getTimes());
-            return ResultVoUtil.success("门诊费用明细信息撤销成功。");
-        }
-        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
+        p.setStaffId(TokenUtil.getTokenUserId());
+        RestTemplate restTemplate = new RestTemplate();
+        return restTemplate.postForObject(siFeeUrl + "/mzFee/revokeOutpatientFeeDetails", p, ResultVo.class);
+//        if (null == p.getTimes()) {
+//            p.setTimes(dao.selectMaxTimes(p.getPatNo()));
+//        }
+//        SiPatInfo siPatInfo = queryDao.selectSiPatInfoForMz(p.getPatNo(), p.getTimes());
+//        log.info("patNo: {}, times: {}, sipatinfo: {}", p.getPatNo(), p.getTimes(), siPatInfo);
+//        if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getMdtrtId())) {
+//            return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有此患者的医保挂号信息!");
+//        }
+//        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.REVOKE_OUTPATIENT_FEE_DETAILS, siPatInfo.getInsuplcAdmdvs());
+//        JSONObject data = new JSONObject();
+//        data.put("mdtrt_id", siPatInfo.getMdtrtId());
+//        data.put("psn_no", siPatInfo.getPsnNo());
+//        data.put("chrg_bchno", "0000");
+//        input.getJSONObject("input").put("data", data);
+//        JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_OUTPATIENT_FEE_DETAILS);
+//        log.info("【操作员:{}】门诊费用明细信息撤销,参数:{},结果:{}", TokenUtil.getTokenUserId(), input, result);
+//        if (null == result) {
+//            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+//        }
+//        if (null == result.getInteger(RESULT_CODE)) {
+//            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
+//        }
+//        if (result.getIntValue(RESULT_CODE) == 0) {
+//            dao.afterRevokeFees(p.getPatNo(), p.getTimes());
+//            return ResultVoUtil.success("门诊费用明细信息撤销成功。");
+//        }
+//        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
     }
 
     public ResultVo<FundDetail> outpatientPreSettlement(MzPatientInfo p) {
-        if (null == p.getTimes()) {
-            p.setTimes(dao.selectMaxTimes(p.getPatNo()));
-        }
-        ResultVo<FundDetail> fundDetail1 = getFundDetailResultVo(p);
-        if (fundDetail1 != null) return fundDetail1;
-        PreSetlmt preSetlmt = dao.selectPreSetlmt(p.getPatNo(), p.getTimes());
-        preSetlmt.setMedfeeSumamt(preSetlmt.getMedfeeSumamt().setScale(2, RoundingMode.HALF_UP));
-        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.OUTPATIENT_PRE_SETTLEMENT, preSetlmt.getInsuplcAdmdvs());
-        preSetlmt.setMdtrtCertType(MdtrtCertType.RESIDENT_IDENTITY_CARD.getCode());
-        preSetlmt.setPsnSetlway(PsnSetlWay.SETTLE_BY_ITEMS.getCode());
-        preSetlmt.setAcctUsedFlag(YesOrNo.NO.getCodeStr());
-        preSetlmt.setChrgBchno(p.getPatNo() + "_" + p.getTimes());
-        String ref = JSONObject.toJSONString(preSetlmt);
-        input.getJSONObject("input").put("data", JSONObject.parseObject(ref));
-        JSONObject result = exec.executeTrade(input, SiFunction.OUTPATIENT_PRE_SETTLEMENT);
-        log.info("【操作员:{}】门诊预结算:\n参数:{},\n结果:{}", p.getStaffId(), input, result);
-        if (null == result) {
-            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
-        }
-        if (null == result.getInteger(RESULT_CODE)) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
-        }
-        if (result.getIntValue(RESULT_CODE) == 0) {
-            int mtPartCount = dao.selectMtPartCount(p.getPatNo(), p.getTimes());
-            if (mtPartCount == 0) {
-                CssybApplyInfo applyInfo = new CssybApplyInfo();
-                applyInfo.setPatientId(p.getPatNo());
-                applyInfo.setTimes(p.getTimes());
-                applyInfo.setHicNo(preSetlmt.getPsnNo());
-                applyInfo.setBizType(preSetlmt.getMedType());
-                applyInfo.setIcdCode("");
-                applyInfo.setIcdName("");
-                applyInfo.setMzSerialNo(preSetlmt.getMdtrtId());
-                dao.insertMtPartInfo(applyInfo);
-            }
-            JSONObject setlinfo = result.getJSONObject(OUTPUT).getJSONObject("setlinfo");
-            FundDetail fundDetail = new FundDetail();
-            fundDetail.setTotalCost(setlinfo.getString("medfee_sumamt"));
-            fundDetail.setFundPay(setlinfo.getString("fund_pay_sumamt"));
-            fundDetail.setCashPay(setlinfo.getString("psn_cash_pay"));
-            fundDetail.setAcctPay(setlinfo.getString("acct_pay"));
-            fundDetail.setSelfPay(setlinfo.getString("psn_part_amt"));
-            return ResultVoUtil.success(fundDetail);
-        }
-        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
-    }
-
-    private ResultVo<FundDetail> getFundDetailResultVo(MzPatientInfo p) {
-        SiSetlinfo sisetl = dao.selectSettledInfo(p.getPatNo(), p.getTimes());
-        if (null != sisetl && null != sisetl.getSetlId()) {
-            FundDetail fundDetail = new FundDetail();
-            fundDetail.setTotalCost(String.valueOf(sisetl.getMedfeeSumamt()));
-            fundDetail.setFundPay(String.valueOf(sisetl.getFundPaySumamt()));
-            fundDetail.setCashPay(String.valueOf(sisetl.getPsnCashPay()));
-            fundDetail.setAcctPay(String.valueOf(sisetl.getAcctPay()));
-            fundDetail.setSelfPay(String.valueOf(sisetl.getPsnPartAmt()));
-            return ResultVoUtil.success(fundDetail);
-        }
         if (null == p.getStaffId()) {
             p.setStaffId(TokenUtil.getTokenUserId());
         }
-        return null;
+        RestTemplate restTemplate = new RestTemplate();
+        return restTemplate.postForObject(siFeeUrl + "/mzFee/outpatientPreSettlement", p, ResultVo.class);
+//        if (null == p.getTimes()) {
+//            p.setTimes(dao.selectMaxTimes(p.getPatNo()));
+//        }
+//        ResultVo<FundDetail> fundDetail1 = getFundDetailResultVo(p);
+//        if (fundDetail1 != null) return fundDetail1;
+//        PreSetlmt preSetlmt = dao.selectPreSetlmt(p.getPatNo(), p.getTimes());
+//        preSetlmt.setMedfeeSumamt(preSetlmt.getMedfeeSumamt().setScale(2, RoundingMode.HALF_UP));
+//        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.OUTPATIENT_PRE_SETTLEMENT, preSetlmt.getInsuplcAdmdvs());
+//        preSetlmt.setMdtrtCertType(MdtrtCertType.RESIDENT_IDENTITY_CARD.getCode());
+//        preSetlmt.setPsnSetlway(PsnSetlWay.SETTLE_BY_ITEMS.getCode());
+//        preSetlmt.setAcctUsedFlag(YesOrNo.NO.getCodeStr());
+//        preSetlmt.setChrgBchno(p.getPatNo() + "_" + p.getTimes());
+//        String ref = JSONObject.toJSONString(preSetlmt);
+//        input.getJSONObject("input").put("data", JSONObject.parseObject(ref));
+//        JSONObject result = exec.executeTrade(input, SiFunction.OUTPATIENT_PRE_SETTLEMENT);
+//        log.info("【操作员:{}】门诊预结算:\n参数:{},\n结果:{}", p.getStaffId(), input, result);
+//        if (null == result) {
+//            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+//        }
+//        if (null == result.getInteger(RESULT_CODE)) {
+//            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
+//        }
+//        if (result.getIntValue(RESULT_CODE) == 0) {
+//            int mtPartCount = dao.selectMtPartCount(p.getPatNo(), p.getTimes());
+//            if (mtPartCount == 0) {
+//                CssybApplyInfo applyInfo = new CssybApplyInfo();
+//                applyInfo.setPatientId(p.getPatNo());
+//                applyInfo.setTimes(p.getTimes());
+//                applyInfo.setHicNo(preSetlmt.getPsnNo());
+//                applyInfo.setBizType(preSetlmt.getMedType());
+//                applyInfo.setIcdCode("");
+//                applyInfo.setIcdName("");
+//                applyInfo.setMzSerialNo(preSetlmt.getMdtrtId());
+//                dao.insertMtPartInfo(applyInfo);
+//            }
+//            JSONObject setlinfo = result.getJSONObject(OUTPUT).getJSONObject("setlinfo");
+//            FundDetail fundDetail = new FundDetail();
+//            fundDetail.setTotalCost(setlinfo.getString("medfee_sumamt"));
+//            fundDetail.setFundPay(setlinfo.getString("fund_pay_sumamt"));
+//            fundDetail.setCashPay(setlinfo.getString("psn_cash_pay"));
+//            fundDetail.setAcctPay(setlinfo.getString("acct_pay"));
+//            fundDetail.setSelfPay(setlinfo.getString("psn_part_amt"));
+//            return ResultVoUtil.success(fundDetail);
+//        }
+//        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
     }
 
+//    private ResultVo<FundDetail> getFundDetailResultVo(MzPatientInfo p) {
+//        SiSetlinfo sisetl = dao.selectSettledInfo(p.getPatNo(), p.getTimes());
+//        if (null != sisetl && null != sisetl.getSetlId()) {
+//            FundDetail fundDetail = new FundDetail();
+//            fundDetail.setTotalCost(String.valueOf(sisetl.getMedfeeSumamt()));
+//            fundDetail.setFundPay(String.valueOf(sisetl.getFundPaySumamt()));
+//            fundDetail.setCashPay(String.valueOf(sisetl.getPsnCashPay()));
+//            fundDetail.setAcctPay(String.valueOf(sisetl.getAcctPay()));
+//            fundDetail.setSelfPay(String.valueOf(sisetl.getPsnPartAmt()));
+//            return ResultVoUtil.success(fundDetail);
+//        }
+//        if (null == p.getStaffId()) {
+//            p.setStaffId(TokenUtil.getTokenUserId());
+//        }
+//        return null;
+//    }
+
     public ResultVo<FundDetail> outpatientSettlement(MzPatientInfo p) {
-        ResultVo<FundDetail> fundDetail1 = getFundDetailResultVo(p);
-        if (fundDetail1 != null) return fundDetail1;
-        Setlmt setlmt = dao.selectSetlmt(p.getPatNo(), p.getTimes());
-        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.OUTPATIENT_SETTLEMENT, setlmt.getInsuplcAdmdvs());
-        setlmt.setMdtrtCertType(MdtrtCertType.RESIDENT_IDENTITY_CARD.getCode());
-        setlmt.setMedfeeSumamt(setlmt.getMedfeeSumamt().setScale(2, RoundingMode.HALF_UP));
-        setlmt.setPsnSetlway(PsnSetlWay.SETTLE_BY_ITEMS.getCode());
-        setlmt.setChrgBchno(p.getPatNo() + "_" + p.getTimes());
-        setlmt.setAcctUsedFlag(YesOrNo.NO.getCodeStr());
-        setlmt.setInvono(SnowFlakeId.instance().nextId());
-        String ref = JSONObject.toJSONString(setlmt);
-        input.getJSONObject("input").put("data", JSONObject.parseObject(ref));
-        JSONObject result = exec.executeTrade(input, SiFunction.OUTPATIENT_SETTLEMENT);
-        log.info("【操作员:{}】门诊结算:\n参数:{},\n结果:{}", p.getStaffId(), input, result);
-        if (null == result) {
-            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR, "与医保中心的连接出现网络异常!");
-        }
-        if (null == result.getInteger(RESULT_CODE)) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
-        }
-        if (result.getIntValue(RESULT_CODE) == 0) {
-            JSONObject setlinfo = result.getJSONObject(OUTPUT).getJSONObject("setlinfo");
-            SiSetlinfo setlEntity = JSONObject.parseObject(setlinfo.toJSONString(), SiSetlinfo.class);
-            setlEntity.setPatNo(p.getPatNo());
-            setlEntity.setTimes(p.getTimes());
-            setlEntity.setLedgerSn(0);
-            setlEntity.setStaffId(p.getStaffId());
-            setlEntity.setRevoked(YesOrNo.NO.getCode());
-            setlEntity.setSetlType(ClrType.OUTPATIENT.getCode());
-            setlinfoDao.insert(setlEntity);
-            setlinfoDao.updateSiZyInfoSetlId(p.getPatNo(), p.getTimes(), 0, setlEntity.getSetlId(),
-                    setlEntity.getMedinsSetlId(), input.getString("msgid"));
-            JSONArray setldetail = result.getJSONObject(OUTPUT).getJSONArray("setldetail");
-            for (int i = 0; i < setldetail.size(); i++) {
-                SiSetldetail setldetailEntity = JSONObject.parseObject(setldetail.getJSONObject(i).toJSONString(), SiSetldetail.class);
-                setldetailEntity.setPatNo(p.getPatNo());
-                setldetailEntity.setTimes(p.getTimes());
-                setldetailEntity.setLedgerSn(0);
-                setldetailDao.insert(setldetailEntity);
-            }
-            FundDetail fundDetail = new FundDetail();
-            fundDetail.setTotalCost(String.valueOf(setlEntity.getMedfeeSumamt()));
-            fundDetail.setFundPay(String.valueOf(setlEntity.getFundPaySumamt()));
-            fundDetail.setCashPay(String.valueOf(setlEntity.getPsnCashPay()));
-            fundDetail.setAcctPay(String.valueOf(setlEntity.getAcctPay()));
-            fundDetail.setSelfPay(String.valueOf(setlEntity.getPsnPartAmt()));
-            return ResultVoUtil.success(fundDetail);
+        if (null == p.getStaffId()) {
+            p.setStaffId(TokenUtil.getTokenUserId());
         }
-        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
+        RestTemplate restTemplate = new RestTemplate();
+        return restTemplate.postForObject(siFeeUrl + "/mzFee/outpatientSettlement", p, ResultVo.class);
+//        ResultVo<FundDetail> fundDetail1 = getFundDetailResultVo(p);
+//        if (fundDetail1 != null) return fundDetail1;
+//        Setlmt setlmt = dao.selectSetlmt(p.getPatNo(), p.getTimes());
+//        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.OUTPATIENT_SETTLEMENT, setlmt.getInsuplcAdmdvs());
+//        setlmt.setMdtrtCertType(MdtrtCertType.RESIDENT_IDENTITY_CARD.getCode());
+//        setlmt.setMedfeeSumamt(setlmt.getMedfeeSumamt().setScale(2, RoundingMode.HALF_UP));
+//        setlmt.setPsnSetlway(PsnSetlWay.SETTLE_BY_ITEMS.getCode());
+//        setlmt.setChrgBchno(p.getPatNo() + "_" + p.getTimes());
+//        setlmt.setAcctUsedFlag(YesOrNo.NO.getCodeStr());
+//        setlmt.setInvono(SnowFlakeId.instance().nextId());
+//        String ref = JSONObject.toJSONString(setlmt);
+//        input.getJSONObject("input").put("data", JSONObject.parseObject(ref));
+//        JSONObject result = exec.executeTrade(input, SiFunction.OUTPATIENT_SETTLEMENT);
+//        log.info("【操作员:{}】门诊结算:\n参数:{},\n结果:{}", p.getStaffId(), input, result);
+//        if (null == result) {
+//            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR, "与医保中心的连接出现网络异常!");
+//        }
+//        if (null == result.getInteger(RESULT_CODE)) {
+//            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
+//        }
+//        if (result.getIntValue(RESULT_CODE) == 0) {
+//            JSONObject setlinfo = result.getJSONObject(OUTPUT).getJSONObject("setlinfo");
+//            SiSetlinfo setlEntity = JSONObject.parseObject(setlinfo.toJSONString(), SiSetlinfo.class);
+//            setlEntity.setPatNo(p.getPatNo());
+//            setlEntity.setTimes(p.getTimes());
+//            setlEntity.setLedgerSn(0);
+//            setlEntity.setStaffId(p.getStaffId());
+//            setlEntity.setRevoked(YesOrNo.NO.getCode());
+//            setlEntity.setSetlType(ClrType.OUTPATIENT.getCode());
+//            setlinfoDao.insert(setlEntity);
+//            setlinfoDao.updateSiZyInfoSetlId(p.getPatNo(), p.getTimes(), 0, setlEntity.getSetlId(),
+//                    setlEntity.getMedinsSetlId(), input.getString("msgid"));
+//            JSONArray setldetail = result.getJSONObject(OUTPUT).getJSONArray("setldetail");
+//            for (int i = 0; i < setldetail.size(); i++) {
+//                SiSetldetail setldetailEntity = JSONObject.parseObject(setldetail.getJSONObject(i).toJSONString(), SiSetldetail.class);
+//                setldetailEntity.setPatNo(p.getPatNo());
+//                setldetailEntity.setTimes(p.getTimes());
+//                setldetailEntity.setLedgerSn(0);
+//                setldetailDao.insert(setldetailEntity);
+//            }
+//            FundDetail fundDetail = new FundDetail();
+//            fundDetail.setTotalCost(String.valueOf(setlEntity.getMedfeeSumamt()));
+//            fundDetail.setFundPay(String.valueOf(setlEntity.getFundPaySumamt()));
+//            fundDetail.setCashPay(String.valueOf(setlEntity.getPsnCashPay()));
+//            fundDetail.setAcctPay(String.valueOf(setlEntity.getAcctPay()));
+//            fundDetail.setSelfPay(String.valueOf(setlEntity.getPsnPartAmt()));
+//            return ResultVoUtil.success(fundDetail);
+//        }
+//        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
     }
 
     public ResultVo<String> revokeOutpatientSettlement(MzPatientInfo p) {
-        if (null == p.getTimes()) {
-            p.setTimes(dao.selectMaxTimes(p.getPatNo()));
-        }
         if (null == p.getStaffId()) {
             p.setStaffId(TokenUtil.getTokenUserId());
         }
-        QueryWrapper<SiSetlinfo> wrapper = new QueryWrapper<>();
-        wrapper.eq("pat_no", p.getPatNo());
-        wrapper.eq("times", p.getTimes());
-        wrapper.eq("revoked", 0);
-        SiSetlinfo setlinfo = setlinfoDao.selectOne(wrapper);
-        if (null == setlinfo) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的结算信息。");
-        }
-        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.REVOKE_OUTPATIENT_SETTLEMENT,
-                dao.selectAdmdvs(setlinfo.getPatNo(), setlinfo.getTimes(), setlinfo.getLedgerSn()));
-        JSONObject data = new JSONObject();
-        data.put("setl_id", setlinfo.getSetlId());
-        data.put("mdtrt_id", setlinfo.getMdtrtId());
-        data.put("psn_no", setlinfo.getPsnNo());
-        input.getJSONObject("input").put("data", data);
-        JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_OUTPATIENT_SETTLEMENT);
-        log.info("【操作员:{}】门诊结算撤销:\n参数:{},\n结果:{}", p.getStaffId(), input, result);
-        if (null == result) {
-            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
-        }
-        if (null == result.getInteger(RESULT_CODE)) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
-        }
-        if (result.getIntValue(RESULT_CODE) == 0) {
-            dao.deleteSetlInfo(p.getPatNo(), p.getTimes());
-            dao.deleteSetlDetail(p.getPatNo(), p.getTimes());
-            dao.updateRvkSetlMsgid(p.getPatNo(), p.getTimes(), input.getString("msgid"));
-            return ResultVoUtil.success("门诊结算撤销成功。");
-        }
-        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
+        RestTemplate restTemplate = new RestTemplate();
+        return restTemplate.postForObject(siFeeUrl + "/mzFee/revokeOutpatientSettlement", p, ResultVo.class);
+//        if (null == p.getTimes()) {
+//            p.setTimes(dao.selectMaxTimes(p.getPatNo()));
+//        }
+//        if (null == p.getStaffId()) {
+//            p.setStaffId(TokenUtil.getTokenUserId());
+//        }
+//        QueryWrapper<SiSetlinfo> wrapper = new QueryWrapper<>();
+//        wrapper.eq("pat_no", p.getPatNo());
+//        wrapper.eq("times", p.getTimes());
+//        wrapper.eq("revoked", 0);
+//        SiSetlinfo setlinfo = setlinfoDao.selectOne(wrapper);
+//        if (null == setlinfo) {
+//            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的结算信息。");
+//        }
+//        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.REVOKE_OUTPATIENT_SETTLEMENT,
+//                dao.selectAdmdvs(setlinfo.getPatNo(), setlinfo.getTimes(), setlinfo.getLedgerSn()));
+//        JSONObject data = new JSONObject();
+//        data.put("setl_id", setlinfo.getSetlId());
+//        data.put("mdtrt_id", setlinfo.getMdtrtId());
+//        data.put("psn_no", setlinfo.getPsnNo());
+//        input.getJSONObject("input").put("data", data);
+//        JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_OUTPATIENT_SETTLEMENT);
+//        log.info("【操作员:{}】门诊结算撤销:\n参数:{},\n结果:{}", p.getStaffId(), input, result);
+//        if (null == result) {
+//            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+//        }
+//        if (null == result.getInteger(RESULT_CODE)) {
+//            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
+//        }
+//        if (result.getIntValue(RESULT_CODE) == 0) {
+//            dao.deleteSetlInfo(p.getPatNo(), p.getTimes());
+//            dao.deleteSetlDetail(p.getPatNo(), p.getTimes());
+//            dao.updateRvkSetlMsgid(p.getPatNo(), p.getTimes(), input.getString("msgid"));
+//            return ResultVoUtil.success("门诊结算撤销成功。");
+//        }
+//        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
     }
 }

+ 1 - 2
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiQueryService.java

@@ -615,8 +615,7 @@ public class SiQueryService {
             }
             q.setPsnNo(psnNo);
         }
-        String admdvs = StringUtil.isBlank(q.getPatNo()) ? dao.selectAdmdvsByPsnNo(q.getPsnNo())
-                : dao.selectAdmdvsByPatNoAndPsnNo(q.getPatNo(), q.getPsnNo());
+        String admdvs = StringUtil.isBlank(q.getPatNo()) ? dao.selectAdmdvsByPsnNo(q.getPsnNo()) : dao.selectAdmdvsByPatNo(q.getPatNo());
         JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.QUERY_SPECIAL_CHRONIC_DISEASES_ACCREDITATION, admdvs);
         JSONObject data = new JSONObject();
         data.put("psn_no", q.getPsnNo());

+ 4 - 10
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiZyService.java

@@ -21,15 +21,11 @@ import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetlinfo;
 import thyyxxk.webserver.entity.yibao.dismiss.YbSettleFee;
 import thyyxxk.webserver.entity.yibao.patient.Overview;
 import thyyxxk.webserver.service.yibao.DismissService;
-import thyyxxk.webserver.service.yibao.SettleService;
 import thyyxxk.webserver.utils.*;
-import thyyxxk.webserver.websocket.WebSocketServer;
 
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import java.util.Queue;
 
 /**
  * @description: 住院医保交易
@@ -59,14 +55,13 @@ public class SiZyService {
     private final SiChargeTempDao chrgtmpdao;
     private final ExecService exec;
     private final DismissService dismissService;
-    private final SettleService settleService;
-    @Value("${si-uploadfee-url}")
-    private String siUploadFeeUrl;
+    @Value("${si-fee-url}")
+    private String siFeeUrl;
 
     @Autowired
     public SiZyService(SiZyDao dao, SiQueryDao qrydao, SiSetlinfoDao setlinfoDao,
                        SiSetldetailDao setldetldao, SiChargeTempDao chrgtmpdao, ExecService exec,
-                       DismissService dismissService, SettleService settleService) {
+                       DismissService dismissService) {
         this.dao = dao;
         this.qrydao = qrydao;
         this.setlinfodao = setlinfoDao;
@@ -74,7 +69,6 @@ public class SiZyService {
         this.chrgtmpdao = chrgtmpdao;
         this.exec = exec;
         this.dismissService = dismissService;
-        this.settleService = settleService;
     }
 
     public ResultVo<String> admissRegister(ZyPatientInfo p) {
@@ -188,7 +182,7 @@ public class SiZyService {
     public ResultVo<String> uploadFeeDetail(Overview o) {
         RestTemplate template = new RestTemplate();
         o.setStaffId(TokenUtil.getTokenUserId());
-        return template.postForObject(siUploadFeeUrl, o, ResultVo.class);
+        return template.postForObject(siFeeUrl + "/zyFee/upload", o, ResultVo.class);
     }
 
 //    public ResultVo<String> uploadFeeDetail(Overview o) {

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

@@ -62,4 +62,4 @@ si-api-url: http://10.136.68.158:22005/isp-api/powercsb/1101
 si-access-key: 04eMGRg7beAO6vqwrZiLacV8Uy3jNn7QGDUcBO
 si-secret-key: SK3Oip3a2R3NLz2xm58Mpmi69oFu96KrdKNRKglN
 
-si-uploadfee-url: http://172.16.32.159:1100/upload/execute
+si-fee-url: http://172.16.32.159:1100

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

@@ -70,8 +70,8 @@ si-api-url: http://10.136.68.158:22005/isp-api/powercsb/1101
 si-access-key: 04eMGRg7beAO6vqwrZiLacV8Uy3jNn7QGDUcBO
 si-secret-key: SK3Oip3a2R3NLz2xm58Mpmi69oFu96KrdKNRKglN
 
-#si-uploadfee-url: http://localhost:1100/upload/execute
-si-uploadfee-url: http://172.16.32.159:1100/upload/execute
+si-fee-url: http://localhost:1100
+#si-fee-url: http://172.16.32.159:1100
 
 #logging:
 #  level: