|
@@ -9,6 +9,8 @@ import org.dom4j.DocumentException;
|
|
|
import org.dom4j.DocumentHelper;
|
|
|
import org.dom4j.Element;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpEntity;
|
|
|
+import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
import thyyxxk.webserver.config.exception.BizException;
|
|
@@ -19,6 +21,7 @@ import thyyxxk.webserver.entity.examinations.adicon.ReportDetail;
|
|
|
import thyyxxk.webserver.service.externalhttp.AdiconHttpSrvc;
|
|
|
import thyyxxk.webserver.utils.FilterUtil;
|
|
|
import thyyxxk.webserver.utils.StringUtil;
|
|
|
+import thyyxxk.webserver.utils.TokenUtil;
|
|
|
|
|
|
import javax.xml.bind.JAXBContext;
|
|
|
import javax.xml.bind.Unmarshaller;
|
|
@@ -48,7 +51,7 @@ public class AdiconService {
|
|
|
}
|
|
|
|
|
|
public List<ListTableItem> getReportList(AdiconInquiry inquiry) throws Exception {
|
|
|
- List<String> barcodesList = getPatientBarcodeList(inquiry);
|
|
|
+ JSONArray barcodesList = getPatientBarcodeList(inquiry);
|
|
|
String key = URLEncoder.encode(inquiry.getKey(), StandardCharsets.UTF_8.name());
|
|
|
String xmlString = adiconHttpSrvc.getReportList(key, inquiry.getBegin(), inquiry.getEnd());
|
|
|
List<ListTableItem> result = new ArrayList<>();
|
|
@@ -114,27 +117,26 @@ public class AdiconService {
|
|
|
return root.getText();
|
|
|
}
|
|
|
|
|
|
- private List<String> getPatientBarcodeList(AdiconInquiry inquiry) {
|
|
|
- List<String> barcodesList = new ArrayList<>();
|
|
|
+ private JSONArray getPatientBarcodeList(AdiconInquiry inquiry) {
|
|
|
+ JSONArray list = new JSONArray();
|
|
|
if (StringUtil.notBlank(inquiry.getPatNo())) {
|
|
|
- String url = "http://172.16.32.167:9206/thyy/api/public/lis/bar_code";
|
|
|
- JSONObject obj = new RestTemplate().postForObject(url, inquiry, JSONObject.class);
|
|
|
+ String url = "http://172.16.32.167:9206/thyy/api/intergration/jyjc/bar_code";
|
|
|
+ HttpHeaders httpHeaders = new HttpHeaders();
|
|
|
+ httpHeaders.add("token", TokenUtil.getInstance().getUserToken());
|
|
|
+ HttpEntity<AdiconInquiry> entity = new HttpEntity<>(inquiry, httpHeaders);
|
|
|
+ JSONObject obj = new RestTemplate().postForObject(url, entity, JSONObject.class);
|
|
|
if (null == obj) {
|
|
|
throw new BizException("没有找到此患者已发布的外送报告。");
|
|
|
}
|
|
|
if (obj.getIntValue("code") != 1) {
|
|
|
throw new BizException(obj.getString("message"));
|
|
|
}
|
|
|
- JSONArray data = obj.getJSONArray("data");
|
|
|
- if (data.isEmpty()) {
|
|
|
+ list = obj.getJSONArray("data");
|
|
|
+ if (list.isEmpty()) {
|
|
|
throw new BizException("没有找到此患者已发布的外送报告。");
|
|
|
}
|
|
|
- for (int i = 0; i < data.size(); i++) {
|
|
|
- JSONObject item = data.getJSONObject(i);
|
|
|
- barcodesList.add(item.getString("barCode"));
|
|
|
- }
|
|
|
}
|
|
|
- return barcodesList;
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
private Element getRootElement(String xmlString) throws DocumentException {
|