|
@@ -6,6 +6,7 @@ import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
import com.jfinal.core.Controller;
|
|
import com.jfinal.core.Controller;
|
|
|
|
+import com.jfinal.kit.HttpKit;
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
import com.zskk.model.Doctors;
|
|
import com.zskk.model.Doctors;
|
|
@@ -15,179 +16,230 @@ import com.zskk.model.Report;
|
|
import com.zskk.model.Studies;
|
|
import com.zskk.model.Studies;
|
|
import com.zskk.service.WeixinService;
|
|
import com.zskk.service.WeixinService;
|
|
import com.zskk.tools.XmlHelper;
|
|
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 {
|
|
public class ViewController extends Controller {
|
|
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 在被连接数据库执行sql语句
|
|
* 在被连接数据库执行sql语句
|
|
*/
|
|
*/
|
|
public void executeSql() {
|
|
public void executeSql() {
|
|
try {
|
|
try {
|
|
- List<Record> d = Db.use("connected").find("select * from (select * from reportinfo order by REPORTDATE desc) where rownum <= 20");
|
|
|
|
|
|
+ List<Record> d = Db.use("connected")
|
|
|
|
+ .find("select * from (select * from reportinfo order by REPORTDATE desc) where rownum <= 20");
|
|
this.renderJson(d);
|
|
this.renderJson(d);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
// TODO: handle exception
|
|
// TODO: handle exception
|
|
this.renderText(e.toString());
|
|
this.renderText(e.toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public void executeSql2() {
|
|
public void executeSql2() {
|
|
try {
|
|
try {
|
|
String sqlString = this.getPara("str");
|
|
String sqlString = this.getPara("str");
|
|
- List<Record> d = Db.use("connected").find(sqlString);
|
|
|
|
|
|
+ List<Record> d = Db.use("connected").find(sqlString);
|
|
this.renderJson(d);
|
|
this.renderJson(d);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
// TODO: handle exception
|
|
// TODO: handle exception
|
|
this.renderText(e.toString());
|
|
this.renderText(e.toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- public void testTask() {
|
|
|
|
|
|
+
|
|
|
|
+ public void getReport() {
|
|
|
|
+
|
|
try {
|
|
try {
|
|
- 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) {
|
|
|
|
- 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();
|
|
|
|
- this.renderText(e.toString());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ XmlHelper xmlHelper = XmlHelper.of(HttpKit.readData(getRequest()));
|
|
|
|
+
|
|
|
|
+ String studyuid = xmlHelper.getString("//studyuid");
|
|
|
|
+
|
|
|
|
+ Studies studiesFind = Studies.dao.use("zskk").findFirst("SELECT * FROM studies WHERE studyuid=?", studyuid);
|
|
|
|
+
|
|
|
|
+ if (studiesFind != null) {
|
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- // TODO: handle exception
|
|
|
|
- this.renderText(e.toString());
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
-// this.renderJson(examds);
|
|
|
|
|
|
+
|
|
|
|
+ PatientInfos patientInfos = new PatientInfos().use("zskk");
|
|
|
|
+ patientInfos.setId(creatId());
|
|
|
|
+
|
|
|
|
+ String patientname = xmlHelper.getString("//patientname");
|
|
|
|
+
|
|
|
|
+ patientInfos.setName(patientname);
|
|
|
|
+
|
|
|
|
+ String patientsex = xmlHelper.getString("//patientsex");
|
|
|
|
+
|
|
|
|
+ patientInfos.setSex(patientsex);
|
|
|
|
+
|
|
|
|
+ String idcard = xmlHelper.getString("//idcard");
|
|
|
|
+
|
|
|
|
+ patientInfos.setCardNum(idcard);
|
|
|
|
+
|
|
|
|
+ String phone = xmlHelper.getString("//phone");
|
|
|
|
+
|
|
|
|
+ patientInfos.setPhone(phone);
|
|
|
|
+
|
|
|
|
+ String birthdate = xmlHelper.getString("//birthdate");
|
|
|
|
+
|
|
|
|
+ patientInfos.setBirthday(birthdate);
|
|
|
|
+
|
|
|
|
+ String patientage = xmlHelper.getString("//patientage");
|
|
|
|
+
|
|
|
|
+ patientInfos.setAge(patientage);
|
|
|
|
+
|
|
|
|
+ String patientid = xmlHelper.getString("//patientid");
|
|
|
|
+
|
|
|
|
+ patientInfos.setAge(patientid);
|
|
|
|
+
|
|
|
|
+ patientInfos.setStatus(1);
|
|
|
|
+
|
|
|
|
+ patientInfos.setInstitutionId("15000004");
|
|
|
|
+
|
|
|
|
+ patientInfos.setCreatedAt(new Date());
|
|
|
|
+
|
|
|
|
+ patientInfos.setUpdatedAt(new Date());
|
|
|
|
+
|
|
|
|
+ patientInfos.save();
|
|
|
|
+
|
|
|
|
+ Studies studies = new Studies().use("zskk");
|
|
|
|
+
|
|
|
|
+ studies.setId(creatId());
|
|
|
|
+
|
|
|
|
+ studies.setStudyid(studyuid);
|
|
|
|
+
|
|
|
|
+ studies.setPatientId(patientInfos.getId());
|
|
|
|
+
|
|
|
|
+ String accessionNumber = xmlHelper.getString("//accessionNumber");
|
|
|
|
+
|
|
|
|
+ studies.setAccessionNum(accessionNumber);
|
|
|
|
+
|
|
|
|
+ String modality = xmlHelper.getString("//modality");
|
|
|
|
+
|
|
|
|
+ studies.setModality(modality);
|
|
|
|
+
|
|
|
|
+ studies.setStatus(1);
|
|
|
|
+
|
|
|
|
+ studies.setPatientAge(patientage);
|
|
|
|
+
|
|
|
|
+ studies.setInstitutionId("15000004");
|
|
|
|
+
|
|
|
|
+ studies.setCreatedAt(new Date());
|
|
|
|
+
|
|
|
|
+ studies.setUpdatedAt(new Date());
|
|
|
|
+
|
|
|
|
+ studies.save();
|
|
|
|
+
|
|
|
|
+ Exams exams = new Exams().use("zskk");
|
|
|
|
+
|
|
|
|
+ exams.setId(creatId());
|
|
|
|
+
|
|
|
|
+ exams.setPatientId(patientInfos.getId());
|
|
|
|
+
|
|
|
|
+ exams.setPatientNum(idcard);
|
|
|
|
+
|
|
|
|
+ exams.setAccessionNum(accessionNumber);
|
|
|
|
+
|
|
|
|
+ exams.setExamClass(modality);
|
|
|
|
+
|
|
|
|
+ exams.setInstitutionId("15000004");
|
|
|
|
+
|
|
|
|
+ exams.setStudyId(studies.getId());
|
|
|
|
+
|
|
|
|
+ exams.setStatus("0");
|
|
|
|
+
|
|
|
|
+ exams.setFilmType("2");
|
|
|
|
+
|
|
|
|
+ exams.setCreatedAt(new Date());
|
|
|
|
+
|
|
|
|
+ exams.setUpdatedAt(new Date());
|
|
|
|
+
|
|
|
|
+ String department = xmlHelper.getString("//department");
|
|
|
|
+
|
|
|
|
+ exams.setApplicationDepartment(department);
|
|
|
|
+
|
|
|
|
+ String clinicaldoctor = xmlHelper.getString("//clinicaldoctor");
|
|
|
|
+
|
|
|
|
+ exams.setApplicationDoctor(clinicaldoctor);
|
|
|
|
+
|
|
|
|
+ exams.setExamStatus(9);
|
|
|
|
+
|
|
|
|
+ exams.save();
|
|
|
|
+
|
|
|
|
+ Report report = new Report().use("zskk");
|
|
|
|
+
|
|
|
|
+ report.setId(creatId());
|
|
|
|
+
|
|
|
|
+ String reportdate = xmlHelper.getString("//reportdate");
|
|
|
|
+
|
|
|
|
+ report.setReportDatetime(parseStringToDate(reportdate));
|
|
|
|
+
|
|
|
|
+ String description = xmlHelper.getString("//description");
|
|
|
|
+
|
|
|
|
+ String impression = xmlHelper.getString("//impression");
|
|
|
|
+
|
|
|
|
+ if (impression == null && description == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ report.setImpression(impression);
|
|
|
|
+
|
|
|
|
+ report.setDescription(description);
|
|
|
|
+ report.setExamId(exams.getId());
|
|
|
|
+ report.setCreatedAt(new Date());
|
|
|
|
+
|
|
|
|
+ String reportdoctor = xmlHelper.getString("//reportdoctor");
|
|
|
|
+
|
|
|
|
+ report.setReportDoctorId(getDoctorIdByName(reportdoctor));
|
|
|
|
+
|
|
|
|
+ String reviewdoctor = xmlHelper.getString("//reviewdoctor");
|
|
|
|
+
|
|
|
|
+ report.setReviewDoctorId(getDoctorIdByName(reviewdoctor));
|
|
|
|
+ report.setReviewDatetime(parseStringToDate(reportdate));
|
|
|
|
+ report.setConfirmDoctorId(getDoctorIdByName(reviewdoctor));
|
|
|
|
+ report.setConfirmDatetime(parseStringToDate(reportdate));
|
|
|
|
+ report.save();
|
|
|
|
+
|
|
|
|
+ WeixinService wService = new WeixinService();
|
|
|
|
+ wService.requestWeixinQrcode(report.getId());
|
|
|
|
+
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- // TODO: handle exception
|
|
|
|
|
|
+ // TODO Auto-generated catch block
|
|
|
|
+ e.printStackTrace();
|
|
this.renderText(e.toString());
|
|
this.renderText(e.toString());
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
private String creatId() {
|
|
private String creatId() {
|
|
UUID id = UUID.randomUUID();
|
|
UUID id = UUID.randomUUID();
|
|
- String[] idd =id.toString().split("-");
|
|
|
|
- return idd[0]+idd[1]+idd[2];
|
|
|
|
|
|
+ String[] idd = id.toString().split("-");
|
|
|
|
+ return idd[0] + idd[1] + idd[2];
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
private String getDoctorIdByName(String name) {
|
|
private String getDoctorIdByName(String name) {
|
|
if (name == null) {
|
|
if (name == null) {
|
|
return "1";
|
|
return "1";
|
|
}
|
|
}
|
|
- Doctors doctors = Doctors.dao.use("zskk").findFirst("SELECT * FROM doctors where instr(?,realname) and institution_id=30000001",name);
|
|
|
|
|
|
+ Doctors doctors = Doctors.dao.use("zskk").findFirst("SELECT * FROM doctors where instr(?,realname) and institution_id=15000004 and realname<>''", name);
|
|
if (doctors == null) {
|
|
if (doctors == null) {
|
|
return "1";
|
|
return "1";
|
|
}
|
|
}
|
|
return doctors.getId();
|
|
return doctors.getId();
|
|
}
|
|
}
|
|
-
|
|
|
|
- private Date aaa(String timestr) {
|
|
|
|
- if (timestr == null) {
|
|
|
|
- return new Date();
|
|
|
|
- }
|
|
|
|
- SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
- Date date = null;
|
|
|
|
- try {
|
|
|
|
- date = sdf.parse(timestr);
|
|
|
|
- } catch (ParseException e) {
|
|
|
|
- // TODO Auto-generated catch block
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
- return date;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
private static Date parseStringToDate(String dateStr) {
|
|
private static Date parseStringToDate(String dateStr) {
|
|
if (dateStr == null) {
|
|
if (dateStr == null) {
|
|
return new Date();
|
|
return new Date();
|
|
}
|
|
}
|
|
- SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
|
|
|
- Date date = null;
|
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ Date date = null;
|
|
try {
|
|
try {
|
|
date = sdf.parse(dateStr);
|
|
date = sdf.parse(dateStr);
|
|
- System.out.println(date);
|
|
|
|
} catch (ParseException e) {
|
|
} catch (ParseException e) {
|
|
// TODO Auto-generated catch block
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
- return date;
|
|
|
|
|
|
+ return date;
|
|
}
|
|
}
|
|
-
|
|
|
|
- public static void main(String[] args) {
|
|
|
|
- parseStringToDate("2019-07-18T01:26:28.57+08:00");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|