|
@@ -15,6 +15,13 @@ import com.zskk.model.PatientInfos;
|
|
|
import com.zskk.model.Report;
|
|
|
import com.zskk.model.Studies;
|
|
|
import com.zskk.service.WeixinService;
|
|
|
+import com.zskk.tools.XmlHelper;
|
|
|
+
|
|
|
+import okhttp3.MediaType;
|
|
|
+import okhttp3.OkHttpClient;
|
|
|
+import okhttp3.Request;
|
|
|
+import okhttp3.RequestBody;
|
|
|
+import okhttp3.Response;
|
|
|
|
|
|
public class ViewController extends Controller {
|
|
|
|
|
@@ -45,41 +52,88 @@ public class ViewController extends Controller {
|
|
|
|
|
|
public void testTask() {
|
|
|
try {
|
|
|
- //List<Record> d = Db.use("connected").find(this.getPara("sqlStr"));
|
|
|
- List<Exams> exams = Exams.dao.use("zskk").find("SELECT * FROM pacsonline.exams where exam_status=3 and institution_id=46400001 order by createdAt desc limit 50");
|
|
|
- List<Record> examds = new ArrayList<>();
|
|
|
+ List<Exams> exams = Exams.dao.use("zskk").find("SELECT * FROM pacsonline.exams where exam_status=3 and institution_id=30000001 order by createdAt desc limit 5");
|
|
|
for (Exams exams2 : exams) {
|
|
|
-// Studies studies = Studies.dao.use("zskk").findById(exams2.getStudyId());
|
|
|
- Record record = Db.use("connected").findFirst("select * from hhris.view_reportinfo where ACCESSIONNUMBER=?",exams2.getAccessionNum());
|
|
|
- if (record == null) {
|
|
|
+ try {
|
|
|
+ Studies studies = Studies.dao.use("zskk").findById(exams2.getStudyId());
|
|
|
+ String url = "http://192.168.2.41/WebQuery.asmx/Query";
|
|
|
+ OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append("input=");
|
|
|
+ sb.append(studies.getStudyuid());
|
|
|
+
|
|
|
+ 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 patientname = xmlHelper.getString("//patientname");
|
|
|
+ if (patientname == null && patientname == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ String department = xmlHelper.getString("//department");
|
|
|
+
|
|
|
+ String clinicaldoctor = xmlHelper.getString("//clinicaldoctor");
|
|
|
+
|
|
|
+ String reportdate = xmlHelper.getString("//reportdate");
|
|
|
+
|
|
|
+ String description = xmlHelper.getString("//description");
|
|
|
+
|
|
|
+ String impression = xmlHelper.getString("//impression");
|
|
|
+
|
|
|
+ String reportdoctor = xmlHelper.getString("//reportdoctor");
|
|
|
+
|
|
|
+ String reviewdoctor = xmlHelper.getString("//reviewdoctor");
|
|
|
+
|
|
|
+ String phone = xmlHelper.getString("//phone ");
|
|
|
+
|
|
|
+ Report report = new Report().use("zskk");
|
|
|
+ report.setId(creatId());
|
|
|
+ report.setReportDatetime(parseStringToDate(reportdate));
|
|
|
+ if (impression == null && description == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ report.setImpression(impression);
|
|
|
+ report.setDescription(description);
|
|
|
+ report.setExamId(exams2.getId());
|
|
|
+ report.setCreatedAt(new Date());
|
|
|
+ report.setReportDoctorId(getDoctorIdByName(reportdoctor));
|
|
|
+ report.setReviewDoctorId(getDoctorIdByName(reviewdoctor));
|
|
|
+ report.setReviewDatetime(parseStringToDate(reportdate));
|
|
|
+ report.setConfirmDoctorId(getDoctorIdByName(reviewdoctor));
|
|
|
+ report.setConfirmDatetime(parseStringToDate(reportdate));
|
|
|
+ report.save();
|
|
|
+
|
|
|
+ PatientInfos patientInfos = PatientInfos.dao.use("zskk").findById(exams2.getPatientId());
|
|
|
+ patientInfos.setName(patientname);
|
|
|
+ patientInfos.setPhone(phone);
|
|
|
+ patientInfos.update();
|
|
|
+
|
|
|
+ exams2.setApplicationDepartment(department);
|
|
|
+ exams2.setApplicationDoctor(clinicaldoctor);
|
|
|
+
|
|
|
+ exams2.setExamStatus(9);
|
|
|
+ exams2.update();
|
|
|
+ WeixinService wService = new WeixinService();
|
|
|
+ wService.requestWeixinQrcode(report.getId());
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
continue;
|
|
|
}
|
|
|
- Report report = new Report().use("zskk");
|
|
|
- report.setId(creatId());
|
|
|
- report.setReportDatetime(parseStringToDate(record.getStr("REPORTDATE")));
|
|
|
- if (record.getStr("IMPRESSION") == null && record.getStr("DESCRIPTION") == null) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ // TODO: handle exception
|
|
|
continue;
|
|
|
}
|
|
|
- report.setImpression(new String(record.getStr("DESCRIPTION").getBytes("windows-1252"),"GBK"));
|
|
|
- report.setDescription(new String(record.getStr("IMPRESSION").getBytes("windows-1252"),"GBK"));
|
|
|
- report.setExamId(exams2.getId());
|
|
|
- report.setCreatedAt(new Date());
|
|
|
- report.setReportDoctorId(getDoctorIdByName(new String(record.getStr("REPORTDOCTOR").getBytes("windows-1252"),"GBK")));
|
|
|
- report.setReviewDoctorId(getDoctorIdByName(new String(record.getStr("REVIEWDOCTOR").getBytes("windows-1252"),"GBK")));
|
|
|
- report.setReviewDatetime(parseStringToDate(new String(record.getStr("REPORTDATE").getBytes("windows-1252"),"GBK")));
|
|
|
- report.setConfirmDoctorId(getDoctorIdByName(new String(record.getStr("REVIEWDOCTOR").getBytes("windows-1252"),"GBK")));
|
|
|
- report.setConfirmDatetime(parseStringToDate(new String(record.getStr("REPORTDATE").getBytes("windows-1252"),"GBK")));
|
|
|
- report.save();
|
|
|
- PatientInfos patientInfos = PatientInfos.dao.use("zskk").findById(exams2.getPatientId());
|
|
|
- patientInfos.setName(new String(record.getStr("PATIENTNAME").getBytes("windows-1252"),"GBK"));
|
|
|
- patientInfos.update();
|
|
|
- exams2.setClinDoctors(new String(record.getStr("CLINICALDOCTOR").getBytes("windows-1252"),"GBK"));
|
|
|
- exams2.setExamStatus(9);
|
|
|
- exams2.update();
|
|
|
- examds.add(record);
|
|
|
-
|
|
|
}
|
|
|
- this.renderJson(examds);
|
|
|
+// this.renderJson(examds);
|
|
|
} catch (Exception e) {
|
|
|
// TODO: handle exception
|
|
|
this.renderText(e.toString());
|
|
@@ -96,7 +150,7 @@ public class ViewController extends Controller {
|
|
|
if (name == null) {
|
|
|
return "1";
|
|
|
}
|
|
|
- Doctors doctors = Doctors.dao.use("zskk").findFirst("SELECT * FROM doctors where instr(?,realname) and institution_id=46400001",name);
|
|
|
+ Doctors doctors = Doctors.dao.use("zskk").findFirst("SELECT * FROM doctors where instr(?,realname) and institution_id=30000001",name);
|
|
|
if (doctors == null) {
|
|
|
return "1";
|
|
|
}
|
|
@@ -126,8 +180,6 @@ public class ViewController extends Controller {
|
|
|
Date date = null;
|
|
|
try {
|
|
|
date = sdf.parse(dateStr);
|
|
|
- SimpleDateFormat sdf2= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
-
|
|
|
System.out.println(date);
|
|
|
} catch (ParseException e) {
|
|
|
// TODO Auto-generated catch block
|