Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/sznsrmyy/FindPatientInfoByHospitalNumDaoImpl.java =================================================================== diff -u -r19761 -r20016 --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/sznsrmyy/FindPatientInfoByHospitalNumDaoImpl.java (.../FindPatientInfoByHospitalNumDaoImpl.java) (revision 19761) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/sznsrmyy/FindPatientInfoByHospitalNumDaoImpl.java (.../FindPatientInfoByHospitalNumDaoImpl.java) (revision 20016) @@ -57,6 +57,7 @@ Object patientIDCard = patientInfo.opt("patientIDCard"); Object doctorName = patientInfo.opt("doctorName"); Object operation = patientInfo.opt("operation"); + Object opRoomId = patientInfo.opt("opRoomId"); Object operationTime = patientInfo.opt("operationTime");// Object patientArea = patientInfo.opt("patientArea"); Object bedNumber = patientInfo.opt("bedNumber"); @@ -74,6 +75,7 @@ vo.setPatientIDCard(patientIDCard instanceof String ? (String)patientIDCard : ""); vo.setDoctorName(doctorName instanceof String ? (String)doctorName : ""); vo.setOperation(operation instanceof String ? (String)operation : ""); + vo.setOpRoomId(opRoomId instanceof String ? (String)opRoomId : ""); vo.setOperationTime(operationTime instanceof String ? (String)operationTime : ""); vo.setPatientArea(patientArea instanceof String ? (String)patientArea : ""); vo.setBedNumber(bedNumber instanceof String ? (String)bedNumber : ""); Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/sznsrmyy/SyncOrgUnitAndUserDaoImpl.java =================================================================== diff -u -r19640 -r20016 --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/sznsrmyy/SyncOrgUnitAndUserDaoImpl.java (.../SyncOrgUnitAndUserDaoImpl.java) (revision 19640) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/sznsrmyy/SyncOrgUnitAndUserDaoImpl.java (.../SyncOrgUnitAndUserDaoImpl.java) (revision 20016) @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.List; +import net.sf.json.JSON; import net.sf.json.JSONArray; import net.sf.json.JSONObject; @@ -30,105 +31,109 @@ */ @Override public UserVo[] getAllUser() { - /*UserVo[] userVoArray = null; + UserVo[] userVoArray = null; List userVoList = new ArrayList(); try{ - String xml = CssdUtils.callWebService(DatasyncConstant.WebserviceAddress, - WebServiceClientHelper.buildInputXml(DatasyncConstant.MethodName_CSSD_User, ""), Constants.CHARSET_GBK); - JSONObject json = (JSONObject)WebServiceClientHelper.patientXml2Json(xml); - if(json!=null){ - String code = json.optString("Result"); - if(DatasyncConstant.RESULT_OK.equals(code)){ - Object dataTableObj = json.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); + String url = WebServiceClientHelper.buildAccessUrl(DatasyncConstant.MethodName_User); + String xmlString = CssdUtils.sendGetRequest(url , null , Constants.CHARSET_UTF8); + + //由于返回的xml数据格式可能有问题导致解析有点问题,现换成为文本方案截取 + int startIndex = xmlString.indexOf("<" + DatasyncConstant.TAG_NAME_UserResult + ">"); + if(startIndex == -1){ + return null; + } + int endIndex = xmlString.lastIndexOf(""); + if(endIndex == -1 || endIndex < startIndex){ + return null; + } + xmlString = xmlString.substring(startIndex + DatasyncConstant.TAG_NAME_UserResult.length() + 2, endIndex); + if(StringUtils.isNotBlank(xmlString)){ + JSONArray userJsonArray = JSONArray.fromObject(xmlString); + 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 : ""); + //如果人员工号或名称为空,则忽略该条数据 + if(StringUtils.isBlank(userVo.getName()) || StringUtils.isBlank(userVo.getCoding())){ + continue; } - userVoArray = new UserVo[userJsonArray.size()]; - userVoList.toArray(userVoArray); + userVoList.add(userVo); } + userVoArray = new UserVo[userJsonArray.size()]; + userVoList.toArray(userVoArray); }else{ - throw new RuntimeException(json.optString("Error")); + throw new RuntimeException("未找到人员数据..."); } + }else{ + throw new RuntimeException("未找到人员数据..."); } }catch(Exception e){ logger.error("查询his人员信息失败:" + e); } - return userVoArray;*/ - return null; + return userVoArray; } /** * 查询his系统科室信息查询his系统人员信息(等拿到数据返回格式后再开发) */ @Override public OrgUnitVo[] getAllOrgUnit() { - /*OrgUnitVo[] orgUnitVoArray = null; + OrgUnitVo[] orgUnitVoArray = null; List orgUnitVoList = new ArrayList(); try{ - String xml = CssdUtils.callWebService(DatasyncConstant.WebserviceAddress, - WebServiceClientHelper.buildInputXml(DatasyncConstant.MethodName_CSSD_Department, ""), Constants.CHARSET_GBK); - JSONObject json = (JSONObject)WebServiceClientHelper.patientXml2Json(xml); - if(json!=null){ - String code = json.optString("Result"); - if(DatasyncConstant.RESULT_OK.equals(code)){ - Object dataTableObj = json.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("orgUnitCoding"); - 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); + String url = WebServiceClientHelper.buildAccessUrl(DatasyncConstant.MethodName_Department); + String xmlString = CssdUtils.sendGetRequest(url , null , Constants.CHARSET_UTF8); + + //由于返回的xml数据格式可能有问题导致解析有点问题,现换成为文本方案截取 + int startIndex = xmlString.indexOf("<" + DatasyncConstant.TAG_NAME_DepartmentResult + ">"); + if(startIndex == -1){ + return null; + } + int endIndex = xmlString.lastIndexOf(""); + if(endIndex == -1 || endIndex < startIndex){ + return null; + } + xmlString = xmlString.substring(startIndex + DatasyncConstant.TAG_NAME_DepartmentResult.length() + 2, endIndex); + if(StringUtils.isNotBlank(xmlString)){ + JSONArray orgJsonArray = JSONArray.fromObject(xmlString); + 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("orgUnitCoding"); + 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); } - orgUnitVoArray = new OrgUnitVo[orgJsonArray.size()]; - orgUnitVoList.toArray(orgUnitVoArray); + //如果科室编码或名称为空,则忽略该条数据 + if(StringUtils.isBlank(orgVo.getCoding()) || StringUtils.isBlank(orgVo.getName())){ + continue; + } + orgUnitVoList.add(orgVo); } + orgUnitVoArray = new OrgUnitVo[orgJsonArray.size()]; + orgUnitVoList.toArray(orgUnitVoArray); }else{ - throw new RuntimeException(json.optString("Error")); + throw new RuntimeException("未找到科室数据..."); } + }else{ + throw new RuntimeException("未找到科室数据..."); } }catch(Exception e){ logger.error("查询his科室信息失败" + e); } - - return orgUnitVoArray;*/ - return null; + return orgUnitVoArray; } } Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/sznsrmyy/DatasyncConstant.java =================================================================== diff -u -r19640 -r20016 --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/sznsrmyy/DatasyncConstant.java (.../DatasyncConstant.java) (revision 19640) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/sznsrmyy/DatasyncConstant.java (.../DatasyncConstant.java) (revision 20016) @@ -10,41 +10,51 @@ /** * Webservice地址 */ - public static String WebserviceAddress = "http://10.240.232.121/dthealth/web/http%3A//10.240.232.121/dthealth/web/web.GZFJInterface.cls?soap_method="; + public final static String WebserviceAddress = "http://10.240.232.121/dthealth/web/http%3A//10.240.232.121/dthealth/web/web.GZFJInterface.cls?soap_method="; /** * 按诊疗号查询病人信息的接口方法名(作为输入参数) */ - public static String MethodName_ClinicNumber = "ClinicNumber"; + public final static String MethodName_ClinicNumber = "ClinicNumber"; /** * 按住院号查询病人信息的接口方法名(作为输入参数) */ - public static String MethodName_HospitalNumber = "HospitalNumber"; + public final static String MethodName_HospitalNumber = "HospitalNumber"; /** * 科室信息的接口方法名(作为输入参数) */ - public static String MethodName_Department = "Department"; + public final static String MethodName_Department = "Department"; /** * 人员信息的接口方法名(作为输入参数) */ - public static String MethodName_User = "User"; + public final static String MethodName_User = "User"; /** * 住院病人与门诊病人的住院号及诊疗号参数名 */ - public static String PARAMETER_PATIENT_ID = "PatientID"; + public final static String PARAMETER_PATIENT_ID = "PatientID"; /** * 住院病人接口返回的数据节点名 */ - public static String TAG_NAME_HospitalNumberResult = "HospitalNumberResult"; + public final static String TAG_NAME_HospitalNumberResult = "HospitalNumberResult"; /** * 门诊病人接口返回的数据节点名 */ - public static String TAG_NAME_ClinicNumberResult = "ClinicNumberResult"; + public final static String TAG_NAME_ClinicNumberResult = "ClinicNumberResult"; + + /** + * 科室接口返回的数据节点名 + */ + public final static String TAG_NAME_DepartmentResult = "DepartmentResult"; + + /** + * 人员接口返回的数据节点名 + */ + public final static String TAG_NAME_UserResult = "UserResult"; } Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/sznsrmyy/WebServiceClientHelper.java =================================================================== diff -u -r19682 -r20016 --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/sznsrmyy/WebServiceClientHelper.java (.../WebServiceClientHelper.java) (revision 19682) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/sznsrmyy/WebServiceClientHelper.java (.../WebServiceClientHelper.java) (revision 20016) @@ -1,16 +1,7 @@ package com.forgon.disinfectsystem.datasynchronization.dao.sznsrmyy; -import java.io.StringReader; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - import org.apache.log4j.Logger; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; /** * 深圳南山人民医院webservice帮助类