|
@@ -11,6 +11,9 @@ 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;
|
|
|
+import com.zskk.service.ServiceFactory;
|
|
|
+import com.zskk.service.WeixinService;
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
@@ -66,12 +69,10 @@ 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=81069902 order by createdAt desc limit 30");
|
|
|
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());
|
|
|
+ Studies studies = Studies.dao.use("zskk").findById(exams2.getStudyId());
|
|
|
+ Record record = Db.use("connected").findFirst("select * from PACSONLINE_Interface where STUDYUID=?",studies.getStudyuid());
|
|
|
if (record == null) {
|
|
|
continue;
|
|
|
}
|
|
@@ -81,26 +82,29 @@ public class ViewController extends Controller {
|
|
|
if (record.getStr("IMPRESSION") == null && record.getStr("DESCRIPTION") == null) {
|
|
|
continue;
|
|
|
}
|
|
|
- report.setImpression(new String(record.getStr("DESCRIPTION").getBytes("windows-1252"),"GBK"));
|
|
|
- report.setDescription(new String(record.getStr("IMPRESSION").getBytes("windows-1252"),"GBK"));
|
|
|
+ report.setImpression(record.getStr("IMPRESSION"));
|
|
|
+ report.setDescription(record.getStr("DESCRIPTION"));
|
|
|
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.setReportDoctorId(getDoctorIdByName(record.getStr("REPORTDOCTOR")));
|
|
|
+ report.setReviewDoctorId(getDoctorIdByName(record.getStr("REVIEWDOCTOR")));
|
|
|
+ report.setReviewDatetime(parseStringToDate(record.getStr("REPORTDATE")));
|
|
|
+ report.setConfirmDoctorId(getDoctorIdByName(record.getStr("REVIEWDOCTOR")));
|
|
|
+ report.setConfirmDatetime(parseStringToDate(record.getStr("REPORTDATE")));
|
|
|
report.save();
|
|
|
PatientInfos patientInfos = PatientInfos.dao.use("zskk").findById(exams2.getPatientId());
|
|
|
- patientInfos.setName(new String(record.getStr("PATIENTNAME").getBytes("windows-1252"),"GBK"));
|
|
|
+ patientInfos.setName(record.getStr("PATIENTNAME"));
|
|
|
+// patientInfos.setPhone(record.getStr("telephone"));
|
|
|
+// patientInfos.setCardNum(record.getStr("IDCARD"));
|
|
|
patientInfos.update();
|
|
|
- exams2.setClinDoctors(new String(record.getStr("CLINICALDOCTOR").getBytes("windows-1252"),"GBK"));
|
|
|
exams2.setExamStatus(9);
|
|
|
+ exams2.setApplicationDepartment(record.getStr("DEPARTMENT"));
|
|
|
+ exams2.setApplicationDoctor(record.getStr("CLINICALDOCTOR"));
|
|
|
exams2.update();
|
|
|
- examds.add(record);
|
|
|
+ WeixinService wService = ServiceFactory.getService(WeixinService.class);
|
|
|
+ wService.requestWeixinQrcode(report.getId());
|
|
|
|
|
|
}
|
|
|
- this.renderJson(examds);
|
|
|
} catch (Exception e) {
|
|
|
// TODO: handle exception
|
|
|
this.renderText(e.toString());
|
|
@@ -115,11 +119,20 @@ public class ViewController extends Controller {
|
|
|
|
|
|
private String getDoctorIdByName(String name) {
|
|
|
if (name == null) {
|
|
|
- return "1";
|
|
|
+ return null;
|
|
|
}
|
|
|
- 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=81069902 and realname<>''", name);
|
|
|
if (doctors == null) {
|
|
|
- return "1";
|
|
|
+ Doctors newDoctors = new Doctors().use("zskk");
|
|
|
+ newDoctors.setId(creatId());
|
|
|
+ newDoctors.setUsername("none");
|
|
|
+ newDoctors.setRealname(name);
|
|
|
+ newDoctors.setPassword("123456");
|
|
|
+ newDoctors.setInstitutionId("81069902");
|
|
|
+ newDoctors.setCreatedAt(new Date());
|
|
|
+ newDoctors.setUpdatedAt(new Date());
|
|
|
+ newDoctors.save();
|
|
|
+ return newDoctors.getId();
|
|
|
}
|
|
|
return doctors.getId();
|
|
|
}
|