Browse Source

湘雅同步数据

shiyue 3 years ago
parent
commit
790a85269c

+ 9 - 0
src/main/java/com/diagbot/dto/SentEntryRecordDTO.java

@@ -36,6 +36,15 @@ public class SentEntryRecordDTO {
      */
      */
     private String modeName;
     private String modeName;
 
 
+    /**
+     * 病人所在科室
+     */
+    private String deptId;
+
+    /**
+     * 病人所属医生
+     */
+    private String doctorName;
 
 
     /**
     /**
      * 分值
      * 分值

+ 187 - 122
src/main/java/com/diagbot/facade/QcresultInfoFacade.java

@@ -1,5 +1,6 @@
 package com.diagbot.facade;
 package com.diagbot.facade;
 
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.diagbot.dto.AlgorithmDTO;
 import com.diagbot.dto.AlgorithmDTO;
@@ -10,14 +11,12 @@ import com.diagbot.entity.*;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.exception.CommonException;
+import com.diagbot.facade.data.AHomePageFacade;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
 import com.diagbot.service.impl.MedQcresultCasesServiceImpl;
 import com.diagbot.service.impl.MedQcresultCasesServiceImpl;
 import com.diagbot.service.impl.QcresultDetailServiceImpl;
 import com.diagbot.service.impl.QcresultDetailServiceImpl;
 import com.diagbot.service.impl.QcresultInfoServiceImpl;
 import com.diagbot.service.impl.QcresultInfoServiceImpl;
-import com.diagbot.util.BeanUtil;
-import com.diagbot.util.DateUtil;
-import com.diagbot.util.ListUtil;
-import com.diagbot.util.StringUtil;
-import com.diagbot.util.SysUserUtils;
+import com.diagbot.util.*;
 import com.diagbot.vo.AlgorithmVO;
 import com.diagbot.vo.AlgorithmVO;
 import com.diagbot.vo.AnalyzeVO;
 import com.diagbot.vo.AnalyzeVO;
 import com.diagbot.vo.GetDetailVO;
 import com.diagbot.vo.GetDetailVO;
@@ -28,10 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 
 /**
 /**
  * @Description:
  * @Description:
@@ -48,6 +44,10 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
     @Autowired
     @Autowired
     private BehospitalInfoFacade behospitalInfoFacade;
     private BehospitalInfoFacade behospitalInfoFacade;
     @Autowired
     @Autowired
+    private AHomePageFacade aHomePageFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Autowired
     private MedCheckInfoFacade medCheckInfoFacade;
     private MedCheckInfoFacade medCheckInfoFacade;
     @Autowired
     @Autowired
     @Qualifier("medQcresultCasesServiceImpl")
     @Qualifier("medQcresultCasesServiceImpl")
@@ -61,6 +61,8 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
     @Autowired
     @Autowired
     private SysUserFacade sysUserFacade;
     private SysUserFacade sysUserFacade;
 
 
+    private TZDBConnForHis tzDBConnForHis = new TZDBConnForHis();
+
     /**
     /**
      * 修改评分结果信息
      * 修改评分结果信息
      *
      *
@@ -224,6 +226,7 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
                             .eq("behospital_code", analyzeVO.getBehospitalCode()));
                             .eq("behospital_code", analyzeVO.getBehospitalCode()));
                 }
                 }
 
 
+
                 qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
                 qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
                         .eq("is_deleted", IsDeleteEnum.N.getKey())
                         .eq("is_deleted", IsDeleteEnum.N.getKey())
                         .eq("hospital_id", analyzeVO.getHospitalId())
                         .eq("hospital_id", analyzeVO.getHospitalId())
@@ -282,9 +285,9 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
                         .eq(MedCheckInfo::getBehospitalCode, sentEntryRecordDTO.getBehospitalCode())
                         .eq(MedCheckInfo::getBehospitalCode, sentEntryRecordDTO.getBehospitalCode())
                         .eq(MedCheckInfo::getHospitalId, qcresultDetailAdd.getHospitalId())
                         .eq(MedCheckInfo::getHospitalId, qcresultDetailAdd.getHospitalId())
                         //  .eq(MedCheckInfo::getStatus, 1)
                         //  .eq(MedCheckInfo::getStatus, 1)
-                        .in(MedCheckInfo::getCheckType, Arrays.asList(0,2))
+                        .in(MedCheckInfo::getCheckType, Arrays.asList(0, 2))
                         .eq(MedCheckInfo::getIsDeleted, IsDeleteEnum.N.getKey()).one();
                         .eq(MedCheckInfo::getIsDeleted, IsDeleteEnum.N.getKey()).one();
-                if(null != medCheckInfo){
+                if (null != medCheckInfo) {
                     sentEntryRecordDTO.setCheckName(medCheckInfo.getCheckName());
                     sentEntryRecordDTO.setCheckName(medCheckInfo.getCheckName());
                     sentEntryRecordDTO.setCheckTime(medCheckInfo.getCheckTime());
                     sentEntryRecordDTO.setCheckTime(medCheckInfo.getCheckTime());
                 }
                 }
@@ -292,57 +295,103 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
                         .eq(SysUser::getId, medCheckInfo.getCheckId())
                         .eq(SysUser::getId, medCheckInfo.getCheckId())
                         .eq(SysUser::getStatus, 1)
                         .eq(SysUser::getStatus, 1)
                         .eq(SysUser::getIsDeleted, IsDeleteEnum.N.getKey()).one();
                         .eq(SysUser::getIsDeleted, IsDeleteEnum.N.getKey()).one();
-                if(null != sysUser){
+                if (null != sysUser) {
                     sentEntryRecordDTO.setCheckId(sysUser.getUsername());
                     sentEntryRecordDTO.setCheckId(sysUser.getUsername());
                 }
                 }
                 QcCasesEntry qcCasesEntry = qcCasesEntryFacade.lambdaQuery()
                 QcCasesEntry qcCasesEntry = qcCasesEntryFacade.lambdaQuery()
                         .eq(QcCasesEntry::getId, qcresultDetailAdd.getCasesEntryId())
                         .eq(QcCasesEntry::getId, qcresultDetailAdd.getCasesEntryId())
                         .eq(QcCasesEntry::getIsDeleted, IsDeleteEnum.N.getKey()).one();
                         .eq(QcCasesEntry::getIsDeleted, IsDeleteEnum.N.getKey()).one();
-                if(null != qcCasesEntry){
+                if (null != qcCasesEntry) {
                     QcMode qcMode = qcModeFacade.lambdaQuery()
                     QcMode qcMode = qcModeFacade.lambdaQuery()
                             .eq(QcMode::getId, qcCasesEntry.getModeId())
                             .eq(QcMode::getId, qcCasesEntry.getModeId())
                             .eq(QcMode::getIsDeleted, IsDeleteEnum.N.getKey()).one();
                             .eq(QcMode::getIsDeleted, IsDeleteEnum.N.getKey()).one();
-                    if(null != qcCasesEntry){
+                    if (null != qcCasesEntry) {
                         sentEntryRecordDTO.setModeName(qcMode.getName());
                         sentEntryRecordDTO.setModeName(qcMode.getName());
                     }
                     }
                 }
                 }
+                //获取患者的科室id和病人的主治医师
+                BehospitalInfo behospitalInfo = behospitalInfoFacade.getOne(new QueryWrapper<BehospitalInfo>()
+                        .eq("behospital_code", sentEntryRecordDTO.getBehospitalCode())
+                        .eq("is_deleted", IsDeleteEnum.N.getKey()));
+                if (null != behospitalInfo) {
+                    sentEntryRecordDTO.setDeptId(behospitalInfo.getBehDeptId());
+                    if (StringUtil.isNotEmpty(behospitalInfo.getDoctorName()) && !behospitalInfo.getDoctorName().equals("-")) {
+                        sentEntryRecordDTO.setDoctorName(behospitalInfo.getDoctorName());
+                    } else {
+                        HomePage homePage = aHomePageFacade.getOne(new QueryWrapper<HomePage>()
+                                .eq("behospital_code", sentEntryRecordDTO.getBehospitalCode())
+                                .eq("is_deleted", IsDeleteEnum.N.getKey()));
+                        sentEntryRecordDTO.setDoctorName(homePage.getAttendingDoctor());
+                    }
+            }
+        //根据his新增相应的数据
+        try {
+            Integer i = tzDBConnForHis.setQcMessAge(sentEntryRecordDTO);
+//            if (i == 0) {
+//                aMedAbnormalInfoFacade.saveAbnormalInfo("发送质控人员新增人工缺陷到his系统失败", "", "", JSON.toJSONString(sentEntryRecordDTO), "");
+//            }
+            //插入方法
+//                    qcClientFacade.sentEntryRecord(sentEntryRecordDTO);
+        } catch (Exception e) {
+            e.printStackTrace();
+            aMedAbnormalInfoFacade.saveAbnormalInfo("发送质控人员新增人工缺陷到his系统失败", "", "", JSON.toJSONString(sentEntryRecordDTO), e.getMessage());
 
 
+        }
 
 
+        break;
+        case 2:
+        //删除条目
+        qcresultDetailServiceImpl.remove(new QueryWrapper<QcresultDetail>()
+                .eq("id", algorithmVO.getOptResultAlgVO().getId())
+                .eq("hospital_id", analyzeVO.getHospitalId())
+                .eq("behospital_code", analyzeVO.getBehospitalCode())
+        );
+        break;
+        case 3:
+            //发送质控人员修改人工缺陷到his系统
+            SentEntryRecordDTO updateEntryRecordDTO = new SentEntryRecordDTO();
+            BeanUtil.copyProperties(algorithmVO.getOptResultAlgVO(), updateEntryRecordDTO);
+            updateEntryRecordDTO.setBehospitalCode(analyzeVO.getBehospitalCode());
+            QcresultDetail qcresultDetail= qcresultDetailServiceImpl.getOne(new QueryWrapper<QcresultDetail>()
+                                        .eq("id",algorithmVO.getOptResultAlgVO().getId()));
+            String oldMsg = qcresultDetail.getMsg();
+            try {
+                Integer i = tzDBConnForHis.UpdateQcMessAge(updateEntryRecordDTO,oldMsg);
+            } catch (Exception e) {
+                e.printStackTrace();
+                aMedAbnormalInfoFacade.saveAbnormalInfo("发送质控人员修改人工缺陷到his系统失败", "", "", JSON.toJSONString(updateEntryRecordDTO), e.getMessage());
+
+            }
+        //修改条目
+        qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
+                .eq("id", algorithmVO.getOptResultAlgVO().getId())
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", analyzeVO.getHospitalId())
+                .eq("behospital_code", analyzeVO.getBehospitalCode())
+                .set("msg", algorithmVO.getOptResultAlgVO().getMsg())
+                .set("score", algorithmVO.getOptResultAlgVO().getScore())
+                .set("opt_type", 3)
+                .set("grade_type", 2)
+                .set("modifier", useId)
+                .set("qcresult_info_id", newId)
+                .set("gmt_modified", now)
+                .set("explain_info", algorithmVO.getOptResultAlgVO().getExplainInfo())
+        );
+        break;
+        case 4:
+                //发送质控人员删除人工缺陷到his系统
+                QcresultDetail deleteQcDetail= qcresultDetailServiceImpl.getOne(new QueryWrapper<QcresultDetail>()
+                        .eq("id",algorithmVO.getOptResultAlgVO().getId()));
+                SentEntryRecordDTO deleteEntryRecordDTO = new SentEntryRecordDTO();
+                deleteEntryRecordDTO.setMsg(deleteQcDetail.getMsg());
+                deleteEntryRecordDTO.setBehospitalCode(analyzeVO.getBehospitalCode());
                 try {
                 try {
-                    //插入方法
-//                    qcClientFacade.sentEntryRecord(sentEntryRecordDTO);
+                    Integer i = tzDBConnForHis.DeleteQcMessAge(deleteEntryRecordDTO);
                 } catch (Exception e) {
                 } catch (Exception e) {
                     e.printStackTrace();
                     e.printStackTrace();
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("发送质控人员删除人工缺陷到his系统失败", "", "", JSON.toJSONString(deleteEntryRecordDTO), e.getMessage());
                 }
                 }
-
-                break;
-            case 2:
-                //删除条目
-                qcresultDetailServiceImpl.remove(new QueryWrapper<QcresultDetail>()
-                        .eq("id", algorithmVO.getOptResultAlgVO().getId())
-                        .eq("hospital_id", analyzeVO.getHospitalId())
-                        .eq("behospital_code", analyzeVO.getBehospitalCode())
-                );
-                break;
-            case 3:
-                //修改条目
-                qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
-                        .eq("id", algorithmVO.getOptResultAlgVO().getId())
-                        .eq("is_deleted", IsDeleteEnum.N.getKey())
-                        .eq("hospital_id", analyzeVO.getHospitalId())
-                        .eq("behospital_code", analyzeVO.getBehospitalCode())
-                        .set("msg", algorithmVO.getOptResultAlgVO().getMsg())
-                        .set("score", algorithmVO.getOptResultAlgVO().getScore())
-                        .set("opt_type", 3)
-                        .set("grade_type", 2)
-                        .set("modifier", useId)
-                        .set("qcresult_info_id", newId)
-                        .set("gmt_modified", now)
-                        .set("explain_info", algorithmVO.getOptResultAlgVO().getExplainInfo())
-                );
-                break;
-            case 4:
-                //获取病历核查人员id,该操作只能是核查员操作
+        //获取病历核查人员id,该操作只能是核查员操作
 //                Long checkId = medCheckInfoFacade.getOne(new QueryWrapper<MedCheckInfo>()
 //                Long checkId = medCheckInfoFacade.getOne(new QueryWrapper<MedCheckInfo>()
 //                        .eq("is_deleted", IsDeleteEnum.N.getKey())
 //                        .eq("is_deleted", IsDeleteEnum.N.getKey())
 //                        .eq("hospital_id", analyzeVO.getHospitalId())
 //                        .eq("hospital_id", analyzeVO.getHospitalId())
@@ -355,100 +404,116 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
 //                {
 //                {
 //                    throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "当前用户不是分配的核查人员");
 //                    throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "当前用户不是分配的核查人员");
 //                }
 //                }
-                //逻辑删除质控明细 0删除
-                if (analyzeVO.getDelStatus() == 0) {
-                    qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
-                            .eq("id", algorithmVO.getOptResultAlgVO().getId())
-                            .eq("is_deleted", IsDeleteEnum.N.getKey())
-                            .eq("hospital_id", analyzeVO.getHospitalId())
-                            .eq("behospital_code", analyzeVO.getBehospitalCode())
-                            .set("is_deleted", IsDeleteEnum.Y.getKey())
-                            .set("grade_type", 2)
-                            .set("opt_type", 2)
-                            .set("qcresult_info_id", newId)
-                            .set("modifier", useId)
-                            .set("gmt_modified", now)
-                    );
-                }
-                //1恢复
-                else if (analyzeVO.getDelStatus() == 1) {
-                    //该条目是机器插入条目
-                    qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
-                            .eq("id", algorithmVO.getOptResultAlgVO().getId())
-                            .eq("is_deleted", IsDeleteEnum.Y.getKey())
-                            .eq("hospital_id", analyzeVO.getHospitalId())
-                            .eq("behospital_code", analyzeVO.getBehospitalCode())
-                            .set("is_deleted", IsDeleteEnum.N.getKey())
-                            .set("grade_type", 2)
-                            .set("opt_type", 1)
-                            .set("qcresult_info_id", newId)
-                            .set("modifier", useId)
-                            .set("remark", null)
-                            .set("gmt_modified", now)
-                    );
-                } else {
-                    throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "delStatus参数错误");
-                }
-                break;
-            default:
-                /* DO NOTHING */
-                break;
-        }
-
-        //如果不是自动评分(是新增修改删除条目)修改评分主表id
-        if (algorithmVO.getType() != 0) {
-            //修改上一次人工条目 评分主表id
-            if (qcresultInfoup != null && qcresultInfoup.getId() != null) {
-                qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
-                        .eq("qcresult_info_id", qcresultInfoup.getId())
-                        .eq("hospital_id", analyzeVO.getHospitalId())
-                        .eq("grade_type", 2)
-                        .eq("behospital_code", analyzeVO.getBehospitalCode())
-                        .set("qcresult_info_id", newId)
-                        .set("modifier", useId)
-                        .set("gmt_modified", now)
-                );
-            }
-            //未删除的 评分主表id
+        //逻辑删除质控明细 0删除
+        if (analyzeVO.getDelStatus() == 0) {
             qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
             qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
+                    .eq("id", algorithmVO.getOptResultAlgVO().getId())
                     .eq("is_deleted", IsDeleteEnum.N.getKey())
                     .eq("is_deleted", IsDeleteEnum.N.getKey())
                     .eq("hospital_id", analyzeVO.getHospitalId())
                     .eq("hospital_id", analyzeVO.getHospitalId())
                     .eq("behospital_code", analyzeVO.getBehospitalCode())
                     .eq("behospital_code", analyzeVO.getBehospitalCode())
+                    .set("is_deleted", IsDeleteEnum.Y.getKey())
+                    .set("grade_type", 2)
+                    .set("opt_type", 2)
                     .set("qcresult_info_id", newId)
                     .set("qcresult_info_id", newId)
                     .set("modifier", useId)
                     .set("modifier", useId)
                     .set("gmt_modified", now)
                     .set("gmt_modified", now)
             );
             );
         }
         }
+        //1恢复
+        else if (analyzeVO.getDelStatus() == 1) {
+            //该条目是机器插入条目
+            qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
+                    .eq("id", algorithmVO.getOptResultAlgVO().getId())
+                    .eq("is_deleted", IsDeleteEnum.Y.getKey())
+                    .eq("hospital_id", analyzeVO.getHospitalId())
+                    .eq("behospital_code", analyzeVO.getBehospitalCode())
+                    .set("is_deleted", IsDeleteEnum.N.getKey())
+                    .set("grade_type", 2)
+                    .set("opt_type", 1)
+                    .set("qcresult_info_id", newId)
+                    .set("modifier", useId)
+                    .set("remark", null)
+                    .set("gmt_modified", now)
+            );
+        } else {
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "delStatus参数错误");
+        }
+        break;
+        default:
+        /* DO NOTHING */
+        break;
+    }
 
 
+    //如果不是自动评分(是新增修改删除条目)修改评分主表id
+        if(algorithmVO.getType()!=0)
 
 
-        //质控模块评分数据
-        //统一为长兴的算法
-        //逻辑删除数据
-        medQcresultCasesService.update(new UpdateWrapper<MedQcresultCases>()
+    {
+        //修改上一次人工条目 评分主表id
+        if (qcresultInfoup != null && qcresultInfoup.getId() != null) {
+            qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
+                    .eq("qcresult_info_id", qcresultInfoup.getId())
+                    .eq("hospital_id", analyzeVO.getHospitalId())
+                    .eq("grade_type", 2)
+                    .eq("behospital_code", analyzeVO.getBehospitalCode())
+                    .set("qcresult_info_id", newId)
+                    .set("modifier", useId)
+                    .set("gmt_modified", now)
+            );
+        }
+        //未删除的 评分主表id
+        qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("hospital_id", analyzeVO.getHospitalId())
                 .eq("hospital_id", analyzeVO.getHospitalId())
                 .eq("behospital_code", analyzeVO.getBehospitalCode())
                 .eq("behospital_code", analyzeVO.getBehospitalCode())
-                .set("is_deleted", IsDeleteEnum.Y.getKey())
+                .set("qcresult_info_id", newId)
                 .set("modifier", useId)
                 .set("modifier", useId)
-                .set("gmt_modified", now));
-        //批量插入新的数据
-        List<MedQcresultCases> medQcresultCasesList = new ArrayList<>();
-        List<MedQcresultCasesVO> medQcresultCasesVOList = algorithmVO.getMedQcresultCasesVOList();
-        if (ListUtil.isNotEmpty(medQcresultCasesVOList)) {
-            for (MedQcresultCasesVO medQcresultCasesVO : medQcresultCasesVOList) {
-                MedQcresultCases medQcresultCases = new MedQcresultCases();
-                BeanUtil.copyProperties(medQcresultCasesVO, medQcresultCases);
-                medQcresultCases.setGmtCreate(now);
-                medQcresultCases.setCreator(useId.toString());
-                medQcresultCases.setGmtModified(now);
-                medQcresultCases.setModifier(useId.toString());
-                medQcresultCases.setQcresultInfoId(newId);
-                medQcresultCasesList.add(medQcresultCases);
-            }
-            medQcresultCasesService.saveBatch(medQcresultCasesList);
+                .set("gmt_modified", now)
+        );
+    }
+
+
+    //质控模块评分数据
+    //统一为长兴的算法
+    //逻辑删除数据
+        medQcresultCasesService.update(new UpdateWrapper<MedQcresultCases>()
+                .
+
+    eq("is_deleted",IsDeleteEnum.N.getKey())
+            .
+
+    eq("hospital_id",analyzeVO.getHospitalId())
+            .
+
+    eq("behospital_code",analyzeVO.getBehospitalCode())
+            .
+
+    set("is_deleted",IsDeleteEnum.Y.getKey())
+            .
+
+    set("modifier",useId)
+                .
+
+    set("gmt_modified",now));
+    //批量插入新的数据
+    List<MedQcresultCases> medQcresultCasesList = new ArrayList<>();
+    List<MedQcresultCasesVO> medQcresultCasesVOList = algorithmVO.getMedQcresultCasesVOList();
+        if(ListUtil.isNotEmpty(medQcresultCasesVOList))
+
+    {
+        for (MedQcresultCasesVO medQcresultCasesVO : medQcresultCasesVOList) {
+            MedQcresultCases medQcresultCases = new MedQcresultCases();
+            BeanUtil.copyProperties(medQcresultCasesVO, medQcresultCases);
+            medQcresultCases.setGmtCreate(now);
+            medQcresultCases.setCreator(useId.toString());
+            medQcresultCases.setGmtModified(now);
+            medQcresultCases.setModifier(useId.toString());
+            medQcresultCases.setQcresultInfoId(newId);
+            medQcresultCasesList.add(medQcresultCases);
         }
         }
-        return now;
+        medQcresultCasesService.saveBatch(medQcresultCasesList);
     }
     }
+        return now;
+}
 
 
 
 
     /**
     /**

+ 5 - 1
src/main/java/com/diagbot/facade/ViewFacade.java

@@ -98,6 +98,7 @@ public class ViewFacade {
         long start = System.currentTimeMillis();
         long start = System.currentTimeMillis();
         List<BehospitalInfo> behospitalInfoList = aBehospitalInfoFacade.list(new QueryWrapper<BehospitalInfo>()
         List<BehospitalInfo> behospitalInfoList = aBehospitalInfoFacade.list(new QueryWrapper<BehospitalInfo>()
                 .eq("hospital_id", Long.valueOf("35"))
                 .eq("hospital_id", Long.valueOf("35"))
+                .eq("is_deleted",IsDeleteEnum.N.getKey())
                 .eq("is_placefile","0"));
                 .eq("is_placefile","0"));
 
 
         for (BehospitalInfo bean : behospitalInfoList) {
         for (BehospitalInfo bean : behospitalInfoList) {
@@ -627,17 +628,20 @@ public class ViewFacade {
         //获取无出院时间的病人信息
         //获取无出院时间的病人信息
         List<BehospitalInfo> infoList = aBehospitalInfoFacade.list(new QueryWrapper<BehospitalInfo>()
         List<BehospitalInfo> infoList = aBehospitalInfoFacade.list(new QueryWrapper<BehospitalInfo>()
                 .eq("hospital_id", Long.valueOf("35"))
                 .eq("hospital_id", Long.valueOf("35"))
-                .isNull("leave_hospital_date"));
+                .eq("is_deleted",IsDeleteEnum.N.getKey())
+                .eq("is_placefile","0"));
         //获取出院时间date天之内的的病人信息
         //获取出院时间date天之内的的病人信息
         if (list.size() > 0) {
         if (list.size() > 0) {
             list.forEach(behospitalInfo -> {
             list.forEach(behospitalInfo -> {
                 this.IfCoincide(behospitalInfo.getBehospitalCode());
                 this.IfCoincide(behospitalInfo.getBehospitalCode());
+                aMedAbnormalInfoFacade.saveAbnormalInfo("归档补传数据成功", behospitalInfo.getBehospitalCode(),"","" ,"");
             });
             });
         }
         }
         //获取无出院时间的运行质控的病人信息
         //获取无出院时间的运行质控的病人信息
         if (infoList.size() > 0) {
         if (infoList.size() > 0) {
             infoList.forEach(info -> {
             infoList.forEach(info -> {
                 this.IfCoincide(info.getBehospitalCode());
                 this.IfCoincide(info.getBehospitalCode());
+                aMedAbnormalInfoFacade.saveAbnormalInfo("运行补传数据成功", info.getBehospitalCode(),"","" ,"");
             });
             });
         }
         }
     }
     }

+ 2 - 1
src/main/java/com/diagbot/facade/data/ABehospitalInfoFacade.java

@@ -170,7 +170,7 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
             }else {
             }else {
                 //根据科室查找对应质控类型
                 //根据科室查找对应质控类型
                 List<QcType> qcTypeList = qcTypeFacade.list(new QueryWrapper<QcType>()
                 List<QcType> qcTypeList = qcTypeFacade.list(new QueryWrapper<QcType>()
-                        .eq("beh_dept_id", s.getBehDeptId())
+                        .like("beh_dept_id", s.getBehDeptId())
                         .eq("hospital_id", s.getHospitalId())
                         .eq("hospital_id", s.getHospitalId())
                         .eq("is_deleted", IsDeleteEnum.N));
                         .eq("is_deleted", IsDeleteEnum.N));
                 if (qcTypeList.size() == 0) {
                 if (qcTypeList.size() == 0) {
@@ -270,6 +270,7 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
                 updateWrapper.eq("behospital_code", aBehospitalInfoVO.getBehospitalCode())
                 updateWrapper.eq("behospital_code", aBehospitalInfoVO.getBehospitalCode())
                         .eq("hospital_id", aBehospitalInfoVO.getHospitalId())
                         .eq("hospital_id", aBehospitalInfoVO.getHospitalId())
                         .eq("is_deleted",IsDeleteEnum.N)
                         .eq("is_deleted",IsDeleteEnum.N)
+                        .set("is_placefile",Long.valueOf("1"))
                         .set("leave_hospital_date",aBehospitalInfoVO.getLeaveHospitalDate().isEmpty()?DateUtil.formatDateTime(DateUtil.now()):DateUtil.parseDateTime(aBehospitalInfoVO.getLeaveHospitalDate()))
                         .set("leave_hospital_date",aBehospitalInfoVO.getLeaveHospitalDate().isEmpty()?DateUtil.formatDateTime(DateUtil.now()):DateUtil.parseDateTime(aBehospitalInfoVO.getLeaveHospitalDate()))
                         .set("gmt_modified", DateUtil.now());
                         .set("gmt_modified", DateUtil.now());
 
 

+ 40 - 8
src/main/java/com/diagbot/facade/data/AMedicalRecordFacade.java

@@ -488,7 +488,7 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
         }else {
         }else {
             //根据科室查找对应质控类型
             //根据科室查找对应质控类型
             List<QcType> qcTypeList = qcTypeFacade.list(new QueryWrapper<QcType>()
             List<QcType> qcTypeList = qcTypeFacade.list(new QueryWrapper<QcType>()
-                    .eq("beh_dept_id", s.getBehDeptId())
+                    .like("beh_dept_id", s.getBehDeptId())
                     .eq("hospital_id", s.getHospitalId())
                     .eq("hospital_id", s.getHospitalId())
                     .eq("is_deleted", IsDeleteEnum.N));
                     .eq("is_deleted", IsDeleteEnum.N));
             if (qcTypeList.size() == 0) {
             if (qcTypeList.size() == 0) {
@@ -531,13 +531,45 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
         } else {
         } else {
             modeId = Long.valueOf("0");
             modeId = Long.valueOf("0");
         }
         }
-//        if (modeId.equals(Long.valueOf("0"))){
-//            String recTitle=medicalRecord.getRecTitle();
-//            if (recTitle.contains("查") && recTitle.contains("房")){
-//
-//            }
-//
-//        }
+        // rec_type_id未匹配成功后根据名称进行下一步匹配
+        if (modeId.equals(Long.valueOf("0"))){
+            String recTitle=medicalRecord.getRecTitle();
+            if (recTitle.contains("查") && recTitle.contains("房")){
+                modeId = Long.valueOf("4");
+            }else if (recTitle.contains("阶段小结")){
+                modeId = Long.valueOf("28");
+            }else if (recTitle.contains("术后")){
+                modeId = Long.valueOf("18");
+            }else if (recTitle.contains("术前")){
+                modeId = Long.valueOf("11");
+            }else if (recTitle.contains("会诊意见")){
+                modeId = Long.valueOf("31");
+            }else if (recTitle.contains("会诊") && !recTitle.contains("会诊意见")){
+                modeId = Long.valueOf("7");
+            }else if (recTitle.contains("出院小结")){
+                modeId = Long.valueOf("5");
+            }else if (recTitle.contains("抢救")){
+                modeId = Long.valueOf("22");
+            }else if (recTitle.contains("首次病程记录")){
+                modeId = Long.valueOf("2");
+            }else if (recTitle.contains("同意书") && ! recTitle.contains("手术")){
+                modeId = Long.valueOf("53");
+            }else if (recTitle.contains("手术记录")){
+                modeId = Long.valueOf("17");
+            }else if (recTitle.contains("疑难病例")){
+                modeId = Long.valueOf("19");
+            }else if (recTitle.contains("危急值")){
+                modeId = Long.valueOf("23");
+            }else if (recTitle.contains("死亡记录")){
+                modeId = Long.valueOf("24");
+            }else if (recTitle.contains("告知书")){
+                modeId = Long.valueOf("54");
+            }else if (recTitle.contains("病危")  || recTitle.contains("病重") ){
+                modeId = Long.valueOf("29");
+            }else if (recTitle.contains("输血")){
+                modeId = Long.valueOf("10");
+            }
+        }
         return modeId;
         return modeId;
     }
     }
 
 

+ 67 - 0
src/main/java/com/diagbot/util/TZDBConn.java

@@ -1,10 +1,14 @@
 package com.diagbot.util;
 package com.diagbot.util;
 
 
+import com.diagbot.dto.SentEntryRecordDTO;
 import com.diagbot.entity.*;
 import com.diagbot.entity.*;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
+import io.undertow.util.DateUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 
 
 import java.sql.*;
 import java.sql.*;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.util.List;
 import java.util.List;
 import java.util.ResourceBundle;
 import java.util.ResourceBundle;
 
 
@@ -686,4 +690,67 @@ public class TZDBConn {
 		}
 		}
 		return medicalRecordList;
 		return medicalRecordList;
 	}
 	}
+
+	/**
+	 * 关闭数据库
+	 * @param conn
+	 */
+	public void closeConnection(Connection conn){
+		try{
+			if(conn != null){
+				conn.close();
+			}
+		}
+		catch(Exception e){
+			System.out.println("数据库关闭失败");
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * 新赠评分插入表中
+	 * @return
+	 */
+	public Integer setQcMessAge(SentEntryRecordDTO sentEntryRecordDTO) throws SQLException {
+		try {
+			String patientId=sentEntryRecordDTO.getBehospitalCode().split("_")[0];
+			String visitId=sentEntryRecordDTO.getBehospitalCode().split("_")[1];
+			int re=0;
+			connection = getConnection();
+			connection.setAutoCommit(false);//事物开始
+			PreparedStatement state=connection.prepareStatement("insert into MEDICAL_QC_MSG " +
+					"(PATIENT_ID,VISIT_ID,DOCTOR_IN_CHARGE,QA_EVENT_TYPE,QC_MSG_CODE,MESSAGE,ISSUED_BY,ISSUED_DATE_TIME,TOPIC_ID,DEPT_STAYED,MSG_STATUS)"+
+					"values(?,?,?,?,?,?,?,to_date(?,'yyyy-mm-dd hh24:mi:ss'),?,?,?)");
+			state.setString(1, patientId);
+			state.setString(2, visitId);
+			state.setString(3,StringUtils.isNotEmpty(sentEntryRecordDTO.getDoctorName())?sentEntryRecordDTO.getDoctorName():sentEntryRecordDTO.getCheckName());
+			state.setString(4,StringUtils.isNotEmpty(sentEntryRecordDTO.getModeName())?sentEntryRecordDTO.getModeName():"其他");
+			state.setInt(5,1511);
+			state.setString(6,sentEntryRecordDTO.getMsg());
+			state.setString(7,"评价质控");
+			state.setString(8, DateUtil.formatDateTime(DateUtil.now()));
+			state.setString(9,StringUtils.isNotEmpty(sentEntryRecordDTO.getModeName())?sentEntryRecordDTO.getModeName():"其他");
+			state.setString(10,sentEntryRecordDTO.getDeptId());
+			state.setInt(11,0);
+			re = state.executeUpdate();
+			if(re < 0){               //插入失败
+				connection.rollback();      //回滚
+				state.close();
+				closeConnection(connection);
+				return re;
+			}
+			connection.commit();            //插入正常
+			state.close();
+			closeConnection(connection);
+			return re;
+
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw e;
+		}finally {
+			close();
+		}
+
+	}
+
 }
 }

+ 822 - 0
src/main/java/com/diagbot/util/TZDBConnForHis.java

@@ -0,0 +1,822 @@
+package com.diagbot.util;
+
+import com.diagbot.dto.SentEntryRecordDTO;
+import com.diagbot.entity.*;
+import com.google.common.collect.Lists;
+import org.apache.commons.lang3.StringUtils;
+
+import java.sql.*;
+import java.util.List;
+import java.util.ResourceBundle;
+
+public class TZDBConnForHis {
+	private static final String DRIVER = getValue("jdbc.driverClassName1");
+    private static final String URL = getValue("jdbc.url1");
+    private static final String USERNAME = getValue("jdbc.username1");
+    private static final String PASSWORD = getValue("jdbc.password1");
+
+	public static final Long HOSPITAL_ID=Long.valueOf("35");//1:长兴,2:邵逸夫,3:台州市立医院
+
+    private static Connection connection = null;
+    private static PreparedStatement sta = null;
+	private static 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 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 List<BasDeptInfo> getDeptInfo(String sql) {
+		List<BasDeptInfo> basDeptInfoList=Lists.newLinkedList();
+		try {
+			TZDBConnForHis dbconn=new TZDBConnForHis();
+			ResultSet rs =dbconn.Query(sql, null);
+			while(rs.next()){
+				BasDeptInfo basDeptInfo=new BasDeptInfo();
+				basDeptInfo.setDeptId(rs.getString("deptId"));//科室编码
+				basDeptInfo.setHospitalId(HOSPITAL_ID);//医院ID
+				basDeptInfo.setDeptName(rs.getString("deptName"));//科室名称
+				basDeptInfo.setParentDeptId(rs.getString("partentDeptId"));//父类科室名称
+				basDeptInfo.setDeptType(rs.getString("deptType"));//科室类别
+				basDeptInfo.setStation(rs.getString("station"));//区域类别
+				basDeptInfo.setSpell(rs.getString("spell"));//首字母拼音
+
+				basDeptInfoList.add(basDeptInfo);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally {
+			close();
+		}
+		return basDeptInfoList;
+	}
+
+	/**
+	 * 从视图中获取医院医生信息
+	 * @return
+	 */
+	public List<BasDoctorInfo> getDoctorInfo(String sql) {
+		List<BasDoctorInfo> basDoctorInfos=Lists.newLinkedList();
+		try {
+			TZDBConnForHis dbconn=new TZDBConnForHis();
+			ResultSet rs =dbconn.Query(sql, null);
+			while(rs.next()){
+				BasDoctorInfo basDoctorInfo =new BasDoctorInfo();
+				basDoctorInfo.setDoctorId(rs.getString("user_id"));//医生id
+				basDoctorInfo.setHospitalId(Long.valueOf("35"));
+				basDoctorInfo.setDeptId(rs.getString("dept_code"));//医生所在科室
+				basDoctorInfo.setName(rs.getString("name"));//医师姓名
+				basDoctorInfo.setProfessor(rs.getString("title"));//医师职称
+				basDoctorInfo.setOccup(rs.getString("certificate"));//是否有职业医师资格
+				basDoctorInfos.add(basDoctorInfo);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally {
+			close();
+		}
+		return basDoctorInfos;
+	}
+
+	/**
+	 * 查询文书数量
+	 * @return
+	 */
+	public Integer getCount(String sql) {
+		Integer count =0;
+		try {
+			TZDBConnForHis dbconn=new TZDBConnForHis();
+			ResultSet rs =dbconn.Query(sql, null);
+			while(rs.next()){
+				count=rs.getInt("count");
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally {
+			close();
+		}
+		return count;
+	}
+
+	/**
+	 * 病案诊断
+	 * @return
+	 */
+	public List<HomeDiagnoseInfo> getHomeDiagnose(String sql){
+		List<HomeDiagnoseInfo> homeDiagnoseVOList=Lists.newLinkedList();
+		try {
+			TZDBConnForHis dbconn=new TZDBConnForHis();
+			ResultSet rs =dbconn.Query(sql, null);
+			while(rs.next()){
+				HomeDiagnoseInfo homeDiagnose=new HomeDiagnoseInfo();
+				homeDiagnose.setHomePageId(rs.getString("homePageId"));//病案首页ID
+				homeDiagnose.setHospitalId(HOSPITAL_ID);//医院ID
+				homeDiagnose.setDiagnoseOrderNo(rs.getString("diagnoseOrderNo"));//诊断序号
+				homeDiagnose.setDiagnoseName(rs.getString("diagnoseName"));//诊断名称
+				homeDiagnose.setDiagnoseType(rs.getString("diagnoseType"));//诊断类别
+				homeDiagnose.setDiagnoseTypeShort(rs.getString("diagnoseTypeShort"));//诊断判别
+				homeDiagnose.setBehospitalType(rs.getString("behospitalType"));//入院情况
+				homeDiagnose.setLeaveHospitalType(rs.getString("leaveHospitalType"));//出院情况
+				homeDiagnose.setPathologyDiagnose(rs.getString("pathologyDiagnose"));//病理号
+				homeDiagnose.setIcdCode(rs.getString("icdCode"));//诊断编码
+
+				homeDiagnoseVOList.add(homeDiagnose);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally {
+			close();
+		}
+
+		return homeDiagnoseVOList;
+	}
+
+	/**
+	 * 病案手术
+	 * @return
+	 */
+	public List<HomeOperationInfo> getHomeOperation(String sql) {
+		List<HomeOperationInfo> homeOperationVOList=Lists.newLinkedList();
+		try {
+			TZDBConnForHis dbconn=new TZDBConnForHis();
+			ResultSet rs =dbconn.Query(sql, null);
+			while(rs.next()){
+				HomeOperationInfo homeOperationVO=new HomeOperationInfo();
+				homeOperationVO.setHomePageId(rs.getString("homePageId"));//病案首页ID
+				homeOperationVO.setHospitalId(HOSPITAL_ID);//医院ID
+				homeOperationVO.setOperationOrderNo(rs.getString("operationOrderNo"));//手术序号
+				homeOperationVO.setOperationDate(StringUtils.isNotBlank(rs.getString("operationDate"))?DateUtil.parseDateTime(rs.getString("operationDate")):null);//手术日期
+				homeOperationVO.setOperationCode(rs.getString("operationCode"));//手术编码
+				homeOperationVO.setOperationDoctorId(rs.getString("operationDoctorId"));//手术医生
+				homeOperationVO.setFirstAssistantId(rs.getString("firstAssistantId"));//一助医生
+				homeOperationVO.setSecondAssistantId(rs.getString("secondAssistantId"));//二助医生
+				homeOperationVO.setCutLevel(rs.getString("cutLevel"));//切口等级
+				homeOperationVO.setHealingLevel(rs.getString("healingLevel"));//愈合等级
+				homeOperationVO.setOperationName(rs.getString("operationName"));//手术名称
+				homeOperationVO.setOperationLevel(rs.getString("operationLevel"));//手术级别
+				homeOperationVO.setAnaesthesiaName(rs.getString("anaesthesiaName"));//麻醉方式
+				homeOperationVO.setShamOperationName(rs.getString("shamOperationName"));//拟手术名称
+				homeOperationVO.setAnaesthesiaDoctor(rs.getString("anaesthesiaDoctor"));//麻醉医师
+				homeOperationVOList.add(homeOperationVO);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally {
+			close();
+		}
+		List<HomeOperationInfo> homeOperationList=BeanUtil.listCopyTo(homeOperationVOList, HomeOperationInfo.class);
+		return homeOperationList;
+	}
+
+	/**
+	 * 从视图获取病案首页信息
+	 *
+	 */
+	public List<HomePage> getHomePage(String sql) {
+		List<HomePage> homePageList=Lists.newLinkedList();
+		try {
+			TZDBConnForHis dbconn=new TZDBConnForHis();
+			ResultSet rs =dbconn.Query(sql, null);
+//			if (!rs.next()){
+//                System.out.println("返回查询结果为空");
+//            }else {
+                while(rs.next()){
+                    HomePage homePageVO=new HomePage();
+                    homePageVO.setHomePageId(rs.getString("homePageId"));//病案首页编号
+                    homePageVO.setHospitalId(HOSPITAL_ID);//医院ID
+                    homePageVO.setBehospitalCode(rs.getString("behospitalCode")+"_"+rs.getString("behospitalNum"));//病人住院序号
+                    homePageVO.setHospitalCode(rs.getString("hospitalCode"));//组织机构id
+                    homePageVO.setHospitalName(rs.getString("hospitalName"));//医疗机构名称
+                    homePageVO.setOrgCode(rs.getString("orgCode"));//医疗机构代码
+                    homePageVO.setPayType(rs.getString("payType"));//医疗付费方式
+                    homePageVO.setHealthCard(rs.getString("healthCard"));//健康卡号
+                    homePageVO.setBehospitalNum(rs.getString("behospitalNum"));//住院次数
+                    homePageVO.setFileCode(rs.getString("fileCode"));//病案号
+                    homePageVO.setName(rs.getString("name"));//姓名
+                    homePageVO.setSex(rs.getString("sex"));//性别
+                    homePageVO.setBirthday(rs.getDate("birthday"));//出生日期
+                    homePageVO.setAge(rs.getString("age").equals("-")?null:rs.getString("age"));//病人年龄
+                    homePageVO.setAgeUnit(rs.getString("ageUnit"));//年龄单位
+                    homePageVO.setNationality(rs.getString("nationality"));//国籍
+                    homePageVO.setNewbornMonth(rs.getString("newbornMonth"));//新生儿出生月数
+                    homePageVO.setNewbornDay(rs.getString("newbornDay"));//新生儿出生天数
+                    homePageVO.setNewbornWeight(rs.getString("newbornWeight"));//新生儿出生体重
+                    homePageVO.setNewbornBehospitalWeight(rs.getString("newbornBehospitalWeight"));//新生儿入院体重
+                    homePageVO.setBornAddress(rs.getString("bornAddress"));//出生地
+                    homePageVO.setBornPlace(rs.getString("bornPlace"));//籍贯
+                    homePageVO.setNation(rs.getString("nation"));//民族
+                    homePageVO.setIdentityCardNo(rs.getString("identityCardNo"));//身份证号
+                    homePageVO.setJobType(rs.getString("jobType"));//职业
+                    homePageVO.setMarriage(rs.getString("marriage"));//婚姻
+                    homePageVO.setCurAddress(rs.getString("curAddress"));//现住址
+                    homePageVO.setCurPhone(rs.getString("curPhone"));//现住址电话
+                    homePageVO.setCurPostCode(rs.getString("curPostCode"));//现住址邮编
+                    homePageVO.setResidenceAddress(rs.getString("residenceAddress"));//户口地址
+                    homePageVO.setResidencePostCode(rs.getString("residencePostCode"));//户口地址邮编
+                    homePageVO.setWorkAddress(rs.getString("workAddress"));//工作单位
+                    homePageVO.setWorkPhone(rs.getString("workPhone"));//工作单位电话
+                    homePageVO.setWorkPostCode(rs.getString("workPostCode"));//工作单位邮编
+                    homePageVO.setContactName(rs.getString("contactName"));//联系人姓名
+                    homePageVO.setContactRelation(rs.getString("contactRelation"));//联系人关系
+                    homePageVO.setContactAddress(rs.getString("contactAddress"));//联系人地址
+                    homePageVO.setContactPhone(rs.getString("contactPhone"));//联系人电话
+                    homePageVO.setBehospitalWay(rs.getString("behospitalWay"));//入院途径
+                    homePageVO.setBehospitalDate(StringUtils.isNotBlank(rs.getString("behospitalDate"))?DateUtil.parseDateTime(rs.getString("behospitalDate")):null);//入院时间
+                    homePageVO.setBehospitalDept(rs.getString("behospitalDept"));//入院科室
+                    homePageVO.setBehospitalWard(rs.getString("behospitalWard"));//入院病房
+                    homePageVO.setBehospitalBedId(rs.getString("behospitalBedId"));//入院床位序号
+                    homePageVO.setBehospitalBedCode(rs.getString("behospitalBedCode"));//入院床位号码
+                    homePageVO.setChangeDept(rs.getString("changeDept"));//转科科别
+                    homePageVO.setLeaveHospitalDate(StringUtils.isNotBlank(rs.getString("leaveHospitalDate"))?DateUtil.parseDateTime(rs.getString("leaveHospitalDate")):null);//出院时间
+                    homePageVO.setLeaveHospitalDept(rs.getString("leaveHospitalDept"));//出院科别
+                    homePageVO.setLeaveHospitalWard(rs.getString("leaveHospitalWard"));//出院病房
+                    homePageVO.setLeaveHospitalBedId(rs.getString("leaveHospitalBedId"));//出院床位序号
+                    homePageVO.setLeaveHospitalBedCode(rs.getString("leaveHospitalBedCode"));//出院床位号码
+                    homePageVO.setBehospitalDayNum(rs.getString("behospitalDayNum"));//实际住院天数
+                    homePageVO.setOutpatientEmrDiagnose(rs.getString("outpatientEmrDiagnose"));//门急诊诊断
+                    homePageVO.setOutpatientEmrDiagnoseCode(rs.getString("outpatientEmrDiagnoseCode"));//门急诊诊断编码
+                    homePageVO.setPoisonFactor(rs.getString("poisonFactor"));//损伤中毒因素
+                    homePageVO.setPoisonFactorCode(rs.getString("poisonFactorCode"));//损伤中毒因素编码
+                    homePageVO.setPathologyDiagnose(rs.getString("pathologyDiagnose"));//病理诊断
+                    homePageVO.setPathologyDiagnoseCode(rs.getString("pathologyDiagnoseCode"));//病理诊断编码
+                    homePageVO.setPathologyDiagnoseId(rs.getString("pathologyDiagnoseId"));//病理诊断编号
+                    homePageVO.setIsMedAllergy(rs.getString("isMedAllergy"));//药物过敏
+                    homePageVO.setMedAllergyName(rs.getString("medAllergyName"));//过敏药物
+                    homePageVO.setAutopsy(rs.getString("autopsy"));//死亡患者尸检
+                    homePageVO.setBloodType(rs.getString("bloodType"));//血型
+                    homePageVO.setRh(rs.getString("rh"));//Rh
+                    homePageVO.setDeptDirector(rs.getString("deptDirector"));//科主任
+                    homePageVO.setDirectorDoctor(rs.getString("directorDoctor"));//主任医师
+                    homePageVO.setAttendingDoctor(rs.getString("attendingDoctor"));//主治医师
+                    homePageVO.setBehospitalDoctor(rs.getString("behospitalDoctor"));//住院医师
+                    homePageVO.setResponseNurse(rs.getString("responseNurse"));//责任护士
+                    homePageVO.setStudyDoctor(rs.getString("studyDoctor"));//进修医师
+                    homePageVO.setPracticeDoctor(rs.getString("practiceDoctor"));//实习医师
+                    homePageVO.setEncodeMan(rs.getString("encodeMan"));//编码员
+                    homePageVO.setHomePageQuality(rs.getString("homePageQuality"));//病案质量
+                    homePageVO.setQcDoctor(rs.getString("qcDoctor"));//质控医师
+                    homePageVO.setQcNurse(rs.getString("qcNurse"));//质控护士
+                    if(!"".equals(rs.getString("qcDate"))){
+                        homePageVO.setQcDate(DateUtil.parseDate(rs.getString("qcDate"),DateUtil.DATE_TIME_FORMAT));//质控日期
+                    }
+                    homePageVO.setLeaveHospitalType(rs.getString("leaveHospitalType"));//离院方式
+                    homePageVO.setAcceptOrgCode(rs.getString("acceptOrgCode"));//接收机构名称
+                    homePageVO.setAgainBehospitalPlan(rs.getString("againBehospitalPlan"));//31天内再住院计划
+                    homePageVO.setAgainBehospitalGoal(rs.getString("againBehospitalGoal"));//再住院目的
+                    homePageVO.setTbiBeforeDay(rs.getString("tbiBeforeDay"));//颅脑损伤患者昏迷前天数
+                    homePageVO.setTbiBeforeHour(rs.getString("tbiBeforeHour"));//颅脑损伤患者昏迷前小时
+                    homePageVO.setTbiBeforeMinute(rs.getString("tbiBeforeMinute"));//颅脑损伤患者昏迷前分钟
+                    homePageVO.setTbiAfterDay(rs.getString("tbiAfterDay"));//颅脑损伤患者昏迷后天数
+                    homePageVO.setTbiAfterHour(rs.getString("tbiAfterHour"));//颅脑损伤患者昏迷后小时
+                    homePageVO.setTbiAfterMinute(rs.getString("tbiAfterMinute"));//颅脑损伤患者昏迷后分钟
+                    homePageVO.setTotalFee(rs.getString("totalFee"));//总费用
+                    homePageVO.setOwnFee(rs.getString("ownFee"));//自付金额
+                    homePageVO.setGeneralFee(rs.getString("generalFee"));//一般医疗服务费
+                    homePageVO.setServiceFee(rs.getString("serviceFee"));//一般治疗服务费
+                    homePageVO.setNurseFee(rs.getString("nurseFee"));//护理费
+                    homePageVO.setOtherFee(rs.getString("otherFee"));//其他费用
+                    homePageVO.setPathologyFee(rs.getString("pathologyFee"));//病理诊断费
+                    homePageVO.setLabFee(rs.getString("labFee"));//实验室诊断费
+                    homePageVO.setPacsFee(rs.getString("pacsFee"));//影像学诊断费
+                    homePageVO.setClinicDiagnoseFee(rs.getString("clinicDiagnoseFee"));//临床诊断项目费
+                    homePageVO.setNotOperationFee(rs.getString("notOperationFee"));//非手术治疗项目费
+                    homePageVO.setClinicPhysicFee(rs.getString("clinicPhysicFee"));//临床物理治疗费
+                    homePageVO.setOperationTreatFee(rs.getString("operationTreatFee"));//手术治疗费
+                    homePageVO.setAnaesthesiaFee(rs.getString("anaesthesiaFee"));//麻醉费
+                    homePageVO.setOperationFee(rs.getString("operationFee"));//手术费
+                    homePageVO.setHealthTypeFee(rs.getString("healthTypeFee"));//康复类
+                    homePageVO.setChnTreatFee(rs.getString("chnTreatFee"));//中医治疗费
+                    homePageVO.setWesternMedFee(rs.getString("westernMedFee"));//西药费
+                    homePageVO.setAntibiosisFee(rs.getString("antibiosisFee"));//抗菌药物费用
+                    homePageVO.setChnMedFee(rs.getString("chnMedFee"));//中成药费
+                    homePageVO.setChnHerbFee(rs.getString("chnHerbFee"));//中草药费
+                    homePageVO.setBloodFee(rs.getString("bloodFee"));//血费
+                    homePageVO.setAlbumenFee(rs.getString("albumenFee"));//白蛋白类制品费
+                    homePageVO.setGlobulinFee(rs.getString("globulinFee"));//球蛋白类制品费
+                    homePageVO.setBloodFactorFee(rs.getString("bloodFactorFee"));//凝血因子类制品费
+                    homePageVO.setCellFactorFee(rs.getString("cellFactorFee"));//细胞因子类制品费
+                    homePageVO.setCheckMaterialFee(rs.getString("checkMaterialFee"));//检查用一次性医用材料费
+                    homePageVO.setTreatMaterialFee(rs.getString("treatMaterialFee"));//治疗用一次性医用材料费
+                    homePageVO.setOperationMaterialFee(rs.getString("operationMaterialFee"));//手术用一次性医用材料费
+                    homePageVO.setOtherTypeFee(rs.getString("otherTypeFee"));//其他类其他费
+                    homePageVO.setSingleDiagManage(rs.getString("singleDiagManage"));//单病种管理
+                    homePageVO.setClinicPathwayManage(rs.getString("clinicPathwayManage"));//临床路径管理
+                    homePageVO.setIsOutpatientBehospital(rs.getString("isOutpatientBehospital"));//门诊与住院
+                    homePageVO.setIsLeaveBehospital(rs.getString("isLeaveBehospital"));//入院与出院
+                    homePageVO.setIsOperationBeforeAfter(rs.getString("isOperationBeforeAfter"));//术前与术后
+                    homePageVO.setIsClinicPathology(rs.getString("isClinicPathology"));//临床与病理
+                    homePageVO.setIsRadiatePathology(rs.getString("isRadiatePathology"));//放射与病理
+                    homePageVO.setRescueSuccessNum(rs.getString("rescueNum"));//病人抢救次数
+                    homePageVO.setRescueSuccessNum(rs.getString("rescueSuccessNum"));//病人抢救成功次数
+                    homePageVO.setIsAutoLeavehospital(rs.getString("isAutoLeavehospital"));//是否为自动出院
+                    homePageVO.setReturnToType(rs.getString("returnToType"));//转归情况HomePage homePageVO=new HomePage();
+
+                    homePageVO.setIsPhysicalRestraint(rs.getString("isPhysicalRestraint"));//住院期间身体约束
+                    homePageVO.setTbiBehospitalBeforeTime(rs.getString("tbiBehospitalBeforeTime"));//颅脑损伤患者昏迷时间(入院前)
+                    homePageVO.setIsPhysicalRestraint(rs.getString("isPhysicalRestraint"));//颅脑损伤患者昏迷时间(入院后)
+                    homePageVO.setIsFallBed(rs.getString("isFallBed"));//住院期间是否发生跌倒或坠床
+                    homePageVO.setIsNosocomialInfection(rs.getString("isNosocomialInfection"));//医院感染
+                    homePageVO.setIsIntoIcu(rs.getString("isIntoIcu"));//入住ICU情况
+                    homePageVO.setIsComplications(rs.getString("isComplications"));//并发症情况
+                    homePageVO.setIsPressureSore(rs.getString("isPressureSore"));//是否发生压疮
+                    homePageVO.setIsBehospitalPressureSore(rs.getString("isBehospitalPressureSore"));//是否住院期间发生压疮
+                    homePageVO.setIsUnplannedReoperation(rs.getString("isUnplannedReoperation"));//非计划再次手术
+                    homePageVO.setTreatmentResults(rs.getString("treatmentResults"));//治疗结果
+                    homePageVO.setComplicationsResults(rs.getString("complicationsResults"));//并发症
+                    homePageVO.setInfectionSite(rs.getString("infectionSite"));//感染部位
+                    homePageVO.setIsBeInDanger(rs.getString("isBeInDanger"));//住院期间有无告病危
+                    homePageList.add(homePageVO);
+                }
+//            }
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally {
+			close();
+		}
+		return homePageList;
+	}
+
+
+	/**
+	 * 从视图中获取医嘱信息
+	 * @return
+	 */
+	public List<DoctorAdvice> getDoctorAdvice(String sql){
+		List<DoctorAdvice> doctorAdviceList=Lists.newLinkedList();
+		try {
+			TZDBConnForHis dbconn=new TZDBConnForHis();
+			ResultSet rs =dbconn.Query(sql, null);
+			while(rs.next()){
+				DoctorAdvice doctorAdviceVO=new DoctorAdvice();
+				doctorAdviceVO.setDoctorAdviceId(rs.getString("doctorAdviceId"));//病人医嘱ID
+				doctorAdviceVO.setHospitalId(HOSPITAL_ID);//医院ID
+				doctorAdviceVO.setBehospitalCode(rs.getString("behospitalCode")+"_"+rs.getString("behospitalNum"));//病人ID
+				doctorAdviceVO.setOrderDoctorName(rs.getString("orderDoctorName"));//医生开单判别
+				doctorAdviceVO.setFrequency(rs.getString("frequency"));//医嘱频率判别
+				doctorAdviceVO.setParentTypeId(rs.getString("parentTypeId"));//父类医嘱ID
+				doctorAdviceVO.setDoctorAdviceType(rs.getString("doctorAdviceType"));//医嘱类型判别
+				doctorAdviceVO.setUsageNum(rs.getString("usageNum"));//一次使用数量
+				doctorAdviceVO.setUsageUnit(rs.getString("usageUnit"));//一次用量单位
+				doctorAdviceVO.setDose(rs.getString("dose"));//医嘱单次剂量
+				doctorAdviceVO.setDoseUnit(rs.getString("doseUnit"));//单次剂量单位
+				doctorAdviceVO.setMedModeType(rs.getString("medModeType"));//给药方式
+				doctorAdviceVO.setMedicineType(rs.getString("medicineType"));//药品类型
+				doctorAdviceVO.setDaFrequency(rs.getString("daFrequency"));//医嘱频率
+				doctorAdviceVO.setDaDealType(rs.getString("daDealType"));//医嘱处理类型
+				doctorAdviceVO.setDaStartDate(StringUtils.isNotBlank(rs.getString("daStartDate"))?DateUtil.parseDateTime(rs.getString("daStartDate")):null);//医嘱开始时间
+				doctorAdviceVO.setDaItemName(rs.getString("daItemName"));//医嘱项目名称
+				doctorAdviceVO.setDaStatus(rs.getString("daStatus"));//医嘱状态判别
+				doctorAdviceVO.setDaStopDate(StringUtils.isNotBlank(rs.getString("daStopDate"))?DateUtil.parseDateTime(rs.getString("daStopDate")):null);//医嘱结束时间
+				doctorAdviceVO.setDaGroupNo(rs.getString("daGroupCode"));//医嘱同组序号
+				doctorAdviceVO.setDaPrescriptionType(rs.getString("daPrescriptionType"));//医嘱处方类型
+				doctorAdviceVO.setDaMedType(rs.getString("daMedType"));//医嘱领药类型
+				doctorAdviceVO.setDoctorNotice(rs.getString("doctoryNotice"));//医生嘱托
+//				doctorAdviceVO.setDoctorId(rs.getString("KDYSID"));//开单医生ID
+				doctorAdviceVO.setDoctorName(rs.getString("doctorName"));//开单医生姓名
+
+				doctorAdviceList.add(doctorAdviceVO);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally {
+			close();
+		}
+		return doctorAdviceList;
+	}
+
+
+
+	/**
+	 * 从视图中获取化验信息
+	 * @return
+	 */
+	public List<MedLisInfo> getLisInfo(String sql){
+		List<MedLisInfo> medLisInfos=Lists.newLinkedList();
+		try {
+			TZDBConnForHis dbconn=new TZDBConnForHis();
+			ResultSet rs =dbconn.Query(sql, null);
+			while(rs.next()){
+				MedLisInfo medLisInfo=new MedLisInfo();
+				medLisInfo.setRepNo(rs.getString("repNo"));//报告单号
+				medLisInfo.setHospitalId(HOSPITAL_ID+"");//医院ID
+				medLisInfo.setBehospitalCode(rs.getString("behospitalCode")+"_"+rs.getString("behospitalNum"));//住院病人ID
+				medLisInfo.setRepName(rs.getString("repName"));//报告名称
+				medLisInfo.setRepType(rs.getString("repType"));//报告类型代码
+				medLisInfo.setRepTypeName(rs.getString("repTypeName"));//检查类型名称
+				medLisInfo.setSlideType(rs.getString("slideType"));//标本名称
+				medLisInfo.setRepDate(rs.getString("repDate"));//发布时间
+				medLisInfo.setCheckDate(rs.getString("checkDate"));//报告检查时间
+				medLisInfo.setApplyDoctor(rs.getString("applyDoctor"));//申请医生
+				medLisInfo.setDeptName(rs.getString("deptName"));//开单科室名称
+				medLisInfo.setDeptId(rs.getString("deptId"));//开单科室代码
+				medLisInfo.setRegisterFlag(rs.getString("registerFlag"));//报告单状态
+				medLisInfos.add(medLisInfo);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally {
+			close();
+		}
+		return medLisInfos;
+	}
+
+
+
+	/**
+	 * 从视图中获取化验结果
+	 * @return
+	 */
+	public List<MedLisResult> getLisResult(String sql){
+		List<MedLisResult> medLisResultList=Lists.newLinkedList();
+		try {
+			TZDBConnForHis dbconn=new TZDBConnForHis();
+			ResultSet rs =dbconn.Query(sql, null);
+			while(rs.next()){
+				MedLisResult medLisResult=new MedLisResult();
+				medLisResult.setRepNo(rs.getString("repNo"));//报告单号
+				medLisResult.setHospitalId(HOSPITAL_ID);//医院ID
+				medLisResult.setBehospitalCode(rs.getString("behospitalCode")+"_"+rs.getString("behospitalNum"));//住院病人ID
+				medLisResult.setItemCode(rs.getString("itemCode"));//报告代码
+				medLisResult.setItemName(rs.getString("itemName"));//报告名称
+				medLisResult.setResult(rs.getString("result"));//检验结果
+				medLisResult.setReferenceMin(rs.getString("referenceMin"));//最小参考值
+				medLisResult.setReferenceMax(rs.getString("referenceMax"));//最大参考值
+				medLisResult.setUnit(rs.getString("unit"));//单位
+				medLisResult.setAbnormal(rs.getString("abnormal"));//异常标志
+				medLisResult.setColor(rs.getString("color"));//异常颜色
+
+				medLisResultList.add(medLisResult);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally {
+			close();
+		}
+
+		return medLisResultList;
+	}
+
+	/**
+	 * 获取检查信息
+	 * @param sql
+	 * @return
+	 */
+	public List<MedPacsInfo> getPacsInfo(String sql){
+		List<MedPacsInfo> medPacsInfos=Lists.newLinkedList();
+		try {
+			TZDBConnForHis dbconn=new TZDBConnForHis();
+			ResultSet rs =dbconn.Query(sql, null);
+			while(rs.next()){
+				MedPacsInfo medPacsInfo=new MedPacsInfo();
+				medPacsInfo.setRepNo(rs.getString("repNo"));//报告单号
+				medPacsInfo.setHospitalId(HOSPITAL_ID+"");//医院ID
+				medPacsInfo.setBehospitalCode(rs.getString("behospitalCode")+"_"+rs.getString("behospitalNum"));//住院病人ID
+				medPacsInfo.setRepName(rs.getString("repName"));//报告名称
+				medPacsInfo.setRepType(rs.getString("repType"));//报告类型代码
+				medPacsInfo.setRepTypeName(rs.getString("repTypeName"));//检查类型名称
+				medPacsInfo.setPart(rs.getString("part"));//检查部位
+				medPacsInfo.setRepDate(rs.getString("repDate"));//发布时间
+				medPacsInfo.setCheckDate(rs.getString("checkDate"));//报告检查时间
+				medPacsInfo.setApplyDoctor(rs.getString("applyDoctor"));//申请医生
+				medPacsInfo.setChecker(rs.getString("checker"));//报告审核医生
+				medPacsInfo.setReportDoctor(rs.getString("reportDoctor"));//报告医生
+				medPacsInfo.setDeptName(rs.getString("deptName"));//开单科室名称
+				medPacsInfo.setDeptId(rs.getString("deptId"));//开单科室代码
+				medPacsInfos.add(medPacsInfo);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally {
+			close();
+		}
+		return medPacsInfos;
+	}
+
+	/**
+	 * 从视图中获取检查结果
+	 * @return
+	 */
+	public List<MedPacsResult> getPacsResult(String sql){
+		List<MedPacsResult> medPacsResultList=Lists.newLinkedList();
+		try {
+			TZDBConnForHis dbconn=new TZDBConnForHis();
+			ResultSet rs =dbconn.Query(sql, null);
+			while(rs.next()){
+				MedPacsResult medPacsResult=new MedPacsResult();
+				medPacsResult.setRepNo(rs.getString("repNo"));//报告单号
+				medPacsResult.setHospitalId(HOSPITAL_ID);
+				medPacsResult.setBehospitalCode(rs.getString("behospitalCode")+"_"+rs.getString("behospitalNum"));//住院病人ID
+				medPacsResult.setReptName(rs.getString("repName"));//报告名称
+				medPacsResult.setPart(rs.getString("part"));//检查部位
+				medPacsResult.setClinicSight(rs.getString("clinicSight"));//检查所见
+				medPacsResult.setReptDiag(rs.getString("reptDiag"));//检查结果(诊断)
+				medPacsResult.setClinicDiag(rs.getString("clinicDiag"));//临床诊断
+				medPacsResult.setApplyDoctor(rs.getString("applyDoctor"));//申请医生
+				medPacsResult.setCheckerDoctor(rs.getString("checker"));//审核医生
+				medPacsResult.setReportDoctor(rs.getString("reportDoctor"));//报告医生
+				medPacsResult.setDeptName(rs.getString("deptName"));//科室名称
+
+				medPacsResultList.add(medPacsResult);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally {
+			close();
+		}
+		return medPacsResultList;
+	}
+
+	/**
+	 * 从视图中获取入院登记
+	 * @return
+	 */
+	public List<BehospitalInfo> getBehospitalInfo(String sql){
+		List<BehospitalInfo> behospitalInfoList=Lists.newLinkedList();
+		try {
+			TZDBConnForHis dbconn=new TZDBConnForHis();
+			ResultSet rs =dbconn.Query(sql, null);
+			while(rs.next()){
+				BehospitalInfo behospitalInfo=new BehospitalInfo();
+				behospitalInfo.setBehospitalCode(rs.getString("behospitalCode")+"_"+rs.getString("behospitalNum"));//病人住院ID
+				behospitalInfo.setHospitalId(HOSPITAL_ID);
+				behospitalInfo.setName(rs.getString("Name"));//姓名
+				behospitalInfo.setSex(rs.getString("Sex"));//性别
+				behospitalInfo.setBirthday(StringUtils.isNotBlank(rs.getString("Birthday"))?DateUtil.parseDate(rs.getString("Birthday")):null);//出生日期
+				behospitalInfo.setFileCode(rs.getString("fileCode"));//住院号
+				behospitalInfo.setWardCode(rs.getString("wardCode"));//病区编码
+				behospitalInfo.setWardName(rs.getString("wardName"));//病区名称
+				behospitalInfo.setBehDeptId(rs.getString("behDeptId"));//住院科室ID
+				behospitalInfo.setBehDeptName(rs.getString("behDeptName"));//住院科室名称
+				behospitalInfo.setBedCode(rs.getString("bedCode"));//床位号
+				behospitalInfo.setBedName(rs.getString("bedName"));//床位名称
+				behospitalInfo.setInsuranceName(rs.getString("charge_type"));//医保类别
+				behospitalInfo.setJobType(rs.getString("jobType"));//职业
+				behospitalInfo.setBehospitalDate(StringUtils.isNotBlank(rs.getString("behospitalDate"))?DateUtil.parseDateTime(rs.getString("behospitalDate")):null);//入院时间
+				behospitalInfo.setLeaveHospitalDate(StringUtils.isNotBlank(rs.getString("leaveHospitalDate"))?DateUtil.parseDateTime(rs.getString("leaveHospitalDate")):null);//出院时间
+				behospitalInfo.setDiagnoseIcd(rs.getString("diagnoseIcd"));//疾病ICD编码
+				behospitalInfo.setDiagnose(rs.getString("Diagnose"));//疾病名称
+				behospitalInfo.setBehDoctorId(rs.getString("behDoctorId"));//住院医生ID
+				behospitalInfo.setBehDoctorName(rs.getString("behDoctorName"));//住院医生姓名
+				behospitalInfo.setDirectorDoctorId(rs.getString("directorDoctorId"));//主任医生ID
+				behospitalInfo.setDirectorDoctorName(rs.getString("directorDoctorName"));//主任医生姓名
+				behospitalInfo.setDoctorId(rs.getString("doctorId"));//主治医生ID
+				behospitalInfo.setDoctorName(rs.getString("doctorName"));//主治医生姓名
+				behospitalInfo.setIsPlacefile(rs.getString("isPlacefile"));//是否归档
+				behospitalInfo.setPlacefileDate(StringUtils.isNotBlank(rs.getString("placefileDate"))?DateUtil.parseDateTime(rs.getString("placefileDate")):null);//归档时间
+//				behospitalInfo.setInstate(rs.getString("Instate"));//病人状态
+				behospitalInfoList.add(behospitalInfo);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally {
+			close();
+		}
+		return behospitalInfoList;
+	}
+
+	/**
+	 * 从视图中获取文书信息
+	 * @return
+	 */
+	public List<MedicalRecord> getMedicalRecord(String sql){
+		List<MedicalRecord> medicalRecordList=Lists.newLinkedList();
+		try {
+			TZDBConnForHis dbconn=new TZDBConnForHis();
+			ResultSet rs =dbconn.Query(sql, null);
+			while(rs.next()){
+                MedicalRecord medicalRecord=new MedicalRecord();
+                medicalRecord.setRecId(rs.getString("recId"));//文书序号
+                medicalRecord.setHospitalId(HOSPITAL_ID);//医院ID
+                medicalRecord.setBehospitalCode(rs.getString("behospitalCode")+"_"+rs.getString("behospitalNum"));//病人住院ID
+                medicalRecord.setOrgCode(rs.getString("orgCode"));//组织机构代码
+                medicalRecord.setRecTypeId(rs.getString("recTypeId"));//病历类别编号
+                medicalRecord.setRecDate(StringUtils.isNotBlank(rs.getString("recDate"))?DateUtil.parseDateTime(rs.getString("recDate")):null);//病历生成日期
+                medicalRecord.setRecTitle(rs.getString("recTitle"));//病历模板名称
+                medicalRecordList.add(medicalRecord);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally {
+			close();
+		}
+		return medicalRecordList;
+	}
+
+	/**
+	 * 关闭数据库
+	 * @param conn
+	 */
+	public void closeConnection(Connection conn){
+		try{
+			if(conn != null){
+				conn.close();
+			}
+		}
+		catch(Exception e){
+			System.out.println("数据库关闭失败");
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * 新赠评分插入表中
+	 * @return
+	 */
+	public Integer setQcMessAge(SentEntryRecordDTO sentEntryRecordDTO) throws SQLException {
+		try {
+			String patientId=sentEntryRecordDTO.getBehospitalCode().split("_")[0];
+			String visitId=sentEntryRecordDTO.getBehospitalCode().split("_")[1];
+			int re=0;
+			connection = getConnection();
+			connection.setAutoCommit(false);//事物开始
+			PreparedStatement state=connection.prepareStatement("insert into MEDICAL_QC_MSG " +
+					"(PATIENT_ID,VISIT_ID,DOCTOR_IN_CHARGE,QA_EVENT_TYPE,QC_MSG_CODE,MESSAGE,ISSUED_BY,ISSUED_DATE_TIME,TOPIC_ID,DEPT_STAYED,MSG_STATUS)"+
+					"values(?,?,?,?,?,?,?,to_date(?,'yyyy-mm-dd hh24:mi:ss'),?,?,?)");
+			state.setString(1, patientId);
+			state.setString(2, visitId);
+			state.setString(3,StringUtils.isNotEmpty(sentEntryRecordDTO.getDoctorName())?sentEntryRecordDTO.getDoctorName():sentEntryRecordDTO.getCheckName());
+			state.setString(4,StringUtils.isNotEmpty(sentEntryRecordDTO.getModeName())?sentEntryRecordDTO.getModeName():"其他");
+			state.setInt(5,1511);
+			state.setString(6,sentEntryRecordDTO.getMsg());
+			state.setString(7,"评价质控");
+			state.setString(8, DateUtil.formatDateTime(DateUtil.now()));
+			state.setString(9,StringUtils.isNotEmpty(sentEntryRecordDTO.getModeName())?sentEntryRecordDTO.getModeName():"其他");
+			state.setString(10,sentEntryRecordDTO.getDeptId());
+			state.setInt(11,0);
+			re = state.executeUpdate();
+			if(re < 0){               //插入失败
+				connection.rollback();      //回滚
+				state.close();
+				closeConnection(connection);
+				return re;
+			}
+			connection.commit();            //插入正常
+			state.close();
+			closeConnection(connection);
+			return re;
+
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw e;
+		}finally {
+			close();
+		}
+
+	}
+
+	/**
+	 * 删除评分表中的对应数据
+	 * @return
+	 */
+	public Integer DeleteQcMessAge(SentEntryRecordDTO sentEntryRecordDTO) throws SQLException {
+		try {
+			String patientId=sentEntryRecordDTO.getBehospitalCode().split("_")[0];
+			String visitId=sentEntryRecordDTO.getBehospitalCode().split("_")[1];
+			int re=0;
+			connection = getConnection();
+			connection.setAutoCommit(false);//事物开始
+			String sql ="delete MEDICAL_QC_MSG  where  PATIENT_ID = '"+patientId+"' and VISIT_ID = '"
+					+visitId+"' and MESSAGE = '"+sentEntryRecordDTO.getMsg()+"'";
+			PreparedStatement state=connection.prepareStatement(sql);
+			re = state.executeUpdate();
+			if(re < 0){               //删除失败
+				connection.rollback();      //回滚
+				state.close();
+				closeConnection(connection);
+				return re;
+			}
+			connection.commit();            //删除正常
+			state.close();
+			closeConnection(connection);
+			return re;
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw e;
+		}finally {
+			close();
+		}
+
+	}
+
+	/**
+	 * 修改评分表中对应数据
+	 * @return
+	 */
+	public Integer UpdateQcMessAge(SentEntryRecordDTO sentEntryRecordDTO,String OldMsg) throws SQLException {
+		try {
+			String patientId=sentEntryRecordDTO.getBehospitalCode().split("_")[0];
+			String visitId=sentEntryRecordDTO.getBehospitalCode().split("_")[1];
+			int re=0;
+			connection = getConnection();
+			connection.setAutoCommit(false);//事物开始
+			String sql =" update MEDICAL_QC_MSG set MESSAGE = '"+sentEntryRecordDTO.getMsg()+"' where PATIENT_ID = '"+patientId+"' and VISIT_ID = '"
+					+visitId+"' and MESSAGE = '"+OldMsg+"'" ;
+			PreparedStatement state=connection.prepareStatement(sql);
+			re = state.executeUpdate();
+			if(re < 0){               //修改失败
+				connection.rollback();      //回滚
+				state.close();
+				closeConnection(connection);
+				return re;
+			}
+			connection.commit();            //修改正常
+			state.close();
+			closeConnection(connection);
+			return re;
+
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw e;
+		}finally {
+			close();
+		}
+
+	}
+
+}

+ 13 - 3
src/main/resources/jdbc.properties

@@ -9,11 +9,21 @@ jdbc.url=jdbc:oracle:thin:@132.147.254.159:1521/dbserver
 jdbc.username=langtong
 jdbc.username=langtong
 jdbc.password=langtong
 jdbc.password=langtong
 
 
+jdbc.driverClassName1=oracle.jdbc.OracleDriver
+jdbc.url1=jdbc:oracle:thin:@132.147.254.5:1521/dbserver
+jdbc.username1=langtong
+jdbc.password1=langtong
+
+#jdbc.driverClassName1=oracle.jdbc.OracleDriver
+#jdbc.url1=jdbc:oracle:thin:@132.147.254.166:1521/his166
+#jdbc.username1=langtong
+#jdbc.password1=langtong
+
 
 
 #jdbc.driverClassName=oracle.jdbc.OracleDriver
 #jdbc.driverClassName=oracle.jdbc.OracleDriver
-#jdbc.url=jdbc:oracle:thin:@132.147.254.166:1521/his166
-#jdbc.username=langtong
-#jdbc.password=langtong
+#jdbc.url=jdbc:oracle:thin:@132.147.254.166:1521/orcl166
+#jdbc.username=ihd
+#jdbc.password=a
 
 
 #jdbc.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
 #jdbc.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
 #jdbc.url=jdbc:sqlserver://192.168.100.39\\tzmhemr;DatabaseName=bigemr
 #jdbc.url=jdbc:sqlserver://192.168.100.39\\tzmhemr;DatabaseName=bigemr

+ 1 - 1
src/main/resources/logback-spring.xml

@@ -185,7 +185,7 @@
         </encoder>
         </encoder>
         <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
         <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
         <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
         <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
-            <level>DEBUG</level>
+            <level>error</level>
         </filter>
         </filter>
     </appender>
     </appender>