|
@@ -1,5 +1,7 @@
|
|
|
package com.zskk.task;
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.UUID;
|
|
@@ -9,6 +11,7 @@ import com.jfinal.plugin.activerecord.Record;
|
|
|
import com.jfinal.plugin.cron4j.ITask;
|
|
|
import com.zskk.model.Doctors;
|
|
|
import com.zskk.model.Exams;
|
|
|
+import com.zskk.model.PatientInfos;
|
|
|
import com.zskk.model.Report;
|
|
|
import com.zskk.model.Studies;
|
|
|
|
|
@@ -24,7 +27,10 @@ public class DataTask implements ITask {
|
|
|
Record record = Db.use("connected").findFirst("select * from caller where STUDYUID=?",studies.getStudyuid());
|
|
|
Report report = new Report().use("zskk");
|
|
|
report.setId(creatId());
|
|
|
- report.setReportDatetime(record.getDate("REPORTDATE"));
|
|
|
+ report.setReportDatetime(parseStringToDate(record.getStr("REPORTDATE")));
|
|
|
+ if (record.getStr("IMPRESSION") == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
report.setImpression(record.getStr("IMPRESSION"));
|
|
|
report.setDescription(record.getStr("DESCRIPTION"));
|
|
|
report.setExamId(exams2.getId());
|
|
@@ -32,10 +38,13 @@ public class DataTask implements ITask {
|
|
|
report.setReportResult(record.getStr("FITEM_RESULT_CODE").contains("阴")?"1":"2");
|
|
|
report.setReportDoctorId(getDoctorIdByName(record.getStr("REPORTDOCTOR")));
|
|
|
report.setReviewDoctorId(getDoctorIdByName(record.getStr("REVIEWDOCTOR")));
|
|
|
- report.setReviewDatetime(record.getDate("REPORTDATE"));
|
|
|
+ report.setReviewDatetime(parseStringToDate(record.getStr("REPORTDATE")));
|
|
|
report.setConfirmDoctorId(getDoctorIdByName(record.getStr("REVIEWDOCTOR")));
|
|
|
- report.setConfirmDatetime(record.getDate("REPORTDATE"));
|
|
|
+ report.setConfirmDatetime(parseStringToDate(record.getStr("REPORTDATE")));
|
|
|
report.save();
|
|
|
+ PatientInfos patientInfos = PatientInfos.dao.use("zskk").findById(exams2.getPatientId());
|
|
|
+ patientInfos.setName(record.getStr("PATIENTNAME"));
|
|
|
+ patientInfos.update();
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
// TODO: handle exception
|
|
@@ -43,22 +52,44 @@ public class DataTask implements ITask {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public void stop() {
|
|
|
// TODO Auto-generated method stub
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- private String creatId() {
|
|
|
+ private String creatId() {
|
|
|
UUID id=UUID.randomUUID();
|
|
|
String[] idd=id.toString().split("-");
|
|
|
return idd[0]+idd[1]+idd[2];
|
|
|
}
|
|
|
|
|
|
- private String getDoctorIdByName(String name) {
|
|
|
- Doctors doctors = Doctors.dao.use("zskk").findFirst("SELECT * FROM pacsonline.doctors where realname like ? and institution_id=73090001",name);
|
|
|
+ private String getDoctorIdByName(String name) {
|
|
|
+ if (name == null) {
|
|
|
+ return "1";
|
|
|
+ }
|
|
|
+ Doctors doctors = Doctors.dao.use("zskk").findFirst("SELECT * FROM doctors where realname like ? and institution_id=73090001",name);
|
|
|
+ if (doctors == null) {
|
|
|
+ return "1";
|
|
|
+ }
|
|
|
return doctors.getId();
|
|
|
}
|
|
|
|
|
|
+ private Date parseStringToDate(String dateStr) {
|
|
|
+ if (dateStr == null) {
|
|
|
+ return new Date();
|
|
|
+ }
|
|
|
+ SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Date date = null;
|
|
|
+ try {
|
|
|
+ date = sdf.parse(dateStr);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return date;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|