Browse Source

调整同步

lantone 5 years ago
parent
commit
968c65e582
31 changed files with 793 additions and 1911 deletions
  1. 22 7
      src/main/java/com/diagbot/entity/BasDeptInfo.java
  2. 4 0
      src/main/java/com/diagbot/entity/BasDoctorInfo.java
  3. 8 0
      src/main/java/com/diagbot/entity/BehospitalInfo.java
  4. 5 2
      src/main/java/com/diagbot/entity/DoctorAdvice.java
  5. 3 0
      src/main/java/com/diagbot/entity/HomeDiagnoseInfo.java
  6. 3 0
      src/main/java/com/diagbot/entity/HomeOperationInfo.java
  7. 3 0
      src/main/java/com/diagbot/entity/HomePage.java
  8. 4 0
      src/main/java/com/diagbot/entity/MedRecordType.java
  9. 4 1
      src/main/java/com/diagbot/entity/MedicalRecord.java
  10. 3 0
      src/main/java/com/diagbot/entity/MedicalRecordContent.java
  11. 76 0
      src/main/java/com/diagbot/entity/QcModelHospital.java
  12. 375 139
      src/main/java/com/diagbot/facade/DataFacade.java
  13. 0 5
      src/main/java/com/diagbot/facade/HomeOperationInfoFacade.java
  14. 16 0
      src/main/java/com/diagbot/mapper/QcModelHospitalMapper.java
  15. 16 0
      src/main/java/com/diagbot/service/QcModelHospitalService.java
  16. 20 0
      src/main/java/com/diagbot/service/impl/QcModelHospitalServiceImpl.java
  17. 0 1
      src/main/java/com/diagbot/task/MedicalRecordContentTask.java
  18. 13 16
      src/main/java/com/diagbot/task/MedRecordTypeTask.java
  19. 0 520
      src/main/java/com/diagbot/util/DBConn.java
  20. 200 98
      src/main/java/com/diagbot/util/TZDBConn.java
  21. 0 43
      src/main/java/com/diagbot/vo/FBasDeptInfoVO.java
  22. 0 38
      src/main/java/com/diagbot/vo/FBasDoctorInfoVO.java
  23. 0 114
      src/main/java/com/diagbot/vo/FBehospitalInfoVO.java
  24. 0 129
      src/main/java/com/diagbot/vo/FDoctorAdviceVO.java
  25. 0 48
      src/main/java/com/diagbot/vo/FHomeDiagnoseVO.java
  26. 0 83
      src/main/java/com/diagbot/vo/FHomeOperationVO.java
  27. 0 664
      src/main/java/com/diagbot/vo/FHomePageVO.java
  28. 2 2
      src/main/resources/application-local.yml
  29. 1 0
      src/main/resources/mapper/BehospitalInfoMapper.xml
  30. 14 0
      src/main/resources/mapper/QcModelHospitalMapper.xml
  31. 1 1
      src/test/java/com/diagbot/CodeGeneration.java

+ 22 - 7
src/main/java/com/diagbot/entity/BasDeptInfo.java

@@ -1,7 +1,11 @@
 package com.diagbot.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
 import java.time.LocalDateTime;
 import java.io.Serializable;
+import java.util.Date;
 
 /**
  * <p>
@@ -9,7 +13,7 @@ import java.io.Serializable;
  * </p>
  *
  * @author gaodm
- * @since 2020-04-17
+ * @since 2020-04-27
  */
 public class BasDeptInfo implements Serializable {
 
@@ -18,6 +22,7 @@ public class BasDeptInfo implements Serializable {
     /**
      * 科室编码(HIS导入)
      */
+    @TableId(value = "dept_id",type = IdType.INPUT)
     private String deptId;
 
     /**
@@ -25,6 +30,8 @@ public class BasDeptInfo implements Serializable {
      */
     private Long hospitalId;
 
+    private String parentDeptId;
+
     /**
      * 科室名称
      */
@@ -53,12 +60,12 @@ public class BasDeptInfo implements Serializable {
     /**
      * 记录创建时间
      */
-    private LocalDateTime gmtCreate;
+    private Date gmtCreate;
 
     /**
      * 记录修改时间,如果时间是1970年则表示纪录未修改
      */
-    private LocalDateTime gmtModified;
+    private Date gmtModified;
 
     /**
      * 创建人,0表示无创建人值
@@ -84,6 +91,13 @@ public class BasDeptInfo implements Serializable {
     public void setHospitalId(Long hospitalId) {
         this.hospitalId = hospitalId;
     }
+    public String getParentDeptId() {
+        return parentDeptId;
+    }
+
+    public void setParentDeptId(String parentDeptId) {
+        this.parentDeptId = parentDeptId;
+    }
     public String getDeptName() {
         return deptName;
     }
@@ -119,18 +133,18 @@ public class BasDeptInfo implements Serializable {
     public void setIsDeleted(String isDeleted) {
         this.isDeleted = isDeleted;
     }
-    public LocalDateTime getGmtCreate() {
+    public Date getGmtCreate() {
         return gmtCreate;
     }
 
-    public void setGmtCreate(LocalDateTime gmtCreate) {
+    public void setGmtCreate(Date gmtCreate) {
         this.gmtCreate = gmtCreate;
     }
-    public LocalDateTime getGmtModified() {
+    public Date getGmtModified() {
         return gmtModified;
     }
 
-    public void setGmtModified(LocalDateTime gmtModified) {
+    public void setGmtModified(Date gmtModified) {
         this.gmtModified = gmtModified;
     }
     public String getCreator() {
@@ -153,6 +167,7 @@ public class BasDeptInfo implements Serializable {
         return "BasDeptInfo{" +
             "deptId=" + deptId +
             ", hospitalId=" + hospitalId +
+            ", parentDeptId=" + parentDeptId +
             ", deptName=" + deptName +
             ", deptType=" + deptType +
             ", spell=" + spell +

+ 4 - 0
src/main/java/com/diagbot/entity/BasDoctorInfo.java

@@ -1,5 +1,8 @@
 package com.diagbot.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
 import java.time.LocalDateTime;
 import java.io.Serializable;
 
@@ -18,6 +21,7 @@ public class BasDoctorInfo implements Serializable {
     /**
      * HIS导入的医生ID
      */
+    @TableId(value = "doctor_id",type = IdType.INPUT)
     private String doctorId;
 
     /**

+ 8 - 0
src/main/java/com/diagbot/entity/BehospitalInfo.java

@@ -1,5 +1,7 @@
 package com.diagbot.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
@@ -23,6 +25,7 @@ public class BehospitalInfo implements Serializable {
     /**
      * 病人住院ID
      */
+    @TableId(value = "behospital_code",type = IdType.INPUT)
     private String behospitalCode;
 
     /**
@@ -50,6 +53,11 @@ public class BehospitalInfo implements Serializable {
      */
     private String fileCode;
 
+    /**
+     * 质控类型
+     */
+    private Long qcTypeId;
+
     /**
      * 病区编码
      */

+ 5 - 2
src/main/java/com/diagbot/entity/DoctorAdvice.java

@@ -1,5 +1,7 @@
 package com.diagbot.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
@@ -23,6 +25,7 @@ public class DoctorAdvice implements Serializable {
     /**
      * 病人医嘱ID
      */
+    @TableId(value = "doctor_advice_id",type = IdType.INPUT)
     private String doctorAdviceId;
 
     /**
@@ -148,12 +151,12 @@ public class DoctorAdvice implements Serializable {
 //    /**
 //     * 记录创建时间
 //     */
-//    private Date gmtCreate;
+    private Date gmtCreate;
 //
 //    /**
 //     * 记录修改时间,如果时间是1970年则表示纪录未修改
 //     */
-//    private Date gmtModified;
+    private Date gmtModified;
 //
 //    /**
 //     * 创建人,0表示无创建人值

+ 3 - 0
src/main/java/com/diagbot/entity/HomeDiagnoseInfo.java

@@ -1,5 +1,7 @@
 package com.diagbot.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
@@ -23,6 +25,7 @@ public class HomeDiagnoseInfo implements Serializable {
     /**
      * 病案首页ID
      */
+    @TableId(value = "home_page_id",type = IdType.INPUT)
     private String homePageId;
 
     /**

+ 3 - 0
src/main/java/com/diagbot/entity/HomeOperationInfo.java

@@ -1,5 +1,7 @@
 package com.diagbot.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
@@ -23,6 +25,7 @@ public class HomeOperationInfo implements Serializable {
     /**
      * 病案首页ID
      */
+    @TableId(value = "home_page_id",type = IdType.INPUT)
     private String homePageId;
 
     /**

+ 3 - 0
src/main/java/com/diagbot/entity/HomePage.java

@@ -1,5 +1,7 @@
 package com.diagbot.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
@@ -23,6 +25,7 @@ public class HomePage implements Serializable {
     /**
      * 病案首页编号
      */
+    @TableId(value = "home_page_id",type = IdType.INPUT)
     private String homePageId;
 
     /**

+ 4 - 0
src/main/java/com/diagbot/entity/MedRecordType.java

@@ -1,5 +1,8 @@
 package com.diagbot.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
 import java.io.Serializable;
 
 /**
@@ -17,6 +20,7 @@ public class MedRecordType implements Serializable {
     /**
      * 类别ID
      */
+    @TableId(value = "type_id",type = IdType.INPUT)
     private String typeId;
 
     /**

+ 4 - 1
src/main/java/com/diagbot/entity/MedicalRecord.java

@@ -1,5 +1,7 @@
 package com.diagbot.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
@@ -20,6 +22,7 @@ public class MedicalRecord implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
+    @TableId(value = "rec_id",type = IdType.INPUT)
     private String recId;
 
     /**
@@ -51,7 +54,7 @@ public class MedicalRecord implements Serializable {
      * 病历标题
      */
     private String recTitle;
-    
+
     /**
      * 模块id
      */

+ 3 - 0
src/main/java/com/diagbot/entity/MedicalRecordContent.java

@@ -1,5 +1,7 @@
 package com.diagbot.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
@@ -24,6 +26,7 @@ public class MedicalRecordContent implements Serializable {
     /**
      * 病历ID
      */
+    @TableId(value = "rec_id",type = IdType.INPUT)
     private String recId;
 
     /**

+ 76 - 0
src/main/java/com/diagbot/entity/QcModelHospital.java

@@ -0,0 +1,76 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author gaodm
+ * @since 2020-05-08
+ */
+public class QcModelHospital implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    private Integer hospitalId;
+
+    private String hospitalModelName;
+
+    private Long standModelId;
+
+    private String standModelName;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+    public Integer getHospitalId() {
+        return hospitalId;
+    }
+
+    public void setHospitalId(Integer hospitalId) {
+        this.hospitalId = hospitalId;
+    }
+    public String getHospitalModelName() {
+        return hospitalModelName;
+    }
+
+    public void setHospitalModelName(String hospitalModelName) {
+        this.hospitalModelName = hospitalModelName;
+    }
+    public Long getStandModelId() {
+        return standModelId;
+    }
+
+    public void setStandModelId(Long standModelId) {
+        this.standModelId = standModelId;
+    }
+    public String getStandModelName() {
+        return standModelName;
+    }
+
+    public void setStandModelName(String standModelName) {
+        this.standModelName = standModelName;
+    }
+
+    @Override
+    public String toString() {
+        return "QcModelHospital{" +
+            "id=" + id +
+            ", hospitalId=" + hospitalId +
+            ", hospitalModelName=" + hospitalModelName +
+            ", standModelId=" + standModelId +
+            ", standModelName=" + standModelName +
+        "}";
+    }
+}

+ 375 - 139
src/main/java/com/diagbot/facade/DataFacade.java

@@ -1,154 +1,390 @@
 package com.diagbot.facade;
 
-import java.sql.ResultSet;
-import java.util.Date;
-import java.util.List;
-import java.util.stream.Collector;
-import java.util.stream.Collectors;
+import java.util.*;
 
+import com.diagbot.entity.*;
+import com.diagbot.service.impl.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.diagbot.entity.BasDeptInfo;
-import com.diagbot.entity.BasDoctorInfo;
-import com.diagbot.entity.BehospitalInfo;
-import com.diagbot.entity.DoctorAdvice;
-import com.diagbot.entity.HomeDiagnoseInfo;
-import com.diagbot.entity.HomeOperationInfo;
-import com.diagbot.entity.HomePage;
-import com.diagbot.entity.MedRecordType;
-import com.diagbot.entity.MedicalRecord;
-import com.diagbot.entity.MedicalRecordContent;
-import com.diagbot.service.impl.BasDeptInfoServiceImpl;
-import com.diagbot.service.impl.BasDoctorInfoServiceImpl;
-import com.diagbot.service.impl.BehospitalInfoServiceImpl;
-import com.diagbot.service.impl.DoctorAdviceServiceImpl;
-import com.diagbot.service.impl.HomeDiagnoseInfoServiceImpl;
-import com.diagbot.service.impl.HomeOperationInfoServiceImpl;
-import com.diagbot.service.impl.HomePageServiceImpl;
-import com.diagbot.service.impl.MedRecordTypeServiceImpl;
-import com.diagbot.service.impl.MedicalRecordContentServiceImpl;
-import com.diagbot.service.impl.MedicalRecordServiceImpl;
-import com.diagbot.util.BeanUtil;
-import com.diagbot.util.DBConn;
 import com.diagbot.util.TZDBConn;
-import com.diagbot.vo.FBasDeptInfoVO;
-import com.diagbot.vo.FBasDoctorInfoVO;
-import com.diagbot.vo.FBehospitalInfoVO;
-import com.diagbot.vo.FDoctorAdviceVO;
-import com.diagbot.vo.FHomeDiagnoseVO;
-import com.diagbot.vo.FHomeOperationVO;
-import com.diagbot.vo.FHomePageVO;
-import com.diagbot.vo.FMedicalRecordContentVO;
-import com.diagbot.vo.FMedicalRecordTypeVO;
-import com.diagbot.vo.FMedicalRecordVO;
 import com.google.common.collect.Lists;
-import com.sun.org.apache.bcel.internal.generic.NEW;
 
 @Component
-public class DataFacade{
-	
-	@Autowired
-	@Qualifier("homePageServiceImpl")
-	private HomePageServiceImpl homePageServiceImpl;
-	
-	@Autowired
-	@Qualifier("behospitalInfoServiceImpl")
-	private BehospitalInfoServiceImpl behospitalInfoServiceImpl;
-	
-	@Autowired
-	@Qualifier("doctorAdviceServiceImpl")
-	private DoctorAdviceServiceImpl doctorAdviceServiceImpl;
-	
-	@Autowired
-	@Qualifier("medicalRecordServiceImpl")
-	private MedicalRecordServiceImpl medicalRecordServiceImpl;
-	
-	@Autowired
-	@Qualifier("medicalRecordContentServiceImpl")
-	private MedicalRecordContentServiceImpl medicalRecordContentServiceImpl;
-	
-	@Autowired
-	@Qualifier("medRecordTypeServiceImpl")
-	private MedRecordTypeServiceImpl medRecordTypeServiceImpl;
-	
-	@Autowired
-	@Qualifier("homeDiagnoseInfoServiceImpl")
-	private HomeDiagnoseInfoServiceImpl homeDiagnoseInfoServiceImpl;
-	
-	@Autowired
-	@Qualifier("homeOperationInfoServiceImpl")
-	private HomeOperationInfoServiceImpl homeOperationInfoServiceImpl;
-	
-	@Autowired
-	@Qualifier("basDeptInfoServiceImpl")
-	private BasDeptInfoServiceImpl basDeptInfoServiceImpl;
-	
-	@Autowired
-	@Qualifier("basDoctorInfoServiceImpl")
-	private BasDoctorInfoServiceImpl basDoctorInfoServiceImpl;
-	
-	private TZDBConn tzDBConn=new TZDBConn();
-	
-	public void executeDept() {
-		List<BasDeptInfo> basDeptInfoList=tzDBConn.getDeptInfo();
-		basDeptInfoServiceImpl.saveBatch(basDeptInfoList);
-	}
-	
-	public void executeDoctor() {
-		List<BasDoctorInfo> basDeptInfoList=tzDBConn.getBasDoctorInfo();
-		basDoctorInfoServiceImpl.saveBatch(basDeptInfoList);
-	}
-	
-	public void executeBehospital() {
-        List<BehospitalInfo> behospitalInfoList=tzDBConn.getBehospitalInfo();
-        if(behospitalInfoList!=null && behospitalInfoList.size()!=0) {
-        	behospitalInfoServiceImpl.saveBatch(behospitalInfoList);
+public class DataFacade {
+
+    @Autowired
+    @Qualifier("homePageServiceImpl")
+    private HomePageServiceImpl homePageServiceImpl;
+
+    @Autowired
+    @Qualifier("behospitalInfoServiceImpl")
+    private BehospitalInfoServiceImpl behospitalInfoServiceImpl;
+
+    @Autowired
+    @Qualifier("doctorAdviceServiceImpl")
+    private DoctorAdviceServiceImpl doctorAdviceServiceImpl;
+
+    @Autowired
+    @Qualifier("medicalRecordServiceImpl")
+    private MedicalRecordServiceImpl medicalRecordServiceImpl;
+
+    @Autowired
+    @Qualifier("medicalRecordContentServiceImpl")
+    private MedicalRecordContentServiceImpl medicalRecordContentServiceImpl;
+
+    @Autowired
+    @Qualifier("medRecordTypeServiceImpl")
+    private MedRecordTypeServiceImpl medRecordTypeServiceImpl;
+
+    @Autowired
+    @Qualifier("homeDiagnoseInfoServiceImpl")
+    private HomeDiagnoseInfoServiceImpl homeDiagnoseInfoServiceImpl;
+
+    @Autowired
+    @Qualifier("homeOperationInfoServiceImpl")
+    private HomeOperationInfoServiceImpl homeOperationInfoServiceImpl;
+
+    @Autowired
+    @Qualifier("basDeptInfoServiceImpl")
+    private BasDeptInfoServiceImpl basDeptInfoServiceImpl;
+
+    @Autowired
+    @Qualifier("basDoctorInfoServiceImpl")
+    private BasDoctorInfoServiceImpl basDoctorInfoServiceImpl;
+
+    @Autowired
+    @Qualifier("qcModelHospitalServiceImpl")
+    private QcModelHospitalServiceImpl qcModelHospitalServiceImpl;
+
+    @Autowired
+    @Qualifier("qcTypeServiceImpl")
+    private  QcTypeServiceImpl qcTypeServiceImpl;
+
+    private TZDBConn tzDBConn = new TZDBConn();
+
+    /**
+     * 同步前一天科室的信息
+     */
+    public void executeDept() {
+        List<BasDeptInfo> basDeptInfoList = tzDBConn.getDeptInfo();
+        List<BasDeptInfo> add = Lists.newLinkedList();
+        List<BasDeptInfo> updateE = Lists.newLinkedList();
+        basDeptInfoList.stream().forEach(s -> {
+            QueryWrapper<BasDeptInfo> queryWrapper = new QueryWrapper<>();
+            queryWrapper.in("dept_id", s.getDeptId());
+            BasDeptInfo basDeptInfo = basDeptInfoServiceImpl.getOne(queryWrapper);
+            if (basDeptInfo != null) {
+                updateE.add(s);
+            } else {
+                add.add(s);
+            }
+        });
+
+        if (add != null && add.size() != 0) {
+            basDeptInfoServiceImpl.saveBatch(add);
+        }
+        if (updateE != null && updateE.size() != 0) {
+            updateE.forEach((e) -> {
+                e.setGmtModified(new Date());
+            });
+            basDeptInfoServiceImpl.updateBatchById(updateE);
+        }
+    }
+
+    /**
+     * 同步前一天医生信息
+     */
+    public void executeDoctor() {
+        List<BasDoctorInfo> basDeptInfoList = tzDBConn.getBasDoctorInfo();
+        List<BasDoctorInfo> add = Lists.newLinkedList();
+        List<BasDoctorInfo> updateE = Lists.newLinkedList();
+        basDeptInfoList.stream().forEach(s -> {
+            QueryWrapper<BasDoctorInfo> queryWrapper = new QueryWrapper<>();
+            queryWrapper.in("doctor_id", s.getDeptId());
+            BasDoctorInfo basDoctorInfo = basDoctorInfoServiceImpl.getOne(queryWrapper);
+            if (basDoctorInfo != null) {
+                updateE.add(s);
+            } else {
+                add.add(s);
+            }
+        });
+
+        if (add != null && add.size() != 0) {
+            basDoctorInfoServiceImpl.saveBatch(basDeptInfoList);
+        }
+        if (updateE != null && updateE.size() != 0) {
+            updateE.forEach((e) -> {
+                //e.setGmtModified(new Date());
+            });
+            basDoctorInfoServiceImpl.updateBatchById(updateE);
+        }
+    }
+
+    /**
+     * 同步前一天的入院记录
+     */
+    public void executeBehospital() {
+        List<BehospitalInfo> behospitalInfoList = tzDBConn.getBehospitalInfo();
+        List<BehospitalInfo> add = Lists.newLinkedList();
+        List<BehospitalInfo> updateE = Lists.newLinkedList();
+        behospitalInfoList.stream().forEach(s -> {
+            QueryWrapper<MedicalRecord> wrapper = new QueryWrapper<>();
+            wrapper.eq("behospital_code", s.getBehospitalCode());
+            wrapper.eq("hospital_id", Long.valueOf("3"));
+            wrapper.eq("mode_id", Long.valueOf("1"));
+            MedicalRecord medicalRecord = medicalRecordServiceImpl.getOne(wrapper);
+            if(medicalRecord!=null){
+                QueryWrapper<QcType> qWrapper =new QueryWrapper<>();
+                qWrapper.eq("name",medicalRecord.getRecTitle());
+                QcType qcType=qcTypeServiceImpl.getOne(qWrapper);
+                if(qcType!=null){
+                    s.setQcTypeId(qcType.getId());
+                }else{
+                    s.setQcTypeId(null);
+                }
+            }
+
+            QueryWrapper<BehospitalInfo> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("behospital_code", s.getBehospitalCode());
+            queryWrapper.eq("hospital_id", Long.valueOf("3"));
+            BehospitalInfo behospitalInfo = behospitalInfoServiceImpl.getOne(queryWrapper);
+            if (behospitalInfo != null) {
+                updateE.add(s);
+            } else {
+                add.add(s);
+            }
+        });
+        if (add != null && add.size() != 0) {
+            behospitalInfoServiceImpl.saveBatch(add);
+        }
+        if (updateE != null && updateE.size() != 0) {
+            updateE.forEach((e) -> {
+                e.setGmtModified(new Date());
+            });
+            behospitalInfoServiceImpl.updateBatchById(updateE);
+        }
+    }
+
+    /**
+     * 同步前一天的入院病人医嘱信息
+     */
+    public void executeDoctorAdvice() {
+        List<DoctorAdvice> doctorAdviceList = tzDBConn.getDoctorAdvice();
+        List<DoctorAdvice> add = Lists.newLinkedList();
+        List<DoctorAdvice> updateE = Lists.newLinkedList();
+        if (doctorAdviceList != null && doctorAdviceList.size() > 0) {
+            doctorAdviceList.stream().forEach(s -> {
+                QueryWrapper<DoctorAdvice> queryWrapper = new QueryWrapper<>();
+                queryWrapper.in("doctor_advice_id", s.getDoctorAdviceId());
+                DoctorAdvice doctorAdvice = doctorAdviceServiceImpl.getOne(queryWrapper);
+                if (doctorAdvice != null) {
+                    updateE.add(s);
+                } else {
+                    add.add(s);
+                }
+            });
+            if (add != null && add.size() > 0) {
+                doctorAdviceServiceImpl.saveBatch(add);
+            }
+            if (updateE != null && updateE.size() > 0) {
+                updateE.forEach((e) -> {
+                    e.setGmtModified(new Date());
+                });
+                doctorAdviceServiceImpl.updateBatchById(updateE);
+            }
+        }
+    }
+
+    /**
+     * 同步前一天变更的模板类型
+     */
+    public void executeMRType() {
+        List<MedRecordType> medRecordTypeList = tzDBConn.getMedicalRecordType();
+        List<MedRecordType> add = Lists.newLinkedList();
+        List<MedRecordType> updateE = Lists.newLinkedList();
+        if (medRecordTypeList != null && medRecordTypeList.size() != 0) {
+            medRecordTypeList.stream().forEach(s -> {
+                QueryWrapper<MedRecordType> queryWrapper = new QueryWrapper<>();
+                queryWrapper.in("type_id", s.getTypeId());
+                MedRecordType mrType = medRecordTypeServiceImpl.getOne(queryWrapper);
+                if (mrType != null) {
+                    updateE.add(s);
+                } else {
+                    add.add(s);
+                }
+            });
+            if (add != null && add.size() != 0) {
+                medRecordTypeServiceImpl.saveBatch(add);
+            }
+            if (updateE != null && updateE.size() != 0) {
+                //updateE.forEach((e)->{e.setGmtModified(new Date());});
+                medRecordTypeServiceImpl.updateBatchById(updateE);
+            }
+        }
+    }
+
+    /**
+     * 同步前一天的病历记录
+     */
+    public void executeMrRecord() {
+        List<MedicalRecord> medicalRecordList = tzDBConn.getMedicalRecord();
+        List<MedicalRecord> add = Lists.newLinkedList();
+        List<MedicalRecord> updateE = Lists.newLinkedList();
+        if (medicalRecordList != null && medicalRecordList.size() > 0) {
+            medicalRecordList.stream().forEach(s -> {
+                //初始化mode_id
+                QueryWrapper<QcModelHospital> wrapper = new QueryWrapper<>();
+                wrapper.eq("hospital_id", Long.valueOf("3"));
+                wrapper.eq("hospital_model_name",s.getRecTitle());
+                QcModelHospital mode=qcModelHospitalServiceImpl.getOne(wrapper);
+                if(mode!=null){
+                    s.setModeId(mode.getStandModelId());
+                }else{
+                    s.setModeId(null);
+                }
+
+                //新增或修改
+                QueryWrapper<MedicalRecord> queryWrapper = new QueryWrapper<>();
+                queryWrapper.in("rec_id", s.getRecId());
+                MedicalRecord medicalRecord = medicalRecordServiceImpl.getOne(queryWrapper);
+                if (medicalRecord != null) {
+                    updateE.add(s);
+                } else {
+                    add.add(s);
+                }
+            });
+            if (add != null && add.size() > 0) {
+                medicalRecordServiceImpl.saveBatch(add);
+            }
+            if (updateE != null && updateE.size() > 0) {
+                updateE.forEach((e) -> {
+                    e.setGmtModified(new Date());
+                });
+                medicalRecordServiceImpl.updateBatchById(updateE);
+            }
+        }
+    }
+
+    /**
+     * 同步前一天的病历详细记录
+     */
+    public void executeMrRecordContent() {
+        List<MedicalRecordContent> mrContentList = tzDBConn.getMedicalRecordContent();
+        List<MedicalRecordContent> add = Lists.newLinkedList();
+        List<MedicalRecordContent> updateE = Lists.newLinkedList();
+        if (mrContentList != null && mrContentList.size() > 0) {
+            mrContentList.stream().forEach(s -> {
+                QueryWrapper<MedicalRecordContent> queryWrapper = new QueryWrapper<>();
+                queryWrapper.in("rec_id", s.getRecId());
+                MedicalRecordContent mrContent = medicalRecordContentServiceImpl.getOne(queryWrapper);
+                if (mrContent != null) {
+                    updateE.add(s);
+                } else {
+                    add.add(s);
+                }
+            });
+            if (add != null && add.size() > 0) {
+                medicalRecordContentServiceImpl.saveBatch(add);
+            }
+            if (updateE != null && updateE.size() > 0) {
+                updateE.forEach((e) -> {
+                    e.setGmtModified(new Date());
+                });
+                medicalRecordContentServiceImpl.updateBatchById(updateE);
+            }
+        }
+    }
+
+    /**
+     * 同步前一天病案首页
+     */
+    public void executeHomePage() {
+        List<HomePage> homePageList = tzDBConn.getHomePage();
+        List<HomePage> add = Lists.newLinkedList();
+        List<HomePage> updateE = Lists.newLinkedList();
+        if (homePageList != null && homePageList.size() > 0) {
+            homePageList.stream().forEach(s -> {
+                QueryWrapper<HomePage> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("home_page_id", s.getHomePageId());
+                HomePage homePage = homePageServiceImpl.getOne(queryWrapper);
+                if (homePage != null) {
+                    updateE.add(s);
+                } else {
+                    add.add(s);
+                }
+            });
+            if (add != null && add.size() > 0) {
+                homePageServiceImpl.saveBatch(add);
+            }
+            if (updateE != null && updateE.size() > 0) {
+                updateE.forEach((e) -> {
+                    e.setGmtModified(new Date());
+                });
+                homePageServiceImpl.updateBatchById(updateE);
+            }
+        }
+    }
+
+    public void executeHomeOperation() {
+        List<HomeOperationInfo> homeOperationList = tzDBConn.getHomeOperation();
+        List<HomeOperationInfo> add = Lists.newLinkedList();
+        List<HomeOperationInfo> updateE = Lists.newLinkedList();
+        if (homeOperationList != null && homeOperationList.size() > 0) {
+            homeOperationList.stream().forEach(s -> {
+                if(s.getHomePageId()!=null && !"".equals(s.getOperationOrderNo())) {
+                    QueryWrapper<HomeOperationInfo> queryWrapper = new QueryWrapper<>();
+                    queryWrapper.eq("home_page_id", s.getHomePageId());
+                    queryWrapper.eq("operation_order_no", s.getOperationOrderNo());
+                    HomeOperationInfo operationInfo = homeOperationInfoServiceImpl.getOne(queryWrapper);
+                    if (operationInfo != null) {
+                        updateE.add(s);
+                    } else {
+                        add.add(s);
+                    }
+                }
+            });
+            if (add != null && add.size() > 0) {
+                homeOperationInfoServiceImpl.saveBatch(add);
+            }
+            if (updateE != null && updateE.size() > 0) {
+                updateE.forEach((e) -> {
+                    e.setGmtModified(new Date());
+                });
+                homeOperationInfoServiceImpl.updateBatchById(updateE);
+            }
+        }
+    }
+
+    public void executeHomeDiagnose() {
+        List<HomeDiagnoseInfo> homeDiagnoseList = tzDBConn.getHomeDiagnose();
+        List<HomeDiagnoseInfo> add = Lists.newLinkedList();
+        List<HomeDiagnoseInfo> updateE = Lists.newLinkedList();
+        if (homeDiagnoseList != null && homeDiagnoseList.size() > 0) {
+            homeDiagnoseList.stream().forEach(s -> {
+                if(s.getHomePageId()!=null && !"".equals(s.getDiagnoseOrderNo())){
+                    QueryWrapper<HomeDiagnoseInfo> queryWrapper = new QueryWrapper<>();
+                    queryWrapper.eq("home_page_id", s.getHomePageId());
+                    queryWrapper.eq("diagnose_order_no", s.getDiagnoseOrderNo());
+                    HomeDiagnoseInfo diagnoseInfo = homeDiagnoseInfoServiceImpl.getOne(queryWrapper);
+                    if (diagnoseInfo != null) {
+                        updateE.add(s);
+                    } else {
+                        add.add(s);
+                    }
+                }
+            });
+            if (add != null && add.size() > 0) {
+                homeDiagnoseInfoServiceImpl.saveBatch(add);
+            }
+            if (updateE != null && updateE.size() > 0) {
+                updateE.forEach((e) -> {
+                    e.setGmtModified(new Date());
+                });
+                homeDiagnoseInfoServiceImpl.updateBatchById(updateE);
+            }
         }
     }
-	
-	public void executeDoctorAdvice() {
-		List<DoctorAdvice> doctorAdviceList=tzDBConn.getDoctorAdvice();
-		doctorAdviceServiceImpl.saveBatch(doctorAdviceList);
-	}
-	
-	public void executeMRType() {
-		List<MedRecordType> medRecordTypeList=tzDBConn.getMedicalRecordType();
-		medRecordTypeServiceImpl.saveBatch(medRecordTypeList);
-	}
-	
-	public void executeMrRecord() {
-		List<MedicalRecord> medicalRecordList=tzDBConn.getMedicalRecord();
-		medicalRecordServiceImpl.saveBatch(medicalRecordList);
-	}
-	
-	public void executeMrRecordContent() {
-		List<MedicalRecordContent> mrContentList=tzDBConn.getMedicalRecordContent();
-		medicalRecordContentServiceImpl.saveBatch(mrContentList);
-	}
-	
-	public void executeHomePage() {
-		List<HomePage> homePageList=tzDBConn.getHomePage();
-		List<String> behCodeList=Lists.newLinkedList();
-		behCodeList=homePageList.stream().map(e-> e.getBehospitalCode()).collect(Collectors.toList());
-		homePageServiceImpl.listByIds(behCodeList);
-		//homePageServiceImpl.saveBatch(homePageList);
-	}
-	
-	public void executeHomeOperation() {
-		List<HomeOperationInfo> homeOperationList=tzDBConn.getHomeOperation();
-		homeOperationInfoServiceImpl.saveBatch(homeOperationList);
-	}
-	
-	public void executeHomeDiagnose() {
-		List<HomeDiagnoseInfo> homeDiagnoseList=tzDBConn.getHomeDiagnose();
-		homeDiagnoseInfoServiceImpl.saveBatch(homeDiagnoseList);
-	}
-	
-	public static void main(String[] args) {
-		DataFacade dataFacade=new DataFacade();
-		dataFacade.executeHomePage();
-	}
 }

+ 0 - 5
src/main/java/com/diagbot/facade/HomeOperationInfoFacade.java

@@ -1,12 +1,7 @@
 package com.diagbot.facade;
 
-import com.diagbot.entity.HomeOperationInfo;
 import com.diagbot.service.impl.HomeOperationInfoServiceImpl;
-import com.diagbot.util.DBConn;
 
-import java.util.List;
-
-import com.diagbot.util.TZDBConn;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 

+ 16 - 0
src/main/java/com/diagbot/mapper/QcModelHospitalMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.QcModelHospital;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author gaodm
+ * @since 2020-05-08
+ */
+public interface QcModelHospitalMapper extends BaseMapper<QcModelHospital> {
+
+}

+ 16 - 0
src/main/java/com/diagbot/service/QcModelHospitalService.java

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.QcModelHospital;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2020-05-08
+ */
+public interface QcModelHospitalService extends IService<QcModelHospital> {
+
+}

+ 20 - 0
src/main/java/com/diagbot/service/impl/QcModelHospitalServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.QcModelHospital;
+import com.diagbot.mapper.QcModelHospitalMapper;
+import com.diagbot.service.QcModelHospitalService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2020-05-08
+ */
+@Service
+public class QcModelHospitalServiceImpl extends ServiceImpl<QcModelHospitalMapper, QcModelHospital> implements QcModelHospitalService {
+
+}

+ 0 - 1
src/main/java/com/diagbot/task/MedicalRecordContentTask.java

@@ -16,7 +16,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.entity.SysTaskCron;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.facade.DataFacade;
-import com.diagbot.facade.MedicalRecordContentFacade;
 import com.diagbot.facade.SysTaskCronFacade;
 import com.diagbot.util.StringUtil;
 

+ 13 - 16
src/main/java/com/diagbot/task/MedRecordTypeTask.java

@@ -1,8 +1,12 @@
 package com.diagbot.task;
 
-import java.time.LocalDateTime;
-import java.util.Date;
-
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.entity.SysTaskCron;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.DataFacade;
+import com.diagbot.facade.SysTaskCronFacade;
+import com.diagbot.util.StringUtil;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.scheduling.Trigger;
@@ -12,28 +16,21 @@ import org.springframework.scheduling.annotation.SchedulingConfigurer;
 import org.springframework.scheduling.config.ScheduledTaskRegistrar;
 import org.springframework.scheduling.support.CronTrigger;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.diagbot.entity.SysTaskCron;
-import com.diagbot.enums.IsDeleteEnum;
-import com.diagbot.facade.DataFacade;
-import com.diagbot.facade.MedicalRecordTypeFacade;
-import com.diagbot.facade.SysTaskCronFacade;
-import com.diagbot.util.StringUtil;
-
-import lombok.extern.slf4j.Slf4j;
+import java.time.LocalDateTime;
+import java.util.Date;
 
 @Configuration      //1.主要用于标记配置类,兼备Component的效果。
 @EnableScheduling   // 2.开启定时任务
 @Slf4j
-public class MedRecordTypeTask implements SchedulingConfigurer{
-	@Autowired
+public class MedicalRecordTypeTask implements SchedulingConfigurer {
+    @Autowired
     private SysTaskCronFacade sysTaskCronFacade;
 
     private SysTaskCron task001 = new SysTaskCron();
 
     @Autowired
-   	private DataFacade dataFacade;
-    
+    private DataFacade dataFacade;
+
     /**
      * 执行定时任务.
      */

+ 0 - 520
src/main/java/com/diagbot/util/DBConn.java

@@ -1,520 +0,0 @@
-package com.diagbot.util;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Date;
-import java.util.List;
-import java.util.ResourceBundle;
-
-import com.diagbot.entity.BasDeptInfo;
-import com.diagbot.entity.BasDoctorInfo;
-import com.diagbot.entity.BehospitalInfo;
-import com.diagbot.entity.DoctorAdvice;
-import com.diagbot.entity.HomeDiagnoseInfo;
-import com.diagbot.entity.HomeOperationInfo;
-import com.diagbot.entity.HomePage;
-import com.diagbot.entity.MedRecordType;
-import com.diagbot.entity.MedicalRecord;
-import com.diagbot.entity.MedicalRecordContent;
-import com.diagbot.vo.FBasDeptInfoVO;
-import com.diagbot.vo.FBasDoctorInfoVO;
-import com.diagbot.vo.FBehospitalInfoVO;
-import com.diagbot.vo.FDoctorAdviceVO;
-import com.diagbot.vo.FHomeDiagnoseVO;
-import com.diagbot.vo.FHomeOperationVO;
-import com.diagbot.vo.FHomePageVO;
-import com.diagbot.vo.FMedicalRecordContentVO;
-import com.diagbot.vo.FMedicalRecordTypeVO;
-import com.diagbot.vo.FMedicalRecordVO;
-import com.google.common.collect.Lists;
-
-public class DBConn {
-	
-	private static final String DRIVER = getValue("jdbc.driverClassName");
-    private static final String URL = getValue("jdbc.url");
-    private static final String USERNAME = getValue("jdbc.username");
-    private static final String PASSWORD = getValue("jdbc.password");
-    
-    private Connection connection = null;
-    private PreparedStatement sta = null;
-	private ResultSet rs = null;
-	
-	/**
-     * 读取属性文件中的信息
-     *
-     * @param key
-     * @return
-     */
-    private static String getValue(String key) {
-        // 资源包绑定
-        ResourceBundle bundle = ResourceBundle.getBundle("jdbc");
-        return bundle.getString(key);
-    }
-    
-    /**
-	 * 加载驱动程序
-	 */
-	static {
-		try {
-			Class.forName(DRIVER);
-		} catch (ClassNotFoundException e) {
-			e.printStackTrace();
-		}
-	}
-
-	/**
-	 * @return 连接对象
-	 */
-	public Connection getConnection() {
-		try {
-			connection = DriverManager.getConnection(URL,USERNAME,PASSWORD);
-		} catch (SQLException e) {
-
-			e.printStackTrace();
-		}
-		return connection;
-	}
-
-
-	/**
-	 * @param sql
-	 *            sql语句  增加,删除,修改
-	 * @param obj
-	 *            参数
-	 * @return
-	 */
-	public int update(String sql, Object... obj) {
-		int count = 0;
-		connection = getConnection();
-		try {
-			sta = connection.prepareStatement(sql);
-			if (obj != null) {
-				for (int i = 0; i < obj.length; i++) {
-					sta.setObject(i + 1, obj[i]);
-				}
-			}
-			count = sta.executeUpdate();
-		} catch (SQLException e) {
-			e.printStackTrace();
-		} finally{
-		
-			close();
-		}
-		return count;
-	}
-
-	/**
-	 * @param sql sql语句
-	 * @param obj 参数
-	 * @return 数据集合
-	 */
-	public ResultSet Query(String sql,Object...obj){
-		connection=getConnection();
-		try {
-			sta=connection.prepareStatement(sql);
-			if(obj!=null){
-				for(int i=0;i<obj.length;i++){
-					sta.setObject(i+1, obj[i]);
-				}
-			}
-			rs=sta.executeQuery();
-		} catch (SQLException e) {
-			e.printStackTrace();
-		}
-		return rs;
-	}
-	
-	/**
-	 * 关闭资源
-	 */
-	public void close() {
-		try {
-			if (rs != null) {
-				rs.close();
-			}
-		} catch (SQLException e) {
-			e.printStackTrace();
-		} finally {
-			try {
-				if (sta != null) {
-					sta.close();
-				}
-			} catch (SQLException e2) {
-				e2.printStackTrace();
-			} finally {
-				if (connection != null) {
-					try {
-						connection.close();
-					} catch (SQLException e) {
-						e.printStackTrace();
-					}
-				}
-			}
-		}
-	}
-	
-	/**
-	 * 医生信息
-	 * @return
-	 */
-	public static List<BasDoctorInfo> getBasDoctorInfo() {
-		List<BasDoctorInfo> basDoctorInfoList=Lists.newLinkedList();
-		
-		try {
-			DBConn dbconn=new DBConn();
-			String sql="select * from GI_USERINFO";
-			ResultSet rs =dbconn.Query(sql, null);
-			while(rs.next()){
-				FBasDoctorInfoVO basDoctorInfoVO=new FBasDoctorInfoVO();
-				basDoctorInfoVO.setDoctorId(rs.getString("YHRYBH"));//医生ID
-				basDoctorInfoVO.setHospitalId(Long.valueOf("1"));//医院ID
-				basDoctorInfoVO.setDeptId(rs.getString("ZZKSID"));//科室ID
-				basDoctorInfoVO.setName(rs.getString("YHRYMC"));//医生姓名
-				basDoctorInfoVO.setProfessor(rs.getString("YHRYZC"));//职称
-				
-				BasDoctorInfo basDoctorInfo=new BasDoctorInfo();
-				BeanUtil.copyProperties(basDoctorInfoVO, basDoctorInfo);
-				
-				basDoctorInfoList.add(basDoctorInfo);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		
-		return basDoctorInfoList;
-	}
-	
-	/**
-	 * 科室信息
-	 * @returnDeptInfo
-	 */
-	public static List<BasDeptInfo> getDeptInfo() {
-		List<BasDeptInfo> basDeptInfoList=Lists.newLinkedList();
-		
-		try {
-			DBConn dbconn=new DBConn();
-			String sql="select * from HI_DEPTINFO_CX where XGCZSJ BETWEEN TO_DATE('2020-03-01', 'yyyy-MM-dd') and TO_DATE('2020-03-30', 'yyyy-MM-dd')";
-			ResultSet rs =dbconn.Query(sql, null);
-			while(rs.next()){
-				FBasDeptInfoVO basDeptInfoVO=new FBasDeptInfoVO();
-				basDeptInfoVO.setDeptId(rs.getString("ZZKSID"));//科室编码
-				basDeptInfoVO.setHospitalId(Long.valueOf("1"));//医院ID
-				basDeptInfoVO.setDeptName(rs.getString("ZZKSMC"));//科室名称
-				basDeptInfoVO.setDeptType(rs.getString("ZZKSLB"));//科室类别
-				basDeptInfoVO.setSpell(rs.getString("HZSRM1"));//首字母拼音
-				basDeptInfoVO.setStation(rs.getString("FLKSID"));//区域类别
-				
-				BasDeptInfo basDeptInfo=new BasDeptInfo();
-				BeanUtil.copyProperties(basDeptInfoVO, basDeptInfo);
-				
-				basDeptInfoList.add(basDeptInfo);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		
-		return basDeptInfoList;
-	}
-	
-	/**
-	 * 从视图中获取医嘱信息
-	 * @return
-	 */
-	public static List<DoctorAdvice> getDoctorAdvice(){
-		List<DoctorAdvice> doctorAdviceList=Lists.newLinkedList();
-		
-		try {
-			DBConn dbconn=new DBConn();
-			String sql="select * from BR_DOCTADVICE_CX where CJCXRQ BETWEEN TO_DATE('2020-03-01', 'yyyy-MM-dd') and TO_DATE('2020-03-30', 'yyyy-MM-dd')";
-			ResultSet rs =dbconn.Query(sql, null);
-			while(rs.next()){
-				FDoctorAdviceVO doctorAdviceVO=new FDoctorAdviceVO();
-				doctorAdviceVO.setDoctorAdviceId(rs.getString("BRYZID"));//病人医嘱ID
-				doctorAdviceVO.setHospitalId(Long.valueOf("1"));//医院ID
-				doctorAdviceVO.setBehospitalCode(rs.getString("BRYZID"));//病人ID
-				doctorAdviceVO.setOrderDoctorName(rs.getString("YSKDPB"));//医生开单判别
-				doctorAdviceVO.setFrequency(rs.getString("YZPLPB"));//医嘱频率判别
-				doctorAdviceVO.setParentTypeId(rs.getString("FLYZID"));//父类医嘱ID
-				doctorAdviceVO.setDoctorAdviceType(rs.getString("YZLXPB"));//医嘱类型判别
-				doctorAdviceVO.setUsageNum(rs.getString("YCSYSL"));//一次使用数量
-				doctorAdviceVO.setUsageUnit(rs.getString("YCYLDW"));//一次用量单位
-				doctorAdviceVO.setDose(rs.getString("YZDCJL"));//医嘱单次剂量
-				doctorAdviceVO.setDoseUnit(rs.getString("DCJLDW"));//单次剂量单位
-				doctorAdviceVO.setMedModeType(rs.getString("GYFSID"));//给药方式
-				doctorAdviceVO.setDaFrequency(rs.getString("YZPLID"));//医嘱频率
-				doctorAdviceVO.setDaDealType(rs.getString("YZCLLX"));//医嘱处理类型
-				doctorAdviceVO.setDaStartDate(rs.getDate("YZKSSJ"));//医嘱开始时间
-				doctorAdviceVO.setDaItemName(rs.getString("YZXMMC"));//医嘱项目名称
-				doctorAdviceVO.setDaStatus(rs.getString("YZZTPB"));//医嘱状态判别
-				doctorAdviceVO.setDaStopDate(rs.getDate("YZJSSJ"));//医嘱结束时间
-				doctorAdviceVO.setDaGroupNo(rs.getString("YZTZXH"));//医嘱同组序号
-				doctorAdviceVO.setDaPrescriptionType(rs.getString("YZCFLX"));//医嘱处方类型
-				doctorAdviceVO.setDaMedType(rs.getString("YZLYLX"));//医嘱领药类型
-				doctorAdviceVO.setDoctorNotice(rs.getString("YSZTSM"));//医生嘱托
-				doctorAdviceVO.setDoctorId(rs.getString("KDYSID"));//开单医生ID
-				doctorAdviceVO.setDoctorName(rs.getString("KDYSXM"));//开单医生姓名
-				
-				//doctorAdviceVO.set
-				
-				DoctorAdvice doctorAdvice=new DoctorAdvice();
-				BeanUtil.copyProperties(doctorAdviceVO, doctorAdvice);
-				
-				doctorAdviceList.add(doctorAdvice);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return doctorAdviceList;
-	}
-
-	/**
-	 * 获取病历信息
-	 * @return
-	 */
-	public static List<BehospitalInfo> getBehospitalInfo() {
-		List<BehospitalInfo> behospitalInfoList=Lists.newLinkedList();
-		try {
-			DBConn dbconn=new DBConn();
-			String sql="select * from BR_INPATIENTINFO_CX where CJCXRQ BETWEEN TO_DATE('2020-01-01', 'yyyy-MM-dd') and TO_DATE('2020-01-20', 'yyyy-MM-dd')";
-			ResultSet rs =dbconn.Query(sql, null);
-			while(rs.next()){
-				FBehospitalInfoVO behospitalInfoVO=new FBehospitalInfoVO();
-				behospitalInfoVO.setBehospitalCode(rs.getString("BRZYID"));//病人住院ID
-				behospitalInfoVO.setHospitalId("1");//医院ID
-				behospitalInfoVO.setName(rs.getString("BRDAXM"));//姓名
-				behospitalInfoVO.setSex(rs.getString("BRDAXB"));//性别
-				behospitalInfoVO.setBirthday(rs.getDate("BRCSRQ"));//出生日期
-				behospitalInfoVO.setFileCode(rs.getString("BRDABH"));//档案号
-				behospitalInfoVO.setWardCode(rs.getString("ZYBQID"));//病区编码
-				behospitalInfoVO.setWardName(rs.getString("ZYBQMC"));//病区名称
-				behospitalInfoVO.setBehDeptId(rs.getString("ZYKSID"));//住院科室ID
-				behospitalInfoVO.setBehDeptName(rs.getString("ZYKSMC"));//住院科室名称
-				behospitalInfoVO.setBedCode(rs.getString("ZYCWID"));//床位号
-				behospitalInfoVO.setBedName(rs.getString("ZYCWHM"));//床位名称
-				behospitalInfoVO.setInsuranceName(rs.getString("BRLBID"));//医保类别
-				behospitalInfoVO.setJobType(rs.getString("BRXZID"));//职业
-				behospitalInfoVO.setBehospitalDate(rs.getDate("BRRYRQ"));//入院时间
-				behospitalInfoVO.setLeaveHospitalDate(rs.getDate("BRCYRQ"));//出院时间
-				behospitalInfoVO.setDiagnoseIcd(rs.getString("JBDMID"));//疾病ICD编码
-				behospitalInfoVO.setDiagnose(rs.getString("JBMSXX"));//疾病名称
-				behospitalInfoVO.setDoctorId(rs.getString("ZZYSID"));//医生ID
-				behospitalInfoVO.setDoctorName(rs.getString("ZZYSXM"));//医生姓名
-				
-				behospitalInfoVO.setGmtCreate(new Date());
-				
-				BehospitalInfo behospitalInfo=new BehospitalInfo();
-				BeanUtil.copyProperties(behospitalInfoVO, behospitalInfo);
-				behospitalInfoList.add(behospitalInfo);
-				
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		
-		return behospitalInfoList;
-	}
-	
-	/**
-	 * 从视图获取病案首页信息
-	 */
-	public static List<HomePage> getHomePage() {
-		List<HomePage> homePageList=Lists.newLinkedList();
-		try {
-			DBConn dbconn=new DBConn();
-			String sql="select * from BR_RECHOME_CX where BAZKRQ BETWEEN TO_DATE('2020-01-01', 'yyyy-MM-dd') and TO_DATE('2020-01-01', 'yyyy-MM-dd')";
-			ResultSet rs =dbconn.Query(sql, null);
-			while(rs.next()){
-				FHomePageVO homePageVO=new FHomePageVO();
-				homePageVO.setHomePageId(rs.getString("BASYID"));//病案首页ID
-				homePageVO.setHospitalId(Long.valueOf("1"));//医院ID
-				homePageVO.setBehospitalCode(rs.getString("BRZYID"));//病人住院序号
-				homePageVO.setHospitalCode(rs.getString("ZZJGID"));//组织机构id
-				homePageVO.setHospitalName(rs.getString("ZZJGMC"));//医疗机构名称
-				homePageVO.setOrgCode(rs.getString("ZZJGBH"));//医疗机构代码
-				homePageVO.setPayType(rs.getString("YLFKLB"));//医疗付费方式
-				homePageVO.setHealthCard(rs.getString("BRJKKH"));//健康卡号
-				homePageVO.setBehospitalNum(rs.getString("BRZYCS"));//住院次数
-				homePageVO.setFileCode(rs.getString("BRBABH"));//病案号
-				homePageVO.setName(rs.getString("BRBAXM"));//姓名
-				homePageVO.setSex(rs.getString("BRBAXB"));//性别
-				homePageVO.setBirthday(rs.getDate("BRCSRQ"));//出生日期
-				
-				homePageVO.setGmtCreate(new Date());
-				
-				HomePage homePage=new HomePage();
-				BeanUtil.copyProperties(homePageVO, homePage);
-				homePageList.add(homePage);
-				
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return homePageList;
-	}
-	
-	/**
-	 * 从视图中获取文书类型
-	 * @return
-	 */
-	public static List<MedicalRecord> getMedicalRecord(){
-		List<FMedicalRecordVO> medicalRecordVOList=Lists.newLinkedList();
-		try {
-			DBConn dbconn=new DBConn();
-			String sql="select * from MR_MEDICALRECORDS_CX where BCJLSJ BETWEEN TO_DATE('2020-02-01', 'yyyy-MM-dd') and TO_DATE('2020-04-30', 'yyyy-MM-dd')";
-			ResultSet rs =dbconn.Query(sql, null);
-			while(rs.next()){
-				FMedicalRecordVO medicalRecordVO=new FMedicalRecordVO();
-				medicalRecordVO.setRecId(rs.getString("BLCJID"));
-				medicalRecordVO.setHospitalId(Long.valueOf("1"));//医院ID
-				medicalRecordVO.setBehospitalCode(rs.getString("BRZYID"));//病人住院ID
-				medicalRecordVO.setOrgCode(rs.getString("ZZJGDM"));//组织机构代码
-				medicalRecordVO.setRecTypeId(rs.getString("BLLBID"));//病历类别编号
-				medicalRecordVO.setRecDate(rs.getString("BCJLSJ"));//病历日期
-				medicalRecordVO.setRecTitle(rs.getString("BCJLMC"));//病历标题
-				
-				medicalRecordVO.setGmtCreate(new Date());
-				
-				medicalRecordVOList.add(medicalRecordVO);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		
-		List<MedicalRecord> medicalRecordList=BeanUtil.listCopyTo(medicalRecordVOList, MedicalRecord.class);
-		return medicalRecordList;
-	}
-	
-	/**
-	 * 从视图中获取文书内容
-	 * @return
-	 */
-	public static List<MedicalRecordContent> getMedicalRecordContent(){
-		List<FMedicalRecordContentVO> mrContentVOList=Lists.newLinkedList();
-		try {
-			DBConn dbconn=new DBConn();
-			String sql="select * from MR_MRCONTENT_CX where CJCXRQ BETWEEN TO_DATE('2020-02-01', 'yyyy-MM-dd') and TO_DATE('2020-02-20', 'yyyy-MM-dd')";
-			ResultSet rs =dbconn.Query(sql, null);
-			while(rs.next()){
-				FMedicalRecordContentVO mrContentVO=new FMedicalRecordContentVO();
-				//oracle.sql.BLOB blob = (oracle.sql.BLOB)rs.getBlob("BLJLNR");
-				//mrContentVO.setContentBlob(blob);
-				mrContentVO.setHospitalId(Long.valueOf("1"));
-				mrContentVO.setRecId(rs.getString("BLJLID"));
-				
-				mrContentVO.setGmtCreate(new Date());
-				mrContentVOList.add(mrContentVO);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		List<MedicalRecordContent> mrContentList=BeanUtil.listCopyTo(mrContentVOList, MedicalRecordContent.class);
-		return mrContentList;
-	}
-	
-	/**
-	 * 从视图中获取文书类型
-	 * @return
-	 */
-	public static List<MedRecordType> getMedicalRecordType(){
-		List<FMedicalRecordTypeVO> mrTypeVOList=Lists.newLinkedList();
-		try {
-			DBConn dbconn=new DBConn();
-			String sql="select * from AR_MEDIRECCLASS_CX";
-			ResultSet rs =dbconn.Query(sql, null);
-			while(rs.next()){
-				FMedicalRecordTypeVO mrTypeVO=new FMedicalRecordTypeVO();
-				mrTypeVO.setTypeId(rs.getString("BLLBID"));
-				mrTypeVO.setHospitalId(Long.valueOf("1"));
-				mrTypeVO.setTypeName(rs.getString("BLLBMC"));
-				mrTypeVO.setObjName(rs.getString("BLLBFW"));
-				mrTypeVO.setSpell(rs.getString("HZSRM1"));
-				mrTypeVOList.add(mrTypeVO);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		
-		List<MedRecordType> medicalRecordTypeList=BeanUtil.listCopyTo(mrTypeVOList, MedRecordType.class);
-		return medicalRecordTypeList;
-	}
-	
-	/**
-	 * 病案诊断
-	 * @return
-	 */
-	public static List<HomeDiagnoseInfo> getHomeDiagnose(){
-		List<HomeDiagnoseInfo> homeDiagnoseVOList=Lists.newLinkedList();
-		try {
-			DBConn dbconn=new DBConn();
-			String sql="select * from BR_RECDIAGNOSE_CX where CJCXRQ BETWEEN TO_DATE('2020-02-01', 'yyyy-MM-dd') and TO_DATE('2020-04-30', 'yyyy-MM-dd')";
-			ResultSet rs =dbconn.Query(sql, null);
-			while(rs.next()){
-				FHomeDiagnoseVO homeDiagnoseVO=new FHomeDiagnoseVO();
-				homeDiagnoseVO.setHomePageId(rs.getString("BASYID"));//病案首页ID
-				homeDiagnoseVO.setHospitalId(Long.valueOf("1"));//医院ID
-				homeDiagnoseVO.setDiagnoseOrderNo(rs.getString("BAZDXH"));//诊断序号
-				homeDiagnoseVO.setDiagnoseType(rs.getString("ZDLBDM"));//诊断类别
-				homeDiagnoseVO.setDiagnoseTypeShort(rs.getString("ZCZDPB"));//诊断判别
-				homeDiagnoseVO.setDiagnoseName(rs.getString("ZDJBMC"));//诊断名称
-				homeDiagnoseVO.setBehospitalType(rs.getString("ZGQKDM"));//入院情况
-				homeDiagnoseVO.setLeaveHospitalType(rs.getString("RYQKBM"));//出院情况
-				//homeDiagnoseVO.setPathologyDiagnose(rs.getString("BASYID"));//病理号
-				homeDiagnoseVO.setIcdCode(rs.getString("ICDM"));//诊断编码
-				
-				homeDiagnoseVO.setGmtCreate(new Date());
-				
-				HomeDiagnoseInfo homeDiagnoseInfo=new HomeDiagnoseInfo();
-				BeanUtil.copyProperties(homeDiagnoseVO, homeDiagnoseInfo);
-				homeDiagnoseVOList.add(homeDiagnoseInfo);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		
-		return homeDiagnoseVOList;
-	}
-	
-	/**
-	 * 病案手术
-	 * @return
-	 */
-	public static List<HomeOperationInfo> getHomeOperation() {
-		List<FHomeOperationVO> homeOperationVOList=Lists.newLinkedList();
-		try {
-			DBConn dbconn=new DBConn();
-			String sql="select * from BR_RECOPERATION_CX where CJCXRQ BETWEEN TO_DATE('2020-02-01', 'yyyy-MM-dd') and TO_DATE('2020-04-30', 'yyyy-MM-dd')";
-			ResultSet rs =dbconn.Query(sql, null);
-			while(rs.next()){
-				FHomeOperationVO homeOperationVO=new FHomeOperationVO();
-				homeOperationVO.setHomePageId(rs.getString("BASYID"));//病案首页ID
-				homeOperationVO.setHospitalId(Long.valueOf("1"));//医院ID
-				homeOperationVO.setOperationOrderNo(rs.getString("BRSSXH"));//手术序号
-				homeOperationVO.setOperationDate(rs.getDate("BRSSRQ"));//手术日期
-				homeOperationVO.setOperationCode(rs.getString("SSDMID"));//手术编码
-				homeOperationVO.setOperationDoctorId(rs.getString("SSYSID"));//手术医生
-				homeOperationVO.setFirstAssistantId(rs.getString("YZHSID"));//一助医生
-				homeOperationVO.setSecondAssistantId(rs.getString("EZHSID"));//二助医生
-				homeOperationVO.setCutLevel(rs.getString("QKDJDM"));//切口等级
-				homeOperationVO.setHealingLevel(rs.getString("YHDJDM"));//愈合等级
-				homeOperationVO.setOperationName(rs.getString("BRSSMC"));//手术名称
-				homeOperationVO.setOperationLevel(rs.getString("SSJBID"));//手术级别
-				homeOperationVO.setAnaesthesiaName(rs.getString("MZFFMC"));//麻醉方式
-				homeOperationVO.setShamOperationName(rs.getString("NSSMC"));//拟手术名称
-				homeOperationVO.setGmtCreate(new Date());
-				
-				homeOperationVOList.add(homeOperationVO);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		List<HomeOperationInfo> homeOperationList=BeanUtil.listCopyTo(homeOperationVOList, HomeOperationInfo.class);
-		return homeOperationList;
-	}
-	
-	public static void main(String[] args) throws Exception {
-		
-	}
-}

+ 200 - 98
src/main/java/com/diagbot/util/TZDBConn.java

@@ -21,16 +21,6 @@ import com.diagbot.entity.HomePage;
 import com.diagbot.entity.MedRecordType;
 import com.diagbot.entity.MedicalRecord;
 import com.diagbot.entity.MedicalRecordContent;
-import com.diagbot.vo.FBasDeptInfoVO;
-import com.diagbot.vo.FBasDoctorInfoVO;
-import com.diagbot.vo.FBehospitalInfoVO;
-import com.diagbot.vo.FDoctorAdviceVO;
-import com.diagbot.vo.FHomeDiagnoseVO;
-import com.diagbot.vo.FHomeOperationVO;
-import com.diagbot.vo.FHomePageVO;
-import com.diagbot.vo.FMedicalRecordContentVO;
-import com.diagbot.vo.FMedicalRecordTypeVO;
-import com.diagbot.vo.FMedicalRecordVO;
 import com.google.common.collect.Lists;
 
 public class TZDBConn {
@@ -136,19 +126,16 @@ public class TZDBConn {
 		List<BasDoctorInfo> basDoctorInfoList=Lists.newLinkedList();
 		TZDBConn dbconn=new TZDBConn();
 		try {
-			String sql="select * from gi_userinfo where CJCXRQ BETWEEN TO_DATE('2020-03-01', 'yyyy-MM-dd') and TO_DATE('2020-03-30', 'yyyy-MM-dd')";
+			String sql="select * from gi_userinfo";
 			rs =dbconn.Query(sql, null);
 			while(rs.next()){
-				FBasDoctorInfoVO basDoctorInfoVO=new FBasDoctorInfoVO();
-				basDoctorInfoVO.setDoctorId(rs.getString("YHRYBH"));//医生ID
-				basDoctorInfoVO.setHospitalId(Long.valueOf("3"));//医院ID
-				//basDoctorInfoVO.setDeptId(rs.getString("ZZKSID"));//科室ID
-				basDoctorInfoVO.setName(rs.getString("YHRYMC"));//医生姓名
-				basDoctorInfoVO.setProfessor(rs.getString("YHRYZC"));//职称
-				
 				BasDoctorInfo basDoctorInfo=new BasDoctorInfo();
-				BeanUtil.copyProperties(basDoctorInfoVO, basDoctorInfo);
-				
+				basDoctorInfo.setDoctorId(rs.getString("YHRYBH"));//医生ID
+				basDoctorInfo.setHospitalId(Long.valueOf("3"));//医院ID
+				//basDoctorInfoVO.setDeptId(rs.getString("ZZKSID"));//科室ID
+				basDoctorInfo.setName(rs.getString("YHRYMC"));//医生姓名
+				basDoctorInfo.setProfessor(rs.getString("YHRYZC"));//职称
+
 				basDoctorInfoList.add(basDoctorInfo);
 			}
 		} catch (Exception e) {
@@ -166,20 +153,17 @@ public class TZDBConn {
 		List<BasDeptInfo> basDeptInfoList=Lists.newLinkedList();
 		try {
 			TZDBConn dbconn=new TZDBConn();
-			String sql="select * from hi_deptinfo";
+			String sql="select * from hi_deptinfo where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
 			ResultSet rs =dbconn.Query(sql, null);
 			while(rs.next()){
-				FBasDeptInfoVO basDeptInfoVO=new FBasDeptInfoVO();
-				basDeptInfoVO.setDeptId(rs.getString("ZZKSDM"));//科室编码
-				basDeptInfoVO.setHospitalId(Long.valueOf("3"));//医院ID
-				basDeptInfoVO.setDeptName(rs.getString("ZZKSMC"));//科室名称
+				BasDeptInfo basDeptInfo=new BasDeptInfo();
+				basDeptInfo.setDeptId(rs.getString("ZZKSDM"));//科室编码
+				basDeptInfo.setHospitalId(Long.valueOf("3"));//医院ID
+				basDeptInfo.setDeptName(rs.getString("ZZKSMC"));//科室名称
 				//basDeptInfoVO.setDeptType(rs.getString("ZZKSLB"));//科室类别
-				basDeptInfoVO.setSpell(rs.getString("HZSRM1"));//首字母拼音
+				basDeptInfo.setSpell(rs.getString("HZSRM1"));//首字母拼音
 				//basDeptInfoVO.setStation(rs.getString("FLKSID"));//区域类别
-				
-				BasDeptInfo basDeptInfo=new BasDeptInfo();
-				BeanUtil.copyProperties(basDeptInfoVO, basDeptInfo);
-				
+
 				basDeptInfoList.add(basDeptInfo);
 			}
 		} catch (Exception e) {
@@ -195,28 +179,24 @@ public class TZDBConn {
 	public List<HomeDiagnoseInfo> getHomeDiagnose(){
 		List<HomeDiagnoseInfo> homeDiagnoseVOList=Lists.newLinkedList();
 		try {
-			DBConn dbconn=new DBConn();
+			TZDBConn dbconn=new TZDBConn();
 			//String sql="select * from br_recdiagnose where CJCXRQ BETWEEN TO_DATE('2020-02-01', 'yyyy-MM-dd') and TO_DATE('2020-04-30', 'yyyy-MM-dd')";
-			String sql="select * from br_recdiagnose where BASYID IN (select BASYID from br_rechome WHERE BRZYID IN (select BRZYID from br_inpatientinfo where ZYKSID IN('1020500','1009100','1030200')))";
+			String sql="select * from br_recdiagnose where BASYID in (select BASYID from br_rechome where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate())";//今年的数据
 			ResultSet rs =dbconn.Query(sql, null);
 			while(rs.next()){
-				FHomeDiagnoseVO homeDiagnoseVO=new FHomeDiagnoseVO();
-				homeDiagnoseVO.setHomePageId(rs.getString("BASYID"));//病案首页ID
-				homeDiagnoseVO.setHospitalId(Long.valueOf("3"));//医院ID
-				homeDiagnoseVO.setDiagnoseOrderNo(rs.getString("BAZDXH"));//诊断序号
-				homeDiagnoseVO.setDiagnoseName(rs.getString("ZDJBMC"));//诊断名称
-				homeDiagnoseVO.setDiagnoseType(rs.getString("ZDLBDM"));//诊断类别
-				homeDiagnoseVO.setDiagnoseTypeShort(rs.getString("ZCZDPB"));//诊断判别
-				homeDiagnoseVO.setBehospitalType(rs.getString("RYQKBM"));//入院情况
+				HomeDiagnoseInfo homeDiagnose=new HomeDiagnoseInfo();
+				homeDiagnose.setHomePageId(rs.getString("BASYID"));//病案首页ID
+				homeDiagnose.setHospitalId(Long.valueOf("3"));//医院ID
+				homeDiagnose.setDiagnoseOrderNo(rs.getString("BAZDXH"));//诊断序号
+				homeDiagnose.setDiagnoseName(rs.getString("ZDJBMC"));//诊断名称
+				homeDiagnose.setDiagnoseType(rs.getString("ZDLBDM"));//诊断类别
+				homeDiagnose.setDiagnoseTypeShort(rs.getString("ZCZDPB"));//诊断判别
+				homeDiagnose.setBehospitalType(rs.getString("RYQKBM"));//入院情况
 				//homeDiagnoseVO.setLeaveHospitalType(rs.getString("RYQKBM"));//出院情况
 				//homeDiagnoseVO.setPathologyDiagnose(rs.getString("BASYID"));//病理号
-				homeDiagnoseVO.setIcdCode(rs.getString("ICDM"));//诊断编码
-				
-				homeDiagnoseVO.setGmtCreate(new Date());
-				
-				HomeDiagnoseInfo homeDiagnoseInfo=new HomeDiagnoseInfo();
-				BeanUtil.copyProperties(homeDiagnoseVO, homeDiagnoseInfo);
-				homeDiagnoseVOList.add(homeDiagnoseInfo);
+				homeDiagnose.setIcdCode(rs.getString("ICDM"));//诊断编码
+				homeDiagnose.setGmtCreate(new Date());
+				homeDiagnoseVOList.add(homeDiagnose);
 			}
 		} catch (Exception e) {
 			e.printStackTrace();
@@ -230,14 +210,16 @@ public class TZDBConn {
 	 * @return
 	 */
 	public List<HomeOperationInfo> getHomeOperation() {
-		List<FHomeOperationVO> homeOperationVOList=Lists.newLinkedList();
+		List<HomeOperationInfo> homeOperationVOList=Lists.newLinkedList();
 		try {
-			DBConn dbconn=new DBConn();
+			TZDBConn dbconn=new TZDBConn();
 			//String sql="select * from br_recoperation where CJCXRQ BETWEEN TO_DATE('2020-02-01', 'yyyy-MM-dd') and TO_DATE('2020-04-30', 'yyyy-MM-dd')";
-			String sql="select * from br_recoperation where BASYID IN (select BASYID from br_rechome WHERE BRZYID IN (select BRZYID from br_inpatientinfo where ZYKSID IN('1020500','1009100','1030200')))";
+			//String sql="select * from br_recoperation where BASYID IN (select BASYID from br_rechome WHERE BRZYID IN (select BRZYID from br_inpatientinfo where ZYKSID IN('1020500','1009100','1030200')))";
+			String sql="select * from br_recoperation where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
+			//String sql="select * from br_recoperation where BASYID in (select BASYID from br_rechome where DateDiff(dd,CJCXRQ,getdate())=1)";
 			ResultSet rs =dbconn.Query(sql, null);
 			while(rs.next()){
-				FHomeOperationVO homeOperationVO=new FHomeOperationVO();
+				HomeOperationInfo homeOperationVO=new HomeOperationInfo();
 				homeOperationVO.setHomePageId(rs.getString("BASYID"));//病案首页ID
 				homeOperationVO.setHospitalId(Long.valueOf("3"));//医院ID
 				homeOperationVO.setOperationOrderNo(rs.getString("BRSSXH"));//手术序号
@@ -265,18 +247,149 @@ public class TZDBConn {
 	
 	/**
 	 * 从视图获取病案首页信息
+	 * 获取近几个月的数据
 	 */
 	public List<HomePage> getHomePage() {
 		List<HomePage> homePageList=Lists.newLinkedList();
 		try {
-			DBConn dbconn=new DBConn();
+			TZDBConn dbconn=new TZDBConn();
 			//String sql="select * from br_rechome WHERE DateDiff(dd,CJCXRQ,getdate())>120 AND DateDiff(dd,CJCXRQ,getdate())<=200 AND RYKSID IN('1040200','1050000') and BRZYID IN (select top 2000 BRZYID from br_inpatientinfo where ZYKSID IN('1040200','1050000') order by CJCXRQ desc) ORDER BY CJCXRQ DESC";
 			//String sql="select top 500 * from br_rechome WHERE RYKSID in ('1020500','1009100','1030200') and BRZYID is not NULL ORDER BY CJCXRQ DESC";
 			//String sql="select * from br_rechome WHERE RYKSID in ('1020500','1009100','1030200') and BRZYID is not NULL AND DATEDIFF([month],CJCXRQ,getdate())=6 ORDER BY CJCXRQ desc ";
-			String sql="select * from br_rechome WHERE RYKSID in ('1020500','1009100','1030200') and BRZYID is not NULL AND DATEDIFF([month],CJCXRQ,getdate())=0 ORDER BY CJCXRQ desc ";
+			//String sql="select * from br_rechome WHERE BRZYID is not NULL";
+			//String sql="select * from br_rechome where DateDiff(dd,CJCXRQ,getdate())=1";
+			String sql="select * from br_rechome where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
 			ResultSet rs =dbconn.Query(sql, null);
 			while(rs.next()){
-				FHomePageVO homePageVO=new FHomePageVO();
+				HomePage homePageVO=new HomePage();
+				homePageVO.setHomePageId(rs.getString("BASYID"));//病案首页ID
+				homePageVO.setHospitalId(Long.valueOf("3"));//医院ID
+				homePageVO.setBehospitalCode(rs.getString("BRZYID"));//病人住院序号
+				homePageVO.setHospitalCode(rs.getString("ZZJGID"));//组织机构id
+				homePageVO.setHospitalName(rs.getString("ZZJGMC"));//医疗机构名称
+				homePageVO.setOrgCode(rs.getString("ZZJGBH"));//医疗机构代码
+				homePageVO.setPayType(rs.getString("YLFKLB"));//医疗付费方式
+				homePageVO.setHealthCard(rs.getString("BRJKKH"));//健康卡号
+				homePageVO.setBehospitalNum(rs.getString("BRZYCS"));//住院次数
+				homePageVO.setFileCode(rs.getString("BRBABH"));//病案号
+				homePageVO.setName(rs.getString("BRBAXM"));//姓名
+				homePageVO.setSex(rs.getString("BRBAXB"));//性别
+				homePageVO.setBirthday(rs.getDate("BRCSRQ"));//出生日期
+				homePageVO.setAge(rs.getString("BRDQNL"));//病人年龄
+				homePageVO.setAgeUnit(rs.getString("BRNLDW"));//年龄单位
+				homePageVO.setNationality(rs.getString("BRBAGJ"));//国籍
+				homePageVO.setNewbornMonth(rs.getString("YENLYS"));//新生儿出生月数
+				homePageVO.setNewbornDay(rs.getString("YENLTS"));//新生儿出生天数
+				homePageVO.setNewbornWeight(rs.getString("YECSTZ"));//新生儿出生体重
+				homePageVO.setNewbornBehospitalWeight(rs.getString("YERYTZ"));//新生儿入院体重
+				homePageVO.setBornAddress(rs.getString("BRCSDZ"));//出生地
+				homePageVO.setBornPlace(rs.getString("BRBAJG"));//籍贯
+				homePageVO.setNation(rs.getString("BRBAMZ"));//民族
+				homePageVO.setIdentityCardNo(rs.getString("BRSFZH"));//身份证号
+				homePageVO.setJobType(rs.getString("BRBASF"));//职业
+				homePageVO.setMarriage(rs.getString("BRHYZK"));//婚姻
+				homePageVO.setCurAddress(rs.getString("BRLXDZ"));//现住址
+				homePageVO.setCurPhone(rs.getString("BRLXDH"));//现住址电话
+				homePageVO.setCurPostCode(rs.getString("LXDZYB"));//现住址邮编
+				homePageVO.setResidenceAddress(rs.getString("BRHKDZ"));//户口地址
+				homePageVO.setResidencePostCode(rs.getString("HKDZYB"));//户口地址邮编
+				homePageVO.setWorkAddress(rs.getString("GZDWMC"));//工作单位
+				homePageVO.setWorkPhone(rs.getString("GZDWDH"));//工作单位电话
+				homePageVO.setWorkPostCode(rs.getString("GZDWYB"));//工作单位邮编
+				homePageVO.setContactName(rs.getString("LXRYXM"));//联系人姓名
+				homePageVO.setContactRelation(rs.getString("LXRYGX"));//联系人关系
+				homePageVO.setContactAddress(rs.getString("LXRYDZ"));//联系人地址
+				homePageVO.setContactPhone(rs.getString("LXRYDH"));//联系人电话
+				homePageVO.setBehospitalWay(rs.getString("RYLYDM"));//入院途径
+				homePageVO.setBehospitalDate(rs.getDate("BRRYRQ"));//入院时间
+				homePageVO.setBehospitalDept(rs.getString("RYKSID"));//入院科室
+				homePageVO.setBehospitalWard(rs.getString("RYBQID"));//入院病房
+				homePageVO.setBehospitalBedId(rs.getString("RYCWID"));//入院床位序号
+				homePageVO.setBehospitalBedCode(rs.getString("RYCWHM"));//入院床位号码
+				homePageVO.setChangeDept(rs.getString("BRZKKB"));//转科科别
+				homePageVO.setLeaveHospitalDate(rs.getDate("BRCYRQ"));//出院时间
+				homePageVO.setLeaveHospitalDept(rs.getString("CYKSID"));//出院科别
+				homePageVO.setLeaveHospitalWard(rs.getString("CYBQID"));//出院病房
+				homePageVO.setLeaveHospitalBedId(rs.getString("CYCWID"));//出院床位序号
+				homePageVO.setLeaveHospitalBedCode(rs.getString("CYCWHM"));//出院床位号码
+				homePageVO.setBehospitalDayNum(rs.getString("SJZYTS"));//实际住院天数
+				homePageVO.setOutpatientEmrDiagnose(rs.getString("BRMZZD"));//门急诊诊断
+				homePageVO.setOutpatientEmrDiagnoseCode(rs.getString("MZZDDM"));//门急诊诊断编码
+				homePageVO.setPoisonFactor(rs.getString("SSZDYSMC"));//损伤中毒因素
+				homePageVO.setPoisonFactorCode(rs.getString("SSZDYSBM"));//损伤中毒因素编码
+				homePageVO.setPathologyDiagnose(rs.getString("BLZDMC"));//病理诊断
+				homePageVO.setPathologyDiagnoseCode(rs.getString("BLZDBM"));//病理诊断编码
+				homePageVO.setPathologyDiagnoseId(rs.getString("BLZDBH"));//病理诊断编号
+				homePageVO.setIsMedAllergy(rs.getString("YWYWGM"));//药物过敏
+				homePageVO.setMedAllergyName(rs.getString("BRGMYW"));//过敏药物
+				homePageVO.setAutopsy(rs.getString("BRSFSJ"));//死亡患者尸检
+				homePageVO.setBloodType(rs.getString("BRBAXX"));//血型
+				homePageVO.setRh(rs.getString("BRBARH"));//Rh
+				homePageVO.setDeptDirector(rs.getString("KZR"));//科主任
+				homePageVO.setDirectorDoctor(rs.getString("ZRYS"));//主任医师
+				homePageVO.setAttendingDoctor(rs.getString("ZZYS"));//主治医师
+				homePageVO.setBehospitalDoctor(rs.getString("ZYYS"));//住院医师
+				homePageVO.setResponseNurse(rs.getString("ZRHS"));//责任护士
+				homePageVO.setStudyDoctor(rs.getString("JXYS"));//进修医师
+				homePageVO.setPracticeDoctor(rs.getString("SXYS"));//实习医师
+				homePageVO.setEncodeMan(rs.getString("BMY"));//编码员
+				homePageVO.setHomePageQuality(rs.getString("BRBAZL"));//病案质量
+				homePageVO.setQcDoctor(rs.getString("BAZKYS"));//质控医师
+				homePageVO.setQcNurse(rs.getString("BAZKHS"));//质控护士
+				if(!"".equals(rs.getString("BAZKRQ"))){
+					homePageVO.setQcDate(DateUtil.parseDate(rs.getString("BAZKRQ"),DateUtil.DATE_TIME_FORMAT));//质控日期
+				}
+				homePageVO.setLeaveHospitalType(rs.getString("BRLYFS"));//离院方式
+				homePageVO.setAcceptOrgCode(rs.getString("ZYJGMC"));//接收机构名称
+				homePageVO.setAgainBehospitalPlan(rs.getString("SSYZZY"));//31天内再住院计划
+				homePageVO.setAgainBehospitalGoal(rs.getString("SSYZZYMD"));//再住院目的
+				homePageVO.setTbiBeforeDay(rs.getString("RYQHMTS"));//颅脑损伤患者昏迷前天数
+				homePageVO.setTbiBeforeHour(rs.getString("RYQHMXS"));//颅脑损伤患者昏迷前小时
+				homePageVO.setTbiBeforeMinute(rs.getString("RYQHMFZ"));//颅脑损伤患者昏迷前分钟
+				homePageVO.setTbiAfterDay(rs.getString("RYQHMFZ"));//颅脑损伤患者昏迷后天数
+				homePageVO.setTbiAfterHour(rs.getString("RYHHMXS"));//颅脑损伤患者昏迷后小时
+				homePageVO.setTbiAfterMinute(rs.getString("RYQHMFZ"));//颅脑损伤患者昏迷后分钟
+				homePageVO.setTotalFee(rs.getString("ZFY"));//总费用
+				homePageVO.setOwnFee(rs.getString("ZFJE"));//自付金额
+				homePageVO.setGeneralFee(rs.getString("YBYLFWF"));//一般医疗服务费
+				homePageVO.setServiceFee(rs.getString("YBZLCZF"));//一般治疗服务费
+				homePageVO.setNurseFee(rs.getString("HLF"));//护理费
+				//homePageVO.setOtherFee(rs.getString("QTFY"));//其他费用
+				homePageVO.setPathologyFee(rs.getString("BLZDF"));//病理诊断费
+				homePageVO.setLabFee(rs.getString("SYSZDF"));//实验室诊断费
+				homePageVO.setPacsFee(rs.getString("YXXZDF"));//影像学诊断费
+				homePageVO.setClinicDiagnoseFee(rs.getString("LCZDXMF"));//临床诊断项目费
+				homePageVO.setNotOperationFee(rs.getString("FSSZLXMF"));//非手术治疗项目费
+				homePageVO.setClinicPhysicFee(rs.getString("LCWLZLF"));//临床物理治疗费
+				homePageVO.setOperationTreatFee(rs.getString("SSZLF"));//手术治疗费
+				homePageVO.setAnaesthesiaFee(rs.getString("MZF"));//麻醉费
+				homePageVO.setOperationFee(rs.getString("SSF"));//手术费
+				homePageVO.setHealthTypeFee(rs.getString("KFF"));//康复类
+				homePageVO.setChnTreatFee(rs.getString("ZYZLF"));//中医治疗费
+				homePageVO.setWesternMedFee(rs.getString("XYF"));//西药费
+				homePageVO.setAntibiosisFee(rs.getString("KJYWF"));//抗菌药物费用
+				homePageVO.setChnMedFee(rs.getString("ZCYF"));//中成药费
+				homePageVO.setChnHerbFee(rs.getString("CYF"));//中草药费
+				homePageVO.setBloodFee(rs.getString("XF"));//血费
+				homePageVO.setAlbumenFee(rs.getString("BDBLZPF"));//白蛋白类制品费
+				homePageVO.setGlobulinFee(rs.getString("QDBLZPF"));//球蛋白类制品费
+				homePageVO.setBloodFactorFee(rs.getString("NXYZLZPF"));//凝血因子类制品费
+				homePageVO.setCellFactorFee(rs.getString("XBYZLZPF"));//细胞因子类制品费
+				homePageVO.setCheckMaterialFee(rs.getString("JCYYCXYYCLF"));//检查用一次性医用材料费
+				homePageVO.setTreatMaterialFee(rs.getString("ZLYYCXYYCLF"));//治疗用一次性医用材料费
+				homePageVO.setOperationMaterialFee(rs.getString("SSYYCXYYCLF"));//手术用一次性医用材料费
+				homePageVO.setOtherTypeFee(rs.getString("QTF"));//其他类其他费
+				homePageVO.setSingleDiagManage(rs.getString("DBZGL"));//单病种管理
+				homePageVO.setClinicPathwayManage(rs.getString("SSLCLJGL"));//临床路径管理
+				homePageVO.setIsOutpatientBehospital(rs.getString("MZZYFH"));//门诊与住院
+				homePageVO.setIsLeaveBehospital(rs.getString("RYCYFH"));//入院与出院
+				homePageVO.setIsOperationBeforeAfter(rs.getString("SQSHFH"));//术前与术后
+				homePageVO.setIsClinicPathology(rs.getString("LCBLFH"));//临床与病理
+				homePageVO.setIsRadiatePathology(rs.getString("FSBLFH"));//放射与病理
+				homePageVO.setRescueSuccessNum(rs.getString("BRQJCS"));//病人抢救次数
+				homePageVO.setRescueSuccessNum(rs.getString("QJCGCS"));//病人抢救成功次数
+				homePageVO.setIsAutoLeavehospital(rs.getString("ZDCYPB"));//是否为自动出院
+				homePageVO.setReturnToType(rs.getString("CYQKDM"));//转归情况HomePage homePageVO=new HomePage();
 				homePageVO.setHomePageId(rs.getString("BASYID"));//病案首页ID
 				homePageVO.setHospitalId(Long.valueOf("3"));//医院ID
 				homePageVO.setBehospitalCode(rs.getString("BRZYID"));//病人住院序号
@@ -407,10 +520,8 @@ public class TZDBConn {
 				homePageVO.setReturnToType(rs.getString("CYQKDM"));//转归情况
 				
 				homePageVO.setGmtCreate(new Date());
-				
-				HomePage homePage=new HomePage();
-				BeanUtil.copyProperties(homePageVO, homePage);
-				homePageList.add(homePage);
+
+				homePageList.add(homePageVO);
 				
 			}
 		} catch (Exception e) {
@@ -426,11 +537,12 @@ public class TZDBConn {
 	public List<BehospitalInfo> getBehospitalInfo() {
 		List<BehospitalInfo> behospitalInfoList=Lists.newLinkedList();
 		try {
-			DBConn dbconn=new DBConn();
+			TZDBConn dbconn=new TZDBConn();
 			//String sql="select * from br_inpatientinfo where CJCXRQ BETWEEN TO_DATE('2020-01-01', 'yyyy-MM-dd') and TO_DATE('2020-01-20', 'yyyy-MM-dd')";
 			//String sql="select top 2000 * from br_inpatientinfo where ZYKSID IN('1040200','1050000') order by CJCXRQ desc";
-			String sql="select * from br_inpatientinfo where ZYKSID IN('1020500','1009100','1030200')";
-			//String sql="select * from br_inpatientinfo where DateDiff(dd,CJCXRQ,getdate())=1";
+			String sql="select * from br_inpatientinfo where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
+			//String sql="select * from br_inpatientinfo where DateDiff(yy,CJCXRQ,getdate())=0 ORDER BY CJCXRQ desc ";
+
 			ResultSet rs =dbconn.Query(sql, null);
 			while(rs.next()){
 				BehospitalInfo behospitalInfo=new BehospitalInfo();
@@ -474,14 +586,13 @@ public class TZDBConn {
 		List<DoctorAdvice> doctorAdviceList=Lists.newLinkedList();
 		
 		try {
-			DBConn dbconn=new DBConn();
+			TZDBConn dbconn=new TZDBConn();
 			//String sql="select * from br_doctadvice where CJCXRQ BETWEEN TO_DATE('2020-03-01', 'yyyy-MM-dd') and TO_DATE('2020-03-30', 'yyyy-MM-dd')";
 			//String sql="select top 2000 * from br_doctadvice order by CJCXRQ desc";
-			String sql="select * from br_doctadvice  where DateDiff(dd,CJCXRQ,getdate())>100 AND DateDiff(dd,CJCXRQ,getdate())<=200 AND BRZYID IN (select BRZYID from br_inpatientinfo where ZYKSID IN('1020500','1009100','1030200')) ORDER BY CJCXRQ desc";
-			//String sql="select * from br_doctadvice  where DateDiff(dd,CJCXRQ,getdate())=1";
+			String sql="select * from br_doctadvice where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
 			ResultSet rs =dbconn.Query(sql, null);
 			while(rs.next()){
-				FDoctorAdviceVO doctorAdviceVO=new FDoctorAdviceVO();
+				DoctorAdvice doctorAdviceVO=new DoctorAdvice();
 				doctorAdviceVO.setDoctorAdviceId(rs.getString("BRYZID"));//病人医嘱ID
 				doctorAdviceVO.setHospitalId(Long.valueOf("3"));//医院ID
 				doctorAdviceVO.setBehospitalCode(rs.getString("BRZYID"));//病人ID
@@ -506,13 +617,8 @@ public class TZDBConn {
 				doctorAdviceVO.setDoctorNotice(rs.getString("YSZTSM"));//医生嘱托
 				doctorAdviceVO.setDoctorId(rs.getString("KDYSID"));//开单医生ID
 				doctorAdviceVO.setDoctorName(rs.getString("KDYSMC"));//开单医生姓名
-				
-				//doctorAdviceVO.set
-				
-				DoctorAdvice doctorAdvice=new DoctorAdvice();
-				BeanUtil.copyProperties(doctorAdviceVO, doctorAdvice);
-				
-				doctorAdviceList.add(doctorAdvice);
+				doctorAdviceVO.setGmtCreate(new Date());
+				doctorAdviceList.add(doctorAdviceVO);
 			}
 		} catch (Exception e) {
 			e.printStackTrace();
@@ -521,16 +627,17 @@ public class TZDBConn {
 	}
 
 	/**
-	 * 从视图中获取文书类型
+	 * 从视图中获取病历记录
 	 * @return
 	 */
 	public List<MedicalRecord> getMedicalRecord(){
 		List<MedicalRecord> medicalRecordList=Lists.newLinkedList();
 		try {
-			DBConn dbconn=new DBConn();
+			TZDBConn dbconn=new TZDBConn();
 			//String sql="select * from ar_medirecclass where CJCXRQ BETWEEN TO_DATE('2020-02-01', 'yyyy-MM-dd') and TO_DATE('2020-04-30', 'yyyy-MM-dd')";
 			//String sql="select * from mr_medicalrecords  where DateDiff(dd,CJCXRQ,getdate())=1";
-			String sql="select * from mr_medicalrecords  where BRZYID IN (select BRZYID from br_inpatientinfo where ZYKSID IN('1020500','1009100','1030200'))";
+			String sql="select * from mr_medicalrecords  where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
+
 			//String sql="select * from mr_medicalrecords  where BRZYID IN (select top 2000 BRZYID from br_inpatientinfo where ZYKSID IN('1040200','1050000') order by CJCXRQ desc)";
 			ResultSet rs =dbconn.Query(sql, null);
 			while(rs.next()){
@@ -561,16 +668,19 @@ public class TZDBConn {
 	public List<MedicalRecordContent> getMedicalRecordContent(){
 		List<MedicalRecordContent> mrContentList=Lists.newLinkedList();
 		try {
-			DBConn dbconn=new DBConn();
+			TZDBConn dbconn=new TZDBConn();
 			//String sql="select * from mr_mrcontent where CJCXRQ BETWEEN TO_DATE('2020-02-01', 'yyyy-MM-dd') and TO_DATE('2020-02-20', 'yyyy-MM-dd')";
 			//String sql="select * from mr_mrcontent where DateDiff(dd,CJCXRQ,getdate())=0";
 			//String sql="select * from mr_mrcontent WHERE BLJLID in (select BLJLID from mr_medicalrecords  where BRZYID IN (select BRZYID from br_inpatientinfo where ZYKSID IN('1020500','1009100','1030200')))";
-			String sql="select * from mr_mrcontent WHERE BLJLID in (select BLJLID from mr_medicalrecords  where BRZYID IN (select BRZYID from br_inpatientinfo where ZYKSID IN('1020500','1009100','1030200')) AND BLJLMC='0110 查房记录(SOAP)')";
+			//String sql="select * from mr_mrcontent WHERE BLJLID in (select BLJLID from mr_medicalrecords  where BRZYID IN (select BRZYID from br_inpatientinfo where ZYKSID IN('1020500','1009100','1030200')))";
+			String sql="select * from mr_mrcontent  where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
+			//String sql="select * from mr_mrcontent b where b.BLJLID in (select a.BLJLID from mr_medicalrecords a where a.BRZYID in ('619479_2','602341_1','529248_2','324515_4','260869_24','643622_1','514423_4','10002707_4','638897_1','429701_3','583262_1','466126_2','640015_1'))";
 			ResultSet rs =dbconn.Query(sql, null);
 			while(rs.next()){
 				MedicalRecordContent mrContent=new MedicalRecordContent();
 				mrContent.setHospitalId(Long.valueOf("3"));
 				mrContent.setRecId(rs.getString("BLJLID"));
+				//mrContent.setHtmlText(rs.getString("HTMLSJ"));
 				mrContent.setXmlText(rs.getString("BLJLNR"));
 				mrContent.setGmtCreate(new Date());
 				mrContentList.add(mrContent);
@@ -586,35 +696,27 @@ public class TZDBConn {
 	 * @return
 	 */
 	public List<MedRecordType> getMedicalRecordType(){
-		List<FMedicalRecordTypeVO> mrTypeVOList=Lists.newLinkedList();
+		List<MedRecordType> mrTypeList=Lists.newLinkedList();
 		try {
-			DBConn dbconn=new DBConn();
+			TZDBConn dbconn=new TZDBConn();
 			//String sql="select * from ar_medirecclass where CJCXRQ BETWEEN TO_DATE('2020-02-01', 'yyyy-MM-dd') and TO_DATE('2020-02-20', 'yyyy-MM-dd')";
-			String sql="select * from ar_medirecclass where SFZFPB='1'";
+			String sql="select * from ar_medirecclass where SFZFPB='1' and cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
 			ResultSet rs =dbconn.Query(sql, null);
 			while(rs.next()){
-				FMedicalRecordTypeVO mrTypeVO=new FMedicalRecordTypeVO();
-				mrTypeVO.setTypeId(rs.getString("BLLBID"));
-				mrTypeVO.setHospitalId(Long.valueOf("3"));
-				mrTypeVO.setTypeName(rs.getString("BLLBMC"));
-				mrTypeVO.setParentTypeId(rs.getString("SJLBID"));
-				mrTypeVO.setObjName(rs.getString("BLLBFW"));
-				mrTypeVO.setSpell(rs.getString("HZSRM1"));
-				mrTypeVOList.add(mrTypeVO);
+				MedRecordType mrType=new MedRecordType();
+				mrType.setTypeId(rs.getString("BLLBID"));
+				mrType.setHospitalId(Long.valueOf("3"));
+				mrType.setTypeName(rs.getString("BLLBMC"));
+				mrType.setParentTypeId(rs.getString("SJLBID"));
+				mrType.setObjName(rs.getString("BLLBFW"));
+				mrType.setSpell(rs.getString("HZSRM1"));
+				mrTypeList.add(mrType);
 			}
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
-		
-		List<MedRecordType> medicalRecordTypeList=BeanUtil.listCopyTo(mrTypeVOList, MedRecordType.class);
-		return medicalRecordTypeList;
-	}
-	
-	public static void main(String[] args) {
-		TZDBConn dbconn=new TZDBConn();
-		//List<DoctorAdvice> doctorAdviceList=dbconn.getDoctorAdvice();
-		
-		dbconn.getBehospitalInfo();
+
+		return mrTypeList;
 	}
 	
 }

+ 0 - 43
src/main/java/com/diagbot/vo/FBasDeptInfoVO.java

@@ -1,43 +0,0 @@
-package com.diagbot.vo;
-
-import java.time.LocalDateTime;
-
-import lombok.Data;
-
-@Data
-public class FBasDeptInfoVO {
-	/**
-     * 科室编码(HIS导入)
-     */
-    private String deptId;
-
-    /**
-     * 医院ID
-     */
-    private Long hospitalId;
-
-    /**
-     * 科室名称
-     */
-    private String deptName;
-
-    /**
-     * 科室类别
-     */
-    private String deptType;
-
-    /**
-     * 首字母拼音
-     */
-    private String spell;
-
-    /**
-     * 区域类别(门诊、工作站、住院等)
-     */
-    private String station;
-
-    /**
-     * 记录创建时间
-     */
-    private LocalDateTime gmtCreate;
-}

+ 0 - 38
src/main/java/com/diagbot/vo/FBasDoctorInfoVO.java

@@ -1,38 +0,0 @@
-package com.diagbot.vo;
-
-import java.time.LocalDateTime;
-
-import lombok.Data;
-
-@Data
-public class FBasDoctorInfoVO {
-	/**
-     * HIS导入的医生ID
-     */
-    private String doctorId;
-
-    /**
-     * 医院ID
-     */
-    private Long hospitalId;
-
-    /**
-     * 医院导入科室ID
-     */
-    private String deptId;
-
-    /**
-     * 姓名
-     */
-    private String name;
-
-    /**
-     * 职称
-     */
-    private String professor;
-
-    /**
-     * 记录创建时间
-     */
-    private LocalDateTime gmtCreate;
-}

+ 0 - 114
src/main/java/com/diagbot/vo/FBehospitalInfoVO.java

@@ -1,114 +0,0 @@
-package com.diagbot.vo;
-
-import java.util.Date;
-
-import lombok.Data;
-
-@Data
-public class FBehospitalInfoVO{
-
-	/**
-     * 病人住院ID
-     */
-    private String behospitalCode;
-
-    /**
-     * 医院ID
-     */
-    private String hospitalId;
-
-    /**
-     * 姓名
-     */
-    private String name;
-
-    /**
-     * 性别
-     */
-    private String sex;
-
-    /**
-     * 出生日期
-     */
-    private Date birthday;
-
-    /**
-     * 档案号
-     */
-    private String fileCode;
-
-    /**
-     * 病区编码
-     */
-    private String wardCode;
-
-    /**
-     * 病区名称
-     */
-    private String wardName;
-
-    /**
-     * 住院科室ID
-     */
-    private String behDeptId;
-
-    /**
-     * 住院科室名称
-     */
-    private String behDeptName;
-
-    /**
-     * 床位号
-     */
-    private String bedCode;
-
-    /**
-     * 床位名称
-     */
-    private String bedName;
-
-    /**
-     * 医保类别
-     */
-    private String insuranceName;
-
-    /**
-     * 职业
-     */
-    private String jobType;
-
-    /**
-     * 入院时间
-     */
-    private Date behospitalDate;
-
-    /**
-     * 出院时间
-     */
-    private Date leaveHospitalDate;
-
-    /**
-     * 疾病ICD编码
-     */
-    private String diagnoseIcd;
-
-    /**
-     * 疾病名称
-     */
-    private String diagnose;
-
-    /**
-     * 医生ID
-     */
-    private String doctorId;
-
-    /**
-     * 医生姓名
-     */
-    private String doctorName;
-    
-    /**
-     * 记录创建时间
-     */
-    private Date gmtCreate;
-}

+ 0 - 129
src/main/java/com/diagbot/vo/FDoctorAdviceVO.java

@@ -1,129 +0,0 @@
-package com.diagbot.vo;
-
-import java.util.Date;
-
-import lombok.Data;
-
-@Data
-public class FDoctorAdviceVO {
-
-	/**
-     * 病人医嘱ID
-     */
-    private String doctorAdviceId;
-
-    /**
-     * 医院id
-     */
-    private Long hospitalId;
-
-    /**
-     * 病人ID
-     */
-    private String behospitalCode;
-
-    /**
-     * 医生开单判别
-     */
-    private String orderDoctorName;
-
-    /**
-     * 医嘱频率判别
-     */
-    private String frequency;
-
-    /**
-     * 父类医嘱ID
-     */
-    private String parentTypeId;
-
-    /**
-     * 医嘱类型判别(嘱托长嘱、长期医嘱等)
-     */
-    private String doctorAdviceType;
-
-    /**
-     * 一次使用数量
-     */
-    private String usageNum;
-
-    /**
-     * 一次用量单位
-     */
-    private String usageUnit;
-
-    /**
-     * 医嘱单次剂量
-     */
-    private String dose;
-
-    /**
-     * 单次剂量单位
-     */
-    private String doseUnit;
-
-    /**
-     * 给药方式
-     */
-    private String medModeType;
-
-    /**
-     * 医嘱频率
-     */
-    private String daFrequency;
-
-    /**
-     * 医嘱处理类型
-     */
-    private String daDealType;
-
-    /**
-     * 医嘱开始时间
-     */
-    private Date daStartDate;
-
-    /**
-     * 医嘱项目名称
-     */
-    private String daItemName;
-
-    /**
-     * 医嘱状态判别
-     */
-    private String daStatus;
-
-    /**
-     * 医嘱结束时间
-     */
-    private Date daStopDate;
-
-    /**
-     * 医嘱同组序号
-     */
-    private String daGroupNo;
-
-    /**
-     * 医嘱处方类型(检验、描述医嘱、膳食、西药、护理等)
-     */
-    private String daPrescriptionType;
-
-    /**
-     * 医嘱领药类型
-     */
-    private String daMedType;
-
-    /**
-     * 医生嘱托
-     */
-    private String doctorNotice;
-
-    /**
-     * 开单医生ID
-     */
-    private String doctorId;
-
-    /**
-     * 开单医生姓名
-     */
-    private String doctorName;
-}

+ 0 - 48
src/main/java/com/diagbot/vo/FHomeDiagnoseVO.java

@@ -1,48 +0,0 @@
-package com.diagbot.vo;
-
-import java.util.Date;
-
-import lombok.Data;
-
-@Data
-public class FHomeDiagnoseVO {
-	/**
-     * 病案首页ID
-     */
-    private String homePageId;
-
-    /**
-     * 医院ID
-     */
-    private Long hospitalId;
-
-    /**
-     * 诊断序号
-     */
-    private String diagnoseOrderNo;
-
-    /**
-     * 诊断类别(主要诊断、其他诊断)
-     */
-    private String diagnoseType;
-
-    /**
-     * 诊断判别(主、次)
-     */
-    private String diagnoseTypeShort;
-
-    private String diagnoseName;
-
-    private String behospitalType;
-
-    private String leaveHospitalType;
-
-    private String pathologyDiagnose;
-
-    private String icdCode;
-    
-    /**
-     * 记录创建时间
-     */
-    private Date gmtCreate;
-}

+ 0 - 83
src/main/java/com/diagbot/vo/FHomeOperationVO.java

@@ -1,83 +0,0 @@
-package com.diagbot.vo;
-
-import java.util.Date;
-
-import lombok.Data;
-
-@Data
-public class FHomeOperationVO {
-	/**
-     * 病案首页ID
-     */
-    private String homePageId;
-
-    /**
-     * 医院ID
-     */
-    private Long hospitalId;
-
-    /**
-     * 手术序号
-     */
-    private String operationOrderNo;
-
-    /**
-     * 手术日期
-     */
-    private Date operationDate;
-
-    /**
-     * 手术编码
-     */
-    private String operationCode;
-
-    /**
-     * 手术医生ID
-     */
-    private String operationDoctorId;
-
-    /**
-     * 一助医生ID
-     */
-    private String firstAssistantId;
-
-    /**
-     * 二助医生ID
-     */
-    private String secondAssistantId;
-
-    /**
-     * 切口等级
-     */
-    private String cutLevel;
-
-    /**
-     * 愈合等级
-     */
-    private String healingLevel;
-
-    /**
-     * 手术名称
-     */
-    private String operationName;
-
-    /**
-     * 手术级别
-     */
-    private String operationLevel;
-
-    /**
-     * 麻醉方式(全麻、局麻、静脉麻醉)
-     */
-    private String anaesthesiaName;
-
-    /**
-     * 拟手术名称
-     */
-    private String shamOperationName;
-    
-    /**
-     * 记录创建时间
-     */
-    private Date gmtCreate;
-}

+ 0 - 664
src/main/java/com/diagbot/vo/FHomePageVO.java

@@ -1,664 +0,0 @@
-package com.diagbot.vo;
-
-import java.util.Date;
-
-import lombok.Data;
-
-@Data
-public class FHomePageVO{
-	
-	/**
-     * 病案首页编号
-     */
-    private String homePageId;
-
-    /**
-     * 医院ID
-     */
-    private Long hospitalId;
-
-    /**
-     * 病人住院序号
-     */
-    private String behospitalCode;
-
-    /**
-     * 组织机构id
-     */
-    private String hospitalCode;
-
-    /**
-     * 医疗机构名称
-     */
-    private String hospitalName;
-
-    /**
-     * 医疗机构代码
-     */
-    private String orgCode;
-
-    /**
-     * 医疗付费方式
-     */
-    private String payType;
-
-    /**
-     * 健康卡号
-     */
-    private String healthCard;
-
-    /**
-     * 住院次数
-     */
-    private String behospitalNum;
-
-    /**
-     * 病案号
-     */
-    private String fileCode;
-
-    /**
-     * 姓名
-     */
-    private String name;
-
-    /**
-     * 性别
-     */
-    private String sex;
-
-    /**
-     * 出生日期
-     */
-    private Date birthday;
-
-    /**
-     * 年龄
-     */
-    private String age;
-
-    /**
-     * 年龄单位
-     */
-    private String ageUnit;
-
-    /**
-     * 国籍
-     */
-    private String nationality;
-
-    /**
-     * 新生儿出生月数
-     */
-    private String newbornMonth;
-
-    /**
-     * 新生儿出生天数
-     */
-    private String newbornDay;
-
-    /**
-     * 新生儿出生体重
-     */
-    private String newbornWeight;
-
-    /**
-     * 新生儿入院体重
-     */
-    private String newbornBehospitalWeight;
-
-    /**
-     * 出生地
-     */
-    private String bornAddress;
-
-    /**
-     * 籍贯
-     */
-    private String bornPlace;
-
-    /**
-     * 民族
-     */
-    private String nation;
-
-    /**
-     * 身份证号
-     */
-    private String identityCardNo;
-
-    /**
-     * 职业
-     */
-    private String jobType;
-
-    /**
-     * 婚姻
-     */
-    private String marriage;
-
-    /**
-     * 现住址
-     */
-    private String curAddress;
-
-    /**
-     * 现住址电话
-     */
-    private String curPhone;
-
-    /**
-     * 现住址邮编
-     */
-    private String curPostCode;
-
-    /**
-     * 户口地址
-     */
-    private String residenceAddress;
-
-    /**
-     * 户口地址邮编
-     */
-    private String residencePostCode;
-
-    /**
-     * 工作单位
-     */
-    private String workAddress;
-
-    /**
-     * 工作单位电话
-     */
-    private String workPhone;
-
-    /**
-     * 工作单位邮编
-     */
-    private String workPostCode;
-
-    /**
-     * 联系人姓名
-     */
-    private String contactName;
-
-    /**
-     * 联系人关系
-     */
-    private String contactRelation;
-
-    /**
-     * 联系人地址
-     */
-    private String contactAddress;
-
-    /**
-     * 联系人电话
-     */
-    private String contactPhone;
-
-    /**
-     * 入院途径
-     */
-    private String behospitalWay;
-
-    /**
-     * 入院时间
-     */
-    private Date behospitalDate;
-
-    /**
-     * 入院科别
-     */
-    private String behospitalDept;
-
-    /**
-     * 入院病房
-     */
-    private String behospitalWard;
-
-    /**
-     * 入院床位序号
-     */
-    private String behospitalBedId;
-
-    /**
-     * 入院床位号码
-     */
-    private String behospitalBedCode;
-
-    /**
-     * 转科科别
-     */
-    private String changeDept;
-
-    /**
-     * 出院时间
-     */
-    private Date leaveHospitalDate;
-
-    /**
-     * 出院科别
-     */
-    private String leaveHospitalDept;
-
-    /**
-     * 出院病房
-     */
-    private String leaveHospitalWard;
-
-    /**
-     * 出院床位序号
-     */
-    private String leaveHospitalBedId;
-
-    /**
-     * 出院床位号码
-     */
-    private String leaveHospitalBedCode;
-
-    /**
-     * 实际住院天数
-     */
-    private String behospitalDayNum;
-
-    /**
-     * 门急诊诊断
-     */
-    private String outpatientEmrDiagnose;
-
-    /**
-     * 门急诊诊断编码
-     */
-    private String outpatientEmrDiagnoseCode;
-
-    /**
-     * 损伤中毒因素
-     */
-    private String poisonFactor;
-
-    /**
-     * 损伤中毒因素编码
-     */
-    private String poisonFactorCode;
-
-    /**
-     * 病理诊断
-     */
-    private String pathologyDiagnose;
-
-    /**
-     * 病理诊断编码
-     */
-    private String pathologyDiagnoseCode;
-
-    /**
-     * 病理诊断编号
-     */
-    private String pathologyDiagnoseId;
-
-    /**
-     * 药物过敏
-     */
-    private String isMedAllergy;
-
-    /**
-     * 过敏药物
-     */
-    private String medAllergyName;
-
-    /**
-     * 死亡患者尸检
-     */
-    private String autopsy;
-
-    /**
-     * 血型
-     */
-    private String bloodType;
-
-    /**
-     * Rh
-     */
-    private String rh;
-
-    /**
-     * 科主任
-     */
-    private String deptDirector;
-
-    /**
-     * 主任医师
-     */
-    private String directorDoctor;
-
-    /**
-     * 主治医师
-     */
-    private String attendingDoctor;
-
-    /**
-     * 住院医师
-     */
-    private String behospitalDoctor;
-
-    /**
-     * 责任护士
-     */
-    private String responseNurse;
-
-    /**
-     * 进修医师
-     */
-    private String studyDoctor;
-
-    /**
-     * 实习医师
-     */
-    private String practiceDoctor;
-
-    /**
-     * 编码员
-     */
-    private String encodeMan;
-
-    /**
-     * 病案质量
-     */
-    private String homePageQuality;
-
-    /**
-     * 质控医师
-     */
-    private String qcDoctor;
-
-    /**
-     * 质控护士
-     */
-    private String qcNurse;
-
-    /**
-     * 质控日期
-     */
-    private Date qcDate;
-
-    /**
-     * 离院方式
-     */
-    private String leaveHospitalType;
-
-    /**
-     * 接收机构名称
-     */
-    private String acceptOrgCode;
-
-    /**
-     * 31天内再住院计划
-     */
-    private String againBehospitalPlan;
-
-    /**
-     * 再住院目的
-     */
-    private String againBehospitalGoal;
-
-    /**
-     * 颅脑损伤患者昏迷前天数
-     */
-    private String tbiBeforeDay;
-
-    /**
-     * 颅脑损伤患者昏迷前小时
-     */
-    private String tbiBeforeHour;
-
-    /**
-     * 颅脑损伤患者昏迷前分钟
-     */
-    private String tbiBeforeMinute;
-
-    /**
-     * 颅脑损伤患者昏迷后天数
-     */
-    private String tbiAfterDay;
-
-    /**
-     * 颅脑损伤患者昏迷后小时
-     */
-    private String tbiAfterHour;
-
-    /**
-     * 颅脑损伤患者昏迷后分钟
-     */
-    private String tbiAfterMinute;
-
-    /**
-     * 总费用
-     */
-    private String totalFee;
-
-    /**
-     * 自付金额
-     */
-    private String ownFee;
-
-    /**
-     * 一般医疗服务费
-     */
-    private String generalFee;
-
-    /**
-     * 一般治疗服务费
-     */
-    private String serviceFee;
-
-    /**
-     * 护理费
-     */
-    private String nurseFee;
-
-    /**
-     * 其他费用
-     */
-    private String otherFee;
-
-    /**
-     * 病理诊断费
-     */
-    private String pathologyFee;
-
-    /**
-     * 实验室诊断费
-     */
-    private String labFee;
-
-    /**
-     * 影像学诊断费
-     */
-    private String pacsFee;
-
-    /**
-     * 临床诊断项目费
-     */
-    private String clinicDiagnoseFee;
-
-    /**
-     * 非手术治疗项目费
-     */
-    private String notOperationFee;
-
-    /**
-     * 临床物理治疗费
-     */
-    private String clinicPhysicFee;
-
-    /**
-     * 手术治疗费
-     */
-    private String operationTreatFee;
-
-    /**
-     * 麻醉费
-     */
-    private String anaesthesiaFee;
-
-    /**
-     * 手术费
-     */
-    private String operationFee;
-
-    /**
-     * 康复类
-     */
-    private String healthTypeFee;
-
-    /**
-     * 中医治疗费
-     */
-    private String chnTreatFee;
-
-    /**
-     * 西药费
-     */
-    private String westernMedFee;
-
-    /**
-     * 抗菌药物费用
-     */
-    private String antibiosisFee;
-
-    /**
-     * 中成药费
-     */
-    private String chnMedFee;
-
-    /**
-     * 中草药费
-     */
-    private String chnHerbFee;
-
-    /**
-     * 血费
-     */
-    private String bloodFee;
-
-    /**
-     * 白蛋白类制品费
-     */
-    private String albumenFee;
-
-    /**
-     * 球蛋白类制品费
-     */
-    private String globulinFee;
-
-    /**
-     * 凝血因子类制品费
-     */
-    private String bloodFactorFee;
-
-    /**
-     * 细胞因子类制品费
-     */
-    private String cellFactorFee;
-
-    /**
-     * 检查用一次性医用材料费
-     */
-    private String checkMaterialFee;
-
-    /**
-     * 治疗用一次性医用材料费
-     */
-    private String treatMaterialFee;
-
-    /**
-     * 手术用一次性医用材料费
-     */
-    private String operationMaterialFee;
-
-    /**
-     * 其他类其他费
-     */
-    private String otherTypeFee;
-
-    /**
-     * 单病种管理
-     */
-    private String singleDiagManage;
-
-    /**
-     * 临床路径管理
-     */
-    private String clinicPathwayManage;
-
-    /**
-     * 门诊与住院
-     */
-    private String isOutpatientBehospital;
-
-    /**
-     * 入院与出院
-     */
-    private String isLeaveBehospital;
-
-    /**
-     * 术前与术后
-     */
-    private String isOperationBeforeAfter;
-
-    /**
-     * 临床与病理
-     */
-    private String isClinicPathology;
-
-    /**
-     * 放射与病理
-     */
-    private String isRadiatePathology;
-
-    /**
-     * 病人抢救次数
-     */
-    private String rescueNum;
-
-    /**
-     * 病人抢救成功次数
-     */
-    private String rescueSuccessNum;
-
-    /**
-     * 是否为自动出院
-     */
-    private String isAutoLeavehospital;
-
-    /**
-     * 转归情况
-     */
-    private String returnToType;
-
-    /**
-     * 是否删除,N:未删除,Y:删除
-     */
-    private String isDeleted;
-
-    /**
-     * 记录创建时间
-     */
-    private Date gmtCreate;
-
-    /**
-     * 记录修改时间,如果时间是1970年则表示纪录未修改
-     */
-    private Date gmtModified;
-
-    /**
-     * 创建人,0表示无创建人值
-     */
-    private String creator;
-
-    /**
-     * 修改人,如果为0则表示纪录未修改
-     */
-    private String modifier;
-}

+ 2 - 2
src/main/resources/application-local.yml

@@ -58,7 +58,7 @@ spring:
     druid:
       driver-class-name: com.mysql.cj.jdbc.Driver
       platform: mysql
-      url: jdbc:mysql://192.168.2.236:3306/qc_qq?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
+      url: jdbc:mysql://192.168.100.157:3306/qc?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
       username: root
       password: lantone
       # 连接池的配置信息
@@ -110,7 +110,7 @@ spring:
     database:
       cache: 8 # cache索引
       token: 8 # Token索引
-    host: 192.168.2.236  #Redis服务器地址
+    host: 192.168.100.157  #Redis服务器地址
     port: 6379 # Redis服务器连接端口(本地环境端口6378,其他环境端口是6379)
     password: lantone # Redis服务器连接密码(默认为空)
     lettuce:

+ 1 - 0
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -10,6 +10,7 @@
         <result column="sex" property="sex" />
         <result column="birthday" property="birthday" />
         <result column="file_code" property="fileCode" />
+        <result column="qc_type_id" property="qcTypeId" />
         <result column="ward_code" property="wardCode" />
         <result column="ward_name" property="wardName" />
         <result column="beh_dept_id" property="behDeptId" />

+ 14 - 0
src/main/resources/mapper/QcModelHospitalMapper.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.QcModelHospitalMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.QcModelHospital">
+        <id column="id" property="id" />
+        <result column="hospital_id" property="hospitalId" />
+        <result column="hospital_model_name" property="hospitalModelName" />
+        <result column="stand_model_id" property="standModelId" />
+        <result column="stand_model_name" property="standModelName" />
+    </resultMap>
+
+</mapper>

+ 1 - 1
src/test/java/com/diagbot/CodeGeneration.java

@@ -49,7 +49,7 @@ public class CodeGeneration {
         dsc.setDriverName("com.mysql.cj.jdbc.Driver");
         dsc.setUsername("root");
         dsc.setPassword("lantone");
-        dsc.setUrl("jdbc:mysql://192.168.100.157:3306/qc?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8");
+        dsc.setUrl("jdbc:mysql://192.168.2.236:3306/qc?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8");
         mpg.setDataSource(dsc);
 
         // 策略配置