|
@@ -1,10 +1,10 @@
|
|
|
package com.zskk.control;
|
|
|
|
|
|
-import java.io.BufferedReader;
|
|
|
import java.io.File;
|
|
|
-import java.io.FileInputStream;
|
|
|
+import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
-import java.io.InputStreamReader;
|
|
|
+import java.io.InputStream;
|
|
|
+import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
@@ -48,14 +48,12 @@ public class ViewController extends Controller {
|
|
|
*/
|
|
|
public void executeSql() {
|
|
|
try {
|
|
|
- List<Record> d = Db.use("connected").find(this.getPara("sqlstr"));
|
|
|
- this.renderJson(d);
|
|
|
+ List<Record> d = Db.use("connected").find(this.getPara("sqlstr"));
|
|
|
+ this.renderJson(d);
|
|
|
} catch (Exception e) {
|
|
|
// TODO: handle exception
|
|
|
this.renderText(e.toString());
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public void testConn() {
|
|
@@ -73,171 +71,67 @@ public class ViewController extends Controller {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void test() {
|
|
|
- Record recordfind = Db.use("connected").findFirst("select * from studyinfo where rownum < 2");
|
|
|
- String[] strings = recordfind.getStr("YYK_PATHNAME").split("\\\\");
|
|
|
- String aaString= "";
|
|
|
- int index = 0;
|
|
|
- for (String string : strings) {
|
|
|
- aaString = aaString+index+"*"+string;
|
|
|
- index++;
|
|
|
- }
|
|
|
- renderText(aaString);
|
|
|
-
|
|
|
+ public void testtime() {
|
|
|
+ SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Date date = new Date();
|
|
|
+ long dInteger =date.getTime()-360000;
|
|
|
+ String daString = sdf.format(new Date(dInteger));
|
|
|
+ this.renderText(daString);
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void sdcfind() {
|
|
|
- String execCmd = ExecUtil.execCmd("/zskk_system/other/cfind.sh " + this.getPara("time") + " STUDYUID_" + "temppp" + ".xml");
|
|
|
- if (execCmd.contains("Connection refused")) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- File fin_floder = new File("/home/zskk/CFIND_XML/STUDYUID_" + "temppp" + "1.xml");
|
|
|
- // 创建从文件读取数据的FileInputStream流
|
|
|
- FileInputStream fin;
|
|
|
+ public void name() {
|
|
|
try {
|
|
|
- fin = new FileInputStream(fin_floder);
|
|
|
- InputStreamReader isr = null;
|
|
|
- isr = new InputStreamReader(fin);
|
|
|
- BufferedReader raf = null;
|
|
|
- raf = new BufferedReader(isr);
|
|
|
- String xmlContent = null;
|
|
|
- xmlContent = raf.readLine();
|
|
|
- xmlContent = xmlContent.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "");
|
|
|
- xmlContent = "<zskk>" + xmlContent + "</zskk>";
|
|
|
- xmlContent = xmlContent.replace("�", "");
|
|
|
- XmlHelper xmlHelper = XmlHelper.of(xmlContent);
|
|
|
- // NativeDicomModel节点列表
|
|
|
- NodeList nativeDicomModelList = xmlHelper.getNodeList("/zskk/NativeDicomModel");
|
|
|
- for (int i = 0; i < nativeDicomModelList.getLength(); i++) {
|
|
|
- String qString = "";
|
|
|
- String studyuidString = "";
|
|
|
- String modalitiesString = "";
|
|
|
- // DicomAttribute节点列表
|
|
|
- NodeList dicomAttributeList = xmlHelper.getNodeList(nativeDicomModelList.item(i), "DicomAttribute");
|
|
|
- for (int j = 0; j < dicomAttributeList.getLength(); j++) {
|
|
|
- // DicomAttribute节点属性列表
|
|
|
- NamedNodeMap attributeMap = dicomAttributeList.item(j).getAttributes();
|
|
|
- if (attributeMap != null && attributeMap.getLength() > 0) {
|
|
|
- for (int k = 0; k < attributeMap.getLength(); k++) {
|
|
|
- if (attributeMap.item(k).getNodeName().equals("tag")) {
|
|
|
- // 获取studyuid
|
|
|
- if (attributeMap.item(k).getNodeValue().equals("0020000D")) {
|
|
|
- studyuidString = xmlHelper.getString(dicomAttributeList.item(j), "Value");
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 获取检查类型00080060or00080061
|
|
|
- if (attributeMap.item(k).getNodeValue().equals("00080060")) {
|
|
|
- modalitiesString = xmlHelper.getString(dicomAttributeList.item(j), "Value");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ List<Record> record = Db.use("connected").find("select * from tjpacs.V_ZSKK_WEBPACS_IMAGE where STUDYID=?","1832510");
|
|
|
+ for (Record record2 : record) {
|
|
|
+ Request request = new Request.Builder()
|
|
|
+ .url(record2.getStr("HTTP_URL"))
|
|
|
+ .build();
|
|
|
+
|
|
|
+ String fileName = record2.getStr("INSUID");
|
|
|
+// String fileName = "aaaa";
|
|
|
+
|
|
|
+
|
|
|
+ try (Response response = OKHTTP_CLIENT.newCall(request).execute()) {
|
|
|
+ if (!response.isSuccessful())
|
|
|
+ throw new IOException("Unexpected code " + response);
|
|
|
+ String dirName = "/home/zskk/桌面/DICOM_URL";
|
|
|
+ File file = new File(dirName);
|
|
|
+ if (!file.exists()) {
|
|
|
+ file.mkdir();
|
|
|
}
|
|
|
- Record studyidfind = Db.use("local").findFirst("select * from study where studyuid = ?",
|
|
|
- studyuidString);
|
|
|
- if (studyidfind == null) {
|
|
|
- Record studyinfo = new Record().set("studyuid", studyuidString).set("modalities", modalitiesString)
|
|
|
- .set("status", 1).set("createAt", parseStringToDateTime()).set("updateAt", parseStringToDateTime());
|
|
|
- Db.use("local").save("study", studyinfo);
|
|
|
- }else {
|
|
|
- studyidfind.set("status", 2);
|
|
|
- Db.use("local").update("study", studyidfind);
|
|
|
-
|
|
|
+ if (response != null) {
|
|
|
+ InputStream is = response.body().byteStream();
|
|
|
+ FileOutputStream fos = new FileOutputStream(new File(dirName + "/" + fileName));
|
|
|
+ int len = 0;
|
|
|
+ byte[] buffer = new byte[2048];
|
|
|
+ while (-1 != (len = is.read(buffer))) {
|
|
|
+ fos.write(buffer, 0, len);
|
|
|
+ }
|
|
|
+
|
|
|
+ fos.flush();
|
|
|
+ fos.close();
|
|
|
+ is.close();
|
|
|
+ File filen2 = new File(dirName + "/" + fileName);
|
|
|
+ File filen = new File(dirName + "/" + fileName+".dcm");
|
|
|
+ filen2.renameTo(filen);
|
|
|
}
|
|
|
+
|
|
|
+ } catch (IOException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ this.renderText("1*"+e.toString());
|
|
|
}
|
|
|
- } catch (IOException e) {
|
|
|
- // TODO Auto-generated catch block
|
|
|
- e.printStackTrace();
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public void sdreview() {
|
|
|
- try {
|
|
|
- DataService dService = ServiceFactory.getService(DataService.class);
|
|
|
-
|
|
|
- List<Record> records = Db.use("connected").find(
|
|
|
- "SELECT * FROM (select * from reportinfo where REVIEWDATE>to_date(?,'YYYY-MM-DD HH24:MI:SS') and REVIEWDATE<to_date(?,'YYYY-MM-DD HH24:MI:SS') and rownum < 500)ORDER BY REVIEWDATE DESC",this.getPara("from"),this.getPara("to"));
|
|
|
- if (records == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- for (Record record : records) {
|
|
|
- try {
|
|
|
- if (record.getStr("IMPRESSION") == null && record.getStr("DESCRPTION") == null
|
|
|
- && record.getStr("REVIEWDOCTOR") == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- Map<String, String> params = new HashMap<>();
|
|
|
- params.put("type", "4");
|
|
|
-
|
|
|
- params.put("institution_id", PropKit.get("institution_id"));
|
|
|
-
|
|
|
- params.put("code", record.getStr("STUDYUID"));
|
|
|
- // 报告医生姓名
|
|
|
- params.put("report_doctor_name", record.getStr("REPORTDOCTOR"));
|
|
|
- // 报告时间
|
|
|
- params.put("report_datetime", record.getStr("REVIEWDATE"));
|
|
|
- // 审核医生姓名
|
|
|
- params.put("review_doctor_name",
|
|
|
- record.getStr("REVIEWDOCTOR") == null ? "" : record.getStr("REVIEWDOCTOR"));
|
|
|
- // 审核时间
|
|
|
- params.put("review_datetime", record.getStr("REVIEWDATE"));
|
|
|
- // 确认医生姓名
|
|
|
- params.put("confirm_doctor_name",
|
|
|
- record.getStr("REVIEWDOCTOR") == null ? "" : record.getStr("REVIEWDOCTOR"));
|
|
|
- // 确认时间
|
|
|
- params.put("confirm_datetime", record.getStr("REVIEWDATE"));
|
|
|
- // 意见建议
|
|
|
- params.put("impression", record.getStr("IMPRESSION"));
|
|
|
- // 影像所见
|
|
|
- params.put("description", record.getStr("DESCRPTION"));
|
|
|
- // exams表
|
|
|
- // 申请科室
|
|
|
- params.put("application_department", record.getStr("DEPARTMENT")== null ? "" : record.getStr("DEPARTMENT"));
|
|
|
- // 申请医生
|
|
|
- params.put("application_doctor", record.getStr("CLINICALDOCTOR")== null ? "" : record.getStr("CLINICALDOCTOR"));
|
|
|
- // 临床诊断
|
|
|
- params.put("clin_diag", record.getStr("DIAGNOSE") == null ? "" : record.getStr("DIAGNOSE"));
|
|
|
- // 症状
|
|
|
- params.put("clin_symp", record.getStr("SYMPROM") == null ? "" : record.getStr("SYMPROM"));
|
|
|
- // patient_infos表
|
|
|
- // 患者姓名
|
|
|
- params.put("name", record.getStr("PATIENTNAME"));
|
|
|
- // 患者手机号
|
|
|
- params.put("phone", record.getStr("PHONE") == null ? "" : record.getStr("PHONE"));
|
|
|
- // 患者身份证号
|
|
|
- params.put("card_num", record.getStr("IDCARD") == null ? "" : record.getStr("IDCARD"));
|
|
|
- // 检查结果1阴2阳
|
|
|
- params.put("report_result", record.getStr("RESULT").contains("阳") ? "2" : "1");
|
|
|
- // 门诊号住院号
|
|
|
- params.put("hopitalized_no", record.getStr("INPATIENTNUM") == null ? "" : record.getStr("INPATIENTNUM"));
|
|
|
- // 门诊号
|
|
|
- params.put("out_patient", record.getStr("OUTPATIENTNUM") == null ? "" : record.getStr("OUTPATIENTNUM"));
|
|
|
- // 病人ID
|
|
|
- params.put("his_patient_id", record.getStr("PATIENTID") == null ? "" : record.getStr("PATIENTID"));
|
|
|
- // 检查方法
|
|
|
- params.put("exam_project", record.getStr("PROIECT")==null?"":record.getStr("PROIECT"));
|
|
|
- ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);
|
|
|
- tService.execute(() -> {
|
|
|
- dService.saveReport(params);
|
|
|
- });
|
|
|
- } catch (Exception e) {
|
|
|
- // TODO: handle exception
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- this.renderJson(records);
|
|
|
} catch (Exception e) {
|
|
|
// TODO: handle exception
|
|
|
this.renderText(e.toString());
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ this.renderText("succ");
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public static DruidPlugin createConnectedDruidPlugin() {
|
|
|
|
|
|
return new DruidPlugin(PropKit.get("jdbcUrl_connected"), PropKit.get("user_connected"),PropKit.get("password_connected").trim());
|
|
@@ -269,38 +163,29 @@ public class ViewController extends Controller {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- private String parseStringToDate() {
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
- Date date = new Date();
|
|
|
- long dInteger = date.getTime() - 86400000;
|
|
|
- String daString = sdf.format(new Date(dInteger));
|
|
|
- return daString;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- private String parseStringToDate2() {
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- Date date = new Date();
|
|
|
- long dInteger = date.getTime() - 300000;
|
|
|
- String daString = sdf.format(new Date(dInteger));
|
|
|
- return daString;
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 日期字符串格式转换
|
|
|
*
|
|
|
* @param dateStr
|
|
|
* @return
|
|
|
*/
|
|
|
- private String parseStringToDate1(String dString) {
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
- Date date = new Date();
|
|
|
- long dInteger = date.getTime();
|
|
|
+
|
|
|
+ private String parseStringToDate() {
|
|
|
+ SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Date date = new Date();
|
|
|
+ long dInteger =date.getTime()-65000;
|
|
|
String daString = sdf.format(new Date(dInteger));
|
|
|
- return daString;
|
|
|
+ return daString;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ Map<String,String> paramsMap=new HashMap<String,String>();
|
|
|
+ paramsMap.put("institution_id", "44100001");
|
|
|
+
|
|
|
+ String contentString = doPost("https://risserver3.pacsonline.cn/butt/getExam/butt/getExam", paramsMap);
|
|
|
+ System.out.println(contentString);
|
|
|
|
|
|
}
|
|
|
|