|
@@ -1,6 +1,5 @@
|
|
|
package com.zskk.service;
|
|
|
|
|
|
-import com.zskk.model.ApplynoStudyuid;
|
|
|
import com.zskk.util.XmlHelper;
|
|
|
import okhttp3.MediaType;
|
|
|
import okhttp3.OkHttpClient;
|
|
@@ -13,100 +12,6 @@ public class InfoService {
|
|
|
|
|
|
private static final String PACSVIEW_URL_STR = "http://192.10.10.165/#/pc?studyurl=http://192.10.10.165:8999/query?address=192.10.10.165:9999&study_uid=";
|
|
|
|
|
|
- public String getOrderInfo(String applyNo) {
|
|
|
- String studyuidString = null;
|
|
|
- ApplynoStudyuid applynoStudyuidCheck = ApplynoStudyuid.dao.findFirst("select * from applyno_studyuid where ApplyNo = ?",applyNo);
|
|
|
- if (applynoStudyuidCheck == null || (create_timestamp()-applynoStudyuidCheck.getUtime())>=604800) {
|
|
|
- studyuidString = getOrderInfoFromPACS(applyNo);
|
|
|
- if (studyuidString != null) {
|
|
|
- try {
|
|
|
- Thread.sleep(6000);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- // TODO Auto-generated catch block
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return PACSVIEW_URL_STR + studyuidString;
|
|
|
- }
|
|
|
- }else {
|
|
|
- studyuidString = applynoStudyuidCheck.getStudyInstanceUID();
|
|
|
- return PACSVIEW_URL_STR + studyuidString;
|
|
|
-
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- private String getOrderInfoFromPACS(String applyNo) {
|
|
|
- String url = "http://192.10.10.110/CSWebService/CSWebService.asmx/GetOrderInfo";
|
|
|
- OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
- sb.append("Info=<Body><ApplyNo>");
|
|
|
- sb.append(applyNo);
|
|
|
- sb.append("</ApplyNo></Body>");
|
|
|
-
|
|
|
- RequestBody body = RequestBody.create(sb.toString(), MediaType.get("application/x-www-form-urlencoded"));
|
|
|
- Request request = new Request.Builder().url(url).post(body).build();
|
|
|
- try (Response response = okHttpClient.newCall(request).execute()) {
|
|
|
- String contentString = response.body().string();
|
|
|
- XmlHelper xmlHelperStr = XmlHelper.of(contentString);
|
|
|
- String content = xmlHelperStr.getString("//string");
|
|
|
- XmlHelper xmlHelper = XmlHelper.of(content);
|
|
|
- String StudyInstanceUID = xmlHelper.getString("//StudyInstanceUID");
|
|
|
-
|
|
|
- String AccNo = xmlHelper.getString("//AccNo");
|
|
|
-
|
|
|
- String Modality = xmlHelper.getString("//Modality");
|
|
|
-
|
|
|
- String ModalityType = xmlHelper.getString("//ModalityType");
|
|
|
-
|
|
|
- String ReturnCode = xmlHelper.getString("//ReturnCode");
|
|
|
-
|
|
|
- String IsExistImage = xmlHelper.getString("//IsExistImage");
|
|
|
-
|
|
|
- String ReturnDesc = xmlHelper.getString("//ReturnDesc");
|
|
|
-
|
|
|
- if (!ReturnCode.equals("0") || IsExistImage.equals("0")) {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- DicomCMoveService dService = new DicomCMoveService();
|
|
|
- try {
|
|
|
- String resultString = dService.doMove(StudyInstanceUID);
|
|
|
- if (resultString.equals("succeed")) {
|
|
|
- ApplynoStudyuid applynoStudyuidCheck = ApplynoStudyuid.dao.findFirst("select * from applyno_studyuid where ApplyNo=?",applyNo);
|
|
|
-
|
|
|
- if (applynoStudyuidCheck == null) {
|
|
|
- ApplynoStudyuid applynoStudyuid = new ApplynoStudyuid();
|
|
|
- applynoStudyuid.setApplyNo(applyNo);
|
|
|
- applynoStudyuid.setStudyInstanceUID(StudyInstanceUID);
|
|
|
- applynoStudyuid.setModality(Modality);
|
|
|
- applynoStudyuid.setModalityType(ModalityType);
|
|
|
- applynoStudyuid.setAccNo(AccNo);
|
|
|
- applynoStudyuid.setStatus(1);
|
|
|
- applynoStudyuid.setCtime(create_timestamp());
|
|
|
- applynoStudyuid.setUtime(create_timestamp());
|
|
|
- applynoStudyuid.save();
|
|
|
- }else {
|
|
|
- applynoStudyuidCheck.setStatus(1);
|
|
|
- applynoStudyuidCheck.setUtime(create_timestamp());
|
|
|
- applynoStudyuidCheck.update();
|
|
|
- }
|
|
|
- }else {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- // TODO Auto-generated catch block
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return StudyInstanceUID;
|
|
|
- } catch (Exception e) {
|
|
|
- // TODO: handle exception
|
|
|
- System.out.println(e.toString());
|
|
|
- return null;
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private Integer create_timestamp() {
|
|
|
|
|
|
Integer timeInt=Integer.parseInt(Long.toString(System.currentTimeMillis() / 1000));
|