Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/qysfybjy/SyncOrgUnitAndUserDaoImpl.java =================================================================== diff -u --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/qysfybjy/SyncOrgUnitAndUserDaoImpl.java (revision 0) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/qysfybjy/SyncOrgUnitAndUserDaoImpl.java (revision 27633) @@ -0,0 +1,154 @@ +package com.forgon.disinfectsystem.datasynchronization.dao.qysfybjy; + +import java.util.ArrayList; +import java.util.List; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; + +import com.forgon.disinfectsystem.common.CssdUtils; +import com.forgon.disinfectsystem.datasynchronization.dao.SyncOrgUnitAndUserDao; +import com.forgon.disinfectsystem.datasynchronization.model.OrgUnitVo; +import com.forgon.disinfectsystem.datasynchronization.model.UserVo; +import com.forgon.tools.Constants; + +/** + * 查询his系统科室与人员信息(清远市妇幼保健院) + * @author zhoupeimian + * @since 2020-03-09 + */ +public class SyncOrgUnitAndUserDaoImpl implements SyncOrgUnitAndUserDao { + + Logger logger = Logger.getLogger(SyncOrgUnitAndUserDaoImpl.class); + + /** + * 查询his系统人员信息 + */ + @Override + public UserVo[] getAllUser() { + UserVo[] userVoArray = null; + List userVoList = new ArrayList(); + try{ + //String xml = "CSSD201708081112345678CSSDUser0000success李元玖80728104张卓玲6498105"; + String xmlResult = CssdUtils.sendPostRequest(DatasyncConstant.HttpServiceAddress, + HttpInterfaceHelper.buildInputXml(DatasyncConstant.MethodName_User), Constants.CHARSET_GB2312); + JSONObject documentElementJsonObject = (JSONObject)CssdUtils.xml2JsonCommon(xmlResult); + if(documentElementJsonObject != null){ + String code = documentElementJsonObject.optString("Result"); + if(DatasyncConstant.RESULT_OK.equals(code)){ + Object dataTableObj = documentElementJsonObject.opt("DataTable"); + if(dataTableObj == null){ + return null; + } + JSONArray userJsonArray = new JSONArray(); + if(dataTableObj instanceof JSONObject){ + JSONObject userInfo = (JSONObject)dataTableObj; + userJsonArray.add(userInfo); + }else if(dataTableObj instanceof JSONArray){ + userJsonArray = (JSONArray)dataTableObj; + } + if(userJsonArray.size() > 0){ + for (int i = 0; i < userJsonArray.size(); i++) { + + Object coding = userJsonArray.optJSONObject(i).opt("coding"); + Object name = userJsonArray.optJSONObject(i).opt("name"); + Object orgUnitCoding = userJsonArray.optJSONObject(i).opt("orgUnitCoding"); + UserVo userVo = new UserVo(); + userVo.setCoding(coding instanceof String ? (String)coding : ""); + userVo.setName(name instanceof String ? (String)name : ""); + userVo.setOrgUnitCoding(orgUnitCoding instanceof String ? (String)orgUnitCoding : ""); + userVoList.add(userVo); + } + userVoArray = new UserVo[userJsonArray.size()]; + userVoList.toArray(userVoArray); + } + }else{ + throw new RuntimeException(documentElementJsonObject.optString("Error")); + } + } + }catch(Exception e){ + e.printStackTrace(); + logger.error("查询his人员信息失败:" + e); + } + + return userVoArray; + } + + /** + * 查询his系统科室信息 + */ + @Override + public OrgUnitVo[] getAllOrgUnit() { + OrgUnitVo[] orgUnitVoArray = null; + List orgUnitVoList = new ArrayList(); + try{ +// String xml = "CSSD201708081112345678CSSDDepartment0000success打字室8105图书室8104"; + String xmlResult = CssdUtils.sendPostRequest(DatasyncConstant.HttpServiceAddress, + HttpInterfaceHelper.buildInputXml(DatasyncConstant.MethodName_Department), Constants.CHARSET_GB2312); + JSONObject documentElementJsonObject = (JSONObject)CssdUtils.xml2JsonCommon(xmlResult); + if(documentElementJsonObject != null){ + String code = documentElementJsonObject.optString("Result"); + if(DatasyncConstant.RESULT_OK.equals(code)){ + Object dataTableObj = documentElementJsonObject.opt("DataTable"); + if(dataTableObj == null){ + return null; + } + JSONArray orgJsonArray = new JSONArray(); + if(dataTableObj instanceof JSONObject){ + JSONObject userInfo = (JSONObject)dataTableObj; + orgJsonArray.add(userInfo); + }else if(dataTableObj instanceof JSONArray){ + orgJsonArray = (JSONArray)dataTableObj; + } + if(orgJsonArray.size() > 0){ + for (int i = 0; i < orgJsonArray.size(); i++) { + Object coding = orgJsonArray.optJSONObject(i).opt("coding"); + Object name = orgJsonArray.optJSONObject(i).opt("name"); + Object orgUnitCoding = orgJsonArray.optJSONObject(i).opt("parentCoding"); + OrgUnitVo orgVo = new OrgUnitVo(); + orgVo.setCoding(coding instanceof String ? (String)coding : ""); + orgVo.setName(name instanceof String ? (String)name : ""); + orgVo.setParentCoding(orgUnitCoding instanceof String ? (String)orgUnitCoding : ""); + if(StringUtils.equals(orgVo.getCoding(), orgVo.getParentCoding())){ + orgVo.setParentCoding(null); + } + orgUnitVoList.add(orgVo); + } + orgUnitVoArray = new OrgUnitVo[orgJsonArray.size()]; + orgUnitVoList.toArray(orgUnitVoArray); + } + }else{ + throw new RuntimeException(documentElementJsonObject.optString("Error")); + } + } + }catch(Exception e){ + e.printStackTrace(); + logger.error("查询his科室信息失败" + e); + } + + return orgUnitVoArray; + } + + @Override + public OrgUnitVo[] paramToOrgUnitVos(String param) { + // TODO Auto-generated method stub + return null; + } + + @Override + public UserVo[] paramToUserVos(String param) { + // TODO Auto-generated method stub + return null; + } + + @Override + public JSONObject buttjoinResponse(Boolean success, String message, + String param) { + // TODO Auto-generated method stub + return null; + } + +} Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/qysfybjy/FindPatientInfoByTreatmentNumDaoImpl.java =================================================================== diff -u --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/qysfybjy/FindPatientInfoByTreatmentNumDaoImpl.java (revision 0) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/qysfybjy/FindPatientInfoByTreatmentNumDaoImpl.java (revision 27633) @@ -0,0 +1,94 @@ +package com.forgon.disinfectsystem.datasynchronization.dao.qysfybjy; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.apache.log4j.Logger; + +import com.forgon.disinfectsystem.common.CssdUtils; +import com.forgon.disinfectsystem.datasynchronization.dao.FindPatientInfoByTreatmentNumDao; +import com.forgon.disinfectsystem.datasynchronization.model.PatientInfoVO; +import com.forgon.tools.Constants; + +/** + * 清远市妇幼保健院接口-门诊病人dao + * @author zhoupeimian + * @since 2020-03-09 + */ +public class FindPatientInfoByTreatmentNumDaoImpl implements + FindPatientInfoByTreatmentNumDao { + + Logger logger = Logger.getLogger(FindPatientInfoByTreatmentNumDaoImpl.class); + + /** + * 根据诊疗号查询病人信息 + */ + @Override + public PatientInfoVO[] findPatientInfoByTreatmentNum(String treatmentNum) { + PatientInfoVO[] patientInfoVOArray = null; + try{ + //测试数据,建议代码保留往后可以本地调试 + //String xml = "CSSD201808081111111234CSSDHospitalNumber0000success3494841281234梁峻豪9岁1440608200711050015李春景外科住院W+23"; + String xmlResult = CssdUtils.sendPostRequest(DatasyncConstant.HttpServiceAddress, + HttpInterfaceHelper.buildInputXml(DatasyncConstant.MethodName_ClinicNumber, treatmentNum), Constants.CHARSET_GB2312); + JSONObject documentElementJsonObject = (JSONObject)CssdUtils.xml2JsonCommon(xmlResult); + if(documentElementJsonObject != null){ + String code = documentElementJsonObject.optString("Result"); + if(DatasyncConstant.RESULT_OK.equals(code)){ + Object patientInfoObj = documentElementJsonObject.opt("DataTable"); + JSONObject patientInfo = null; + //body下节点可能会有多个rows节点,所以需要判断 + if(patientInfoObj instanceof JSONObject){ + patientInfo = (JSONObject)patientInfoObj; + }else if(patientInfoObj instanceof JSONArray){ + patientInfo = ((JSONArray)patientInfoObj).optJSONObject(0); + } + if(patientInfo == null){ + return null; + } + Object tNumber = patientInfo.opt("clinicNumber"); + Object patientName = patientInfo.opt("patientName"); + Object patientAge = patientInfo.opt("patientAge"); + Object patientSex = patientInfo.opt("patientSex"); + Object patientIDCard = patientInfo.opt("patientIDCard"); + Object doctorName = patientInfo.opt("doctorName"); + Object operation = patientInfo.opt("operation"); + Object operationTime = patientInfo.opt("operationTime"); + Object patientArea = patientInfo.opt("patientArea"); + Object bedNumber = patientInfo.opt("bedNumber"); + Object roomNumber = patientInfo.opt("roomNumber"); + Object remark = patientInfo.opt("remark"); + + PatientInfoVO vo = new PatientInfoVO(); + vo.setPatientNumber(tNumber instanceof String ? (String)tNumber : ""); + vo.setClinicNumber(vo.getPatientNumber()); + vo.setPatientName(patientName instanceof String ? (String)patientName : ""); + vo.setPatientAge(patientAge instanceof String ? (String)patientAge : ""); + vo.setPatientIDCard(patientIDCard instanceof String ? (String)patientIDCard : ""); + vo.setDoctorName(doctorName instanceof String ? (String)doctorName : ""); + vo.setOperation(operation instanceof String ? (String)operation : ""); + vo.setOperationTime(operationTime instanceof String ? (String)operationTime : ""); + vo.setPatientArea(patientArea instanceof String ? (String)patientArea : ""); + vo.setBedNumber(bedNumber instanceof String ? (String)bedNumber : ""); + vo.setRoomNumber(roomNumber instanceof String ? (String)roomNumber : ""); + vo.setRemark(remark instanceof String ? (String)remark : ""); + + + //设置性别及编码转换成中文 + vo.setPatientSex(patientSex instanceof String ? (String)patientSex : ""); + vo.setPatientSex(DatasyncConstant.patientSetMap.getOrDefault(vo.getPatientSex(), vo.getPatientSex())); + + patientInfoVOArray = new PatientInfoVO[] { vo }; + }else{ + throw new RuntimeException(documentElementJsonObject.optString("Error")); + } + } + }catch(Exception e){ + e.printStackTrace(); + logger.error("根据诊疗号查询病人信息失败" + e); + } + + return patientInfoVOArray; + } + +} Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/qysfybjy/FindPatientInfoByHospitalNumDaoImpl.java =================================================================== diff -u --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/qysfybjy/FindPatientInfoByHospitalNumDaoImpl.java (revision 0) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/qysfybjy/FindPatientInfoByHospitalNumDaoImpl.java (revision 27633) @@ -0,0 +1,107 @@ +package com.forgon.disinfectsystem.datasynchronization.dao.qysfybjy; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.apache.log4j.Logger; + +import com.forgon.disinfectsystem.common.CssdUtils; +import com.forgon.disinfectsystem.datasynchronization.dao.FindPatientInfoByHospitalNumDao; +import com.forgon.disinfectsystem.datasynchronization.model.PatientInfoVO; +import com.forgon.tools.Constants; + +/** + * 清远市妇幼保健院接口-住院病人dao + * @author zhoupeimian + * @since 2020-03-09 + */ +public class FindPatientInfoByHospitalNumDaoImpl implements + FindPatientInfoByHospitalNumDao { + + Logger logger = Logger.getLogger(FindPatientInfoByHospitalNumDaoImpl.class); + + /** + * 根据住院号查询病人信息 + */ + @Override + public PatientInfoVO[] findPatientInfoByHospitalNum(String hospitalNum) { + PatientInfoVO[] patientInfoVOArray = null; + try{ + //测试数据,建议代码保留往后可以本地调试 + //String xml = "CSSD201808081111111234CSSDHospitalNumber0000success3494841281234梁峻豪9岁1440608200711050015李春景外科住院W+23"; + String xmlResult = CssdUtils.sendPostRequest(DatasyncConstant.HttpServiceAddress, + HttpInterfaceHelper.buildInputXml(DatasyncConstant.MethodName_HospitalNumber, hospitalNum), Constants.CHARSET_GB2312); + JSONObject documentElementJsonObject = (JSONObject)CssdUtils.xml2JsonCommon(xmlResult); + if(documentElementJsonObject != null){ + String code = documentElementJsonObject.optString("Result"); + if(DatasyncConstant.RESULT_OK.equals(code)){ + Object patientInfoObj = documentElementJsonObject.opt("DataTable"); + JSONObject patientInfo = null; + //body下节点可能会有多个rows节点,所以需要判断 + if(patientInfoObj instanceof JSONObject){ + patientInfo = (JSONObject)patientInfoObj; + }else if(patientInfoObj instanceof JSONArray){ + patientInfo = ((JSONArray)patientInfoObj).optJSONObject(0); + } + if(patientInfo == null){ + return null; + } + Object tNumber = patientInfo.opt("hospitalNumber"); + Object patientName = patientInfo.opt("patientName"); + Object patientAge = patientInfo.opt("patientAge"); + Object patientSex = patientInfo.opt("patientSex"); + Object patientIDCard = patientInfo.opt("patientIDCard"); + Object doctorName = patientInfo.opt("doctorName"); + Object operation = patientInfo.opt("operation"); + Object operationTime = patientInfo.opt("operationTime"); + Object patientArea = patientInfo.opt("patientArea"); + Object bedNumber = patientInfo.opt("bedNumber"); + Object roomNumber = patientInfo.opt("roomNumber"); + Object opRoomId = patientInfo.opt("opRoomId"); + Object remark = patientInfo.opt("remark"); + + Object washHandNurse = patientInfo.opt("washHandNurse"); + Object circuitNurse = patientInfo.opt("circuitNurse"); + + PatientInfoVO vo = new PatientInfoVO(); + vo.setPatientNumber(tNumber instanceof String ? (String)tNumber : ""); + vo.setHospitalNumber(vo.getPatientNumber()); + vo.setPatientName(patientName instanceof String ? (String)patientName : ""); + vo.setPatientAge(patientAge instanceof String ? (String)patientAge : ""); + vo.setPatientIDCard(patientIDCard instanceof String ? (String)patientIDCard : ""); + vo.setDoctorName(doctorName instanceof String ? (String)doctorName : ""); + vo.setOperation(operation instanceof String ? (String)operation : ""); + vo.setOperationTime(operationTime instanceof String ? (String)operationTime : ""); + vo.setPatientArea(patientArea instanceof String ? (String)patientArea : ""); + vo.setBedNumber(bedNumber instanceof String ? (String)bedNumber : ""); + vo.setRoomNumber(roomNumber instanceof String ? (String)roomNumber : ""); + vo.setOpRoomId(opRoomId instanceof String ? (String)opRoomId : ""); + vo.setRemark(remark instanceof String ? (String)remark : ""); + + vo.setWashHandNurse(washHandNurse instanceof String ? (String)washHandNurse : ""); + vo.setCircuitNurse(circuitNurse instanceof String ? (String)circuitNurse : ""); + + //设置性别及编码转换成中文 + vo.setPatientSex(patientSex instanceof String ? (String)patientSex : ""); + vo.setPatientSex(DatasyncConstant.patientSetMap.getOrDefault(vo.getPatientSex(), vo.getPatientSex())); + + patientInfoVOArray = new PatientInfoVO[] { vo }; + }else{ + throw new RuntimeException(documentElementJsonObject.optString("Error")); + } + } + }catch(Exception e){ + e.printStackTrace(); + logger.error("根据住院号查询病人信息失败" + e); + } + + return patientInfoVOArray; + } + + @Override + public PatientInfoVO[] findPatientInfoByHospitalNumBeforeOperation( + String hospitalNum) { + return findPatientInfoByHospitalNum(hospitalNum); + } + +} Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/qysfybjy/HttpInterfaceHelper.java =================================================================== diff -u --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/qysfybjy/HttpInterfaceHelper.java (revision 0) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/qysfybjy/HttpInterfaceHelper.java (revision 27633) @@ -0,0 +1,85 @@ +package com.forgon.disinfectsystem.datasynchronization.dao.qysfybjy; + + +import org.apache.log4j.Logger; + +/** + * 清远市妇幼保健院接口接口帮助类 + * @author zhoupeimian + * @since 2020-03-09 + */ +public class HttpInterfaceHelper { + + private final static Logger logger = Logger.getLogger(HttpInterfaceHelper.class); + + /** + * 构造接口输入参数 + * @param methodName + * @param arg + * @return + */ + public static String buildInputXml(String methodName , String... args){ + String inputXml = ""; + //门诊病人 + /*if (DatasyncConstant.MethodName_HospitalNumber.equals(transIdName)) { + inputXml = "" + + "" + + "" + + "" + + "CSSD201808081111111234"+ DatasyncConstant.AppId +"" + transIdName + ""+ args[0] +"]]>" + + "" + + "" + + ""; + } else */if (DatasyncConstant.MethodName_HospitalNumber.equals(methodName)) { + //住院病人 + inputXml = "" + + "" + + ""+ DatasyncConstant.AccessKey +"" + + ""+ DatasyncConstant.MethodName_HospitalNumber +"" + + " " + + ""+ DatasyncConstant.DataOrgId +"" + + ""+ DatasyncConstant.DataSysId +"" + + ""+ args[0] +"" + + "" + + ""; + } else if (DatasyncConstant.MethodName_ClinicNumber.equals(methodName)) { + //住院病人 + inputXml = "" + + "" + + ""+ DatasyncConstant.AccessKey +"" + + ""+ DatasyncConstant.MethodName_ClinicNumber +"" + + " " + + ""+ DatasyncConstant.DataOrgId +"" + + ""+ DatasyncConstant.DataSysId +"" + + ""+ args[0] +"" + + "" + + ""; + } else if (DatasyncConstant.MethodName_Department.equals(methodName)) { + //科室 + inputXml = "" + + "" + + ""+ DatasyncConstant.AccessKey +"" + + ""+ DatasyncConstant.MethodName_Department +"" + + " " + + ""+ DatasyncConstant.DataOrgId +"" + + ""+ DatasyncConstant.DataSysId +"" + + "" + + ""; + } else if (DatasyncConstant.MethodName_User.equals(methodName)) { + //人员 + inputXml = "" + + "" + + ""+ DatasyncConstant.AccessKey +"" + + ""+ DatasyncConstant.MethodName_User +"" + + " " + + ""+ DatasyncConstant.DataOrgId +"" + + ""+ DatasyncConstant.DataSysId +"" + + "" + + ""; + } else { + throw new RuntimeException("不存在此methodName:" + methodName); + } + return inputXml; + } + +} Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/qysfybjy/DatasyncConstant.java =================================================================== diff -u --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/qysfybjy/DatasyncConstant.java (revision 0) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/qysfybjy/DatasyncConstant.java (revision 27633) @@ -0,0 +1,110 @@ +package com.forgon.disinfectsystem.datasynchronization.dao.qysfybjy; + +import java.util.HashMap; +import java.util.Map; + +/** + * 清远市妇幼保健院接口相关常量 + * @author zhoupeimian + * @since 2020-03-09 + */ +public class DatasyncConstant { + /** + * http接口地址 + * 测试环境:http://172.26.0.98:10019/EaiServer + * 正式环境:http://未知:未知/EaiServer + */ + public final static String HttpServiceAddress = "http://172.26.0.98:10019/EaiServer"; + + /** + * 授权码 + */ + public final static String AccessKey = "BDB4A993948CEC58CABEB1A98B85F3E497265555019C18A03742A52CAD228F26B7CEF2E4C1C8C6"; + + /** + * 数据机构id-清远市妇幼保健院 + */ + public final static String DataOrgId = "44180103"; + + /** + * 信息系统id-消毒供应质量追溯管理系统 + */ + public final static String DataSysId = "0013"; + + /** + * 接口方法名:住院病人(作为输入参数) + */ + public final static String MethodName_HospitalNumber = "CSSD_HospitalNumber"; + + /** + * 接口方法名:门诊病人(作为输入参数) + */ + public final static String MethodName_ClinicNumber = "CSSD_ClinicNumber"; + + /** + * 接口方法名:科室(作为输入参数) + */ + public final static String MethodName_Department = "CSSD_Department"; + + /** + * 接口方法名:人员(作为输入参数) + */ + public final static String MethodName_User = "CSSD_User"; + + + /** + * 接口返回成功的代码 + */ + public final static String RESULT_OK = "0"; + + /** + * 病人性别,1代表男 + */ + public final static String PATEINTSEXCODE_MALE = "1"; + + /** + * 病人性别,1代表男 + */ + public final static String PATEINTSEXNAME_MALE = "男"; + + /** + * 病人性别,2代表女 + */ + public final static String PATEINTSEXCODE_FEMALE = "2"; + + /** + * 病人性别,2代表女 + */ + public final static String PATEINTSEXNAME_FEMALE = "女"; + + /** + * 病人性别,2代表女 + */ + public final static String PATEINTSEXCODE_UNKNOW = "0"; + + /** + * 病人性别,0代表未知的性别 + */ + public final static String PATEINTSEXNAME_UNKNOW = "未知的性别"; + + /** + * 病人性别,0代表未知的性别 + */ + public final static String PATEINTSEXCODE_UNCONFIRM = "9"; + + /** + * 病人性别,9代表未说明的性别 + */ + public final static String PATEINTSEXNAME_UNCONFIRM = "未说明的性别"; + + public static Map patientSetMap = null; + + static { + patientSetMap = new HashMap(); + patientSetMap.put(PATEINTSEXCODE_MALE, PATEINTSEXNAME_MALE); + patientSetMap.put(PATEINTSEXCODE_FEMALE, PATEINTSEXNAME_FEMALE); + patientSetMap.put(PATEINTSEXCODE_UNKNOW, PATEINTSEXNAME_UNKNOW); + patientSetMap.put(PATEINTSEXCODE_UNCONFIRM, PATEINTSEXNAME_UNCONFIRM); + } + +} Index: ssts-web/src/main/resources/spring/projects/qysfybjy/HIS.xml =================================================================== diff -u -r27599 -r27633 --- ssts-web/src/main/resources/spring/projects/qysfybjy/HIS.xml (.../HIS.xml) (revision 27599) +++ ssts-web/src/main/resources/spring/projects/qysfybjy/HIS.xml (.../HIS.xml) (revision 27633) @@ -48,7 +48,7 @@ --> - + - + - + + + + + + + + +