刘韬 6 éve
szülő
commit
c779f4c069

+ 46 - 0
DataFusion/WebRoot/WEB-INF/classes/com/zskk/model/_DataDictionary.txt

@@ -1,3 +1,28 @@
+Table: doctors
+----------------+---------------+------+-----+---------+---------
+ Field          | Type          | Null | Key | Default | Remarks 
+----------------+---------------+------+-----+---------+---------
+ id             | VARCHAR(32)   | NO   | PRI |         |         
+ username       | VARCHAR(100)  | NO   |     |         | 用户名     
+ password       | VARCHAR(200)  | NO   |     |         | 密码      
+ realname       | VARCHAR(200)  | YES  |     |         | 真实姓名    
+ email          | VARCHAR(200)  | YES  |     |         | email   
+ login_time     | DATETIME(19)  | YES  |     |         | 登录时间    
+ createdAt      | DATETIME(19)  | YES  |     |         | 创建时间    
+ updatedAt      | DATETIME(19)  | YES  |     |         | 修改时间    
+ token          | VARCHAR(255)  | YES  |     |         | 每次登陆产生新的Session标识
+ phone          | VARCHAR(20)   | YES  |     |         | 电话      
+ remark         | VARCHAR(1000) | YES  |     |         | 备注      
+ doctor_title   | VARCHAR(255)  | YES  |     |         | 职称      
+ status         | VARCHAR(50)   | YES  |     |         |         
+ attachment     | VARCHAR(2000) | YES  |     |         | 附件      
+ institution_id | VARCHAR(50)   | YES  |     |         | 医疗机构ID  
+ department_id  | VARCHAR(50)   | YES  |     |         | 主要科室ID  
+ doctor_role    | VARCHAR(20)   | YES  |     |         | 1.本地医生2.远程医生(可多选)
+ login_failure  | INT(10)       | YES  |     |         | 登录失败次数  
+ is_report      | VARCHAR(10)   | YES  |     |         | 是否能写报告  
+----------------+---------------+------+-----+---------+---------
+
 Table: exams
 -------------------+---------------+------+-----+---------+---------
  Field             | Type          | Null | Key | Default | Remarks 
@@ -94,3 +119,24 @@ Table: report
  confirm_datetime  | DATETIME(19)  | YES  |     |         | 确认时间    
 -------------------+---------------+------+-----+---------+---------
 
+Table: studies
+------------------+--------------+------+-----+---------+---------
+ Field            | Type         | Null | Key | Default | Remarks 
+------------------+--------------+------+-----+---------+---------
+ id               | VARCHAR(32)  | NO   | PRI |         |         
+ studyuid         | VARCHAR(200) | YES  |     |         |         
+ patient_id       | VARCHAR(50)  | YES  |     |         | 患者id    
+ studyid          | VARCHAR(50)  | YES  |     |         |         
+ accession_num    | VARCHAR(255) | YES  |     |         | 科室检查号   
+ studydate        | VARCHAR(255) | YES  |     |         |         
+ ctime            | DATETIME(19) | YES  |     |         |         
+ utime            | DATETIME(19) | YES  |     |         |         
+ modality         | VARCHAR(255) | YES  |     |         |         
+ status           | INT(10)      | YES  |     |         |         
+ patient_age      | VARCHAR(20)  | YES  |     |         |         
+ institution_name | VARCHAR(50)  | YES  |     |         | 机构名称    
+ institution_id   | VARCHAR(200) | YES  |     |         |         
+ createdAt        | DATETIME(19) | YES  |     |         |         
+ updatedAt        | DATETIME(19) | YES  |     |         |         
+------------------+--------------+------+-----+---------+---------
+

+ 43 - 2
DataFusion/src/com/zskk/control/ViewController.java

@@ -1,10 +1,16 @@
 package com.zskk.control;
 
+import java.util.Date;
 import java.util.List;
+import java.util.UUID;
 
 import com.jfinal.core.Controller;
 import com.jfinal.plugin.activerecord.Db;
 import com.jfinal.plugin.activerecord.Record;
+import com.zskk.model.Doctors;
+import com.zskk.model.Exams;
+import com.zskk.model.Report;
+import com.zskk.model.Studies;
 
 public class ViewController extends Controller {
 
@@ -12,8 +18,43 @@ public class ViewController extends Controller {
 	 * 在被连接数据库执行sql语句
 	 */
 	public void executeSql() {
-		List<Record>  d =  Db.use("sx").find(this.getPara("sqlstr"));
-		this.renderJson(d);
+		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=73090001 order by createdAt desc limit 50");
+			for (Exams exams2 : exams) {
+				Studies studies = Studies.dao.use("zskk").findById(exams2.getStudyId());
+				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.setImpression(record.getStr("IMPRESSION"));
+				report.setDescription(record.getStr("DESCRIPTION"));
+				report.setExamId(exams2.getId());
+				report.setCreatedAt(new Date());
+				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.setConfirmDoctorId(getDoctorIdByName(record.getStr("REVIEWDOCTOR")));
+				report.setConfirmDatetime(record.getDate("REPORTDATE"));
+				report.save();
+			}
+			this.renderJson(exams);
+		} catch (Exception e) {
+			// TODO: handle exception
+			this.renderText(e.toString());
+		}
+	}
+	
+	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);
+		return doctors.getId();
 	}
 	
 }

+ 11 - 0
DataFusion/src/com/zskk/model/Doctors.java

@@ -0,0 +1,11 @@
+package com.zskk.model;
+
+import com.zskk.model.base.BaseDoctors;
+
+/**
+ * Generated by JFinal.
+ */
+@SuppressWarnings("serial")
+public class Doctors extends BaseDoctors<Doctors> {
+	public static final Doctors dao = new Doctors().dao();
+}

+ 11 - 0
DataFusion/src/com/zskk/model/Studies.java

@@ -0,0 +1,11 @@
+package com.zskk.model;
+
+import com.zskk.model.base.BaseStudies;
+
+/**
+ * Generated by JFinal.
+ */
+@SuppressWarnings("serial")
+public class Studies extends BaseStudies<Studies> {
+	public static final Studies dao = new Studies().dao();
+}

+ 46 - 0
DataFusion/src/com/zskk/model/_DataDictionary.txt

@@ -1,3 +1,28 @@
+Table: doctors
+----------------+---------------+------+-----+---------+---------
+ Field          | Type          | Null | Key | Default | Remarks 
+----------------+---------------+------+-----+---------+---------
+ id             | VARCHAR(32)   | NO   | PRI |         |         
+ username       | VARCHAR(100)  | NO   |     |         | 用户名     
+ password       | VARCHAR(200)  | NO   |     |         | 密码      
+ realname       | VARCHAR(200)  | YES  |     |         | 真实姓名    
+ email          | VARCHAR(200)  | YES  |     |         | email   
+ login_time     | DATETIME(19)  | YES  |     |         | 登录时间    
+ createdAt      | DATETIME(19)  | YES  |     |         | 创建时间    
+ updatedAt      | DATETIME(19)  | YES  |     |         | 修改时间    
+ token          | VARCHAR(255)  | YES  |     |         | 每次登陆产生新的Session标识
+ phone          | VARCHAR(20)   | YES  |     |         | 电话      
+ remark         | VARCHAR(1000) | YES  |     |         | 备注      
+ doctor_title   | VARCHAR(255)  | YES  |     |         | 职称      
+ status         | VARCHAR(50)   | YES  |     |         |         
+ attachment     | VARCHAR(2000) | YES  |     |         | 附件      
+ institution_id | VARCHAR(50)   | YES  |     |         | 医疗机构ID  
+ department_id  | VARCHAR(50)   | YES  |     |         | 主要科室ID  
+ doctor_role    | VARCHAR(20)   | YES  |     |         | 1.本地医生2.远程医生(可多选)
+ login_failure  | INT(10)       | YES  |     |         | 登录失败次数  
+ is_report      | VARCHAR(10)   | YES  |     |         | 是否能写报告  
+----------------+---------------+------+-----+---------+---------
+
 Table: exams
 -------------------+---------------+------+-----+---------+---------
  Field             | Type          | Null | Key | Default | Remarks 
@@ -94,3 +119,24 @@ Table: report
  confirm_datetime  | DATETIME(19)  | YES  |     |         | 确认时间    
 -------------------+---------------+------+-----+---------+---------
 
+Table: studies
+------------------+--------------+------+-----+---------+---------
+ Field            | Type         | Null | Key | Default | Remarks 
+------------------+--------------+------+-----+---------+---------
+ id               | VARCHAR(32)  | NO   | PRI |         |         
+ studyuid         | VARCHAR(200) | YES  |     |         |         
+ patient_id       | VARCHAR(50)  | YES  |     |         | 患者id    
+ studyid          | VARCHAR(50)  | YES  |     |         |         
+ accession_num    | VARCHAR(255) | YES  |     |         | 科室检查号   
+ studydate        | VARCHAR(255) | YES  |     |         |         
+ ctime            | DATETIME(19) | YES  |     |         |         
+ utime            | DATETIME(19) | YES  |     |         |         
+ modality         | VARCHAR(255) | YES  |     |         |         
+ status           | INT(10)      | YES  |     |         |         
+ patient_age      | VARCHAR(20)  | YES  |     |         |         
+ institution_name | VARCHAR(50)  | YES  |     |         | 机构名称    
+ institution_id   | VARCHAR(200) | YES  |     |         |         
+ createdAt        | DATETIME(19) | YES  |     |         |         
+ updatedAt        | DATETIME(19) | YES  |     |         |         
+------------------+--------------+------+-----+---------+---------
+

+ 2 - 0
DataFusion/src/com/zskk/model/_MappingKit.java

@@ -16,9 +16,11 @@ import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
 public class _MappingKit {
 	
 	public static void mapping(ActiveRecordPlugin arp) {
+		arp.addMapping("doctors", "id", Doctors.class);
 		arp.addMapping("exams", "id", Exams.class);
 		arp.addMapping("patient_infos", "id", PatientInfos.class);
 		arp.addMapping("report", "id", Report.class);
+		arp.addMapping("studies", "id", Studies.class);
 	}
 }
 

+ 183 - 0
DataFusion/src/com/zskk/model/base/BaseDoctors.java

@@ -0,0 +1,183 @@
+package com.zskk.model.base;
+
+import com.jfinal.plugin.activerecord.Model;
+import com.jfinal.plugin.activerecord.IBean;
+
+/**
+ * Generated by JFinal, do not modify this file.
+ */
+@SuppressWarnings({"serial", "unchecked"})
+public abstract class BaseDoctors<M extends BaseDoctors<M>> extends Model<M> implements IBean {
+
+	public M setId(java.lang.String id) {
+		set("id", id);
+		return (M)this;
+	}
+	
+	public java.lang.String getId() {
+		return getStr("id");
+	}
+
+	public M setUsername(java.lang.String username) {
+		set("username", username);
+		return (M)this;
+	}
+	
+	public java.lang.String getUsername() {
+		return getStr("username");
+	}
+
+	public M setPassword(java.lang.String password) {
+		set("password", password);
+		return (M)this;
+	}
+	
+	public java.lang.String getPassword() {
+		return getStr("password");
+	}
+
+	public M setRealname(java.lang.String realname) {
+		set("realname", realname);
+		return (M)this;
+	}
+	
+	public java.lang.String getRealname() {
+		return getStr("realname");
+	}
+
+	public M setEmail(java.lang.String email) {
+		set("email", email);
+		return (M)this;
+	}
+	
+	public java.lang.String getEmail() {
+		return getStr("email");
+	}
+
+	public M setLoginTime(java.util.Date loginTime) {
+		set("login_time", loginTime);
+		return (M)this;
+	}
+	
+	public java.util.Date getLoginTime() {
+		return get("login_time");
+	}
+
+	public M setCreatedAt(java.util.Date createdAt) {
+		set("createdAt", createdAt);
+		return (M)this;
+	}
+	
+	public java.util.Date getCreatedAt() {
+		return get("createdAt");
+	}
+
+	public M setUpdatedAt(java.util.Date updatedAt) {
+		set("updatedAt", updatedAt);
+		return (M)this;
+	}
+	
+	public java.util.Date getUpdatedAt() {
+		return get("updatedAt");
+	}
+
+	public M setToken(java.lang.String token) {
+		set("token", token);
+		return (M)this;
+	}
+	
+	public java.lang.String getToken() {
+		return getStr("token");
+	}
+
+	public M setPhone(java.lang.String phone) {
+		set("phone", phone);
+		return (M)this;
+	}
+	
+	public java.lang.String getPhone() {
+		return getStr("phone");
+	}
+
+	public M setRemark(java.lang.String remark) {
+		set("remark", remark);
+		return (M)this;
+	}
+	
+	public java.lang.String getRemark() {
+		return getStr("remark");
+	}
+
+	public M setDoctorTitle(java.lang.String doctorTitle) {
+		set("doctor_title", doctorTitle);
+		return (M)this;
+	}
+	
+	public java.lang.String getDoctorTitle() {
+		return getStr("doctor_title");
+	}
+
+	public M setStatus(java.lang.String status) {
+		set("status", status);
+		return (M)this;
+	}
+	
+	public java.lang.String getStatus() {
+		return getStr("status");
+	}
+
+	public M setAttachment(java.lang.String attachment) {
+		set("attachment", attachment);
+		return (M)this;
+	}
+	
+	public java.lang.String getAttachment() {
+		return getStr("attachment");
+	}
+
+	public M setInstitutionId(java.lang.String institutionId) {
+		set("institution_id", institutionId);
+		return (M)this;
+	}
+	
+	public java.lang.String getInstitutionId() {
+		return getStr("institution_id");
+	}
+
+	public M setDepartmentId(java.lang.String departmentId) {
+		set("department_id", departmentId);
+		return (M)this;
+	}
+	
+	public java.lang.String getDepartmentId() {
+		return getStr("department_id");
+	}
+
+	public M setDoctorRole(java.lang.String doctorRole) {
+		set("doctor_role", doctorRole);
+		return (M)this;
+	}
+	
+	public java.lang.String getDoctorRole() {
+		return getStr("doctor_role");
+	}
+
+	public M setLoginFailure(java.lang.Integer loginFailure) {
+		set("login_failure", loginFailure);
+		return (M)this;
+	}
+	
+	public java.lang.Integer getLoginFailure() {
+		return getInt("login_failure");
+	}
+
+	public M setIsReport(java.lang.String isReport) {
+		set("is_report", isReport);
+		return (M)this;
+	}
+	
+	public java.lang.String getIsReport() {
+		return getStr("is_report");
+	}
+
+}

+ 147 - 0
DataFusion/src/com/zskk/model/base/BaseStudies.java

@@ -0,0 +1,147 @@
+package com.zskk.model.base;
+
+import com.jfinal.plugin.activerecord.Model;
+import com.jfinal.plugin.activerecord.IBean;
+
+/**
+ * Generated by JFinal, do not modify this file.
+ */
+@SuppressWarnings({"serial", "unchecked"})
+public abstract class BaseStudies<M extends BaseStudies<M>> extends Model<M> implements IBean {
+
+	public M setId(java.lang.String id) {
+		set("id", id);
+		return (M)this;
+	}
+	
+	public java.lang.String getId() {
+		return getStr("id");
+	}
+
+	public M setStudyuid(java.lang.String studyuid) {
+		set("studyuid", studyuid);
+		return (M)this;
+	}
+	
+	public java.lang.String getStudyuid() {
+		return getStr("studyuid");
+	}
+
+	public M setPatientId(java.lang.String patientId) {
+		set("patient_id", patientId);
+		return (M)this;
+	}
+	
+	public java.lang.String getPatientId() {
+		return getStr("patient_id");
+	}
+
+	public M setStudyid(java.lang.String studyid) {
+		set("studyid", studyid);
+		return (M)this;
+	}
+	
+	public java.lang.String getStudyid() {
+		return getStr("studyid");
+	}
+
+	public M setAccessionNum(java.lang.String accessionNum) {
+		set("accession_num", accessionNum);
+		return (M)this;
+	}
+	
+	public java.lang.String getAccessionNum() {
+		return getStr("accession_num");
+	}
+
+	public M setStudydate(java.lang.String studydate) {
+		set("studydate", studydate);
+		return (M)this;
+	}
+	
+	public java.lang.String getStudydate() {
+		return getStr("studydate");
+	}
+
+	public M setCtime(java.util.Date ctime) {
+		set("ctime", ctime);
+		return (M)this;
+	}
+	
+	public java.util.Date getCtime() {
+		return get("ctime");
+	}
+
+	public M setUtime(java.util.Date utime) {
+		set("utime", utime);
+		return (M)this;
+	}
+	
+	public java.util.Date getUtime() {
+		return get("utime");
+	}
+
+	public M setModality(java.lang.String modality) {
+		set("modality", modality);
+		return (M)this;
+	}
+	
+	public java.lang.String getModality() {
+		return getStr("modality");
+	}
+
+	public M setStatus(java.lang.Integer status) {
+		set("status", status);
+		return (M)this;
+	}
+	
+	public java.lang.Integer getStatus() {
+		return getInt("status");
+	}
+
+	public M setPatientAge(java.lang.String patientAge) {
+		set("patient_age", patientAge);
+		return (M)this;
+	}
+	
+	public java.lang.String getPatientAge() {
+		return getStr("patient_age");
+	}
+
+	public M setInstitutionName(java.lang.String institutionName) {
+		set("institution_name", institutionName);
+		return (M)this;
+	}
+	
+	public java.lang.String getInstitutionName() {
+		return getStr("institution_name");
+	}
+
+	public M setInstitutionId(java.lang.String institutionId) {
+		set("institution_id", institutionId);
+		return (M)this;
+	}
+	
+	public java.lang.String getInstitutionId() {
+		return getStr("institution_id");
+	}
+
+	public M setCreatedAt(java.util.Date createdAt) {
+		set("createdAt", createdAt);
+		return (M)this;
+	}
+	
+	public java.util.Date getCreatedAt() {
+		return get("createdAt");
+	}
+
+	public M setUpdatedAt(java.util.Date updatedAt) {
+		set("updatedAt", updatedAt);
+		return (M)this;
+	}
+	
+	public java.util.Date getUpdatedAt() {
+		return get("updatedAt");
+	}
+
+}

+ 39 - 2
DataFusion/src/com/zskk/task/DataTask.java

@@ -1,9 +1,16 @@
 package com.zskk.task;
 
+import java.util.Date;
 import java.util.List;
+import java.util.UUID;
 
+import com.jfinal.plugin.activerecord.Db;
+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.Report;
+import com.zskk.model.Studies;
 
 public class DataTask implements ITask {
 
@@ -11,7 +18,25 @@ public class DataTask implements ITask {
 	public void run() {
 		// TODO Auto-generated method stub
 		try {
-			List<Exams> exams = Exams.dao.find("SELECT * FROM pacsonline.exams where exam_status=3 order by createdAt desc limit 50");
+			List<Exams> exams = Exams.dao.use("zskk").find("SELECT * FROM pacsonline.exams where exam_status=3 and institution_id=73090001 order by createdAt desc limit 50");
+			for (Exams exams2 : exams) {
+				Studies studies = Studies.dao.use("zskk").findById(exams2.getStudyId());
+				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.setImpression(record.getStr("IMPRESSION"));
+				report.setDescription(record.getStr("DESCRIPTION"));
+				report.setExamId(exams2.getId());
+				report.setCreatedAt(new Date());
+				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.setConfirmDoctorId(getDoctorIdByName(record.getStr("REVIEWDOCTOR")));
+				report.setConfirmDatetime(record.getDate("REPORTDATE"));
+				report.save();
+			}
 		} catch (Exception e) {
 			// TODO: handle exception
 		}
@@ -23,5 +48,17 @@ public class DataTask implements ITask {
 		// TODO Auto-generated method stub
 
 	}
-
+	
+	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);
+		return doctors.getId();
+	}
+	
+	
 }

+ 1 - 1
DataFusion/src/com/zskk/tools/_JFinalDemoGenerator.java

@@ -38,7 +38,7 @@ public class _JFinalDemoGenerator {
 		// 设置是否生成链式 setter 方法
 		generator.setGenerateChainSetter(false);
 		// 添加不需要生成的表名
-		generator.addExcludedTable("bodypart","constant","department","device","doctor_class","doctors","dr_cla_permission","exam_class","exam_project","exam_subclass","images","institution","manager","menu","messages","operating","remote_application","report_record","series","studies","sys_logs","sys_menus","templates");
+		generator.addExcludedTable("bodypart","constant","department","device","doctor_class","dr_cla_permission","exam_class","exam_project","exam_subclass","images","institution","manager","menu","messages","operating","remote_application","report_record","series","sys_logs","sys_menus","templates");
 		// 设置是否在 Model 中生成 dao 对象
 		generator.setGenerateDaoInModel(true);
 		// 设置是否生成链式 setter 方法