|
@@ -1,5 +1,6 @@
|
|
|
package thyyxxk.webserver.service.examinations;
|
|
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -8,6 +9,7 @@ import org.springframework.http.HttpEntity;
|
|
|
import org.springframework.http.HttpMethod;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
+import thyyxxk.webserver.config.envionment.ApiUrl;
|
|
|
import thyyxxk.webserver.config.exception.BizException;
|
|
|
import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.webserver.dao.his.examinations.InspectionsDao;
|
|
@@ -27,24 +29,20 @@ import java.util.Objects;
|
|
|
*/
|
|
|
@Service
|
|
|
@Slf4j
|
|
|
+@RequiredArgsConstructor
|
|
|
public class InspectionsService {
|
|
|
- @Value(value = "${thirdpartApi}")
|
|
|
- private String thirdpartApi;
|
|
|
private final InspectionsDao dao;
|
|
|
private final RestTemplate template;
|
|
|
+ private final ApiUrl apiUrl;
|
|
|
|
|
|
- @Autowired
|
|
|
- public InspectionsService(InspectionsDao dao, RestTemplate template) {
|
|
|
- this.dao = dao;
|
|
|
- this.template = template;
|
|
|
- }
|
|
|
|
|
|
public List<JyIndexResponse> queryJyIndex(ReportIndexInquiry inquiry) {
|
|
|
- String url = thirdpartApi + "/inspection/queryJyIndex";
|
|
|
+ String url = apiUrl.getTirdpartApi() + "/inspection/queryJyIndex";
|
|
|
|
|
|
ResultVo<List<JyIndexResponse>> response = template.exchange(
|
|
|
url, HttpMethod.POST, new HttpEntity<>(inquiry),
|
|
|
- new ParameterizedTypeReference<ResultVo<List<JyIndexResponse>>>() {}
|
|
|
+ new ParameterizedTypeReference<ResultVo<List<JyIndexResponse>>>() {
|
|
|
+ }
|
|
|
).getBody();
|
|
|
|
|
|
if (null == response) {
|
|
@@ -59,11 +57,12 @@ public class InspectionsService {
|
|
|
public JyDetailResponse queryJyDetail(String reportId) {
|
|
|
ReportDetailInquiry inquiry = new ReportDetailInquiry();
|
|
|
inquiry.setReportId(reportId);
|
|
|
- String url = thirdpartApi + "/inspection/queryJyDetail";
|
|
|
+ String url = apiUrl.getTirdpartApi() + "/inspection/queryJyDetail";
|
|
|
|
|
|
ResultVo<JyDetailResponse> response = template.exchange(
|
|
|
url, HttpMethod.POST, new HttpEntity<>(inquiry),
|
|
|
- new ParameterizedTypeReference<ResultVo<JyDetailResponse>>() {}
|
|
|
+ new ParameterizedTypeReference<ResultVo<JyDetailResponse>>() {
|
|
|
+ }
|
|
|
).getBody();
|
|
|
|
|
|
if (null == response) {
|
|
@@ -76,10 +75,11 @@ public class InspectionsService {
|
|
|
}
|
|
|
|
|
|
public List<TestReport> checkTestIndex(ReportIndexInquiry inquiry) {
|
|
|
- String url = thirdpartApi + "/inspection/queryJcIndex";
|
|
|
+ String url = apiUrl.getTirdpartApi() + "/inspection/queryJcIndex";
|
|
|
ResultVo<List<TestReport>> response = template.exchange(
|
|
|
url, HttpMethod.POST, new HttpEntity<>(inquiry),
|
|
|
- new ParameterizedTypeReference<ResultVo<List<TestReport>>>() {}
|
|
|
+ new ParameterizedTypeReference<ResultVo<List<TestReport>>>() {
|
|
|
+ }
|
|
|
).getBody();
|
|
|
if (null == response) {
|
|
|
throw new BizException(ExceptionEnum.NETWORK_ERROR);
|
|
@@ -94,10 +94,11 @@ public class InspectionsService {
|
|
|
if (StringUtil.isBlank(request.getReportId())) {
|
|
|
throw new BizException(ExceptionEnum.NULL_POINTER, "报告ID不能为空!");
|
|
|
}
|
|
|
- String url = thirdpartApi + "/inspection/queryJcDetail";
|
|
|
+ String url = apiUrl.getTirdpartApi() + "/inspection/queryJcDetail";
|
|
|
ResultVo<TestReport> response = template.exchange(
|
|
|
url, HttpMethod.POST, new HttpEntity<>(request),
|
|
|
- new ParameterizedTypeReference<ResultVo<TestReport>>() {}
|
|
|
+ new ParameterizedTypeReference<ResultVo<TestReport>>() {
|
|
|
+ }
|
|
|
).getBody();
|
|
|
if (null == response) {
|
|
|
throw new BizException(ExceptionEnum.NETWORK_ERROR);
|
|
@@ -109,11 +110,12 @@ public class InspectionsService {
|
|
|
}
|
|
|
|
|
|
public List<PathologyIndex> checkPathologyIndex(ReportIndexInquiry request) {
|
|
|
- String url = thirdpartApi + "/inspection/queryBlIndex";
|
|
|
+ String url = apiUrl.getTirdpartApi() + "/inspection/queryBlIndex";
|
|
|
request.setSocialNo(getPatSocialNo(request.getPatType(), request.getPatNo()));
|
|
|
ResultVo<List<PathologyIndex>> response = template.exchange(
|
|
|
url, HttpMethod.POST, new HttpEntity<>(request),
|
|
|
- new ParameterizedTypeReference<ResultVo<List<PathologyIndex>>>() {}
|
|
|
+ new ParameterizedTypeReference<ResultVo<List<PathologyIndex>>>() {
|
|
|
+ }
|
|
|
).getBody();
|
|
|
if (null == response) {
|
|
|
throw new BizException(ExceptionEnum.NETWORK_ERROR);
|
|
@@ -127,11 +129,12 @@ public class InspectionsService {
|
|
|
}
|
|
|
|
|
|
public List<ElectroIndex> checkElectroIndex(ReportIndexInquiry request) {
|
|
|
- String url = thirdpartApi + "/inspection/queryXdIndex";
|
|
|
+ String url = apiUrl.getTirdpartApi() + "/inspection/queryXdIndex";
|
|
|
request.setSocialNo(getPatSocialNo(request.getPatType(), request.getPatNo()));
|
|
|
ResultVo<List<ElectroIndex>> response = template.exchange(
|
|
|
url, HttpMethod.POST, new HttpEntity<>(request),
|
|
|
- new ParameterizedTypeReference<ResultVo<List<ElectroIndex>>>() {}
|
|
|
+ new ParameterizedTypeReference<ResultVo<List<ElectroIndex>>>() {
|
|
|
+ }
|
|
|
).getBody();
|
|
|
if (null == response) {
|
|
|
throw new BizException(ExceptionEnum.NETWORK_ERROR);
|