From ab8c13e99d6e8fee396d00fffd905c470240cb73 Mon Sep 17 00:00:00 2001 From: linjj <850658129@qq.com> Date: Thu, 21 Mar 2024 15:11:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 312 ++-- src/main/java/com/xjgs/Application1.java | 34 +- .../java/com/xjgs/controller/MakeUpHis.java | 50 + .../com/xjgs/exception/BusinessException.java | 26 + .../com/xjgs/exception/ExceptionCode.java | 30 + src/main/java/com/xjgs/service/HisJob.java | 10 +- .../java/com/xjgs/service/HisService.java | 1264 +++-------------- .../java/com/xjgs/service/XmlParseToVO.java | 836 ----------- src/main/java/com/xjgs/util/JsonResult.java | 51 + src/main/java/com/xjgs/vo/ArchiveMaster.java | 11 + src/main/resources/application.yml | 2 + src/main/resources/localPath.xml | 2 +- src/main/resources/logback.xml | 42 + 13 files changed, 600 insertions(+), 2070 deletions(-) create mode 100644 src/main/java/com/xjgs/controller/MakeUpHis.java create mode 100644 src/main/java/com/xjgs/exception/BusinessException.java create mode 100644 src/main/java/com/xjgs/exception/ExceptionCode.java delete mode 100644 src/main/java/com/xjgs/service/XmlParseToVO.java create mode 100644 src/main/java/com/xjgs/util/JsonResult.java create mode 100644 src/main/resources/application.yml create mode 100644 src/main/resources/logback.xml diff --git a/pom.xml b/pom.xml index 01f60b2..eb7282e 100644 --- a/pom.xml +++ b/pom.xml @@ -1,128 +1,100 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - his - his + com.xjgs + hisOneDay 1.0-SNAPSHOT + + UTF-8 + 1.7 + 1.7 + + - - junit - junit - 4.11 - - - com.microsoft.sqlserver - sqljdbc6 - 6.4.0 - - - com.oracle - ojdbc14 - 14.0.0 - - - com.xdb - xdb - 1.0.0 - - com.oracle.ojdbc - xmlparserv2 - 19.3.0.0 + junit + junit + 4.11 - - - org.apache.cxf - cxf-rt-transports-http - 3.1.8 - - - org.apache.cxf - cxf-rt-frontend-jaxws - 3.1.8 - - - - org.apache.cxf - cxf-rt-transports-http-jetty - 3.0.1 - - - commons-net - commons-net - 1.4.1 - - - - org.slf4j - slf4j-log4j12 - 1.6.4 - - - commons-io - commons-io - 2.6 - - - mysql - mysql-connector-java - 5.1.17 - - - - commons-dbutils - commons-dbutils - 1.6 - - - com.mchange - c3p0 - 0.9.5.2 - - - log4j - log4j - 1.2.17 - - - - com.itextpdf - itextpdf - 5.5.13 - - - - - org.bouncycastle - bcprov-jdk16 - 1.46 - - - - org.apache.commons - commons-lang3 - 3.3.2 - - - commons-codec - commons-codec - 1.13 - - dom4j - dom4j - RELEASE - compile + com.microsoft.sqlserver + sqljdbc6 + 6.4.0 + + + com.oracle + ojdbc14 + 14.0.0 + + + com.xdb + xdb + 1.0.0 + + + + org.apache.cxf + cxf-rt-transports-http + 3.1.8 + + + org.apache.cxf + cxf-rt-frontend-jaxws + 3.1.8 + + + + org.apache.cxf + cxf-rt-transports-http-jetty + 3.0.1 + + + commons-net + commons-net + 1.4.1 + + + + org.slf4j + slf4j-log4j12 + 1.6.4 + + + commons-io + commons-io + 2.6 dom4j dom4j 1.6.1 + + mysql + mysql-connector-java + 5.1.17 + + + + commons-dbutils + commons-dbutils + 1.6 + + + com.mchange + c3p0 + 0.9.5.2 + + + log4j + log4j + 1.2.17 + + org.quartz-scheduler @@ -134,13 +106,6 @@ quartz-jobs 2.2.1 - - - com.google.code.gson - gson - 2.8.9 - - org.projectlombok lombok @@ -148,52 +113,77 @@ true - + + + com.itextpdf + itextpdf + 5.5.13 + + + com.oracle.ojdbc + xmlparserv2 + 19.3.0.0 + + + + + org.bouncycastle + bcprov-jdk16 + 1.46 + + + + org.apache.commons + commons-lang3 + 3.3.2 + + + commons-codec + commons-codec + 1.13 + + - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 8 - 8 - - - - maven-assembly-plugin - - - - com.xjgs.Application1 - - - - jar-with-dependencies - - - - - - make-assemble - package - - single - - - - - - - - src/main/resources - - **/*.xml - **/*.properties - - - - + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + + maven-assembly-plugin + + + + com.xjgs.Application1 + + + + jar-with-dependencies + + + + + + make-assemble + package + + single + + + + + + + + src/main/resources + + **/*.xml + **/*.properties + + + + diff --git a/src/main/java/com/xjgs/Application1.java b/src/main/java/com/xjgs/Application1.java index 6a7e6d9..2fa0286 100644 --- a/src/main/java/com/xjgs/Application1.java +++ b/src/main/java/com/xjgs/Application1.java @@ -1,54 +1,28 @@ package com.xjgs; import com.xjgs.service.HisJob; -import com.xjgs.service.HisService; -import com.xjgs.service.XmlParseToVO; import com.xjgs.util.Logger; import org.quartz.*; import org.quartz.impl.StdSchedulerFactory; import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -public class Application1 { +public class Application1 { private static Logger logger = new Logger(); static ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = null; public static void main(String[] args) { try { - new Application1().quartzHis();//同步电子病历与护理,每5分钟同步一次 + Application1 application1 = new Application1(); + application1.quartzHis();//同步电子病历与护理,每5分钟同步一次 } catch (InterruptedException e) { logger.log(e.toString()); } - final HisService hisService = new HisService (); - final XmlParseToVO xmlParseToVO = new XmlParseToVO();//首页采集 - scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(9); - scheduledThreadPoolExecutor.scheduleWithFixedDelay(() -> { - hisService.uploadHomePage();//同步基本信息 - },0,5,TimeUnit.MINUTES);//每五分钟同步一次 - scheduledThreadPoolExecutor.scheduleWithFixedDelay(() -> { - hisService.uploadIndex();//同步索引 - },2,10, TimeUnit.MINUTES);//每20分钟同步一次 - scheduledThreadPoolExecutor.scheduleWithFixedDelay(() -> { - xmlParseToVO.getId();//首页解析 - },1,30,TimeUnit.SECONDS);//每30秒同步一次 - scheduledThreadPoolExecutor.scheduleWithFixedDelay(() -> { - hisService.uploadUserInfo ();//用戶 - },3,30,TimeUnit.MINUTES); - scheduledThreadPoolExecutor.scheduleWithFixedDelay(() -> { - hisService.uploadDeptInfo ();//科室 - },4,10,TimeUnit.MINUTES); - scheduledThreadPoolExecutor.scheduleWithFixedDelay(() -> { - hisService.uploadDeath();//更新死亡字段 - },5,10,TimeUnit.MINUTES); - scheduledThreadPoolExecutor.scheduleWithFixedDelay(() -> { - hisService.dropSzyh();//删除留观号 - },6,6,TimeUnit.HOURS); } public void quartzHis() throws InterruptedException{ try { //创建任务器:定义任务细节 JobDetail jobDetail = JobBuilder.newJob(HisJob.class).withIdentity("job1", "group1").build(); - ScheduleBuilder scheduleBuilder = SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(300).repeatForever(); + ScheduleBuilder scheduleBuilder = SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(86400).repeatForever(); //定义触发器 Trigger trigger=TriggerBuilder.newTrigger().withIdentity("simpleTrigger", "simpleTriggerGroup") .withSchedule(scheduleBuilder).startNow().build(); diff --git a/src/main/java/com/xjgs/controller/MakeUpHis.java b/src/main/java/com/xjgs/controller/MakeUpHis.java new file mode 100644 index 0000000..c1fd413 --- /dev/null +++ b/src/main/java/com/xjgs/controller/MakeUpHis.java @@ -0,0 +1,50 @@ +//package com.xjgs.controller; +// +//import com.xjgs.exception.BusinessException; +//import com.xjgs.exception.ExceptionCode; +//import com.xjgs.service.HisService; +//import com.xjgs.util.JsonResult; +//import com.xjgs.util.Logger; +//import org.eclipse.jetty.util.StringUtil; +//import org.springframework.stereotype.Controller; +//import org.springframework.web.bind.annotation.GetMapping; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.ResponseBody; +// +//import java.util.Map; +// +///** +// * @ClassName MakeUpHis +// * @Description 补偿采集的相关接口 +// * @Author linjj +// * @Date 2024/2/23 11:27 +// * @Version 1.0 +// */ +// +//@Controller +//@ResponseBody +//@RequestMapping("/makeUp") +//public class MakeUpHis { +// +// private static Logger logger = new Logger(); +// +// /** +// * @description: his按需采集 +// * @params: patientId +// * @author linjj +// * @date: 2024/2/23 11:34 +// */ +// @GetMapping("/makeUpByHis") +// public Map makeUpByNeed(String patientId) throws BusinessException { +// logger.log("开始补偿"); +// // 声明his操作类 +// HisService hisService=new HisService(); +// //调用接口 +// hisService.hisInfnByPatientId(patientId); +// // 声明返回 +// JsonResult jsonResult = new JsonResult(); +// jsonResult.setCode("200"); +// jsonResult.setMsg("调用成功,请稍等下载文件"); +// return jsonResult.getDataMap(); +// } +//} diff --git a/src/main/java/com/xjgs/exception/BusinessException.java b/src/main/java/com/xjgs/exception/BusinessException.java new file mode 100644 index 0000000..67fd37f --- /dev/null +++ b/src/main/java/com/xjgs/exception/BusinessException.java @@ -0,0 +1,26 @@ +package com.xjgs.exception; + + + +/** + * @description: 自定义的异常类 + * @author: ChenJ + * @date: 2022/5/9 17:29 + * @param: + * @return: + **/ +public class BusinessException extends Exception { + /** + * 枚举类型,内含状态码code和信息msg + */ + private final ExceptionCode exceptionCode; + + public ExceptionCode getExceptionCode() { + return exceptionCode; + } + + public BusinessException(ExceptionCode exceptionCode) { + super(exceptionCode.getMessage()); + this.exceptionCode = exceptionCode; + } +} diff --git a/src/main/java/com/xjgs/exception/ExceptionCode.java b/src/main/java/com/xjgs/exception/ExceptionCode.java new file mode 100644 index 0000000..d22a89c --- /dev/null +++ b/src/main/java/com/xjgs/exception/ExceptionCode.java @@ -0,0 +1,30 @@ +package com.xjgs.exception; + +/** + * @description: 这是一个列举异常信息的枚举类 + * @author: ChenJ + * @date: 2022/5/9 17:31 + **/ +public enum ExceptionCode { + /** + * 服务器开小差了,请稍后再试 + */ + WRONG_PARAMS("参数不对", 1001), + ; + + private final String message; + private final Integer code; + + ExceptionCode(String message, int code) { + this.message = message; + this.code = code; + } + + public String getMessage() { + return message; + } + + public Integer getCode() { + return code; + } +} diff --git a/src/main/java/com/xjgs/service/HisJob.java b/src/main/java/com/xjgs/service/HisJob.java index 05ba284..8c5413c 100644 --- a/src/main/java/com/xjgs/service/HisJob.java +++ b/src/main/java/com/xjgs/service/HisJob.java @@ -1,13 +1,19 @@ package com.xjgs.service; +import lombok.extern.slf4j.Slf4j; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; +@Slf4j public class HisJob implements Job { @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - HisService hisService = new HisService(); - hisService.hisInfo(); + try { + HisService hisService = new HisService(); + hisService.hisInfo(); + }catch (Exception e){ + log.info(e.toString()); + } } } diff --git a/src/main/java/com/xjgs/service/HisService.java b/src/main/java/com/xjgs/service/HisService.java index f677b39..dff6e86 100644 --- a/src/main/java/com/xjgs/service/HisService.java +++ b/src/main/java/com/xjgs/service/HisService.java @@ -27,55 +27,113 @@ import java.util.*; public class HisService { private static Logger logger = new Logger(); - //同步病人基本信息 - @Test - public void uploadHomePage(){ - SimpleDateFormat dateFormat = new SimpleDateFormat ("yyyy-MM-dd"); - String format1 = dateFormat.format (new Date ()); - String rootPath = System.getProperty ("user.dir"); - rootPath = rootPath+"\\logs\\"+format1; - File f = new File (rootPath); - if(!f.isDirectory ()){ - f.mkdirs (); + + public List getPatientInfo() { + String sql = "select fpatno as 记账号,fpatfileno as 住院号,fpattimes as 住院次数,fpatname as 姓名,farchieve_dt as 最后更改时间 from pacs.V_emrpatient t \n" + + "where FARCHIEVE_DT between sysdate-6/1 and sysdate order by farchieve_dt ASC"; + List v_emrpatients = new ArrayList(); + V_emrpatient v_emrpatient = null; + ResultSet resultSet = null; + Connection connection = null; + PreparedStatement statement = null; + try { + connection = JDBCUtils.getConnection(); + statement = connection.prepareStatement(sql); + resultSet = statement.executeQuery(); + while (resultSet.next()) { + v_emrpatient = new V_emrpatient(); + v_emrpatient.setFpatno(resultSet.getString("记账号")); + v_emrpatient.setFarchieve_dt(resultSet.getString("最后更改时间")); + v_emrpatients.add(v_emrpatient); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + JDBCUtils.release(resultSet, statement, connection); } - System.setProperty ("log.base",rootPath); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - String format = sdf.format(new Date ()); - List homeEntity = getHomeEntity(); - List homeEntity1 = getHomeEntity1(); - List archiveMasterList = getMasterId(); - for(ArchiveMaster archiveMaster:homeEntity){ - boolean flag = false; - for(ArchiveMaster archiveMaster1:archiveMasterList){ - if(archiveMaster.getPatientId().equals(archiveMaster1.getPatientId())){ - flag =true; + return v_emrpatients; + } + + //电子病历采集 + public void hisInfo() { + SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String format = dateFormat1.format(new Date()); + List patientInfo = getPatientInfo(); + logger.log("电子病历与护理已开始采集,需要同步" + patientInfo.size() + "份病历"); + for (V_emrpatient v_emrpatient : patientInfo) { + ArchiveMaster masterIdByPa = getMasterIdByPa(v_emrpatient.getFpatno()); + if (null != masterIdByPa.getId()) { + List pdfPathByIdAndHis = getPdfPathByIdAndHis(masterIdByPa); + for (Archive_Detail archiveDetail : pdfPathByIdAndHis) { + File file = new File(archiveDetail.getPdfPath().replace("F:\\pdf", "Z:")); + if (file.exists()) { + file.delete(); + } } - } - if(!flag){ - writeHomeEntity(archiveMaster); + redirectHisInfo(masterIdByPa); + hisInfnByPatientId(v_emrpatient.getFpatno()); + } else { + uploadHomePageByPid(v_emrpatient.getFpatno()); + hisInfnByPatientId(v_emrpatient.getFpatno()); } } - for(ArchiveMaster archiveMaster:homeEntity1){ - boolean flag1 = false; - for(ArchiveMaster archiveMaster1:archiveMasterList){ - if(archiveMaster.getPatientId().equals(archiveMaster1.getPatientId())){ - flag1 =true; + String format1 = dateFormat1.format(new Date()); + logger.log("电子病历与护理已采集,采集时间,开始时间:" + format + "结束时间:" + format1 + ",共同步" + patientInfo.size() + "份病历"); + } + + + //电子病历采集 + public void hisInfnByPatientId(String PatientId) { + SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String format = dateFormat1.format(new Date()); + uploadHisInfo(PatientId); + uploadEmrInfo(PatientId); + String format1 = dateFormat1.format(new Date()); + logger.log("电子病历与护理已采集,采集时间,开始时间:" + format + "结束时间:" + format1 + "," + PatientId + "病历已补偿完成"); + } + + + //护理采集 +// @Test +// public void hisInfo1(){ +// List masterList = hisInfoMasterId(); +// for(ArchiveMaster archiveMaster:masterList){ +// uploadEmrInfo(archiveMaster.getPatientId()); +// } +// } + public List hisInfoMasterId() { + List patientInfo = getPatientInfo(); + logger.log("电子病历与护理已采集,需要同步" + patientInfo.size() + "份病历"); + List archiveMasterList = new ArrayList<>(); + for (V_emrpatient v_emrpatient : patientInfo) { + ArchiveMaster masterIdByPa = getMasterIdByPa(v_emrpatient.getFpatno()); + if (null != masterIdByPa.getId()) { + List pdfPathByIdAndHis = getPdfPathByIdAndHis(masterIdByPa); + for (Archive_Detail archiveDetail : pdfPathByIdAndHis) { + File file = new File(archiveDetail.getPdfPath().replace("F:\\pdf", "Z:")); + if (file.exists()) { + file.delete(); + } } - } - if(!flag1){ - writeHomeEntity(archiveMaster); + redirectHisInfo(masterIdByPa); + archiveMasterList.add(masterIdByPa); + } else { + uploadHomePageByPid(v_emrpatient.getFpatno()); + ArchiveMaster archiveMaster = getMasterIdByPa(v_emrpatient.getFpatno()); + archiveMasterList.add(archiveMaster); } } - logger.log("病人基本已同步,同步时间:" + format); + return archiveMasterList; } - public void uploadHomePageByPid(String patientId){ + + public void uploadHomePageByPid(String patientId) { String sql = "select t.zyh as 住院号,t.jzh as 记账号,t.zycs as 住院次数,t.xm as 姓名,t.xb as 性别,t.ryrq as 入院日期,t.cyrq as 出院日期,t.sfzh as 身份证号,t.rybq as 入院科室,t.dqbq as 出院科室,t.rycw as 入院床位,hp.fdrname as 主管医生 " + "from ndns.zl t left join hthis.p_doctor hp on t.dqys = hp.fdrid where t.jzh = ? order by t.jzh desc"; ArchiveMaster master = null; ResultSet resultSet = null; Connection connection = null; PreparedStatement statement = null; - Object[]parms = new Object[]{patientId}; + Object[] parms = new Object[]{patientId}; try { connection = JDBCUtils.getConnection(); statement = connection.prepareStatement(sql); @@ -98,10 +156,11 @@ public class HisService { master.setDeptAdmissionTo(resultSet.getString("入院科室")); master.setDeptName(resultSet.getString("出院科室")); master.setDoctorInCharge(resultSet.getString("主管医生")); - master.setBedId(resultSet.getString ("入院床位")); - if(!StringUtils.isNoneBlank (master.getDischargeDateTime ())){ + master.setBedId(resultSet.getString("入院床位")); + master.setSource("hisOneDay"); + if (!StringUtils.isNoneBlank(master.getDischargeDateTime())) { master.setStatus("在院"); - }else{ + } else { master.setStatus("归档中"); } if ("2".equals(master.getSex())) { @@ -113,129 +172,16 @@ public class HisService { } } catch (Exception e) { e.printStackTrace(); - } - finally { - JDBCUtils.release(resultSet,statement,connection); + } finally { + JDBCUtils.release(resultSet, statement, connection); } } - //取在院首页部分数据 - List getHomeEntity() { - List archiveMasterList = new ArrayList (); - ArchiveMaster master = null; - ResultSet resultSet = null; - Connection connection = null; - PreparedStatement statement = null; - try { - connection = JDBCUtils.getConnection(); - Object[] parms = null; - String sql = "select t.zyh as 住院号,t.jzh as 记账号,t.zycs as 住院次数,t.xm as 姓名,t.xb as 性别,t.ryrq as 入院日期,t.cyrq as 出院日期,t.sfzh as 身份证号,t.rybq as 入院科室,t.dqbq as 出院科室,t.RYCW as 入院床位, hp.fdrname as 主管医生 " + - "from ndns.zl t left join hthis.p_doctor hp on t.dqys = hp.fdrid where t.cyrq is null and t.ryrq between sysdate-20/1440 and sysdate and t.zyh not like 'S%' and t.zyh not like 'P%' order by t.jzh desc"; - statement = connection.prepareStatement(sql); - resultSet = statement.executeQuery(); - while (resultSet.next()) { - master = new ArchiveMaster(); - master.setInpNo(resultSet.getString("住院号").trim()); - master.setPatientId(resultSet.getString("记账号").trim()); - master.setVisitId(resultSet.getString("住院次数")); - master.setName(resultSet.getString("姓名")); - master.setSex(resultSet.getString("性别")); - master.setAdmissionDateTime(resultSet.getString("入院日期")); - master.setIdNo(resultSet.getString("身份证号")); - master.setDeptAdmissionTo(resultSet.getString("入院科室")); - master.setDeptName(resultSet.getString("出院科室")); - master.setDoctorInCharge(resultSet.getString("主管医生")); - master.setBedId (resultSet.getString ("入院床位")); - master.setStatus("在院"); - if ("2".equals(master.getSex())) { - master.setSex("女"); - } else { - master.setSex("男"); - } - archiveMasterList.add(master); - } - } catch (Exception e) { - } - finally { - JDBCUtils.release(resultSet,statement,connection); - } - return archiveMasterList; - } - //取出院首页部分数据 - List getHomeEntity1() { - List archiveMasterList = new ArrayList<>(); - ArchiveMaster master = null; - ResultSet resultSet = null; - Connection connection = null; - PreparedStatement statement = null; - try { - connection = JDBCUtils.getConnection(); - String sql = "select t.zyh as 住院号,t.jzh as 记账号,t.zycs as 住院次数,t.xm as 姓名,t.xb as 性别,\n" + - "t.ryrq as 入院日期,t.cyrq as 出院日期,t.sfzh as 身份证号,t.rybq as 入院科室,t.dqbq as 出院科室,t.RYCW as 入院床位,hp.fdrname as 主管医生 from\n" + - "ndns.zl t left join hthis.p_doctor hp on t.dqys = hp.fdrid where t.cyrq is not null and \n" + - "cyrq between sysdate-20/1440 and sysdate and t.zyh not like 'S%' and t.zyh not like 'P%'\n" + - "order by t.jzh desc"; - statement = connection.prepareStatement(sql); - resultSet = statement.executeQuery(); - while (resultSet.next()) { - master = new ArchiveMaster(); - master.setInpNo(resultSet.getString("住院号").trim()); - master.setPatientId(resultSet.getString("记账号").trim()); - master.setVisitId(resultSet.getString("住院次数")); - master.setName(resultSet.getString("姓名")); - master.setSex(resultSet.getString("性别")); - master.setAdmissionDateTime(resultSet.getString("入院日期")); - master.setDischargeDateTime(resultSet.getString("出院日期")); - master.setIdNo(resultSet.getString("身份证号")); - master.setDeptAdmissionTo(resultSet.getString("入院科室")); - master.setDeptName(resultSet.getString("出院科室")); - master.setDoctorInCharge(resultSet.getString("主管医生")); - master.setBedId (resultSet.getString ("入院床位")); - master.setStatus("归档中"); - if ("2".equals(master.getSex())) { - master.setSex("女"); - } else { - master.setSex("男"); - } - archiveMasterList.add(master); - } - } catch (Exception e) { - e.printStackTrace(); - } - finally { - JDBCUtils.release(resultSet,statement,connection); - } - return archiveMasterList; - } - ListgetMasterId(){ - String sql = "select patient_id from archive_master where ArchiveState <>'已归档'"; - ArchiveMaster archiveMaster = null; - ResultSet resultSet = null; - Connection connection = null; - PreparedStatement statement = null; - ListarchiveMasterList = new ArrayList<>(); - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - resultSet = statement.executeQuery(); - while (resultSet.next()){ - archiveMaster = new ArchiveMaster(); - archiveMaster.setPatientId(resultSet.getString("patient_id")); - archiveMasterList.add(archiveMaster); - } - } catch (Exception e) { - e.printStackTrace(); - }finally { - JDBCUtils.release(resultSet,statement,connection); - } - return archiveMasterList; - } - //新增首页数据 int writeHomeEntity(ArchiveMaster archiveMaster) { String sql = "insert into archive_master(id,patient_id,inp_no,visit_id,name,sex,dept_name,discharge_date_time," + - "archivestate,admission_date_time,dept_admission_to,doctor_in_charge,id_no,bed_id)values(replace(newid(), '-', ''),?,?,?,?,?,?,?,?,?,?,?,?,?)"; - Object[] parms = new Object[]{archiveMaster.getPatientId(), archiveMaster.getInpNo(), archiveMaster.getVisitId(), archiveMaster.getName(), archiveMaster.getSex(), archiveMaster.getDeptName(), archiveMaster.getDischargeDateTime(), archiveMaster.getStatus(), archiveMaster.getAdmissionDateTime(), archiveMaster.getDeptAdmissionTo(), archiveMaster.getDoctorInCharge(), archiveMaster.getIdNo(),archiveMaster.getBedId ()}; + "archivestate,admission_date_time,dept_admission_to,doctor_in_charge,id_no,bed_id,source)values(replace(newid(), '-', ''),?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + Object[] parms = new Object[]{archiveMaster.getPatientId(), archiveMaster.getInpNo(), archiveMaster.getVisitId(), archiveMaster.getName(), archiveMaster.getSex(), archiveMaster.getDeptName(), archiveMaster.getDischargeDateTime(), archiveMaster.getStatus(), archiveMaster.getAdmissionDateTime(), archiveMaster.getDeptAdmissionTo(), archiveMaster.getDoctorInCharge(), archiveMaster.getIdNo(), archiveMaster.getBedId(),archiveMaster.getSource()}; Connection connection = null; PreparedStatement statement = null; int j = 0; @@ -250,87 +196,19 @@ public class HisService { j = statement.executeUpdate(); } catch (Exception e) { e.printStackTrace(); - }finally { - JDBCUtils.release(null,statement,connection); + } finally { + JDBCUtils.release(null, statement, connection); } return j; } - public List getPatientInfo(){ - String sql = "select fpatno as 记账号,fpatfileno as 住院号,fpattimes as 住院次数,fpatname as 姓名,farchieve_dt as 最后更改时间 from pacs.V_emrpatient t \n" + - "where FARCHIEVE_DT between sysdate-6/1440 and sysdate order by farchieve_dt desc"; - Listv_emrpatients = new ArrayList (); - V_emrpatient v_emrpatient = null; - ResultSet resultSet = null; - Connection connection = null; - PreparedStatement statement = null; - try { - connection = JDBCUtils.getConnection(); - statement = connection.prepareStatement(sql); - resultSet = statement.executeQuery(); - while (resultSet.next()){ - v_emrpatient = new V_emrpatient(); - v_emrpatient.setFpatno(resultSet.getString("记账号")); - v_emrpatient.setFarchieve_dt(resultSet.getString("最后更改时间")); - v_emrpatients.add(v_emrpatient); - } - } catch (Exception e) { - e.printStackTrace(); - } - finally { - JDBCUtils.release(resultSet,statement,connection); - } - return v_emrpatients; - } - //电子病历采集 - public void hisInfo(){ - SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - String format = dateFormat1.format(new Date()); - List masterList = hisInfoMasterId(); - for(ArchiveMaster archiveMaster:masterList) { - uploadHisInfo(archiveMaster.getPatientId()); - uploadEmrInfo(archiveMaster.getPatientId()); - } - String format1 = dateFormat1.format(new Date()); - logger.log("电子病历与护理已采集,采集时间,开始时间:"+format+"结束时间:"+format1+",共同步"+masterList.size()+"份病历"); - } - //护理采集 -// @Test -// public void hisInfo1(){ -// List masterList = hisInfoMasterId(); -// for(ArchiveMaster archiveMaster:masterList){ -// uploadEmrInfo(archiveMaster.getPatientId()); -// } -// } - public List hisInfoMasterId(){ - List patientInfo = getPatientInfo(); - ListarchiveMasterList = new ArrayList<>(); - for(V_emrpatient v_emrpatient:patientInfo){ - ArchiveMaster masterIdByPa = getMasterIdByPa(v_emrpatient.getFpatno()); - if(null != masterIdByPa.getId()){ - List pdfPathByIdAndHis = getPdfPathByIdAndHis(masterIdByPa); - for (Archive_Detail archiveDetail:pdfPathByIdAndHis){ - File file = new File(archiveDetail.getPdfPath().replace ("F:\\pdf","Z:")); - if(file.exists()){ - file.delete(); - } - } - redirectHisInfo(masterIdByPa); - archiveMasterList.add(masterIdByPa); - }else{ - uploadHomePageByPid(v_emrpatient.getFpatno()); - ArchiveMaster archiveMaster = getMasterIdByPa(v_emrpatient.getFpatno()); - archiveMasterList.add(archiveMaster); - } - } - return archiveMasterList; - } - public ListgetPdfPathByIdAndHis(ArchiveMaster archiveMaster){ + + public List getPdfPathByIdAndHis(ArchiveMaster archiveMaster) { String sql = "select id,PDF_PATH from archive_detail where Source='his' and MasterID=?"; - Object[]parms = new Object[]{archiveMaster.getId()}; + Object[] parms = new Object[]{archiveMaster.getId()}; Connection connection = null; PreparedStatement statement = null; ResultSet resultSet = null; - Listarchive_details = new ArrayList<>(); + List archive_details = new ArrayList<>(); Archive_Detail archiveDetail = null; try { connection = JDBCUtils3.getConnection(); @@ -341,22 +219,23 @@ public class HisService { } } resultSet = statement.executeQuery(); - while (resultSet.next()){ + while (resultSet.next()) { archiveDetail = new Archive_Detail(); archiveDetail.setId(resultSet.getString("id")); archiveDetail.setPdfPath(resultSet.getString("PDF_PATH")); archive_details.add(archiveDetail); } - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); - }finally { - JDBCUtils.release(resultSet,statement,connection); + } finally { + JDBCUtils.release(resultSet, statement, connection); } - return archive_details; + return archive_details; } - public int redirectHisInfo(ArchiveMaster archiveMaster){ + + public int redirectHisInfo(ArchiveMaster archiveMaster) { String sql = "delete from archive_detail where MasterID = ? and Source = 'his'"; - Object[]parms = new Object[]{archiveMaster.getId()}; + Object[] parms = new Object[]{archiveMaster.getId()}; int j = 0; Connection connection = null; PreparedStatement statement = null; @@ -371,15 +250,15 @@ public class HisService { j = statement.executeUpdate(); } catch (Exception e) { e.printStackTrace(); - } - finally { - JDBCUtils.release(null,statement,connection); + } finally { + JDBCUtils.release(null, statement, connection); } return j; } - public ArchiveMaster getMasterIdByPa(String jzh){ + + public ArchiveMaster getMasterIdByPa(String jzh) { String sql = "select ID,patient_id from archive_master where patient_id = ?"; - Object[]parms = new Object[]{jzh}; + Object[] parms = new Object[]{jzh}; ArchiveMaster archiveMaster = null; ResultSet resultSet = null; Connection connection = null; @@ -393,30 +272,25 @@ public class HisService { } } resultSet = statement.executeQuery(); - while (resultSet.next()){ + while (resultSet.next()) { archiveMaster = new ArchiveMaster(); archiveMaster.setId(resultSet.getString("ID")); archiveMaster.setPatientId(resultSet.getString("patient_id")); } } catch (Exception e) { e.printStackTrace(); + } finally { + JDBCUtils.release(resultSet, statement, connection); } - finally { - JDBCUtils.release(resultSet,statement,connection); - } - return archiveMaster == null ? new ArchiveMaster():archiveMaster; + return archiveMaster == null ? new ArchiveMaster() : archiveMaster; } + //取his数据 public void uploadHisInfo(String patientId) { -// boolean flag = true; -// List hisAssort = getAssortIdBySource ("his"); -// for(Archive_Detail archiveDetail:hisAssort){ -// -// } - String temp = System.getProperty("user.dir")+"\\temp"; - File fs = new File (temp); - if(!fs.isDirectory ()){ - fs.mkdirs (); + String temp = System.getProperty("user.dir") + "\\temp"; + File fs = new File(temp); + if (!fs.isDirectory()) { + fs.mkdirs(); } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String format = sdf.format(new Date()); @@ -441,70 +315,71 @@ public class HisService { Archive_Detail archiveDetail = null; while (resultSet.next()) { archiveDetail = new Archive_Detail(); - archiveDetail.setSubAssort(resultSet.getString ("FFILE_ID")); + archiveDetail.setSubAssort(resultSet.getString("FFILE_ID")); String visit_id = resultSet.getString("住院次数"); - archiveDetail.setMasterId(getMasterIdByPa(resultSet.getString ("记账号")).getId()); + archiveDetail.setMasterId(getMasterIdByPa(resultSet.getString("记账号")).getId()); archiveDetail.setTitle(resultSet.getString("记录名称")); BLOB blob = (BLOB) resultSet.getBlob("文件内容"); in = blob.getBinaryStream(); // 建立输出流 UUID uuid = UUID.randomUUID();//UUID唯一识别 String id = uuid.toString(); id = id.replace("-", ""); - file = new FileOutputStream(temp+"\\"+id+".pdf"); + file = new FileOutputStream(temp + "\\" + id + ".pdf"); int len = (int) blob.length(); byte[] buffer = new byte[len]; // 建立缓冲区 while ((len = in.read(buffer)) != -1) { file.write(buffer, 0, len); } - archiveDetail.setPdfPath(getXmlPath("path")+"\\his\\"+resultSet.getString ("记账号")+"\\"+ id + ".pdf"); - File file1 = new File(getXmlPath("path")+"\\his\\"+resultSet.getString ("记账号")); - if(!file1.isDirectory ()){ + archiveDetail.setPdfPath(getXmlPath("path") + "\\his\\" + resultSet.getString("记账号") + "\\" + id + ".pdf"); + File file1 = new File(getXmlPath("path") + "\\his\\" + resultSet.getString("记账号")); + if (!file1.isDirectory()) { file1.mkdirs(); } - if(null!=in){ + if (null != in) { in.close(); } - if(null!=file){ + if (null != file) { file.close(); } - if(new File(temp+"\\"+id+".pdf").exists()){ - FileUtils.copyFile (new File (temp+"\\"+id+".pdf"),new File (archiveDetail.getPdfPath ())); + if (new File(temp + "\\" + id + ".pdf").exists()) { + FileUtils.copyFile(new File(temp + "\\" + id + ".pdf"), new File(archiveDetail.getPdfPath())); } archiveDetail.setAssortId(getEmrAssort(resultSet.getString("病例分类ID"))); archiveDetail.setFlag("0"); archiveDetail.setSource("his"); - archiveDetail.setUploadDateTime(new Date ()); - File file2 =new File (archiveDetail.getPdfPath ()); - if(file2.exists ()){ - archiveDetail.setPdfPath(archiveDetail.getPdfPath().replace ("Z:","F:\\pdf")); + archiveDetail.setUploadDateTime(new Date()); + File file2 = new File(archiveDetail.getPdfPath()); + if (file2.exists()) { + archiveDetail.setPdfPath(archiveDetail.getPdfPath().replace("Z:", "F:\\pdf")); writeArchiveDetail(archiveDetail); } - File file3 = new File (temp+"\\"+id+".pdf"); - file3.delete (); + File file3 = new File(temp + "\\" + id + ".pdf"); + file3.delete(); } - logger.log("电子病历已采集,时间" + format+",记账号:"+patientId); + logger.log("电子病历已采集,时间" + format + ",记账号:" + patientId); } catch (Exception e) { e.printStackTrace(); - }finally { + } finally { try { - if(null!=in){ + if (null != in) { in.close(); } - if(null!=file){ + if (null != file) { file.close(); } } catch (IOException e) { - e.printStackTrace (); - }finally { - JDBCUtils.release(resultSet,statement,connection); + e.printStackTrace(); + } finally { + JDBCUtils.release(resultSet, statement, connection); } } } + public void uploadEmrInfo(String patientId) { - String temp = System.getProperty("user.dir")+"\\temp"; - File fs = new File (temp); - if(!fs.isDirectory ()){ - fs.mkdirs (); + String temp = System.getProperty("user.dir") + "\\temp"; + File fs = new File(temp); + if (!fs.isDirectory()) { + fs.mkdirs(); } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String format = sdf.format(new Date()); @@ -518,7 +393,7 @@ public class HisService { String sql = "select FFILE_ID,FPATNO as 记账号,fpattimes as 住院次数,FPATFILENO AS 住院号,FPATNAME AS 姓名,FFILE_CONTENT AS 文件内容,FLOGLUDATE AS 最后修改时间,FREC_NAME AS 记录名称\n" + "from V_EMRPDFFILE_NURSE where dbms_lob.getlength(FFILE_CONTENT)!=0 and FPATNO=? \n" + "order by FLOGLUDATE"; - Object[]parms = new Object[]{patientId}; + Object[] parms = new Object[]{patientId}; statement = connection.prepareStatement(sql); if (parms != null && parms.length > 0) { for (int i = 0; i < parms.length; i++) { @@ -531,63 +406,82 @@ public class HisService { archiveDetail = new Archive_Detail(); archiveDetail.setSubAssort(resultSet.getString("FFILE_ID")); String visit_id = resultSet.getString("住院次数"); - archiveDetail.setMasterId(getMasterIdByPa(resultSet.getString ("记账号")).getId()); + archiveDetail.setMasterId(getMasterIdByPa(resultSet.getString("记账号")).getId()); archiveDetail.setTitle(resultSet.getString("记录名称")); BLOB blob = (BLOB) resultSet.getBlob("文件内容"); in = blob.getBinaryStream(); // 建立输出流 UUID uuid = UUID.randomUUID();//UUID唯一识别 String id = uuid.toString(); id = id.replace("-", ""); - file = new FileOutputStream(temp+"\\"+id+".pdf"); + file = new FileOutputStream(temp + "\\" + id + ".pdf"); int len = (int) blob.length(); byte[] buffer = new byte[len]; // 建立缓冲区 while ((len = in.read(buffer)) != -1) { file.write(buffer, 0, len); } - archiveDetail.setPdfPath(getXmlPath("path") +"\\his\\"+resultSet.getString ("记账号")+"\\"+id+".pdf"); - File file1 = new File(getXmlPath("path") +"\\his\\"+resultSet.getString ("记账号")); - if(!file1.isDirectory ()){ + archiveDetail.setPdfPath(getXmlPath("path") + "\\his\\" + resultSet.getString("记账号") + "\\" + id + ".pdf"); + File file1 = new File(getXmlPath("path") + "\\his\\" + resultSet.getString("记账号")); + if (!file1.isDirectory()) { file1.mkdirs(); } - if(null!=in){ + if (null != in) { in.close(); } - if(null!=file){ + if (null != file) { file.close(); } - if(new File(temp+"\\"+id+".pdf").exists()){ - FileUtils.copyFile (new File (temp+"\\"+id+".pdf"),new File (archiveDetail.getPdfPath ())); + if (new File(temp + "\\" + id + ".pdf").exists()) { + FileUtils.copyFile(new File(temp + "\\" + id + ".pdf"), new File(archiveDetail.getPdfPath())); } archiveDetail.setAssortId("C70E8C427A3648B79BE80798C08F4D12"); archiveDetail.setFlag("0"); archiveDetail.setSource("his"); archiveDetail.setUploadDateTime(new Date()); - File file2 = new File (archiveDetail.getPdfPath ()); - if(file2.exists ()){ - archiveDetail.setPdfPath(archiveDetail.getPdfPath().replace ("Z:","F:\\pdf")); + File file2 = new File(archiveDetail.getPdfPath()); + if (file2.exists()) { + archiveDetail.setPdfPath(archiveDetail.getPdfPath().replace("Z:", "F:\\pdf")); writeArchiveDetail(archiveDetail); } - File file3 = new File (temp+"\\"+id+".pdf"); - file3.delete (); + File file3 = new File(temp + "\\" + id + ".pdf"); + file3.delete(); } - logger.log("护理已采集,采集时间" + format+",记账号:"+patientId); + logger.log("护理已采集,采集时间" + format + ",记账号:" + patientId); } catch (Exception e) { e.printStackTrace(); - }finally { + } finally { try { - if(null!=file){ + if (null != file) { file.close(); } - if(null !=in){ + if (null != in) { in.close(); } } catch (IOException e) { - e.printStackTrace (); - }finally { - JDBCUtils.release(resultSet,statement,connection); + e.printStackTrace(); + } finally { + JDBCUtils.release(resultSet, statement, connection); + } + } + } + + public String getXmlPath(String elementName) { + Document doc = null; + try { + doc = new SAXReader().read(this.getClass().getResourceAsStream("/localPath.xml")); + } catch (DocumentException e) { + logger.log(e.toString()); + } + Element root = doc.getRootElement(); + Iterator itr = root.elementIterator(); + while (itr.hasNext()) { + Element element = (Element) itr.next(); + if (elementName.equals(element.getName())) { + return element.getTextTrim(); } } + return ""; } + public String getEmrAssort(String fentryNo) { Map map = new HashMap<>(); map.put("801", "DA342ED81CEE4A8EA827424626F3F521"); @@ -606,17 +500,17 @@ public class HisService { map.put("020", "AC2C8F4A88884DC894630302C61C6A07"); map.put("021", "AC2C8F4A88884DC894630302C61C6A07"); map.put("802", "AFB9FBE656D7492C80AEDE6E685A851A"); - map.put("805", "15E7FE7803F545CB81390BC88E725240"); + map.put("805", "799B1580459442598B6073712736BA51"); map.put("810", "C7C73CD034B440F6B33A79E382A5610F"); map.put("832", "DE599D770E8347CCB5122BC357D96F35"); map.put("814", "DE599D770E83479CB5126BC357D96F35"); - map.put("816", "DE599D770E8347CCB5122BC357D96F35"); + map.put("816", "DE599D770E83479CB5126BC357D96F35"); map.put("818", "C70E8C427A3648B79BE80798C08F4D12"); map.put("806", "7A9C621E3F4F4C9CA95292141C5E15E8"); map.put("025", "0DB93797885746B18DAF6C0C936D2DCA"); map.put("847", "C7C73CD034B440F6B33A79E382A5610F"); - map.put ("02D","D80ED429AEC24C389E444F3156F890B5"); - if(!StringUtils.isNoneBlank (map.get(fentryNo))){ + map.put("02D", "D80ED429AEC24C389E444F3156F890B5"); + if (!StringUtils.isNoneBlank(map.get(fentryNo))) { return "C7C73CD034B440F6B33A79E382A5610F"; } return map.get(fentryNo); @@ -635,7 +529,7 @@ public class HisService { statement = connection.prepareStatement(sql); if (parms != null && parms.length > 0) { for (int i = 0; i < parms.length; i++) { - if(parms[i] instanceof Date) { + if (parms[i] instanceof Date) { parms[i] = new java.sql.Timestamp(((Date) parms[i]).getTime()); } statement.setObject(i + 1, parms[i]); @@ -644,736 +538,43 @@ public class HisService { j = statement.executeUpdate(); } catch (Exception e) { e.printStackTrace(); - }finally { - JDBCUtils.release(null,statement,connection); + } finally { + JDBCUtils.release(null, statement, connection); } return j; } - //同步科室数据 - public void uploadDeptInfo() { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - String format = sdf.format(new Date()); - List deptList = deptIndex(); - for (Dept dept : deptList) { - boolean flag = false; - List deptList1 = getDeptInfo(); - for (Dept dept1:deptList1) { - if (dept1.getDeptCode ().equals (dept.getDeptCode ())) { - flag = true; - updateDeptInfo(dept1); - } - } - if (!flag) { - writeDeptInfo(dept); - } - } - for(Dept dept:deptList){ - boolean flag1 = false; - List deptList2 = powerIndex (); - for(Dept dept1:deptList2){ - if(dept1.getDeptCode ().equals (dept.getDeptCode ())){ - flag1 = true; - updatePower (dept); - } - } - if(!flag1){ - insertPower (dept); - } - } - logger.log("权限科室与字典表科室已同步,同步时间:" + format); - } - public ListpowerIndex(){ - String sql ="select dept_code from power_dept"; + + public List powerIndex() { + String sql = "select dept_code from power_dept"; Connection connection = null; PreparedStatement statement = null; ResultSet resultSet = null; - ListdeptList = new ArrayList<> (); + List deptList = new ArrayList<>(); Dept dept = null; try { - connection = JDBCUtils5.getConnection (); - statement = connection.prepareStatement (sql); - resultSet = statement.executeQuery (); - while (resultSet.next ()){ - dept = new Dept (); - dept.setDeptCode (resultSet.getString ("dept_code")); - deptList.add (dept); + connection = JDBCUtils5.getConnection(); + statement = connection.prepareStatement(sql); + resultSet = statement.executeQuery(); + while (resultSet.next()) { + dept = new Dept(); + dept.setDeptCode(resultSet.getString("dept_code")); + deptList.add(dept); } - }catch (Exception ex){ - logger.log(ex.toString()); - }finally { - JDBCUtils5.release (resultSet,statement,connection); + } catch (Exception ex) { + logger.log(ex.toString()); + } finally { + JDBCUtils5.release(resultSet, statement, connection); } return deptList; } + public int insertPower(Dept dept) { int j = 0; Connection connection = null; PreparedStatement statement = null; String sql = "insert into power_dept(dept_name,dict_id,effective" + ",creater,create_date,updater,dept_code)values(?,?,?,?,?,?,?)"; - Object[] parms = new Object[]{dept.getFdeptname (), 1, 1, "admin", dept.getFlogcdate (), "admin", dept.getDeptCode ()}; - try { - connection = JDBCUtils5.getConnection (); - statement = connection.prepareStatement (sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject (i + 1, parms[i]); - } - } - j = statement.executeUpdate (); - } catch (Exception e) { - logger.log(e.toString()); - } finally { - JDBCUtils.release (null, statement, connection); - } - return j; - } - public int updatePower(Dept dept){ - if (StringUtils.isBlank(dept.getFdeptname())){ - return 0; - } - int j = 0; - String sql = "update power_dept set dept_name=? where dept_code=?"; - Object[]parms= new Object[]{dept.getFdeptname (),dept.getDeptCode ()}; - Connection connection = null; - PreparedStatement statement = null; - try { - connection = JDBCUtils5.getConnection (); - statement = connection.prepareStatement (sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject (i + 1, parms[i]); - } - } - j = statement.executeUpdate (); - }catch (Exception ex){ - logger.log(ex.toString()); - }finally { - JDBCUtils.release (null,statement,connection); - } - return j ; - } - - //查询his科室数据 - public List getDeptInfo() { - ResultSet resultSet = null; - Connection connection = null; - PreparedStatement statement = null; - String sql = "select BQDM 病区代码,BQMC 病区名称,FSSJ from ndns.bq"; - List deptList = new ArrayList(); - Dept dept = null; - try { - connection = JDBCUtils.getConnection(); - statement = connection.prepareStatement(sql); - resultSet = statement.executeQuery(); - while (resultSet.next()) { - dept = new Dept(); - dept.setDeptCode(resultSet.getString("病区代码")); - dept.setFdeptname(resultSet.getString("病区名称")); - dept.setFlogcdate(resultSet.getString("FSSJ")); - deptList.add(dept); - } - } catch (Exception e) { - logger.log(e.toString()); - }finally { - JDBCUtils.release(resultSet,statement,connection); - } - return deptList; - } - - public ListdeptIndex(){ - String sql = "select code from emr_dictionary where parent_id = 1"; - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - ListdeptList = new ArrayList<> (); - Dept dept = null; - try { - connection = JDBCUtils3.getConnection (); - statement = connection.prepareStatement (sql); - resultSet = statement.executeQuery (); - while (resultSet.next ()){ - dept = new Dept (); - dept.setDeptCode (resultSet.getString ("code")); - deptList.add (dept); - } - }catch (Exception ex){ - logger.log(ex.toString()); - }finally { - JDBCUtils.release (resultSet,statement,connection); - } - return deptList; - } - public int updateDeptInfo(Dept dept) { - Connection connection = null; - PreparedStatement statement = null; - String sql = "update emr_dictionary set Name =? where code=? and parent_id=1"; - Object[] parms = new Object[]{dept.getFdeptname(),dept.getDeptCode ()}; - int j = 0; - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j = statement.executeUpdate(); - } catch (Exception e) { - logger.log(e.toString()); - } - finally { - JDBCUtils.release(null,statement,connection); - } - return j; - } - - public int writeDeptInfo(Dept dept) { - Connection connection = null; - PreparedStatement statement = null; - String sql = "insert into emr_dictionary(code,Name,parent_id,effective,creater,create_time)values(?,?,?,?,?,?)"; - Object[] parms = new Object[]{dept.getDeptCode (), dept.getFdeptname(), 1, 1, "admin", dept.getFlogcdate()}; - int j = 0; - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j = statement.executeUpdate(); - } catch (Exception e) { - logger.log(e.toString()); - }finally { - JDBCUtils.release(null,statement,connection); - } - return j; - } - //更新死亡字段 - public void uploadDeath(){ - SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); - String format = sdf.format (new Date ()); - Map archiveMasterMap = sqlDeath(); - Map ycyMap = hisDeath(); - for(Map.EntryycyEntry:ycyMap.entrySet()){ - String key = ycyEntry.getKey(); - for(Map.EntryarchiveMasterEntry:archiveMasterMap.entrySet()){ - String key1 = archiveMasterEntry.getKey(); - if(key.equals(key1)){ - updateDeath(key); - } - } - } - } - //查询sql死亡字段 - public MapsqlDeath(){ - String sql = "select patient_id,DISCHARGE_DISPOSITION from archive_master "; - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - MaparchiveMasterMap = new HashMap<>(); - ArchiveMaster archiveMaster = null; - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - resultSet = statement.executeQuery(); - while (resultSet.next()){ - archiveMaster = new ArchiveMaster(); - archiveMaster.setPatientId(resultSet.getString("patient_id")); - archiveMaster.setDischargeDisposition(resultSet.getString("DISCHARGE_DISPOSITION")); - archiveMasterMap.put(archiveMaster.getPatientId(),archiveMaster); - } - }catch (Exception e){ - logger.log(e.toString()); - }finally { - JDBCUtils.release(resultSet,statement,connection); - } - return archiveMasterMap; - } - //查询his死亡字段 - public MaphisDeath(){ - String sql = "select JZH,CYQK from ndns.ycy where ( CYQK='4'or cyqk='5') and to_char(cyrq,'yyyy-mm-dd hh24:mi:ss')>='2019-12-24 00:00:00'"; - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - MapycyMap = new HashMap<>(); - Ycy ycy = null; - try { - connection = JDBCUtils.getConnection(); - statement = connection.prepareStatement(sql); - resultSet = statement.executeQuery(); - while (resultSet.next()){ - ycy = new Ycy(); - ycy.setJzh(resultSet.getString("JZH")); - ycy.setCyqk(resultSet.getString("CYQK")); - ycyMap.put(ycy.getJzh(),ycy); - } - }catch (Exception e){ - logger.log(e.toString()); - }finally { - JDBCUtils.release(resultSet,statement,connection); - } - return ycyMap; - } - //更新死亡字段 - public int updateDeath(String patient_id){ - String sql = "update archive_master set DISCHARGE_DISPOSITION=5 where patient_id=?"; - Object[]parms = new Object[]{patient_id}; - Connection con = null; - PreparedStatement statement = null; - int j = 0; - try { - con = JDBCUtils3.getConnection(); - statement = con.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j = statement.executeUpdate(); - }catch (Exception ex){ - logger.log(ex.toString()); - }finally { - JDBCUtils.release(null,statement,con); - } - return j; - } - //删除留观号 - public int dropSzyh(){ - String sql = "delete from archive_master where inp_no like 'S%'"; - Connection connection = null; - PreparedStatement statement = null; - int i = 0; - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - i = statement.executeUpdate(); - }catch (Exception ex){ - logger.log(ex.toString()); - }finally { - JDBCUtils.release(null,statement,connection); - } - return i; - } - //更新索引数据 - @Test - public void uploadIndex() { - SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss"); - String format = sdf.format (new Date ()); - Map stringZlMap = oraIndex (); - Map stringArchiveMasterMap = sqlIndex (); - for (Map.Entry entry : stringZlMap.entrySet ()) { - String key = entry.getKey (); - Zl value = entry.getValue (); - for (Map.Entry entry1 : stringArchiveMasterMap.entrySet ()) { - String key1 = entry1.getKey (); - ArchiveMaster value1 = entry1.getValue (); - if (key.equals (key1)) { - if (!StringUtils.isNoneBlank(value.getCyrq ())) { - updateIndex (value); - } else { - if(!StringUtils.isNoneBlank(value1.getDischargeDateTime ())){ - updateIndex1 (value); - }else{ - updateIndex2 (value); - } - } - } - } - } - logger.log ("索引数据已同步 同步时间:"+format); - } - - //查询ora首页索引 - public Map oraIndex() { - ResultSet resultSet = null; - Connection connection = null; - PreparedStatement statement = null; - String sql = "select t.zyh as 住院号,t.jzh as 记账号,t.zycs as 住院次数,t.xm as 姓名,t.ryrq as 入院日期,t.cyrq as 出院日期,t.rybq as 入院科室,t.dqbq as 出院科室,t.RYCW as 入院床位,hp.fdrname as 主管医生 from ndns.zl t left join hthis.p_doctor hp on t.dqys = hp.fdrid where t.cyrq>to_date('2019/12/24 00:00:00', 'YYYY/MM/DD HH24:MI:SS') order by t.jzh desc"; - Map hashMap = new HashMap(); - Zl zl = null; - try { - connection = JDBCUtils.getConnection(); - statement = connection.prepareStatement(sql); - resultSet = statement.executeQuery(); - while (resultSet.next()) { - zl = new Zl(); - zl.setZyh(resultSet.getString("住院号")); - zl.setJzh(resultSet.getString("记账号")); - zl.setZycs(resultSet.getString("住院次数")); - zl.setXm(resultSet.getString("姓名")); - zl.setRyrq(resultSet.getString("入院日期")); - zl.setCyrq(resultSet.getString("出院日期")); - zl.setRybq(resultSet.getString("入院科室")); - zl.setDqbq(resultSet.getString("出院科室")); - zl.setRycw (resultSet.getString ("入院床位")); - zl.setFdrname (resultSet.getString ("主管医生")); - hashMap.put(zl.getJzh(), zl); - } - } catch (Exception e) { - logger.log(e.toString()); - }finally { - JDBCUtils.release(resultSet,statement,connection); - } - return hashMap; - } - - //查询sql首页索引 - public Map sqlIndex() { - ResultSet resultSet = null; - Connection connection = null; - PreparedStatement statement = null; - String sql = "select patient_id as 记账号,inp_no as 住院号,visit_id as 住院次数,name as 姓名,dept_name as 出院科室,discharge_date_time\n" + - " 出院日期,ArchiveState 状态,DOCTOR_IN_CHARGE as '主管医生',admission_date_time 入院日期,dept_admission_to 入院科室,bed_id 入院床位 from archive_master"; - Object[] parms = null; - Map hashMap = new HashMap(); - ArchiveMaster archiveMaster = null; - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - resultSet = statement.executeQuery(); - while (resultSet.next()) { - archiveMaster = new ArchiveMaster(); - archiveMaster.setPatientId(resultSet.getString("记账号")); - archiveMaster.setInpNo(resultSet.getString("住院号")); - archiveMaster.setVisitId(resultSet.getString("住院次数")); - archiveMaster.setName(resultSet.getString("姓名")); - archiveMaster.setDeptName(resultSet.getString("出院科室")); - archiveMaster.setDischargeDateTime(resultSet.getString("出院日期")); - archiveMaster.setArchiveState(resultSet.getString ("状态")); - archiveMaster.setAdmissionDateTime(resultSet.getString("入院日期")); - archiveMaster.setDeptAdmissionTo(resultSet.getString ("入院科室")); - archiveMaster.setBedId (resultSet.getString ("入院床位")); - archiveMaster.setDoctorInCharge (resultSet.getString ("主管医生")); - hashMap.put(archiveMaster.getPatientId(), archiveMaster); - } - } catch (Exception e) { - logger.log(e.toString()); - }finally { - JDBCUtils.release(resultSet,statement,connection); - } - return hashMap; - } - - //更新索引 - public int updateIndex(Zl zl) { - Connection connection = null; - PreparedStatement statement = null; - String sql = "update archive_master set inp_no=?,visit_id=?,name=?,bed_id=?,dept_admission_to=?,dept_name=?,DOCTOR_IN_CHARGE=?,admission_date_time=?\n" + - "where patient_id=? and ArchiveState='在院'"; - Object[] parms = new Object[]{zl.getZyh(),zl.getZycs(),zl.getXm(),zl.getRycw (),zl.getRybq (),zl.getDqbq (),zl.getFdrname (),zl.getRyrq(),zl.getJzh()}; - int j = 0; - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j = statement.executeUpdate(); - } catch (Exception e) { - logger.log(e.toString()); - }finally { - JDBCUtils.release(null,statement,connection); - } - return j; - } - //更新索引 - public int updateIndex1(Zl zl) { - Connection connection = null; - PreparedStatement statement = null; - String sql="update archive_master set inp_no=?,visit_id=?,name=?,discharge_date_time=?,ArchiveState='归档中',bed_id=?,dept_admission_to=?,dept_name=?,DOCTOR_IN_CHARGE=?,admission_date_time=?\n" + - "where patient_id=? and ArchiveState='在院'"; - Object[] parms = new Object[]{zl.getZyh(),zl.getZycs(),zl.getXm(),zl.getCyrq(),zl.getRycw (),zl.getRybq (),zl.getDqbq (),zl.getFdrname (),zl.getRyrq(),zl.getJzh()}; - int j = 0; - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j = statement.executeUpdate(); - } catch (Exception e) { - logger.log(e.toString()); - }finally { - JDBCUtils.release(null,statement,connection); - } - return j; - } - public int updateIndex2(Zl zl) { - Connection connection = null; - PreparedStatement statement = null; - String sql = "update archive_master set inp_no=?,visit_id=?,name=?,bed_id=?,dept_admission_to=?,dept_name=?,DOCTOR_IN_CHARGE=?,admission_date_time=?,discharge_date_time=?\n" + - "where patient_id=?"; - Object[] parms = new Object[]{zl.getZyh(),zl.getZycs(),zl.getXm(),zl.getRycw (),zl.getRybq (),zl.getDqbq (),zl.getFdrname (),zl.getRyrq(),zl.getCyrq(),zl.getJzh()}; - int j = 0; - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j = statement.executeUpdate(); - } catch (Exception e) { - logger.log(e.toString()); - }finally { - JDBCUtils.release(null,statement,connection); - } - return j; - } - @Test - public void uploadUserInfo() { - SimpleDateFormat format = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); - String date = format.format (new Date ()); - Listlist = new ArrayList<>(); - Map integerEmployeeMap = queryEmployee(); - Map integerEmployeeMap1 = queryEmployee(); - Iterator> iterator2 = integerEmployeeMap.entrySet().iterator(); - while (iterator2.hasNext()){ - Map.Entry next = iterator2.next(); - String key = next.getKey(); - Employee value = next.getValue(); - Iterator> iterator3 = integerEmployeeMap1.entrySet().iterator(); - while (iterator3.hasNext()){ - Map.Entry next1 = iterator3.next(); - String key1 = next1.getKey(); - Employee value1 = next1.getValue(); - if(!key.equals(key1)&&value.getFempid().equals(value1.getFempid())){ - list.add(key1); - iterator3.remove(); - } - } - integerEmployeeMap1.remove(key); - } - for(String str:list){ - integerEmployeeMap.remove(str); - } - Map integerEmployeeMap3 = queryEmployee(); - Iterator> iterator = integerEmployeeMap.entrySet().iterator(); - while (iterator.hasNext()){ - Map.Entry next = iterator.next(); - String index = next.getKey(); - Employee value = next.getValue(); - Iterator> iterator1 = integerEmployeeMap3.entrySet().iterator(); - while (iterator1.hasNext()){ - Map.Entry next1 = iterator1.next(); - String index1 = next1.getKey(); - Employee value1 = next1.getValue(); - if(!index1.equals(index) && value.getFempid().equals(value1.getFempid())){ - value.setFadmdeptid(value.getFadmdeptid()+","+value1.getFadmdeptid()); - iterator1.remove(); - } - } - } - List users = queryUser (); - for(Map.Entryentry:integerEmployeeMap.entrySet()){ - boolean flag = true; - Employee value = entry.getValue(); - for(User user:users){ - if (user.getCode().equals(value.getFempid())) { - if((!user.getDepartmentId().equals("1315"))&&(StringUtils.isNoneBlank(user.getPassword()))) { - updateUser(value); - } - flag = false; - } - } - if(flag){ - insertUser (value); - } - } -// users.forEach(user->{ -// boolean flag = true; -// for(Map.Entryentry:integerEmployeeMap.entrySet()){ -// Employee value = entry.getValue(); -// if(user.getCode().equals(value.getFempid())){ -// flag = false; -// } -// } -// if(flag){ -// dropUser(user.getCode()); -// } -// }); - logger.log ("用户已同步,同步时间:"+date); - } - - //查询ora用户 - public Map queryEmployee() { - ResultSet resultSet = null; - Connection connection = null; - PreparedStatement statement = null; - MapemployeeList = new HashMap<>(); - try { - connection = JDBCUtils.getConnection(); - Object[]parms = new Object[]{}; - String sql = "select rownum,FEMPID as 工号,FEMPNAME as 姓名,FUSERPWD as 密码,FDEPTID as 查看科室,FSSID as 角色,FIP_DEPTID as 所属科室 from v_emrssuser"; - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - resultSet = statement.executeQuery(); - Employee employee = null; - while (resultSet.next()) { - employee = new Employee(); - employee.setId(String.valueOf(resultSet.getInt("rownum"))); - employee.setFempid(resultSet.getString("工号")); - employee.setFempname(resultSet.getString("姓名")); - employee.setFuserpwd(resultSet.getString("密码")); - employee.setFadmdeptid(returnDeptId(resultSet.getString("查看科室")).getFdeptid()); - if("YS".equals(resultSet.getString("角色"))){ - employee.setFempcode("16"); - }if("HS".equals(resultSet.getString("角色"))){ - employee.setFempcode("17"); - } - employee.setFipdeptid(returnDeptId(resultSet.getString("所属科室")).getFdeptid()); - employeeList.put(employee.getId(),employee); - } - } catch (SQLException e) { - logger.log(e.toString()); - }finally { - JDBCUtils.release(resultSet,statement,connection); - } - return employeeList; - } - public User getUserEntity(String name){ - String sql = "select user_name from power_user where name=?"; - Object[]parms = new Object[]{name}; - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - User user = new User (); - try { - connection = JDBCUtils5.getConnection (); - statement = connection.prepareStatement (sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - resultSet = statement.executeQuery (); - while (resultSet.next ()){ - user.setCode (resultSet.getString ("user_name")); - } - }catch (Exception ex){ - logger.log(ex.toString()); - }finally { - JDBCUtils.release (resultSet,statement,connection); - } - return user; - } - public int updateUser(Employee employee){ - String sql = "update power_user set remark=?,`name`=?,dept_id=? where user_name=?"; - Connection connection = null; - PreparedStatement statement = null; - Object[]parms = new Object[]{employee.getFuserpwd (),employee.getFempname (),employee.getFadmdeptid(),employee.getFempid ()}; - int j = 0; - try { - connection = JDBCUtils5.getConnection (); - statement = connection.prepareStatement (sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j = statement.executeUpdate (); - }catch (Exception ex){ - logger.log(ex.toString()); - }finally { - JDBCUtils.release (null,statement,connection); - } - return j; - } - //查询sql用户 - public ListqueryUser(){ - Listusers = new ArrayList<> (); - User user = null; - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - String sql = "select user_name,remark,dept_id,`name` from power_user"; - try { - connection = JDBCUtils5.getConnection (); - statement = connection.prepareStatement (sql); - resultSet = statement.executeQuery (); - while (resultSet.next ()){ - user = new User (); - user.setCode (resultSet.getString ("user_name")); - user.setName (resultSet.getString ("name")); - user.setPassword (resultSet.getString ("remark")); - user.setDepartmentId (resultSet.getString ("dept_id")); - users.add (user); - } - }catch (Exception ex){ - logger.log(ex.toString()); - }finally { - JDBCUtils.release (resultSet,statement,connection); - } - return users; - } - public int dropUser(String userName){ - String sql = "delete from power_user where user_name = ?"; - Object[]parms = new Object[]{userName}; - Connection connection = null; - PreparedStatement statement = null; - int j = 0; - try { - connection = JDBCUtils5.getConnection(); - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j = statement.executeUpdate(); - }catch (Exception e){ - logger.log(e.toString()); - } - return j ; - } - public Dept returnDeptId(String deptId){ - ResultSet resultSet = null; - Connection connection = null; - PreparedStatement statement = null; - String sql = "select dept_id from power_dept where dept_code = ?"; - Object[]parms = new Object[]{deptId}; - Dept dept = new Dept(); - try { - connection = JDBCUtils5.getConnection(); - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - resultSet = statement.executeQuery(); - while (resultSet.next()){ - dept.setFdeptid(resultSet.getString("dept_id")); - } - } catch (Exception e) { - logger.log(e.toString()); - }finally { - JDBCUtils.release(resultSet,statement,connection); - } - return dept; - } - //新增sql用户 - public int insertUser(Employee employee) { - - Connection connection = null; - PreparedStatement statement = null; - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); - String format = simpleDateFormat.format(new Date()); - String sql = "insert into power_user(user_name,user_pwd,create_date,creater,dept_id,role_id,effective,`name`,remark)values(?,?,?,?,?,?,?,?,?)"; - Object[] parms = new Object[]{employee.getFempid(),Base64.encode (MD5.KL ("123456")),format,"admin", employee.getFadmdeptid(),employee.getFempcode(), 1,employee.getFempname(),employee.getFuserpwd()}; - int j = 0; - sql.getBytes(); + Object[] parms = new Object[]{dept.getFdeptname(), 1, 1, "admin", dept.getFlogcdate(), "admin", dept.getDeptCode()}; try { connection = JDBCUtils5.getConnection(); statement = connection.prepareStatement(sql); @@ -1385,26 +586,9 @@ public class HisService { j = statement.executeUpdate(); } catch (Exception e) { logger.log(e.toString()); - }finally { - JDBCUtils.release(null,statement,connection); + } finally { + JDBCUtils.release(null, statement, connection); } return j; } - public String getXmlPath(String elementName) { - Document doc = null; - try { - doc = new SAXReader ().read(this.getClass().getResourceAsStream("/localPath.xml")); - } catch (DocumentException e) { - logger.log(e.toString()); - } - Element root = doc.getRootElement(); - Iterator itr = root.elementIterator(); - while(itr.hasNext()){ - Element element = (Element)itr.next(); - if(elementName.equals(element.getName())){ - return element.getTextTrim(); - } - } - return ""; - } } diff --git a/src/main/java/com/xjgs/service/XmlParseToVO.java b/src/main/java/com/xjgs/service/XmlParseToVO.java deleted file mode 100644 index 1bbb8ed..0000000 --- a/src/main/java/com/xjgs/service/XmlParseToVO.java +++ /dev/null @@ -1,836 +0,0 @@ -package com.xjgs.service; - -import com.google.gson.Gson; -import com.xjgs.dao.BaseDao; -import com.xjgs.dao.JDBCUtils; -import com.xjgs.dao.JDBCUtils3; -import com.xjgs.util.Logger; -import com.xjgs.vo.*; -import com.xjgs.xmlParseVO.XmlFirstPage; -import lombok.extern.slf4j.Slf4j; -import oracle.jdbc.driver.OracleResultSet; -import oracle.sql.OPAQUE; -import oracle.xdb.XMLType; -import org.apache.commons.lang3.StringUtils; -import org.dom4j.Document; -import org.dom4j.DocumentException; -import org.dom4j.Element; -import org.dom4j.io.SAXReader; -import org.eclipse.jetty.util.ajax.JSON; -import org.junit.Test; - -import java.io.*; -import java.math.BigDecimal; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Timestamp; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -@Slf4j -public class XmlParseToVO { - private static Logger logger = new Logger(); - - - @Test - public void getId(){ - String sql = "select dept_name,patient_id from archive_master where archivestate='已归档' and patient_id not in(select patient_id from commomtable2)"; - Connection connection = null; - PreparedStatement statement = null; - ArchiveMaster archiveMaster = null; - ListarchiveMasterList = new ArrayList (); - ResultSet resultSet = null; - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - resultSet = statement.executeQuery(); - while (resultSet.next()){ - archiveMaster = new ArchiveMaster(); - archiveMaster.setPatientId(resultSet.getString("patient_id")); - archiveMaster.setDeptName (resultSet.getString ("dept_name")); - archiveMasterList.add(archiveMaster); - } - }catch (Exception e){ - logger.log(e.toString()); - }finally { - JDBCUtils.release(resultSet,statement,connection); - } - for(ArchiveMaster archiveMaster1:archiveMasterList){ - if((!archiveMaster1.getDeptName ().equals ("13"))&&(!archiveMaster1.getDeptName ().equals ("17"))&&(!archiveMaster1.getDeptName ().equals ("1702"))){ - getMasterRecord(archiveMaster1); - }else{ - Zl (archiveMaster1); - } - } - } - public void Zl(ArchiveMaster archiveMaster1){ - SimpleDateFormat simpleDateFormat = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss"); - ArchiveMaster masterInfo = getMasterInfo (archiveMaster1); - CommomVo commomVo = new CommomVo (); - commomVo.setPatientId (getMasterId (masterInfo.getPatientId ()).getId ()); - commomVo.setInpatientNo (masterInfo.getInpNo ()); - commomVo.setAdmissId (masterInfo.getInpNo ()); - commomVo.setName (masterInfo.getName ()); - commomVo.setSex (masterInfo.getSex ()); - if(StringUtils.isNoneBlank(masterInfo.getVisitId())){ - commomVo.setAdmissTimes (Short.parseShort (masterInfo.getVisitId ())); - } - commomVo.setDisDept (masterInfo.getDeptName ()); - try { - commomVo.setDisDate (simpleDateFormat.parse (masterInfo.getDischargeDateTime ())); - commomVo.setAdmissDate (simpleDateFormat.parse (masterInfo.getAdmissionDateTime ())); - commomVo.setAdmissDept (masterInfo.getDeptAdmissionTo ()); - commomVo.setAttending (masterInfo.getDoctorInCharge ()); - int i = insertArchive (commomVo); - int j =insertArchive1 (commomVo); - if(i==1 && j==1){ - addCommom2 (masterInfo.getPatientId ()); - } - } catch (Exception e) { - e.printStackTrace (); - } - } - public int insertArchive(CommomVo commomVo){ - int j = 0; - String sql = "insert into commomtable(patient_id,inpatient_no,admiss_id,name,sex,dis_dept,dis_date,admiss_date,attending,is_oper,admiss_times)values(?,?,?,?,?,?,?,?,?,?,?)"; - Object[]parms = new Object[]{commomVo.getPatientId (),commomVo.getInpatientNo (),commomVo.getAdmissId (),commomVo.getName (),commomVo.getSex (),commomVo.getDisDept (), - commomVo.getDisDate (),commomVo.getAdmissDate (),commomVo.getAttending (),"无",commomVo.getAdmissTimes ()}; - Connection connection = null; - PreparedStatement statement = null; - try { - connection = JDBCUtils3.getConnection (); - statement = connection.prepareStatement (sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - if(parms[i] instanceof Date) { - parms[i] = new Timestamp(((Date) parms[i]).getTime()); - } - statement.setObject(i + 1, parms[i]); - } - } - j=statement.executeUpdate (); - }catch (Exception ex){ - logger.log(ex.toString()); - }finally { - JDBCUtils.release (null,statement,connection); - } - return j; - } - public int insertArchive1(CommomVo commomVo){ - int j = 0; - String sql = "insert into commomtable1(patient_id,admiss_dept,is_medicine)values(?,?,?)"; - Object[]parms = new Object[]{commomVo.getPatientId (),commomVo.getAdmissDept (),"无"}; - Connection connection = null; - PreparedStatement statement = null; - try { - connection = JDBCUtils3.getConnection (); - statement = connection.prepareStatement (sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j=statement.executeUpdate (); - }catch (Exception ex){ - logger.log(ex.toString()); - }finally { - JDBCUtils.release (null,statement,connection); - } - return j; - } - public ArchiveMaster getMasterInfo(ArchiveMaster archiveMaster){ - String sql = "select am.patient_id,am.inp_no,am.visit_id,am.name,am.sex,ed.Name cyks,am.discharge_date_time,am.admission_date_time\n" + - ",ed1.Name ryks,am.DOCTOR_IN_CHARGE from \n" + - "archive_master am join emr_dictionary ed \n" + - "on am.dept_name = ed.code join \n" + - "emr_dictionary ed1 on am.dept_admission_to = ed1.code where am.patient_id = ? and ed.parent_id=1 and ed1.parent_id=1"; - Object[]parms = new Object[]{archiveMaster.getPatientId ()}; - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - ArchiveMaster archiveMaster1 = new ArchiveMaster (); - try { - connection = JDBCUtils3.getConnection (); - statement = connection.prepareStatement (sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - resultSet = statement.executeQuery (); - while (resultSet.next ()){ - archiveMaster1.setPatientId (resultSet.getString ("patient_id")); - archiveMaster1.setInpNo (resultSet.getString ("inp_no")); - archiveMaster1.setVisitId (resultSet.getString ("visit_id")); - archiveMaster1.setName (resultSet.getString ("name")); - archiveMaster1.setSex (resultSet.getString ("sex")); - archiveMaster1.setDeptName (resultSet.getString ("cyks")); - archiveMaster1.setDischargeDateTime (resultSet.getString ("discharge_date_time")); - archiveMaster1.setAdmissionDateTime (resultSet.getString ("admission_date_time")); - archiveMaster1.setDeptAdmissionTo (resultSet.getString ("ryks")); - archiveMaster1.setDoctorInCharge (resultSet.getString ("DOCTOR_IN_CHARGE")); - } - }catch (Exception ex){ - logger.log(ex.toString()); - }finally { - JDBCUtils.release (resultSet,statement,connection); - } - return archiveMaster1; - } - public void getMasterRecord(ArchiveMaster archiveMaster){ - BaseDao baseDao = new BaseDao();//不能改为连接池,否则有类型转换错误 - Connection connection = null; - PreparedStatement statement = null; - OracleResultSet resultSet = null; - String sql = "select t.fcontent 病案首页内容,t.fpatno 记账号 from ht.bl_tbs_record t where " + - "t.fentryno ='025' and t.fvalid ='1' and fpatno=?"; - Object[]parms = new Object[]{archiveMaster.getPatientId ()}; - MasterContentVO masterContentVO = new MasterContentVO (); - try { - connection = baseDao.getConnection(); - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - resultSet = (OracleResultSet)statement.executeQuery(); - while (resultSet.next()){ - OPAQUE opaque = resultSet.getOPAQUE("病案首页内容"); - XMLType xml = XMLType.createXML(opaque); - masterContentVO.setContent(xml.getStringVal()); - masterContentVO.setPatientId(resultSet.getString("记账号")); - } - } catch (Exception e) { - logger.log(e.toString()); - }finally { - JDBCUtils.release(resultSet,statement,connection); - } - converMasterRecord(masterContentVO,archiveMaster); - } - public void converMasterRecord(MasterContentVO masterRecord,ArchiveMaster archiveMaster){ - CommomVo commomVo = new CommomVo(); - XmlFirstPage xmlFirstPage = null; - try { - if(StringUtils.isNoneBlank (masterRecord.getContent ())){ - xmlFirstPage = new XmlFirstPage(masterRecord.getContent()); - TBasic tBasic = new TBasic();//病人基本信息表 - tBasic.setPatientId(getMasterId (xmlFirstPage.eprhead.PATNO.getValText()).getId ());//master表id - tBasic.setPayType(xmlFirstPage.BasiInfor.MedTreatPayModeNew.getValText());//医疗付费方式 - tBasic.setBaseMedicare(xmlFirstPage.BasiInfor.HealthNum.getValText());//健康卡号 - if(StringUtils.isNoneBlank (xmlFirstPage.BasiInfor.TheNumOfInHos.getValText())){ - tBasic.setAdmissTimes(Long.parseLong(xmlFirstPage.BasiInfor.TheNumOfInHos.getValText()));//住院次数 - } - tBasic.setInpatientNo(xmlFirstPage.BasiInfor.ZYH.getValText());//病案号 - tBasic.setName(xmlFirstPage.BasiInfor.NAME.getValText());//姓名 - tBasic.setSex(xmlFirstPage.BasiInfor.SEXOption.getValText());//性别 - log.info("时间格式"+xmlFirstPage.BasiInfor.BIRTHDATE.getValText()); - tBasic.setBirthday(Timestamp.valueOf(xmlFirstPage.BasiInfor.BIRTHDATE.getValText()+" 00:00:00"));//出生日期 - if(StringUtils.isNoneBlank(xmlFirstPage.BasiInfor.AGE.getValText())){ - String regEx="[^0-9]"; - Pattern compile = Pattern.compile(regEx); - Matcher matcher = compile.matcher(xmlFirstPage.BasiInfor.AGE.getValText()); - if(StringUtils.isNoneBlank(matcher.replaceAll("").trim())){ - tBasic.setAge(Short.parseShort(matcher.replaceAll("").trim()));//年龄 - } - } - tBasic.setCountry(xmlFirstPage.BasiInfor.PatNATIVE.getValText());//国籍 - tBasic.setNation(xmlFirstPage.BasiInfor.PatNATION.getValText());//民族 - TBaby tBaby = new TBaby();//婴儿表 - if(!"".equals(xmlFirstPage.BasiInfor.InfantWeight.getValText())){ - tBaby.setPatientId(getMasterId (xmlFirstPage.eprhead.PATNO.getValText()).getId ());// - //tBaby.setAvoirdupois(Double.valueOf(xmlFirstPage.BasiInfor.InfantWeight.getValText()));//新生儿出生体重 - //新生儿入院体重 - addTbaby(tBaby); - } - tBasic.setBirthAddr(xmlFirstPage.BasiInfor.BIRTHPL.getValText());//出生地 - //籍贯 - tBasic.setIdCard(xmlFirstPage.BasiInfor.PatIDCARD.getValText());//身份证号 - tBasic.setJob(xmlFirstPage.BasiInfor.JOB.getValText());//职业 - tBasic.setMarriage(xmlFirstPage.BasiInfor.STATUOptionNEW.getValText());//婚姻 - tBasic.setHomeAddr(xmlFirstPage.BasiInfor.NOWADDR.getValText());//现住址 - tBasic.setHomeTel(xmlFirstPage.BasiInfor.NOWADDRTELE.getValText());//电话 - tBasic.setHomeZip(xmlFirstPage.BasiInfor.NOWADDRPOST.getValText());//邮编 - tBasic.setWorkAddr(xmlFirstPage.BasiInfor.DWNAME.getValText());//工作单位及地址 - tBasic.setWorkTel(xmlFirstPage.BasiInfor.DWTELE.getValText());//单位电话 - tBasic.setWorkZip(xmlFirstPage.BasiInfor.DWPOST.getValText());//邮编 - tBasic.setLinkman(xmlFirstPage.BasiInfor.LXNAME.getValText());//联系人姓名 - tBasic.setRelation(xmlFirstPage.BasiInfor.RELATE.getValText());//关系 - tBasic.setRelAddr(xmlFirstPage.BasiInfor.LXADDR.getValText());//地址 - tBasic.setRelTel(xmlFirstPage.BasiInfor.LXTELE.getValText());//联系人电话 - TAdmissThing tAdmissThing = new TAdmissThing();//病人住院信息表 - tAdmissThing.setPatientId(getMasterId (xmlFirstPage.eprhead.PATNO.getValText()).getId ()); - tAdmissThing.setAdmissType(xmlFirstPage.BasiInfor.InHospWayOption.getValText());//入院途径 - try { - tAdmissThing.setAdmissDate(Timestamp.valueOf(xmlFirstPage.BasiInfor.xmlRYDATE.RYDATEY.getValText() + "-" + - xmlFirstPage.BasiInfor.xmlRYDATE.RYDATEM.getValText() + "-" + xmlFirstPage.BasiInfor.xmlRYDATE.RYDATED.getValText() - + " " + xmlFirstPage.BasiInfor.xmlRYDATE.RYDATEH.getValText() + ":" + xmlFirstPage.BasiInfor.xmlRYDATE.RYDATEMin.getValText() + ":00"));//入院时间 - }catch (Exception ex){ - - } - tAdmissThing.setAdmissDept(xmlFirstPage.BasiInfor.RYDEPT.getValText());//入院科别 - tAdmissThing.setAdmissWard(xmlFirstPage.BasiInfor.RYBS.getValText());//入院病房 - //转科时间 - tAdmissThing.setChangeDept(xmlFirstPage.BasiInfor.FirstZKDpt.FirstZKDptName1.getValText());//转科 - try { - tAdmissThing.setDisDate(Timestamp.valueOf(xmlFirstPage.BasiInfor.xmlCYDATE.CYDATEY.getValText() + "-" + - xmlFirstPage.BasiInfor.xmlCYDATE.CYDATEM.getValText() + "-" + xmlFirstPage.BasiInfor.xmlCYDATE.CYDATED.getValText() - + " " + xmlFirstPage.BasiInfor.xmlCYDATE.CYDATEH.getValText() + ":" + xmlFirstPage.BasiInfor.xmlCYDATE.CYDATEMin.getValText() + ":00"));//出院时间 - }catch (Exception ex){ - - } - tAdmissThing.setDisDept(xmlFirstPage.BasiInfor.CYDEPT.getValText());//出院科别 - tAdmissThing.setDisWard(xmlFirstPage.BasiInfor.CYBS.getValText());//出院病房 - //实际住院天数 - TDiag tDiag = new TDiag();//诊断表 - int i = 1; - tDiag.setPatientId(getMasterId (xmlFirstPage.eprhead.PATNO.getValText()).getId ()); - tDiag.setDiagNo(i); - tDiag.setDiagCode(xmlFirstPage.DiagInfor.MainDiag.ICD10.getValText());//疾病编码 - tDiag.setDiagName(xmlFirstPage.DiagInfor.MainDiag.DiagName.getValText());//诊断名 - tDiag.setDiagType("1");//入院病情 - if("-1".equals(xmlFirstPage.DiagInfor.MainDiag.xmlInHospStat.InHospStatHav.getValText())){ - tDiag.setDisThing("有"); - }else if("-1".equals(xmlFirstPage.DiagInfor.MainDiag.xmlInHospStat.InHospStatNotS.getValText())){ - tDiag.setDisThing("临床未确定"); - }else if("-1".equals(xmlFirstPage.DiagInfor.MainDiag.xmlInHospStat.InHospStatNotC.getValText())){ - tDiag.setDisThing("情况不明"); - }else if("-1".equals(xmlFirstPage.DiagInfor.MainDiag.xmlInHospStat.InHospStatNon.getValText())){ - tDiag.setDisThing("无"); - } - addTdiag(tDiag); - i++; - if(!"".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag1.DiagName.getValText())){ - TDiag tDiag1 = new TDiag(); - tDiag1.setPatientId(getMasterId (xmlFirstPage.eprhead.PATNO.getValText()).getId ()); - tDiag1.setDiagNo(i); - tDiag1.setDiagCode(xmlFirstPage.DiagInfor.OthDiag.OthDiag1.ICD10.getValText()); - tDiag1.setDiagName(xmlFirstPage.DiagInfor.OthDiag.OthDiag1.DiagName.getValText()); - tDiag1.setDiagType("2"); - if("-1".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag1.xmlInHospStat.InHospStatHav.getValText())){ - tDiag1.setDisThing("有"); - }else if("-1".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag1.xmlInHospStat.InHospStatNotS.getValText())){ - tDiag1.setDisThing("临床未确定"); - }else if("-1".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag1.xmlInHospStat.InHospStatNotC.getValText())){ - tDiag1.setDisThing("情况不明"); - }else if("-1".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag1.xmlInHospStat.InHospStatNon.getValText())){ - tDiag1.setDisThing("无"); - } - i++; - addTdiag(tDiag1); - } - if(!"".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag2.DiagName.getValText())){ - TDiag tDiag2 = new TDiag(); - tDiag2.setPatientId(getMasterId (xmlFirstPage.eprhead.PATNO.getValText()).getId ()); - tDiag2.setDiagNo(i); - tDiag2.setDiagCode(xmlFirstPage.DiagInfor.OthDiag.OthDiag2.ICD10.getValText()); - tDiag2.setDiagName(xmlFirstPage.DiagInfor.OthDiag.OthDiag2.DiagName.getValText()); - tDiag2.setDiagType("2"); - if("-1".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag2.xmlInHospStat.InHospStatHav.getValText())){ - tDiag2.setDisThing("有"); - }else if("-1".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag2.xmlInHospStat.InHospStatNotS.getValText())){ - tDiag2.setDisThing("临床未确定"); - }else if("-1".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag2.xmlInHospStat.InHospStatNotC.getValText())){ - tDiag2.setDisThing("情况不明"); - }else if("-1".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag2.xmlInHospStat.InHospStatNon.getValText())){ - tDiag2.setDisThing("无"); - } - i++; - addTdiag(tDiag2); - } - if(!"".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag3.DiagName.getValText())){ - TDiag tDiag3 = new TDiag(); - tDiag3.setDiagNo(i); - tDiag3.setPatientId(getMasterId (xmlFirstPage.eprhead.PATNO.getValText()).getId ()); - tDiag3.setDiagCode(xmlFirstPage.DiagInfor.OthDiag.OthDiag3.ICD10.getValText()); - tDiag3.setDiagName(xmlFirstPage.DiagInfor.OthDiag.OthDiag3.DiagName.getValText()); - tDiag3.setDiagType("2"); - if("-1".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag3.xmlInHospStat.InHospStatHav.getValText())){ - tDiag3.setDisThing("有"); - }else if("-1".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag3.xmlInHospStat.InHospStatNotS.getValText())){ - tDiag3.setDisThing("临床未确定"); - }else if("-1".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag3.xmlInHospStat.InHospStatNotC.getValText())){ - tDiag3.setDisThing("情况不明"); - }else if("-1".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag3.xmlInHospStat.InHospStatNon.getValText())){ - tDiag3.setDisThing("无"); - } - i++; - addTdiag(tDiag3); - } - if(!"".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag4.DiagName.getValText())){ - TDiag tDiag4 = new TDiag(); - tDiag4.setDiagNo(i); - tDiag4.setPatientId(getMasterId (xmlFirstPage.eprhead.PATNO.getValText()).getId ()); - tDiag4.setDiagCode(xmlFirstPage.DiagInfor.OthDiag.OthDiag4.ICD10.getValText()); - tDiag4.setDiagName(xmlFirstPage.DiagInfor.OthDiag.OthDiag4.DiagName.getValText()); - tDiag4.setDiagType("2"); - if("-1".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag4.xmlInHospStat.InHospStatHav.getValText())){ - tDiag4.setDisThing("有"); - }else if("-1".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag4.xmlInHospStat.InHospStatNotS.getValText())){ - tDiag4.setDisThing("临床未确定"); - }else if("-1".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag4.xmlInHospStat.InHospStatNotC.getValText())){ - tDiag4.setDisThing("情况不明"); - }else if("-1".equals(xmlFirstPage.DiagInfor.OthDiag.OthDiag4.xmlInHospStat.InHospStatNon.getValText())){ - tDiag4.setDisThing("无"); - } - i++; - addTdiag(tDiag4); - } - addTadmissthing(tAdmissThing); - try { - addTbasic(tBasic); - }catch (Exception ex){ - - } - int j = 1; - - if(!"".equals(xmlFirstPage.SurgInfor.Operation1.ICD9_CM.getValText())){ - TOperate tOperate = new TOperate(); //手术表 - tOperate.setPatientId(getMasterId (xmlFirstPage.eprhead.PATNO.getValText()).getId ()); - tOperate.setOperateNo(j); - tOperate.setOperateCode(xmlFirstPage.SurgInfor.Operation1.ICD9_CM.getValText());//手术及操作编码 - tOperate.setOperName(xmlFirstPage.SurgInfor.Operation1.OperName.getValText());//手术及操作名称 - tOperate.setOperateClass(xmlFirstPage.SurgInfor.Operation1.OperDegrOption.getValText());//手术级别 - tOperate.setOperator(xmlFirstPage.SurgInfor.Operation1.OperDoct.MainOperator.getValText());//术者 - tOperate.setAssistant1(xmlFirstPage.SurgInfor.Operation1.OperDoct.Assistant1.getValText());//I助 - tOperate.setAssistant2(xmlFirstPage.SurgInfor.Operation1.OperDoct.Assistant2.getValText());//II助 - tOperate.setAssistant3(xmlFirstPage.SurgInfor.Operation1.OperDoct.Assistant3.getValText());//III助 - //tOperate.setCut(xmlFirstPage.SurgInfor.Operation1.);切口愈合等级 - //择期手术 - tOperate.setAnaesthesiaType(xmlFirstPage.SurgInfor.Operation1.MAZUI.getValText());//麻醉方式 - tOperate.setAnaesthesiaName(xmlFirstPage.SurgInfor.Operation1.HocusDoct.getValText());//麻醉医师 - addToperate(tOperate); - } - if(!"".equals(xmlFirstPage.SurgInfor.Operation2.ICD9_CM.getValText())){ - TOperate tOperate = new TOperate(); //手术表 - tOperate.setPatientId(getMasterId (xmlFirstPage.eprhead.PATNO.getValText()).getId ()); - tOperate.setOperateNo(j); - tOperate.setOperateCode(xmlFirstPage.SurgInfor.Operation2.ICD9_CM.getValText());//手术及操作编码 - tOperate.setOperName(xmlFirstPage.SurgInfor.Operation2.OperName.getValText());//手术及操作名称 - tOperate.setOperateClass(xmlFirstPage.SurgInfor.Operation2.OperDegrOption.getValText());//手术级别 - tOperate.setOperator(xmlFirstPage.SurgInfor.Operation2.OperDoct.MainOperator.getValText());//术者 - tOperate.setAssistant1(xmlFirstPage.SurgInfor.Operation2.OperDoct.Assistant1.getValText());//I助 - tOperate.setAssistant2(xmlFirstPage.SurgInfor.Operation2.OperDoct.Assistant2.getValText());//II助 - tOperate.setAssistant3(xmlFirstPage.SurgInfor.Operation2.OperDoct.Assistant3.getValText());//III助 - //tOperate.setCut(xmlFirstPage.SurgInfor.Operation1.);切口愈合等级 - //择期手术 - tOperate.setAnaesthesiaType(xmlFirstPage.SurgInfor.Operation2.MAZUI.getValText());//麻醉方式 - tOperate.setAnaesthesiaType(xmlFirstPage.SurgInfor.Operation2.HocusDoct.getValText());//麻醉医师 - addToperate(tOperate); - } - if(!"".equals(xmlFirstPage.SurgInfor.Operation3.ICD9_CM.getValText())){ - TOperate tOperate = new TOperate(); //手术表 - tOperate.setPatientId(getMasterId (xmlFirstPage.eprhead.PATNO.getValText()).getId ()); - tOperate.setOperateNo(j); - tOperate.setOperateCode(xmlFirstPage.SurgInfor.Operation3.ICD9_CM.getValText());//手术及操作编码 - tOperate.setOperName(xmlFirstPage.SurgInfor.Operation3.OperName.getValText());//手术及操作名称 - tOperate.setOperateClass(xmlFirstPage.SurgInfor.Operation3.OperDegrOption.getValText());//手术级别 - tOperate.setOperator(xmlFirstPage.SurgInfor.Operation3.OperDoct.MainOperator.getValText());//术者 - tOperate.setAssistant1(xmlFirstPage.SurgInfor.Operation3.OperDoct.Assistant1.getValText());//I助 - tOperate.setAssistant2(xmlFirstPage.SurgInfor.Operation3.OperDoct.Assistant2.getValText());//II助 - tOperate.setAssistant3(xmlFirstPage.SurgInfor.Operation3.OperDoct.Assistant3.getValText());//III助 - //tOperate.setCut(xmlFirstPage.SurgInfor.Operation1.);切口愈合等级 - //择期手术 - tOperate.setAnaesthesiaType(xmlFirstPage.SurgInfor.Operation3.MAZUI.getValText());//麻醉方式 - tOperate.setAnaesthesiaType(xmlFirstPage.SurgInfor.Operation3.HocusDoct.getValText());//麻醉医师 - addToperate(tOperate); - } - - commomVo.setPatientId(tBasic.getPatientId());//主键 唯一 - commomVo.setAdmissTimes((short) tBasic.getAdmissTimes());//住院次数 - commomVo.setInpatientNo(tBasic.getInpatientNo());//病案号 - commomVo.setName(tBasic.getName());//姓名 - commomVo.setAdmissId(tBasic.getInpatientNo());//住院号 - commomVo.setSex(tBasic.getSex());//性别 - commomVo.setAge((short) tBasic.getAge());//年龄 - commomVo.setAgeMonth(Short.parseShort(xmlFirstPage.BasiInfor.BIRTHDAY.BIRTHDAYM.getValText()));//年龄(月) - - commomVo.setAgeDay(Short.parseShort(xmlFirstPage.BasiInfor.BIRTHDAY.BIRTHDAYD.getValText()));//年龄(天) - commomVo.setHomeAddr(tBasic.getHomeAddr());//现住地址 - commomVo.setNameCym(xmlFirstPage.BasiInfor.NAME.getValText());//姓名简写 - commomVo.setAdmissDate(tAdmissThing.getAdmissDate());//入院日期 - commomVo.setDisDate(tAdmissThing.getDisDate());//出院日期 - if(StringUtils.isNoneBlank (xmlFirstPage.BasiInfor.DAYS.getValText())){ - commomVo.setAdmissDays(Integer.valueOf(xmlFirstPage.BasiInfor.DAYS.getValText().trim())); - } - if(!"".equals(xmlFirstPage.SurgInfor.Operation1.ICD9_CM.getValText().trim())) { - commomVo.setIsOper("有"); - }else { - commomVo.setIsOper("无"); - } - commomVo.setDisDept(tAdmissThing.getDisDept());//出院科别 - commomVo.setAttending(xmlFirstPage.ThirClassExa.ZZDOCT.getValText());//主治医师 - commomVo.setMainDiagName(tDiag.getDiagName()); - commomVo.setMainDisThing(tDiag.getDisThing ());//主诊断转归情况 - commomVo.setCountry(tBasic.getCountry());//国籍 - commomVo.setBirthAddr(tBasic.getBirthAddr());//出生地 - commomVo.setIdCard(tBasic.getIdCard());//身份证号 - commomVo.setJob(tBasic.getJob());//职业 - commomVo.setMarriage(tBasic.getMarriage());//婚况 转 - commomVo.setHomeTel(tBasic.getHomeTel());//家庭电话 - commomVo.setHomeZip(tBasic.getHomeZip());//家庭邮编 - commomVo.setWorkAddr(tBasic.getWorkAddr());//工作单位及地址 - commomVo.setWorkTel(tBasic.getWorkTel());//工作单位电话 - commomVo.setHomeZip(tBasic.getHomeZip());//工作单位住址邮编 - commomVo.setLinkman(tBasic.getLinkman());//联系人姓名 - commomVo.setRelation(tBasic.getRelation());//联系人关系 - commomVo.setRelAddr(tBasic.getRelAddr());//关系人住址 - commomVo.setRelTel(tBasic.getRelTel());//关系人电话 - commomVo.setPayType(tBasic.getPayType());//医疗付费方式 - commomVo.setBirthday(tBasic.getBirthday());//出生日期 - commomVo.setAvoirdupois(BigDecimal.valueOf(tBaby.getAvoirdupois()));//新生儿体重 - commomVo.setAdmissType(tAdmissThing.getAdmissType());//入院途径 - commomVo.setAdmissDept(tAdmissThing.getAdmissDept());//入院科别 - commomVo.setAdmissWard(tAdmissThing.getAdmissWard());//入院病房 - commomVo.setChangeDept(tAdmissThing.getChangeDept());//转院科别 - commomVo.setDisWard(tAdmissThing.getDisWard());//出院病房 - //插入zd_icd_code clinic_diag clinic_name - //commomVo.setClinicDiag(xmlFirstPage.BasiInfor.MZZDCode.getValText()); - //commomVo.setClinicName(xmlFirstPage.BasiInfor.MZZD.getValText()); - //commomVo.setAdmissThing(null);//入院病情 - if("1".equals(xmlFirstPage.DiagInfor.GMYWIfOption.getValText())){ - commomVo.setIsMedicine("无"); - }else { - commomVo.setIsMedicine("有"); - commomVo.setMedicine(xmlFirstPage.DiagInfor.GMYW.getValText());//过敏药物 - } - commomVo.setEmitPathology(xmlFirstPage.DiagInfor.BODYOption.getValText());// 是否尸检 插/转 - commomVo.setDeptDirector(xmlFirstPage.ThirClassExa.KZR.getValText());//科主任 - commomVo.setDirector(xmlFirstPage.ThirClassExa.ZRDOCT.getValText());//主任医师 - commomVo.setAdmissDoctor(xmlFirstPage.ThirClassExa.ZYDOCT.getValText());//住院医师 - commomVo.setRefresher(xmlFirstPage.ThirClassExa.JXDOCT.getValText());//进修医师 - commomVo.setPraxis(xmlFirstPage.ThirClassExa.SXDOCT.getValText());//实习医师 - commomVo.setCoding(xmlFirstPage.ThirClassExa.BMY.getValText());//编码员 - commomVo.setQuality(xmlFirstPage.ThirClassExa.QUALITYOption.getValText());//病案质量 - commomVo.setControl(xmlFirstPage.ThirClassExa.ZKDOCT.getValText());//质控医师 - commomVo.setNurses(xmlFirstPage.ThirClassExa.ZKNURSE.getValText());//质控护士 - //Date parse3 = format.parse(xmlFirstPage.ThirClassExa.ZKRQ.ZKRQYear.getValText()+"-" - // +xmlFirstPage.ThirClassExa.ZKRQ.ZKRQMon.getValText()+"-"+xmlFirstPage.ThirClassExa.ZKRQ.ZKRQDay.getValText()); - //commomVo.setQualityDate(parse3);//质检日期 - commomVo.setBloodType(xmlFirstPage.DiagInfor.BLOODOptionNEW.getValText());//血型 - commomVo.setRh(xmlFirstPage.DiagInfor.RHOptionNEW.getValText());//Rh - addCommom(commomVo); - addCommom1(commomVo); - addCommom2(xmlFirstPage.eprhead.PATNO.getValText()); - } - } catch (Exception e) { - log.error(e.getMessage(),e); - } - } - - //根据流水号得到masterId - public ArchiveMaster getMasterId(String patientId){ - String sql ="select id from archive_master where patient_id=?"; - Object[]parms = new Object[]{patientId}; - Connection connection = null; - PreparedStatement statement = null; - ResultSet resultSet = null; - ArchiveMaster archiveMaster = null; - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - resultSet = statement.executeQuery(); - while (resultSet.next()){ - archiveMaster = new ArchiveMaster(); - archiveMaster.setId(resultSet.getString("id")); - } - }catch (Exception ex){ - logger.log(ex.toString()); - } finally { - JDBCUtils.release(resultSet,statement,connection); - } - return archiveMaster; - } - //插入病人基本信息表 - public int addTbasic(TBasic tBasic){ - int j = 0; - Connection connection =null; - PreparedStatement statement = null; - try { - connection = JDBCUtils3.getConnection(); - String sql = "INSERT INTO [t_basic]([patient_id],[base_medicare],[other_medicare]\n" + - ",[pay_type],[bed_no],[clinic_id],[admiss_id],[inpatient_no]\n" + - ",[admiss_times],[name],[sex],[birthday],[age],[age_month]\n" + - ",[age_day],[marriage],[job],[birth_addr],[nation],[country]\n" + - ",[id_card],[work_addr],[work_tel],[work_zip],[home_addr]\n" + - ",[home_tel],[home_zip],[linkman],[relation],[rel_addr]\n" + - ",[rel_tel],[m_addr],[ph],[gdh],[oper_code],[oper_name],[oper_date]\n" + - ",[scan_id],[mir_id],[top_unit],[persennl_type],[duty]\n" + - ",[service_system_indicator],[ident],[working_status],[rel_zip]\n" + - ",[patient_origin],[management_code],[name_py],[create_date]\n" + - ",[name_cym],[health_card],[birth_place_name],[native_place]\n" + - ",[FZYID])\n" + - "VALUES\n" + - "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);"; - Object[]parms = new Object[]{ - tBasic.getPatientId(),tBasic.getBaseMedicare(),tBasic.getOtherMedicare(), - tBasic.getPayType(),tBasic.getBedNo(),tBasic.getClinicId(),tBasic.getAdmissId(), - tBasic.getInpatientNo(),tBasic.getAdmissTimes(),tBasic.getName(),tBasic.getSex(), - tBasic.getBirthday(),tBasic.getAge(),tBasic.getAgeMonth(),tBasic.getAgeDay(),tBasic.getMarriage(), - tBasic.getJob(),tBasic.getBirthAddr(),tBasic.getNation(),tBasic.getCountry(), - tBasic.getIdCard(),tBasic.getWorkAddr(),tBasic.getWorkTel(),tBasic.getWorkZip(), - tBasic.getHomeAddr(),tBasic.getHomeTel(),tBasic.getHomeZip(),tBasic.getLinkman(), - tBasic.getRelation(),tBasic.getRelAddr(),tBasic.getRelTel(),tBasic.getMAddr(), - tBasic.getPh(),tBasic.getGdh(),tBasic.getOperCode(),tBasic.getOperName(),tBasic.getOperDate(), - tBasic.getScanId(),tBasic.getMirId(),tBasic.getTopUnit(),tBasic.getPersennlType(), - tBasic.getDuty(),tBasic.getServiceSystemIndicator(),tBasic.getIdent(),tBasic.getWorkingStatus(), - tBasic.getRelZip(),tBasic.getPatientOrigin(),tBasic.getManagementCode(),tBasic.getNamePy(), - tBasic.getCreateDate(),tBasic.getNameCym(),tBasic.getHealthCard(),tBasic.getBirthPlaceName(), - tBasic.getNativePlace(),tBasic.getFzyid() - }; - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j = statement.executeUpdate(); - }catch (Exception e){ - logger.log(e.toString()); - }finally { - JDBCUtils.release(null,statement,connection); - } - return j; - } - - //插入诊断表 - public int addTdiag(TDiag tDiag){ - int j = 0; - Connection connection = null; - PreparedStatement statement = null; - try { - connection = JDBCUtils3.getConnection(); - String sql = "INSERT INTO [t_diag]([patient_id],[diag_no],[diag_code],[diag_name],[diag_type],[dis_thing],[pathology_cut]\n" + - ",[X_ray],[oper_code],[oper_name],[oper_date],[singl],[create_date],[pat_adm_condition],[pid],[vid],[INHospStat])\n" + - "VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; - Object[]parms = new Object[]{tDiag.getPatientId(),tDiag.getDiagNo(),tDiag.getDiagCode(),tDiag.getDiagName(),tDiag.getDiagType(),tDiag.getDisThing(),tDiag.getPathologyCut(), - tDiag.getXRay(),tDiag.getOperCode(),tDiag.getOperName(),tDiag.getOperDate(),tDiag.getSingl(),tDiag.getCreateDate(),tDiag.getPatAdmCondition(),tDiag.getPid(),tDiag.getVid(),tDiag.getInHospStat()}; - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j = statement.executeUpdate(); - }catch (Exception e){ - logger.log(e.toString()); - }finally { - JDBCUtils.release(null,statement,connection); - } - return j; - } - - //插入手术表 - public int addToperate(TOperate tOperate){ - int j = 0; - Connection connection = null; - PreparedStatement statement = null; - String sql = "INSERT INTO [t_operate]([patient_id],[operate_no],[operate_code],[operate_name]\n" + - ",[operate_date],[operator],[assistant_1],[assistant_2],[assistant_3],[anaesthesia_type]\n" + - ",[cut],[anaesthesia_name],[oper_code],[oper_name],[oper_date],[operate_class],[OPERATION_SCALE]\n" + - ",[ChosSurg],[OperDegr])\n" + - "VALUES(replace(newid(), '-', ''),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; - Object[]parms = new Object[]{ - tOperate.getOperateNo(),tOperate.getOperateCode(),tOperate.getOperateName(), - tOperate.getOperDate(),tOperate.getOperator(),tOperate.getAssistant1(),tOperate.getAssistant2(),tOperate.getAssistant3(),tOperate.getAnaesthesiaType(), - tOperate.getCut(),tOperate.getAnaesthesiaName(),tOperate.getOperCode(),tOperate.getOperName(),tOperate.getOperDate(),tOperate.getOperateClass(),tOperate.getOperationScale(), - tOperate.getChosSurg(),tOperate.getOperDegr() - }; - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j=statement.executeUpdate(); - }catch (Exception e){ - logger.log(e.toString()); - }finally { - JDBCUtils.release(null,statement,connection); - } - return j; - } - - //插入婴儿表 - public int addTbaby(TBaby tBaby){ - int j = 0; - Connection connection = null; - PreparedStatement statement = null; - String sql = "INSERT INTO [t_baby]([patient_id],[fetation_times],[childbirth_times],[childbirth_time]\n" + - ",[childbirth_mothed],[sex],[head],[chest],[avoirdupois],[stature]\n" + - ",[diag_type],[diag_code],[diag_name],[father],[id_card],[work_addr]\n" + - ",[home_addr])\n" + - "VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; - Object[]parms = new Object[]{tBaby.getPatientId(),tBaby.getFetationTimes(),tBaby.getChildbirthTimes(),tBaby.getChildbirthTime(), - tBaby.getChildbirthMothed(),tBaby.getSex(),tBaby.getHead(),tBaby.getChest(),tBaby.getAvoirdupois(),tBaby.getStature(), - tBaby.getDiagType(),tBaby.getDiagCode(),tBaby.getDiagName(),tBaby.getFather(),tBaby.getIdCard(),tBaby.getWorkAddr(), - tBaby.getHomeAddr()}; - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j = statement.executeUpdate(); - }catch (Exception e){ - logger.log(e.toString()); - }finally { - JDBCUtils.release(null,statement,connection); - } - return j; - } - - //插入病人住院信息表 - public int addTadmissthing(TAdmissThing tAdmissThing){ - int j = 0; - Connection connection = null; - PreparedStatement statement = null; - String sql = "INSERT INTO [t_admiss_thing]\n" + - "([patient_id],[admiss_date],[admiss_dept],[admiss_ward],[change_dept]\n" + - ",[change_ward],[dis_date],[dis_dept],[dis_ward],[clinic_diag],[clinic_name]\n" + - ",[admiss_thing],[admiss_diag],[admiss_name],[affirm_date],[diag_flag]\n" + - ",[clinic_doctor],[dis_type],[diag_mode],[other_diag],[admiss_type]\n" + - ",[clinic_date],[operator],[admiss_doctor],[dis_doctor],[clinic_diag_2]\n" + - ",[clinic_name_2],[admiss_diag_2],[admiss_name_2],[admiss_diag_3]\n" + - ",[admiss_name_3])\n" + - "VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);"; - Object[]parms = new Object[]{tAdmissThing.getPatientId(),tAdmissThing.getAdmissDate(),tAdmissThing.getAdmissDept(),tAdmissThing.getAdmissWard(), - tAdmissThing.getChangeDept(),tAdmissThing.getChangeWard(),tAdmissThing.getDisDate(),tAdmissThing.getDisDept(),tAdmissThing.getDisWard(),tAdmissThing.getClinicDiag(), - tAdmissThing.getClinicName(),tAdmissThing.getAdmissThing(),tAdmissThing.getAdmissDiag(),tAdmissThing.getAdmissName(),tAdmissThing.getAffirmDate(),tAdmissThing.getDiagFlag(), - tAdmissThing.getClinicDoctor(),tAdmissThing.getDisType(),tAdmissThing.getDiagMode(),tAdmissThing.getOtherDiag(),tAdmissThing.getAdmissType(),tAdmissThing.getClinicDate(),tAdmissThing.getOperator(), - tAdmissThing.getAdmissDoctor(),tAdmissThing.getDisDoctor(),tAdmissThing.getClinicDiag2(), - tAdmissThing.getClinicName2(),tAdmissThing.getAdmissDiag2(),tAdmissThing.getAdmissName2(),tAdmissThing.getAdmissDiag3(),tAdmissThing.getAdmissName3()}; - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j = statement.executeUpdate(); - }catch (Exception e){ - logger.log(e.toString()); - }finally { - JDBCUtils.release(null,statement,connection); - } - return j ; - } - - //插入病人检查信息表 - //int addTcheck - - //插入费用表 - - - //插入公共表 - public int addCommom(CommomVo commomVo){ - int j = 0; - String sql = "insert into commomtable\n" + - "(\n" + - "\tpatient_id,admiss_times,inpatient_no,name,admiss_id,sex,age,age_month,age_day,home_addr,name_cym,\n" + - "\tadmiss_date,dis_date,admiss_days,dis_dept,is_oper,attending,main_diag_name,main_dis_thing\n" + - ")\n" + - "values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; - Object[]parms = new Object[]{ - commomVo.getPatientId(),commomVo.getAdmissTimes(),commomVo.getInpatientNo(),commomVo.getName(),commomVo.getAdmissId(),commomVo.getSex(),commomVo.getAge(), - commomVo.getAgeMonth(),commomVo.getAgeDay(),commomVo.getHomeAddr(),commomVo.getNameCym(), - commomVo.getAdmissDate(),commomVo.getDisDate(),commomVo.getAdmissDays(),commomVo.getDisDept(), - commomVo.getIsOper(),commomVo.getAttending(),commomVo.getMainDiagName(),commomVo.getMainDisThing() - }; - Connection connection = null; - PreparedStatement statement = null; - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j = statement.executeUpdate(); - } catch (Exception e) { - logger.log(e.toString()); - }finally { - JDBCUtils.release(null,statement,connection); - } - return j ; - } - - public int addCommom1(CommomVo commomVo){ - Connection connection = null; - PreparedStatement statement = null; - String sql = "insert into commomtable1\n" + - "(\n" + - "\tpatient_id,country,birth_addr,id_card,job,marriage,home_tel,home_zip,work_addr,\n" + - "\twork_tel,work_zip,linkman,relation,rel_addr,rel_tel,pay_type,birthday,avoirdupois,\n" + - "\tadmiss_type,admiss_dept,admiss_ward,change_dept,dis_ward,clinic_diag,clinic_name,\n" + - "\tadmiss_thing,medicine,is_medicine,emit_pathology,dept_director,director,admiss_doctor,\n" + - "\trefresher,praxis,coding,quality,control,nurses,quality_date,blood_type,RH\n" + - ")\n" + - "values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; - Object[]parms = new Object[]{commomVo.getPatientId(),commomVo.getCountry(),commomVo.getBirthAddr(),commomVo.getIdCard(),commomVo.getJob(), - commomVo.getMarriage(),commomVo.getHomeTel(),commomVo.getHomeZip(),commomVo.getWorkAddr(), - commomVo.getWorkTel(),commomVo.getWorkZip(),commomVo.getLinkman(),commomVo.getRelation(),commomVo.getRelAddr(),commomVo.getRelTel(), - commomVo.getPayType(),commomVo.getBirthday(),commomVo.getAvoirdupois(),commomVo.getAdmissType(),commomVo.getAdmissDept(), - commomVo.getAdmissWard(),commomVo.getChangeDept(),commomVo.getDisWard(),commomVo.getClinicDiag(),commomVo.getClinicName(), - commomVo.getAdmissThing(),commomVo.getMedicine(),commomVo.getIsMedicine(),commomVo.getEmitPathology(),commomVo.getDeptDirector(),commomVo.getDirector(),commomVo.getAdmissDoctor(), - commomVo.getRefresher(),commomVo.getPraxis(),commomVo.getCoding(),commomVo.getQuality(),commomVo.getControl(),commomVo.getNurses(),commomVo.getQualityDate(),commomVo.getBloodType(),commomVo.getRh()}; - int j = 0; - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j = statement.executeUpdate(); - } catch (Exception e) { - logger.log(e.toString()); - }finally { - JDBCUtils.release(null,statement,connection); - } - return j ; - } - - public int addCommom2(String patientId){ - String sql = "insert into commomtable2(patient_id)VALUES(?)"; - Object[]parms = new Object[]{patientId}; - Connection connection = null; - PreparedStatement statement = null; - int j = 0; - try { - connection = JDBCUtils3.getConnection(); - statement = connection.prepareStatement(sql); - if (parms != null && parms.length > 0) { - for (int i = 0; i < parms.length; i++) { - statement.setObject(i + 1, parms[i]); - } - } - j = statement.executeUpdate(); - }catch (Exception e){ - logger.log(e.toString()); - }finally { - JDBCUtils.release(null,statement,connection); - } - return j; - } -} - - diff --git a/src/main/java/com/xjgs/util/JsonResult.java b/src/main/java/com/xjgs/util/JsonResult.java new file mode 100644 index 0000000..2350ce1 --- /dev/null +++ b/src/main/java/com/xjgs/util/JsonResult.java @@ -0,0 +1,51 @@ +package com.xjgs.util; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +/** + * 这是一个给fastJSON/jackson准备的一个对象 + */ +public class JsonResult implements Serializable { + private Map dataMap = new HashMap<>(3); + + public JsonResult() { + } + + public String getCode() { + return dataMap.get("code").toString(); + } + + public void setCode(String code) { + this.dataMap.put("code", code); + } + + public String getMsg() { + return dataMap.get("msg").toString(); + } + + public void setMsg(String msg) { + this.dataMap.put("msg", msg); + } + + public Object getData() { + return dataMap.get("data"); + } + + public void setData(Object data) { + this.dataMap.put("data", data); + } + + public Map getDataMap() { + return dataMap; + } + + public void setDataMap(Map dataMap) { + this.dataMap = dataMap; + } + + public void put(String name, Object value) { + this.dataMap.put(name, value); + } +} diff --git a/src/main/java/com/xjgs/vo/ArchiveMaster.java b/src/main/java/com/xjgs/vo/ArchiveMaster.java index 1ca7a58..9602beb 100644 --- a/src/main/java/com/xjgs/vo/ArchiveMaster.java +++ b/src/main/java/com/xjgs/vo/ArchiveMaster.java @@ -15,6 +15,15 @@ public class ArchiveMaster { private String deptName; private String dischargeDateTime; private String archiveState; + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + private String admissionDateTime; private String deptAdmissionTo; private String checkDoctor; @@ -29,6 +38,8 @@ public class ArchiveMaster { private String status; private String bedId; + private String source; + public String getId() { return id; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..e0f4ee0 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,2 @@ +server: + port: 8017 \ No newline at end of file diff --git a/src/main/resources/localPath.xml b/src/main/resources/localPath.xml index 0a46a59..b8afbf0 100644 --- a/src/main/resources/localPath.xml +++ b/src/main/resources/localPath.xml @@ -1,5 +1,5 @@ - Z: + G: D:\JSWorking\SignedPictures\ diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml new file mode 100644 index 0000000..2afc6f9 --- /dev/null +++ b/src/main/resources/logback.xml @@ -0,0 +1,42 @@ + + + logback + + + + + %d{HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n + + + + + + true + + + hisLog/%d{yyyy-MM-dd}/%d{yyyy-MM-dd}.log + + + + + %d{yyyy-MM-dd HH:mm:ss} -%msg%n + + + + + + + + + + + + + + + + + +