|
@@ -10,15 +10,14 @@ import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.webserver.constants.SiFunction;
|
|
|
import thyyxxk.webserver.constants.sidicts.MdtrtCertType;
|
|
|
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.medicalinsurance.FundDetail;
|
|
|
-import thyyxxk.webserver.entity.medicalinsurance.MzPatientInfo;
|
|
|
-import thyyxxk.webserver.entity.medicalinsurance.SiSetldetail;
|
|
|
-import thyyxxk.webserver.entity.medicalinsurance.SiSetlinfo;
|
|
|
+import thyyxxk.webserver.entity.medicalinsurance.*;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.outpatient.FeeDetail;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.outpatient.PreSetlmt;
|
|
|
+import thyyxxk.webserver.entity.medicalinsurance.outpatient.Regstrtn;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.outpatient.Setlmt;
|
|
|
import thyyxxk.webserver.utils.*;
|
|
|
|
|
@@ -33,6 +32,7 @@ import java.util.List;
|
|
|
@Service
|
|
|
public class SiMzService {
|
|
|
private final SiMzDao dao;
|
|
|
+ private final SiQueryDao queryDao;
|
|
|
private final SiSetlinfoDao setlinfoDao;
|
|
|
private final SiSetldetailDao setldetailDao;
|
|
|
private final ExecService exec;
|
|
@@ -41,8 +41,9 @@ public class SiMzService {
|
|
|
private static final String OUTPUT = "output";
|
|
|
|
|
|
@Autowired
|
|
|
- public SiMzService(SiMzDao dao, SiSetlinfoDao setlinfoDao, SiSetldetailDao setldetailDao, ExecService exec) {
|
|
|
+ public SiMzService(SiMzDao dao, SiQueryDao queryDao, SiSetlinfoDao setlinfoDao, SiSetldetailDao setldetailDao, ExecService exec) {
|
|
|
this.dao = dao;
|
|
|
+ this.queryDao = queryDao;
|
|
|
this.setlinfoDao = setlinfoDao;
|
|
|
this.setldetailDao = setldetailDao;
|
|
|
this.exec = exec;
|
|
@@ -50,24 +51,13 @@ public class SiMzService {
|
|
|
|
|
|
public ResultVo<String> outpatientRegistration(MzPatientInfo p) {
|
|
|
JSONObject input = exec.makeTradeHeader(SiFunction.OUTPATIENT_REGISTRATION);
|
|
|
- JSONObject data = new JSONObject();
|
|
|
- data.put("psn_no", p.getPsnNo());
|
|
|
- data.put("insutype", p.getInsutype());
|
|
|
- data.put("begntime", DateUtil.formatDatetime(p.getVisitDate()));
|
|
|
- data.put("mdtrt_cert_type", MdtrtCertType.RESIDENT_IDENTITY_CARD.getCode());
|
|
|
- data.put("mdtrt_cert_no", p.getSocialNo());
|
|
|
- data.put("card_sn", "");
|
|
|
- data.put("psn_cert_type", "1");
|
|
|
- data.put("certno", p.getSocialNo());
|
|
|
- data.put("psn_type", p.getPsnType());
|
|
|
- data.put("psn_name", p.getName());
|
|
|
- data.put("ipt_otp_no", p.getPatientId());
|
|
|
- data.put("atddr_no", p.getDoctorCode());
|
|
|
- data.put("dr_name", p.getDoctorName());
|
|
|
- data.put("dept_code", p.getDeptCode());
|
|
|
- data.put("dept_name", p.getDeptName());
|
|
|
- data.put("caty", p.getDeptClass());
|
|
|
- input.getJSONObject("input").put("data", data);
|
|
|
+ Regstrtn regstrtn = dao.selectRegstrtn(p.getPatientId(), p.getTimes());
|
|
|
+ regstrtn.setInsutype(p.getInsutype());
|
|
|
+ regstrtn.setMdtrtCertType(MdtrtCertType.RESIDENT_IDENTITY_CARD.getCode());
|
|
|
+ regstrtn.setPsnType(p.getPsnType());
|
|
|
+ regstrtn.setIptOtpNo(p.getPatientId());
|
|
|
+ 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("【操作员:{}】,门诊挂号:参数:{},结果:{}", TokenUtil.getTokenUserId(), input, result);
|
|
|
if (null == result) {
|
|
@@ -76,23 +66,33 @@ public class SiMzService {
|
|
|
if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
JSONObject output = result.getJSONObject(OUTPUT).getJSONObject("data");
|
|
|
String mdtrtId = output.getString("mdtrt_id");
|
|
|
- String psnNo = output.getString("psn_no");
|
|
|
- String patientId = output.getString("ipt_otp_no");
|
|
|
+ dao.afterRegistrtn(p.getPatientId(), p.getTimes(), mdtrtId, p.getInsutype(), p.getPsnType());
|
|
|
return ResultVoUtil.success("挂号成功。");
|
|
|
}
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
}
|
|
|
|
|
|
- public ResultVo<String> revokeOutpatientRegistration(MzPatientInfo p) {
|
|
|
+ public ResultVo<String> revokeOutpatientRegistration(String patientId, Integer times) {
|
|
|
+ SiPatInfo siPatInfo = queryDao.selectSiPatInfoForMz(patientId, times);
|
|
|
+ if (null == siPatInfo || StringUtil.isBlank(siPatInfo.getMdtrtId())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保挂号信息。");
|
|
|
+ }
|
|
|
JSONObject input = exec.makeTradeHeader(SiFunction.REVOKE_OUTPATIENT_REGISTRATION);
|
|
|
JSONObject data = new JSONObject();
|
|
|
- data.put("psn_no", p.getPsnNo());
|
|
|
- data.put("mdtrt_id", p.getMdtrtId());
|
|
|
- data.put("ipt_otp_no", p.getPatientId());
|
|
|
+ data.put("psn_no", siPatInfo.getPsnNo());
|
|
|
+ data.put("mdtrt_id", siPatInfo.getMdtrtId());
|
|
|
+ data.put("ipt_otp_no", patientId);
|
|
|
input.getJSONObject("input").put("data", data);
|
|
|
JSONObject result = exec.executeTrade(input, SiFunction.OUTPATIENT_REGISTRATION);
|
|
|
log.info("【操作员:{}】,取消门诊挂号:参数:{},结果:{}", TokenUtil.getTokenUserId(), input, result);
|
|
|
- return SiUtil.makeReturnWithoutOutput(result, "取消挂号成功。");
|
|
|
+ if (null == result) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
+ if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
+ queryDao.clearMdtrtIdForMz(patientId, times);
|
|
|
+ return ResultVoUtil.success("取消门诊挂号成功。");
|
|
|
+ }
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> uploadOutpatientInfo(MzPatientInfo p) {
|