Index: ssts-web/src/main/webapp/disinfectsystem/config/dgfy/interfaces/mqConfig/SDKConfig.properties =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/config/dgfy/interfaces/mqConfig/SDKConfig.properties (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/config/dgfy/interfaces/mqConfig/SDKConfig.properties (revision 37555) @@ -0,0 +1,75 @@ +#查询推送的服务地址 +server.ip=http://10.18.11.18:8360 +#推送的服务地址 +push.server.ip=http://10.18.11.18:8380 +#订阅的服务地址 +websocket.ip=http://10.18.11.18:8350 +#页端的服务地址 +web.ip=http://10.18.11.18:8370 + + + +websocket.endpoint=endpointWisely + +#集群容错:FAIL_OVER FAIL_FAST +cluster.type=FAIL_FAST +cluster.retry=3 + + +#*****客户端配置****** +sys.code=S17 +client.key=597a26c36aff45e4a398455336f446df +#客户端IP +sys.ipaddr= + + +#v4.0.2.5 新增 +#*****apollo配置****** +apollo.bootstrap.enabled=false +app.id=sdk +#apollo环境变量key +env.key=env +env=dev +apollo.cluster=default +apollo.namespace=application +apollo.meta=http://192.168.10.11:8080 +local.meta=http://192.168.10.11:8080 +dev.meta=http://192.168.10.11:8080 +fat.meta=http://192.168.10.11:8080 +uat.meta=http://192.168.10.11:8080 +lpt.meta=http://192.168.10.11:8080 +pro.meta=http://192.168.10.11:8080 +tools.meta=http://192.168.10.11:8080 + + + +#v4.0.2.6 新增 +#ACK回执线程池配置 +#核心线程数 +ack.core.pool.size=50 +#最大线程数 +ack.max.pool.size=1000 +#任务队列大小 +ack.pool.queue.size=30 +#批量获取最大值 +ack.batch.max.size=1000 +#批量获取最小值 +ack.batch.min.size=100 +#批量获取初始值 +ack.batch.initial.size=500 +#批量获取值动态增幅 +ack.batch.increase.size=100 +#批量获取单条等待 +ack.poll.delay.time=3 +#ACK批量发送数 +ack.batch.send.size=100 + + +#4.0.3.1 新增 +#失败消息存储路径 +fail.msg.file.path=E:\\errorMsg +#单个文件大小 单位kb +fail.msg.file.size=10240 +#清除失败消息间隔 单位小时 +fail.msg.clear.inteval=3 + Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/mq/dao/dgfy/TousseInstancePushDaoImpl.java =================================================================== diff -u --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/mq/dao/dgfy/TousseInstancePushDaoImpl.java (revision 0) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/mq/dao/dgfy/TousseInstancePushDaoImpl.java (revision 37555) @@ -0,0 +1,237 @@ +package com.forgon.disinfectsystem.mq.dao.dgfy; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; + +import com.ewell.sdk.business.EwellServiceTool; +import com.forgon.disinfectsystem.datasynchronization.dao.TousseInstancePushDao; +import com.forgon.disinfectsystem.entity.basedatamanager.materialdefinition.MaterialDefinition; +import com.forgon.disinfectsystem.entity.basedatamanager.materialinstance.MaterialInstance; +import com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.TousseDefinition; +import com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.TousseInstance; +import com.forgon.tools.date.DateTools; +import com.forgon.tools.db.DatabaseUtil; +import com.forgon.tools.hibernate.ObjectDao; +import com.forgon.tools.util.SqlUtils; + +/** + * 推送发货的器械包信息 DGSFYBJY-81 + */ +public class TousseInstancePushDaoImpl implements TousseInstancePushDao { + + /** + * 队列管理名称 + */ + public static String QUEUE_MANAGER_NAME = "QMGR.P17"; + + /** + * 数据通道 + */ + public static String FID = "PS30005"; + + /** + * 用户名 + */ + public static String USER_NAME = "S17"; + + /** + * 密码 + */ + public static String PASSWORD = "123456"; + + Logger logger = Logger.getLogger(TousseInstancePushDaoImpl.class); + + @Autowired + private ObjectDao objectDao; + + @Override + public void pushTousseInstanceAfterInvoice(Collection tousseInstances) { + if(CollectionUtils.isEmpty(tousseInstances)){ + return; + } + EwellServiceTool ewellServiceTool = null; + try { + //创建连接对象 + ewellServiceTool = new EwellServiceTool(); + //定义请求体 + String msgbody = buildMsgBody(tousseInstances); + logger.debug("发货的器械包信息推送接口请求参数:" + msgbody); + //放入消息 + String messageId = ewellServiceTool.composePutMsg(QUEUE_MANAGER_NAME, FID, msgbody); + logger.debug("发货的器械包信息推送接口返回参数:" + messageId); + } catch (Exception e) { + e.printStackTrace(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + e.printStackTrace(new PrintStream(baos)); + String exception = baos.toString(); + logger.debug("发货的器械包信息推送接口调用失败:" + exception); + e.printStackTrace(); + } finally{ + if(ewellServiceTool != null){ + try { + ewellServiceTool.disconnect(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + } + + /** + * 构建请求信息 + * + * + * XGXT + * 123456 + * PS30004 + * PS30004S09001 + * 1 + * + * + * PS30004 + * PS30004S09001 + * S17 + * S00 + * GH01 + * -1 + * + * 2023-02-22 15:43:20 + * + * + * + * BAR_CODE + * PACKAGE_NAME + * STERILIZE_DATE + * TODAY_USE_TIMES + * EXP_DATE + * PACKAGE_OPERATOR + * NOTE + * + * + * + * @param tousseInstances + * @return + */ + @SuppressWarnings("unchecked") + private String buildMsgBody(Collection tousseInstances) { + if(CollectionUtils.isEmpty(tousseInstances)){ + return null; + } + String nowDateTime = DateTools.getCurrentDayByFormat(DateTools.COMMON_DATE_HMS); + StringBuffer msgBody = new StringBuffer(); + msgBody.append(""); + msgBody.append(""); + msgBody.append("" + USER_NAME + ""); + msgBody.append("" + PASSWORD + ""); + msgBody.append("" + FID + ""); + msgBody.append("" + FID + "S09001"); + msgBody.append("1"); + msgBody.append(""); + msgBody.append(""); + msgBody.append("" + FID + ""); + msgBody.append("" + FID + "S09001"); + msgBody.append("S17"); + msgBody.append("S00"); + msgBody.append("GH01"); + msgBody.append("-1"); + // + msgBody.append("" + nowDateTime + ""); + msgBody.append(""); + msgBody.append(""); + int index = 1; + for (TousseInstance tousseInstance : tousseInstances) { + + TousseDefinition td = tousseInstance.getTousseDefinition(); + msgBody.append(""); + msgBody.append("" + tousseInstance.getBarcode() + ""); + msgBody.append("" + td.getId() + ""); + msgBody.append("" + tousseInstance.getTousseName() + ""); + msgBody.append("" + tousseInstance.getPrice() + ""); + msgBody.append("" + TousseInstance.STATUS_SHIPPED + ""); + msgBody.append("" + StringUtils.defaultString(tousseInstance.getSterileStartDate()) + ""); + msgBody.append("" + StringUtils.defaultString(tousseInstance.getValidUntilStr()) + ""); + + List materialInstances = (List) objectDao.findByProperty(MaterialInstance.class.getSimpleName(), + "tousse.id", td.getId()); + + Map> materialDefinitionMap = loadMaterialDefinitionMap(materialInstances); + + if(CollectionUtils.isNotEmpty(materialInstances)){ + msgBody.append(""); + for (MaterialInstance mi : materialInstances) { + Map mdMap = materialDefinitionMap.get(mi.getId()); + msgBody.append(""); + msgBody.append("" + mdMap.get("id") + ""); + msgBody.append("" + StringUtils.defaultString((String) mdMap.get("name")) + ""); + msgBody.append("" + StringUtils.defaultString((String) mdMap.get("specification")) + ""); + msgBody.append("" + mi.getCount() + ""); + msgBody.append(""); + } + msgBody.append(""); + } + msgBody.append(""); + index++; + } + msgBody.append(""); + msgBody.append(""); + return msgBody.toString(); + } + + private Map> loadMaterialDefinitionMap(List materialInstances) { + + Map> materialDefinitionMap = new HashMap>(); + if(CollectionUtils.isEmpty(materialInstances)){ + return materialDefinitionMap; + } + List materialInstanceIds = new ArrayList(); + for (MaterialInstance mi : materialInstances) { + materialInstanceIds.add(mi.getId()); + } + String sql = String.format("select mi.id miId, md.id mdId, md.name, md.specification from %s mi " + + "join %s md on md.id = mi.materialDefinition_id " + + "where %s ", + MaterialInstance.class.getSimpleName(), + MaterialDefinition.class.getSimpleName(), + SqlUtils.getNonStringFieldInLargeCollectionsPredicate("mi.id", materialInstanceIds)); + ResultSet rs = null; + try { + rs = objectDao.executeSql(sql); + while(rs.next()){ + Long miId = rs.getLong("miId"); + Long mdId = rs.getLong("mdId"); + String name = rs.getString("name"); + String specification = rs.getString("specification"); + + Map mdMap = new HashMap(); + mdMap.put("id", mdId); + mdMap.put("name", name); + mdMap.put("specification", specification); + + materialDefinitionMap.put(miId, mdMap); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + DatabaseUtil.closeResultSetAndStatement(rs); + } + return materialDefinitionMap; + } + + @Override + public void pushTousseInstanceAfterSign(Collection tousseInstances) { + return; + } + +} Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/mq/dao/dgfy/MQDataDaoImpl.java =================================================================== diff -u --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/mq/dao/dgfy/MQDataDaoImpl.java (revision 0) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/mq/dao/dgfy/MQDataDaoImpl.java (revision 37555) @@ -0,0 +1,64 @@ +package com.forgon.disinfectsystem.mq.dao.dgfy; + +import org.springframework.beans.factory.annotation.Autowired; +import com.forgon.disinfectsystem.datasynchronization.model.OrgUnitVo; +import com.forgon.disinfectsystem.datasynchronization.model.PatientInfoVO; +import com.forgon.disinfectsystem.datasynchronization.model.UserVo; +import com.forgon.disinfectsystem.inventorymanagement.dao.BaseDataDao; +import com.forgon.tools.hibernate.ObjectDao; + +/** + * MQ队列数据处理类DGSFYBJY-78 + */ +public class MQDataDaoImpl implements BaseDataDao { + + @Autowired + private ObjectDao objectDao; + + @Override + public PatientInfoVO[] getAllPatientData() throws Exception { + return null; + } + + @Override + public OrgUnitVo[] getAllOrgUnitVoData() throws Exception { + return null; + } + + @Override + public UserVo[] getAllUserVoData() throws Exception { + return null; + } + + @Override + public Object[] getAllBaseData() { + return null; + } + + @Override + public Object[] getAllDepartAndUserData() { + return null; + } + + @Override + public void invokeMethodOnceAfterStart() throws Exception { + + } + + @Override + public PatientInfoVO[] syncMqPatientInfoByHospitalNumber(String hospitalNum) { + try { + // 从EHSB平台获取住院病人信息(优先同步“住院病人接口”) + return MQHelper.getHospitalPatientMessage(hospitalNum); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + @Override + public PatientInfoVO[] syncMqPatientInfoByTreatmentNum(String treatmentNum) { + return null; + } + +} Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/mq/dao/dgfy/MQHelper.java =================================================================== diff -u --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/mq/dao/dgfy/MQHelper.java (revision 0) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/mq/dao/dgfy/MQHelper.java (revision 37555) @@ -0,0 +1,406 @@ +package com.forgon.disinfectsystem.mq.dao.dgfy; + +import java.io.File; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Comparator; +import java.util.Date; +import java.util.LinkedList; +import java.util.List; + +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.log4j.Logger; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.DocumentHelper; +import org.dom4j.Node; +import org.dom4j.XPath; +import org.dom4j.io.SAXReader; + +import com.ewell.sdk.business.EwellServiceTool; +import com.ewell.sdk.domain.MessageEntity; +import com.forgon.disinfectsystem.datasynchronization.model.PatientInfoVO; +import com.forgon.tools.date.DateTools; + +/** + * MQ队列帮助类DGSFYBJY-78 + */ +public class MQHelper { + + private static Logger logger = Logger.getLogger(MQHelper.class); + /** + * 队列管理名称 + */ + public static String queueManagerName = "QMGR.S17"; + + /** + * 数据通道 + */ + public static String FID = "BS30002"; + + /** + * 用户名 + */ + public static String USER_NAME = "S17"; + + /** + * 密码 + */ + public static String PASSWORD = "123456"; + + /** + * 获取入院病人信息 + * 需要发送带有住院号的xml消息到平台,然后平台再返回对应的住院病人信息 + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static PatientInfoVO[] getHospitalPatientMessage(String HospitalNumber) { + // 查询消息 + /* 消息内容如下: + * + + 1 + XD + 123456 + BS35004 + BS35004S08001 + + + BS35004 + BS35004S08001 + S08 + S00 + DG01 + 2019-05-25 14:00:0 + + + 0 + 500 + + + + + + + + + + + */ + if (StringUtils.isBlank(HospitalNumber)) { + logger.debug("住院号为空!"); + return null; + } + //请求响应消费方:一次请求,一条响应 或者 推送发送方:一次推送,一条推送结果(EHSB平台提供的平台接入方法) + logger.debug("开始查询并解析手术申请单住院病人信息"); + String fid = "BS30002"; + String Req = "1" + USER_NAME + ""+ PASSWORD +"" + fid + "" + fid + "S17001" + + "" + FID + "" + FID + "S17001S17S00GH01" + DateTools.getCurrentDayByFormat("yyyy-MM-dd HH:mm:ss")+ "" + + "0500" + + "" + + ""; + logger.debug("请求信息:" + Req); + String responce = null; + EwellServiceTool queueTools = null; + try { + queueTools = new EwellServiceTool(); + MessageEntity msg = queueTools.composePutAndGetMsg(queueManagerName, null, 5000, Req); + if(msg != null){ + responce = msg.getMsg(); + } + } catch (Exception e) { + e.printStackTrace(); + logger.debug("连接消息队列失败!" + e); + } finally { + if(queueTools != null){ + try { + queueTools.disconnect(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + logger.debug("返回信息:" + responce); + /*responce = "" + + "" + + "BS30002" + + "BS30002S17001" + + "S00" + + "S17" + + "DG01" + + "2021-02-01 15:51:14.423" + + "" + + "" + + "1" + + "query success" + + "" + + "" + + "1" + + "1" + + "" + + "" + + "" + + "112788711127887001111278870012018-07-16T15:20:002018-07-16T16:05:001212右胫骨骨折切复空心螺钉内固定术腰硬联合麻醉0715谭志锋1593黄浩波汤华倩0499龙丽如0720陈杰0720陈杰0499龙丽如汤华倩1002012302骨七科病区1.胫骨骨折 (右胫骨远端骨折)450126200708044922葛英霞2007-08-04T00:00:00汉族2021-06-15 11:12:011]]>" + + "" + + "" + + "112788711127887002111278870022019-07-06T14:10:002019-07-06T14:45:000505右胫骨螺钉取除术腰硬联合麻醉Ⅰ类1593黄浩波0746刘亮洪2669林翠婷1850郭启仁李刚李刚1850郭启仁2669林翠婷1002012302骨七科病区右胫骨远端骨骺骨折术后450126200708044922葛英霞2007-08-04T00:00:00汉族2021-06-15 11:12:011]]>" + + "" + + "" + +"";*/ + if (StringUtils.isNotBlank(responce)) { + // 开始解析 + try { + Document doc = DocumentHelper.parseText(responce); + String RetConXpath = "/ESBEntry/RetInfo/RetCon"; // 查询结果返回提示信息 + String RetCodeXpath = "/ESBEntry/RetInfo/RetCode"; // 查询结果返回状态 + String RetCon = processDataByXpath(doc, RetConXpath); + String RetCode = processDataByXpath(doc, RetCodeXpath); + if ("1".equals(RetCode)) { + // 解析住院病人信息并入库 + String MsgXpath = "/ESBEntry/MsgInfo/Msg"; // 返回结果可能存在多条住院病人信息 + XPath xpath = doc.createXPath(MsgXpath); + List nodeList2 = xpath.selectNodes(doc, xpath); + if (nodeList2 != null && nodeList2.size() > 0) { + List patientInfoVOList = new LinkedList(); + // 解析返回信息中所有住院病人信息 + for (int i = 1; i <= nodeList2.size(); i++) { + String msgXpath = "/ESBEntry/MsgInfo/Msg[" + i + "]"; + String patientInfo = processDataByXpath(doc, msgXpath); // 住院病人信息 + if (StringUtils.isNotBlank(patientInfo)) { + Document document = DocumentHelper.parseText(patientInfo); + // 解析住院病人信息并入库 + //诊疗号 + String clinicNumberXpath = "/msg/body/row/OUTHOSP_INDEX_NO"; + //住院号 + String hospitalNumberXpath = "/msg/body/row/INHOSP_INDEX_NO"; + //住院次数 + String visitAmountXpath = "/msg/body/row/INHOSP_NUM"; + //手术单号 + String operationScheduleIdXpath = "/msg/body/row/SURGERY_NO"; + //手术时间 + String operationTimeXpath = "/msg/body/row/SURGERY_BEGIN_DATETIME"; + //手术间 + String opRoomIdXpath = "/msg/body/row/SURGERY_ROOM_NAME"; + //手术名称 + String operationXpath = "/msg/body/row/SURGERY_OPER_NAME"; + //手术医生 + String doctorNameXpath = "/msg/body/row/SURGERY_DR_NAME"; + //巡回护士 + String circuitNurseXpath = "/msg/body/row/TOUR_NURSE_NAME"; + //病人所在科室 + String ascriptionDepartmentXpath = "/msg/body/row/SURGERY_DEPT_NAME"; + //身份证 + String patientIDCardXpath = "/msg/body/row/ID_NUMBER"; + //姓名 + String patientNameXpath = "/msg/body/row/PAT_NAME"; + //性别 + String patientSexXpath = "/msg/body/row/PHYSI_SEX_NAME"; + //出生日期 + String patientBirthdayXpath = "/msg/body/row/BIRTH_DATE"; + String roomNumberXpath = null; // 没有对应的房间号字段 + //String bedNumberXpath = "/msg/body/row/ADMIT_BED_INDEX_NO"; + String serialNumberXpath = "/msg/body/row/INHOSP_NO"; + + String hospitalNumber = processDataByXpath(document, hospitalNumberXpath); + String clinicNumber = processDataByXpath(document, clinicNumberXpath); + String circuitNurse = processDataByXpath(document, circuitNurseXpath); + String serialNumber = processDataByXpath(document, serialNumberXpath); + String patientName = processDataByXpath(document, patientNameXpath); + String patientBirthday = processDataByXpath(document, patientBirthdayXpath); + String patientSex = processDataByXpath(document, patientSexXpath); + String patientIDCard = processDataByXpath(document, patientIDCardXpath); + String doctorName = processDataByXpath(document, doctorNameXpath); + String operation = processDataByXpath(document, operationXpath); + String operationTime = processDataByXpath(document, operationTimeXpath); + if (StringUtils.isNotBlank(operationTime)) { + operationTime = operationTime.replace("T", " "); + } + //String patientArea = processDataByXpath(document, patientAreaXpath); + String ascriptionDepartment = processDataByXpath(document, ascriptionDepartmentXpath); + String roomNumber = processDataByXpath(document, roomNumberXpath); + String opRoomId = processDataByXpath(document, opRoomIdXpath); + //String bedNumber = processDataByXpath(document, bedNumberXpath); + if (StringUtils.isNotBlank(patientBirthday)) { + patientBirthday = patientBirthday.replace("T", " "); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); + Date date = DateTools.convertTime(patientBirthday, sdf); + patientBirthday = DateTools.getFormatDateStr(date, "yyyy-MM-dd HH:mm:ss"); + } + String visitAmount = processDataByXpath(document, visitAmountXpath); + String operationScheduleId = processDataByXpath(document, operationScheduleIdXpath); + + PatientInfoVO patientInfoVO = new PatientInfoVO(); + patientInfoVO.setClinicNumber(clinicNumber); + patientInfoVO.setHospitalNumber(hospitalNumber); + patientInfoVO.setCircuitNurse(circuitNurse); + patientInfoVO.setSerialNumber(serialNumber); + patientInfoVO.setPatientName(patientName); + patientInfoVO.setPatientAge(birthdayToAge(patientBirthday)); + patientInfoVO.setPatientSex(patientSex); + patientInfoVO.setPatientIDCard(patientIDCard); + patientInfoVO.setDoctorName(doctorName); + patientInfoVO.setOperation(operation); + patientInfoVO.setOperationTime(operationTime); + //patientInfoVO.setPatientArea(patientArea); + patientInfoVO.setAscriptionDepartment(ascriptionDepartment); + patientInfoVO.setRoomNumber(roomNumber); + patientInfoVO.setOpRoomId(opRoomId); + //patientInfoVO.setBedNumber(bedNumber); + patientInfoVO.setVisitId(StringUtils.isBlank(visitAmount) ? null : Long.valueOf(visitAmount)); + patientInfoVO.setOperationScheduleId(operationScheduleId); + + if (!checkObjAllFieldsIsNull(patientInfoVO)) { + patientInfoVOList.add(patientInfoVO); + } + } + } + if (CollectionUtils.isNotEmpty(patientInfoVOList)) { + // 根据记录录入时间visitDate排序,只取最新记录 + patientInfoVOList.sort(new Comparator() { + @Override + public int compare(PatientInfoVO o1, PatientInfoVO o2) { + if (StringUtils.isBlank(o1.getOperationTime()) && StringUtils.isNotBlank(o2.getOperationTime())) { + return -1; + } + if (StringUtils.isBlank(o2.getOperationTime()) && StringUtils.isNotBlank(o1.getOperationTime())) { + return 1; + } + if(StringUtils.isBlank(o1.getOperationTime()) || StringUtils.isBlank(o2.getOperationTime())){ + return 0; + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + Date date1 = sdf.parse(o1.getOperationTime()); + Date date2 = sdf.parse(o2.getOperationTime()); + return date2.compareTo(date1); + } catch (Exception e) { + logger.debug("住院病人信息排序出错(手术时间【SURGERY_BEGIN_DATETIME】字段格式错误)!"); + e.printStackTrace(); + } + return 0; + } + }); + PatientInfoVO[] patientInfoArray = new PatientInfoVO[patientInfoVOList.size()]; + for (int i=0;i xmlFileToStr(String path) { + List strList = new ArrayList(); + String message = null; + try { + SAXReader saxReader = new SAXReader(); + File f = new File(path); + Document doc; + doc = saxReader.read(f); + message = doc.asXML(); + System.out.println(message); + strList.add(message); + } catch (DocumentException e) { + e.printStackTrace(); + } + return strList; + } + + /** + * 患者年龄处理: + * 根据患者出生日期(YYYY-MM-DD hh:mm:ss )计算年龄 + * @param birthday(YYYY-MM-DD hh:mm:ss ) + * @return age + */ + private static String birthdayToAge(String birthday) { + if(StringUtils.isNotBlank(birthday)) { + String[] arr = birthday.split("-"); + Integer year = Integer.parseInt(arr[0]); + Integer month = Integer.parseInt(arr[1]); + Integer day = Integer.parseInt(arr[2].split(" ")[0]); + Calendar now = Calendar.getInstance(); + Integer currentYear = now.get(Calendar.YEAR); + Integer currentMonth = now.get(Calendar.MONTH) + 1; + Integer currentDay = now.get(Calendar.DAY_OF_MONTH); + Integer age = currentYear - year; + if(currentMonth == month) { + if(currentDay < day) { + age -= 1; + } + } else if(currentMonth < month) { + age -= 1; + } + return age.toString(); + } + return null; + } + +} Index: ssts-web/src/main/webapp/disinfectsystem/config/dgfy/spring/HIS.xml =================================================================== diff -u -r30920 -r37555 --- ssts-web/src/main/webapp/disinfectsystem/config/dgfy/spring/HIS.xml (.../HIS.xml) (revision 30920) +++ ssts-web/src/main/webapp/disinfectsystem/config/dgfy/spring/HIS.xml (.../HIS.xml) (revision 37555) @@ -81,20 +81,9 @@ + + - - - - - - - - - - - - @@ -106,5 +95,8 @@ class="com.forgon.disinfectsystem.maintain.device.service.SterisAMSCO3052DataManagerImpl"> + + + \ No newline at end of file