|
@@ -5,10 +5,10 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
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 org.springframework.web.client.RestTemplate;
|
|
|
import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
|
|
|
+import thyyxxk.wxservice_server.config.properties.ApiAddr;
|
|
|
import thyyxxk.wxservice_server.entity.ResultVo;
|
|
|
import thyyxxk.wxservice_server.entity.appointment.MzyReqrec;
|
|
|
import thyyxxk.wxservice_server.entity.hrgresponse.*;
|
|
@@ -26,13 +26,14 @@ import java.util.concurrent.TimeUnit;
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
public class ThmzService {
|
|
|
- @Value("${hrgApiUrl}")
|
|
|
- private String thmzApiUrl;
|
|
|
+ private final String thmzApi;
|
|
|
private final RedisLikeService redis;
|
|
|
|
|
|
+
|
|
|
@Autowired
|
|
|
- public ThmzService(RedisLikeService redis) {
|
|
|
+ public ThmzService(RedisLikeService redis, ApiAddr apiAddr) {
|
|
|
this.redis = redis;
|
|
|
+ this.thmzApi = apiAddr.getThmzApi();
|
|
|
}
|
|
|
|
|
|
public JSONObject queryPatientInfo(String patIdNo) {
|
|
@@ -40,7 +41,7 @@ public class ThmzService {
|
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("patIdType", "11");
|
|
|
params.put("patIdNo", patIdNo);
|
|
|
- JSONObject response = template.postForObject(thmzApiUrl + "/queryPatientInfo", params, JSONObject.class);
|
|
|
+ JSONObject response = template.postForObject(thmzApi + "/queryPatientInfo", params, JSONObject.class);
|
|
|
log.info("在绑卡前查询患者信息:\n参数:{}\n结果:{}", params, response);
|
|
|
if (null == response || response.getInteger("resultCode") != 0) {
|
|
|
return null;
|
|
@@ -50,7 +51,7 @@ public class ThmzService {
|
|
|
|
|
|
public String savePatientInfo(CreatCardParam request) {
|
|
|
CreateCardResponse response = new RestTemplate()
|
|
|
- .postForObject(thmzApiUrl + "/savePatientInfo", request, CreateCardResponse.class);
|
|
|
+ .postForObject(thmzApi + "/savePatientInfo", request, CreateCardResponse.class);
|
|
|
log.info("首诊患者建档:\n参数:{}\n结果:{}", JSON.toJSON(request), JSON.toJSON(response));
|
|
|
if (null == response) {
|
|
|
return "ERROR:网络异常。";
|
|
@@ -63,7 +64,7 @@ public class ThmzService {
|
|
|
|
|
|
public List<Map<String, Object>> getMzClass() {
|
|
|
RestTemplate template = new RestTemplate();
|
|
|
- MzClassResponse response = template.getForObject(thmzApiUrl + "/getMzClass", MzClassResponse.class);
|
|
|
+ MzClassResponse response = template.getForObject(thmzApi + "/getMzClass", MzClassResponse.class);
|
|
|
log.info("获取门诊科室分类:{}", JSON.toJSON(response));
|
|
|
if (null == response || 0 != response.getResultCode()) {
|
|
|
return new ArrayList<>();
|
|
@@ -72,9 +73,9 @@ public class ThmzService {
|
|
|
}
|
|
|
|
|
|
public List<Map<String, Object>> getUnitCodeByMzClass(QueryUnitCodeRequest request) {
|
|
|
- String url = thmzApiUrl + "/getUnitCodeByMzClass";
|
|
|
+ String url = thmzApi + "/getUnitCodeByMzClass";
|
|
|
if (request.isP4Request()) {
|
|
|
- url = thmzApiUrl + "/getP4UnitCode";
|
|
|
+ url = thmzApi + "/getP4UnitCode";
|
|
|
}
|
|
|
MzClassResponse response = new RestTemplate().postForObject(url, request, MzClassResponse.class);
|
|
|
log.info("获取门诊科室列表:{}", JSON.toJSON(response));
|
|
@@ -85,7 +86,7 @@ public class ThmzService {
|
|
|
}
|
|
|
|
|
|
public List<Map<String, Object>> getDoctorByDateAndDept(QueryMzDoctorRequest request) {
|
|
|
- String url = String.format(thmzApiUrl
|
|
|
+ String url = String.format(thmzApi
|
|
|
+ "/getDoctorByDateAndDept?requestDay=%s&unitCode=%s",
|
|
|
request.getRequestDay(), request.getUnitCode());
|
|
|
SourcesResponse response = new RestTemplate().getForObject(url, SourcesResponse.class);
|
|
@@ -96,7 +97,7 @@ public class ThmzService {
|
|
|
}
|
|
|
|
|
|
public List<Map<String, Object>> getDoctorsArrangement(QueryMzDoctorRequest request) {
|
|
|
- String url = String.format(thmzApiUrl + "/getRequestByDateAndDeptAndDoctor?requestDay=%s&unitCode=%s&doctorCode=%s",
|
|
|
+ String url = String.format(thmzApi + "/getRequestByDateAndDeptAndDoctor?requestDay=%s&unitCode=%s&doctorCode=%s",
|
|
|
request.getRequestDay(), request.getUnitCode(), request.getDoctorCode());
|
|
|
SourcesResponse response = new RestTemplate().getForObject(url, SourcesResponse.class);
|
|
|
if (null == response || null == response.getResultCode() || response.getResultCode() == -1) {
|
|
@@ -106,7 +107,7 @@ public class ThmzService {
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> getRegisterCost(QueryRegisterCostRequest request) {
|
|
|
- String url = String.format(thmzApiUrl + "/getMzChargeTypeByRequestIdForHaiCi?" +
|
|
|
+ String url = String.format(thmzApi + "/getMzChargeTypeByRequestIdForHaiCi?" +
|
|
|
"mzyRequestId=%d&patientId=%s", request.getMzyRequestId(), request.getPatientId());
|
|
|
HrgCommonResponse data = new RestTemplate().getForObject(url, HrgCommonResponse.class);
|
|
|
log.info("获取挂号费用:\n参数:{}\n结果:{}", JSON.toJSON(request), JSON.toJSON(data));
|
|
@@ -122,7 +123,7 @@ public class ThmzService {
|
|
|
public List<Map<String, String>> getPaidMzGhList(String patientId) {
|
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("patientId", patientId);
|
|
|
- SourcesResponse response = new RestTemplate().postForObject(thmzApiUrl
|
|
|
+ SourcesResponse response = new RestTemplate().postForObject(thmzApi
|
|
|
+ "/getRegistrationForPaid", params, SourcesResponse.class);
|
|
|
if (null == response || response.getResultCode() != 0) {
|
|
|
return new ArrayList<>();
|
|
@@ -131,7 +132,7 @@ public class ThmzService {
|
|
|
}
|
|
|
|
|
|
public List<MzyReqrec> listMzyReqrec(QueryMzyReqrecRequest request) {
|
|
|
- String url = thmzApiUrl + "/listMzyReqrec?patientId=" + request.getPatientId()
|
|
|
+ String url = thmzApi + "/listMzyReqrec?patientId=" + request.getPatientId()
|
|
|
+ "&payMark=" + request.getPayMark();
|
|
|
List<MzyReqrec> list = new ArrayList<>();
|
|
|
JSONObject response = new RestTemplate().getForObject(url, JSONObject.class);
|
|
@@ -157,7 +158,7 @@ public class ThmzService {
|
|
|
}
|
|
|
|
|
|
public MzyReqrec getMzyReqrecInfo(QueryMzyReqrecRequest request) {
|
|
|
- String url = thmzApiUrl + "/getMzyReqrecInfo?patientId=" +
|
|
|
+ String url = thmzApi + "/getMzyReqrecInfo?patientId=" +
|
|
|
request.getPatientId() + "×=" + request.getTimes();
|
|
|
JSONObject response = new RestTemplate().getForObject(url, JSONObject.class);
|
|
|
if (null == response || 0 != response.getInteger("resultCode")) {
|
|
@@ -178,7 +179,7 @@ public class ThmzService {
|
|
|
}
|
|
|
|
|
|
public String cancelReqFromHis(QueryMzyReqrecRequest request) {
|
|
|
- String url = thmzApiUrl + "/cancelReqrec";
|
|
|
+ String url = thmzApi + "/cancelReqrec";
|
|
|
JSONObject response = new RestTemplate().postForObject(url, request, JSONObject.class);
|
|
|
log.info("自助退号:\n参数:{}\n结果:{}", JSON.toJSON(request), response);
|
|
|
if (null == response) {
|
|
@@ -191,7 +192,7 @@ public class ThmzService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<List<Map<String, Object>>> getMzChargeDetailForUnPaid(QueryReceiptRequest request) {
|
|
|
- String url = thmzApiUrl + "/getMzChargeDetailForUnPaid";
|
|
|
+ String url = thmzApi + "/getMzChargeDetailForUnPaid";
|
|
|
SourcesResponse response = new RestTemplate()
|
|
|
.postForObject(url, request, SourcesResponse.class);
|
|
|
if (null == response || null == response.getResultCode()) {
|
|
@@ -204,7 +205,7 @@ public class ThmzService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<List<Map<String, Object>>> getChargeDetailByHisOrdNum(QueryReceiptRequest request) {
|
|
|
- String url = thmzApiUrl + "/getChargeDetailByHisOrdNum";
|
|
|
+ String url = thmzApi + "/getChargeDetailByHisOrdNum";
|
|
|
SourcesResponse response = new RestTemplate()
|
|
|
.postForObject(url, request, SourcesResponse.class);
|
|
|
if (null == response || null == response.getResultCode()) {
|
|
@@ -217,14 +218,14 @@ public class ThmzService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<List<Map<String, String>>> getMzPaidList(QueryReceiptRequest request) {
|
|
|
- String url = thmzApiUrl + "/getMzChargeDetailForPaid";
|
|
|
+ String url = thmzApi + "/getMzChargeDetailForPaid";
|
|
|
SourcesResponse hrgResponse = new RestTemplate()
|
|
|
.postForObject(url, request, SourcesResponse.class);
|
|
|
return ThmzUtil.getResultVoCompletableFuture(hrgResponse);
|
|
|
}
|
|
|
|
|
|
public ResultVo<List<Map<String, Object>>> getMzPaidDetail(QueryReceiptRequest request) {
|
|
|
- String url = thmzApiUrl + "/getSfjkMzbrmx?djh=" + request.getHisOrdNum();
|
|
|
+ String url = thmzApi + "/getSfjkMzbrmx?djh=" + request.getHisOrdNum();
|
|
|
SourcesResponse hrgResponse = new RestTemplate()
|
|
|
.getForObject(url, SourcesResponse.class);
|
|
|
if (null == hrgResponse) {
|
|
@@ -238,7 +239,7 @@ public class ThmzService {
|
|
|
|
|
|
public ResultVo<List<Map<String, String>>> getParentIdByPatientId(String patientId) {
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
- String url = thmzApiUrl + "/getParentIdByPatientId?patientId=" + patientId;
|
|
|
+ String url = thmzApi + "/getParentIdByPatientId?patientId=" + patientId;
|
|
|
HrgCommonResponse response = restTemplate.getForObject(url, HrgCommonResponse.class);
|
|
|
if (null != response && response.getCode() == 0) {
|
|
|
return ResultVoUtil.success(CastUtil.cast(response.getData()));
|
|
@@ -268,7 +269,7 @@ public class ThmzService {
|
|
|
}
|
|
|
|
|
|
private ExceptionEnum saveMzPayResult(SaveMzPayRequest request, int times) {
|
|
|
- String url = request.isNormalClinic() ? thmzApiUrl + "/payChargeDetailFormHaiCi"
|
|
|
+ String url = request.isNormalClinic() ? thmzApi + "/payChargeDetailFormHaiCi"
|
|
|
: "http://172.16.32.160:8088/thmz/api/v1/payChargeDetailFormHaiCi";
|
|
|
String des = request.isNormalClinic() ? "门诊" : "医美";
|
|
|
RestTemplate template = new RestTemplate();
|
|
@@ -290,7 +291,7 @@ public class ThmzService {
|
|
|
|
|
|
public String saveAppointment(SaveAppointmentRequest request) {
|
|
|
RestTemplate template = new RestTemplate();
|
|
|
- SaveGhFeeResponse response = template.postForObject(thmzApiUrl + "/payRegistrationFormHaiCi",
|
|
|
+ SaveGhFeeResponse response = template.postForObject(thmzApi + "/payRegistrationFormHaiCi",
|
|
|
request, SaveGhFeeResponse.class);
|
|
|
log.info("保存挂号信息: \n参数:{},\n结果:{}", JSON.toJSON(request), JSON.toJSON(response));
|
|
|
if (null == response) {
|
|
@@ -304,7 +305,7 @@ public class ThmzService {
|
|
|
|
|
|
public String saveClinicRegister(SaveClinicRegisterRequest request) {
|
|
|
SaveGhFeeResponse response = new RestTemplate()
|
|
|
- .postForObject(thmzApiUrl + "/payRegistration", request, SaveGhFeeResponse.class);
|
|
|
+ .postForObject(thmzApi + "/payRegistration", request, SaveGhFeeResponse.class);
|
|
|
log.info("保存诊间挂号信息: \n参数:{},\n结果:{}", JSON.toJSON(request), JSON.toJSON(response));
|
|
|
if (null == response) {
|
|
|
return "ERROR:保存诊间挂号信息失败,门诊接口返回空。";
|
|
@@ -317,7 +318,7 @@ public class ThmzService {
|
|
|
|
|
|
public String saveTemplate(SaveTemplateRequest request) {
|
|
|
HrgCommonResponse response = new RestTemplate().
|
|
|
- postForObject(thmzApiUrl + "/saveTcPrescription", request, HrgCommonResponse.class);
|
|
|
+ postForObject(thmzApi + "/saveTcPrescription", request, HrgCommonResponse.class);
|
|
|
log.info("保存套餐缴费:\n参数:{}\n结果:{}", JSON.toJSON(request), JSON.toJSON(response));
|
|
|
if (null == response) {
|
|
|
return "ERROR:保存套餐缴费失败,门诊接口返回空。";
|