Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/DatasyncConstant.java =================================================================== diff -u --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/DatasyncConstant.java (revision 0) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/DatasyncConstant.java (revision 16536) @@ -0,0 +1,43 @@ +package com.forgon.disinfectsystem.datasynchronization.dao.dysrmyy; + +/** + * 德阳市 人民医院接口相关常量 + * @author shuyongfu + * + */ +public class DatasyncConstant { + /** + * TOKEN(明文)—令牌 + */ + public static String token = "6988C07045FFA26D55986FC9DFFB593D"; + + /** + * 密钥 + */ + public static String key = "3D5CF601B7318EA6"; + /** + * Webservice地址 + */ + public static String WebserviceAddress = "http://192.168.28.10:8086/ExternalServices/ZL_InformationService.asmx"; + + /** + * 按诊疗号查询病人信息的接口方法名(作为输入参数) + */ + public static String MethodName_CSSD_ClinicNumber = "ZLTHIRD.CSSD.CLINIC"; + + /** + * 按住院号查询病人信息的接口方法名(作为输入参数) + */ + public static String MethodName_CSSD_HospitalNumber = "ZLTHIRD.CSSD.HOSPITAL"; + + /** + * 科室信息的接口方法名(作为输入参数) + */ + public static String MethodName_CSSD_Department = "ZLTHIRD.CSSD.DEPARTMENT"; + + /** + * 人员信息的接口方法名(作为输入参数) + */ + public static String MethodName_CSSD_User = "ZLTHIRD.CSSD.USER"; + +} Index: forgon-tools/src/main/java/com/forgon/tools/json/AESUtil.java =================================================================== diff -u --- forgon-tools/src/main/java/com/forgon/tools/json/AESUtil.java (revision 0) +++ forgon-tools/src/main/java/com/forgon/tools/json/AESUtil.java (revision 16536) @@ -0,0 +1,87 @@ +package com.forgon.tools.json; + +import javax.crypto.Cipher; +import javax.crypto.spec.SecretKeySpec; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang.StringUtils; + +import com.forgon.tools.Constants; + +/** + * aes加密算法类(用于德阳市人民医院调用his接口传参与返回值加密) + * @author shuyongfu + * @since 2016-12-321 + */ +public class AESUtil { + + /** + * 根据密钥对内容加密(AES的加密算法、ECB模式、PKCS5Padding补码方式,最后再进行base64编码) + * @param plaintext 明文 + * @param key 加密密钥 + * @return + * @throws Exception + */ + public static String Encrypt(String plaintext, String key) { + if (StringUtils.isBlank(plaintext)) { + return null; + } + if (StringUtils.isBlank(key)) { + return null; + } + // 判断Key是否为16位 + if (key.length() != 16) { + return null; + } + byte[] raw; + try { + raw = key.getBytes(Constants.CHARSET_utf8); + SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");// "算法/模式/补码方式" + cipher.init(Cipher.ENCRYPT_MODE, skeySpec); + byte[] encrypted = cipher.doFinal(plaintext.getBytes(Constants.CHARSET_utf8)); + return new Base64().encodeToString(encrypted);// 此处使用BASE64做转码功能,同时能起到2次加密的作用。 + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } + + /** + * 根据密钥对密文进行解密(AES的加密算法、ECB模式、PKCS5Padding补码方式,先进行base64解码) + * @param ciphertext 密文 + * @param key 解密密钥 + * @return + * @throws Exception + */ + public static String Decrypt(String ciphertext, String key) { + try { + if (StringUtils.isBlank(ciphertext)) { + return null; + } + if (StringUtils.isBlank(key)) { + return null; + } + // 判断Key是否为16位 + if (key.length() != 16) { + return null; + } + byte[] raw = key.getBytes(Constants.CHARSET_utf8); + SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); + cipher.init(Cipher.DECRYPT_MODE, skeySpec); + byte[] encrypted1 = new Base64().decode(ciphertext);// 先用base64解密 + try { + byte[] original = cipher.doFinal(encrypted1); + String originalString = new String(original, Constants.CHARSET_utf8); + return originalString; + } catch (Exception e) { + return null; + } + } catch (Exception ex) { + return null; + } + } + +} Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/SyncOrgUnitAndUserDaoImpl.java =================================================================== diff -u --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/SyncOrgUnitAndUserDaoImpl.java (revision 0) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/SyncOrgUnitAndUserDaoImpl.java (revision 16536) @@ -0,0 +1,230 @@ +package com.forgon.disinfectsystem.datasynchronization.dao.dysrmyy; + +import java.util.ArrayList; +import java.util.List; + +import net.sf.json.JSON; +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 shuyongfu + * + */ +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 = CssdUtils.callWebService(DatasyncConstant.WebserviceAddress, + WebServiceClientHelper.buildInputXml(DatasyncConstant.MethodName_CSSD_User, ""), Constants.CHARSET_GBK); + JSON json = WebServiceClientHelper.patientXml2Json(xml); + if(json != null){ + if(json instanceof JSONObject){ + JSONObject resultJsonObject = (JSONObject)json; + Object dataJson = resultJsonObject.opt("DATA"); + if(dataJson instanceof JSONObject){ + JSONObject dataJsonObject = (JSONObject)dataJson; + Object nameJson = dataJsonObject.opt("NAME"); + Object codingJson = dataJsonObject.opt("CODING"); + Object orgUnitCodingJson = dataJsonObject.opt("ORGUNITCODING"); + if(nameJson instanceof String){ + UserVo userVo = new UserVo(); + userVo.setCoding((String)nameJson); + userVo.setName((String)codingJson); + userVo.setOrgUnitCoding((String)orgUnitCodingJson); + if(StringUtils.equals(userVo.getCoding(), userVo.getOrgUnitCoding())){ + userVo.setOrgUnitCoding(null); + } + userVoList.add(userVo); + } else if(nameJson instanceof JSONArray) { + JSONArray nameJsonArray = (JSONArray)nameJson; + JSONArray codingJsonArray = (JSONArray)codingJson; + JSONArray orgUnitCodingJsonArray = (JSONArray)orgUnitCodingJson; + for (int i = 0;nameJsonArray.size() > 0 && i < nameJsonArray.size(); i++) { + String name = nameJsonArray.optString(i); + String coding = codingJsonArray.optString(i); + String orgUnitCoding = orgUnitCodingJsonArray.optString(i); + UserVo userVo = new UserVo(); + userVo.setCoding(coding); + userVo.setName(name); + userVo.setOrgUnitCoding(orgUnitCoding); + if(StringUtils.equals(userVo.getCoding(), userVo.getOrgUnitCoding())){ + userVo.setOrgUnitCoding(null); + } + userVoList.add(userVo); + } + } else { + //暂不处理 + } + }else{ + //暂不处理 + } + }else if(json instanceof JSONArray){ + JSONArray jsonArray = (JSONArray)json; + for (int i = 0;jsonArray.size() > 0 && i < jsonArray.size(); i++) { + JSONObject dataJsonObject = jsonArray.optJSONObject(i); + Object nameJson = dataJsonObject.opt("NAME"); + Object codingJson = dataJsonObject.opt("CODING"); + Object orgUnitCodingJson = dataJsonObject.opt("ORGUNITCODING"); + if(nameJson instanceof String){ + UserVo userVo = new UserVo(); + userVo.setCoding((String)codingJson); + userVo.setName((String)nameJson); + userVo.setOrgUnitCoding((String)orgUnitCodingJson); + if(StringUtils.equals(userVo.getCoding(), userVo.getOrgUnitCoding())){ + userVo.setOrgUnitCoding(null); + } + userVoList.add(userVo); + } else if(nameJson instanceof JSONArray) { + JSONArray nameJsonArray = (JSONArray)nameJson; + JSONArray codingJsonArray = (JSONArray)codingJson; + JSONArray orgUnitCodingJsonArray = (JSONArray)orgUnitCodingJson; + for (int j = 0;nameJsonArray.size() > 0 && j < nameJsonArray.size(); j++) { + String name = nameJsonArray.optString(j); + String coding = codingJsonArray.optString(j); + String orgUnitCoding = orgUnitCodingJsonArray.optString(j); + UserVo userVo = new UserVo(); + userVo.setCoding(name); + userVo.setName(coding); + userVo.setOrgUnitCoding(orgUnitCoding); + if(StringUtils.equals(userVo.getCoding(), userVo.getOrgUnitCoding())){ + userVo.setOrgUnitCoding(null); + } + userVoList.add(userVo); + } + } else { + //暂不处理 + } + } + } + userVoArray = new UserVo[userVoList.size()]; + userVoList.toArray(userVoArray); + } + }catch(Exception e){ + logger.error("查询his人员信息失败:" + e); + } + + return userVoArray; + } + + /** + * 查询his系统科室信息 + */ + @Override + public OrgUnitVo[] getAllOrgUnit() { + OrgUnitVo[] orgUnitVoArray = null; + List orgUnitVoList = new ArrayList(); + try{ + String xml = CssdUtils.callWebService(DatasyncConstant.WebserviceAddress, + WebServiceClientHelper.buildInputXml(DatasyncConstant.MethodName_CSSD_Department, ""), Constants.CHARSET_GBK); + JSON json = WebServiceClientHelper.orgXml2Json(xml); + if(json != null){ + if(json instanceof JSONObject){ + JSONObject resultJsonObject = (JSONObject)json; + Object dataJson = resultJsonObject.opt("DATA"); + if(dataJson instanceof JSONObject){ + JSONObject dataJsonObject = (JSONObject)dataJson; + Object nameJson = dataJsonObject.opt("NAME"); + Object codingJson = dataJsonObject.opt("CODING"); + Object parentCodingJson = dataJsonObject.opt("PARENTCODING"); + if(nameJson instanceof String){ + OrgUnitVo orgVo = new OrgUnitVo(); + orgVo.setCoding((String)nameJson); + orgVo.setName((String)codingJson); + orgVo.setParentCoding((String)parentCodingJson); + if(StringUtils.equals(orgVo.getCoding(), orgVo.getParentCoding())){ + orgVo.setParentCoding(null); + } + orgUnitVoList.add(orgVo); + } else if(nameJson instanceof JSONArray) { + JSONArray nameJsonArray = (JSONArray)nameJson; + JSONArray codingJsonArray = (JSONArray)codingJson; + JSONArray parentCodingJsonArray = (JSONArray)parentCodingJson; + for (int i = 0;nameJsonArray.size() > 0 && i < nameJsonArray.size(); i++) { + String name = nameJsonArray.optString(i); + String coding = codingJsonArray.optString(i); + String parentCoding = parentCodingJsonArray.optString(i); + OrgUnitVo orgVo = new OrgUnitVo(); + orgVo.setCoding(name); + orgVo.setName(coding); + orgVo.setParentCoding(parentCoding); + if(StringUtils.equals(orgVo.getCoding(), orgVo.getParentCoding())){ + orgVo.setParentCoding(null); + } + orgUnitVoList.add(orgVo); + } + } else { + //暂不处理 + } + }else{ + //暂不处理 + } + }else if(json instanceof JSONArray){ + JSONArray jsonArray = (JSONArray)json; + for (int i = 0;jsonArray.size() > 0 && i < jsonArray.size(); i++) { + JSONObject dataJsonObject = jsonArray.optJSONObject(i); + Object nameJson = dataJsonObject.opt("NAME"); + Object codingJson = dataJsonObject.opt("CODING"); + Object parentCodingJson = dataJsonObject.opt("PARENTCODING"); + if(nameJson instanceof String){ + OrgUnitVo orgVo = new OrgUnitVo(); + orgVo.setCoding((String)nameJson); + orgVo.setName((String)codingJson); + orgVo.setParentCoding((String)parentCodingJson); + if(StringUtils.equals(orgVo.getCoding(), orgVo.getParentCoding())){ + orgVo.setParentCoding(null); + } + orgUnitVoList.add(orgVo); + } else if(nameJson instanceof JSONArray) { + JSONArray nameJsonArray = (JSONArray)nameJson; + JSONArray codingJsonArray = (JSONArray)codingJson; + JSONArray parentCodingJsonArray = (JSONArray)parentCodingJson; + for (int j = 0;nameJsonArray.size() > 0 && j < nameJsonArray.size(); j++) { + String name = nameJsonArray.optString(j); + String coding = codingJsonArray.optString(j); + String parentCoding = parentCodingJsonArray.optString(j); + OrgUnitVo orgVo = new OrgUnitVo(); + orgVo.setCoding(name); + orgVo.setName(coding); + orgVo.setParentCoding(parentCoding); + if(StringUtils.equals(orgVo.getCoding(), orgVo.getParentCoding())){ + orgVo.setParentCoding(null); + } + orgUnitVoList.add(orgVo); + } + } else { + //暂不处理 + } + } + } + if(orgUnitVoList.size() > 0){ + orgUnitVoArray = new OrgUnitVo[orgUnitVoList.size()]; + orgUnitVoList.toArray(orgUnitVoArray); + } + } + }catch(Exception e){ + logger.error("查询his科室信息失败" + e); + } + + return orgUnitVoArray; + } + +} Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/FindPatientInfoByHospitalNumDaoImpl.java =================================================================== diff -u --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/FindPatientInfoByHospitalNumDaoImpl.java (revision 0) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/FindPatientInfoByHospitalNumDaoImpl.java (revision 16536) @@ -0,0 +1,87 @@ +package com.forgon.disinfectsystem.datasynchronization.dao.dysrmyy; + +import net.sf.json.JSON; +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; + +/** + * 根据住院号查询病人信息(东莞东华医院) + * @author shuyongfu + * + */ +public class FindPatientInfoByHospitalNumDaoImpl implements + FindPatientInfoByHospitalNumDao { + + Logger logger = Logger.getLogger(FindPatientInfoByHospitalNumDaoImpl.class); + + /** + * 根据住院号查询病人信息 + */ + @Override + public PatientInfoVO[] findPatientInfoByHospitalNum(String hospitalNum) { + PatientInfoVO[] patientInfoVOArray = null; + try{ + //xml格式: + String xml = CssdUtils.callWebService(DatasyncConstant.WebserviceAddress, + WebServiceClientHelper.buildInputXml(DatasyncConstant.MethodName_CSSD_HospitalNumber, hospitalNum), Constants.CHARSET_UTF8); + JSON patientJson = WebServiceClientHelper.patientXml2Json(xml); + if(patientJson != null){ + JSONObject patientInfo = null; + if(patientJson instanceof JSONObject){ + patientInfo = (JSONObject)patientJson; + }else if(patientJson instanceof JSONArray){ + //拿最近的一次性诊疗记录 + JSONArray jsonArray = (JSONArray)patientJson; + patientInfo = jsonArray.size() > 0 ? jsonArray.optJSONObject(0) : new JSONObject(); + } + Object tNumber = patientInfo.opt("hospitalNumber".toUpperCase()); + Object patientName = patientInfo.opt("patientName".toUpperCase()); + Object patientAge = patientInfo.opt("patientAge".toUpperCase()); + Object patientSex = patientInfo.opt("patientSex".toUpperCase()); + Object patientIDCard = patientInfo.opt("patientIDCard".toUpperCase()); + Object doctorName = patientInfo.opt("doctorName".toUpperCase()); + Object operation = patientInfo.opt("operation".toUpperCase()); + Object patientArea = patientInfo.opt("patientArea".toUpperCase()); + Object opRoomId = patientInfo.opt("op_room_id".toUpperCase()); + Object bedNumber = patientInfo.opt("bedNumber".toUpperCase()); + Object roomNumber = patientInfo.opt("roomNumber".toUpperCase()); + Object remark = patientInfo.opt("remark".toUpperCase()); + + Object washHandNurse = patientInfo.opt("washHandNurse".toUpperCase()); + Object circuitNurse = patientInfo.opt("circuitNurse".toUpperCase()); + + PatientInfoVO vo = new PatientInfoVO(); + vo.setPatientNumber(tNumber instanceof String ? (String)tNumber : ""); + vo.setHospitalNumber(vo.getPatientNumber()); + vo.setType(PatientInfoVO.TYPE_HOSPITAL); + vo.setPatientName(patientName instanceof String ? (String)patientName : ""); + vo.setPatientAge(patientAge instanceof String ? (String)patientAge : ""); + vo.setPatientSex(patientSex instanceof String ? (String)patientSex : ""); + vo.setPatientIDCard(patientIDCard instanceof String ? (String)patientIDCard : ""); + vo.setDoctorName(doctorName instanceof String ? (String)doctorName : ""); + vo.setOperation(operation instanceof String ? (String)operation : ""); + vo.setPatientArea(patientArea instanceof String ? (String)patientArea : ""); + vo.setOpRoomId(opRoomId instanceof String ? (String)opRoomId : ""); + vo.setBedNumber(bedNumber instanceof String ? (String)bedNumber : ""); + vo.setRoomNumber(roomNumber instanceof String ? (String)roomNumber : ""); + vo.setRemark(remark instanceof String ? (String)remark : ""); + + vo.setWashHandNurse(washHandNurse instanceof String ? (String)washHandNurse : ""); + vo.setCircuitNurse(circuitNurse instanceof String ? (String)circuitNurse : ""); + patientInfoVOArray = new PatientInfoVO[] { vo }; + } + }catch(Exception e){ + logger.error("根据住院号查询病人信息失败" + e); + } + + return patientInfoVOArray; + } + +} Index: ssts-web/src/main/resources/spring/projects/dysyy/applicationContext-his-gzfdzl.xml =================================================================== diff -u -r14642 -r16536 --- ssts-web/src/main/resources/spring/projects/dysyy/applicationContext-his-gzfdzl.xml (.../applicationContext-his-gzfdzl.xml) (revision 14642) +++ ssts-web/src/main/resources/spring/projects/dysyy/applicationContext-his-gzfdzl.xml (.../applicationContext-his.xml) (revision 16536) @@ -18,7 +18,7 @@ class="com.forgon.disinfectsystem.datasynchronization.service.DataSynchronizationManagerImpl" > - + @@ -41,49 +41,12 @@ class="com.forgon.disinfectsystem.datasynchronization.dwr.DataSynchronizationTableManager"> - - - - - + - - - - - - - - - - - - + - - - - - - - - - + - - - - - - - - - - - \ No newline at end of file Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/WebServiceClientHelper.java =================================================================== diff -u --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/WebServiceClientHelper.java (revision 0) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/WebServiceClientHelper.java (revision 16536) @@ -0,0 +1,184 @@ +package com.forgon.disinfectsystem.datasynchronization.dao.dysrmyy; + + +import net.sf.json.JSON; +import net.sf.json.JSONObject; +import net.sf.json.xml.XMLSerializer; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; + +import com.forgon.tools.json.AESUtil; + +/** + * 德阳市 人民医院webservice帮助类 + * @author shuyongfu + * @since 2016-12-31 + */ +public class WebServiceClientHelper { + + private final static Logger logger = Logger.getLogger(WebServiceClientHelper.class); + + /** + * 返回成功与失败 + */ + public static String STATE_SUCC = "T"; + public static String STATE_FAIL = "F"; + + /** + * 构造接口输入参数 + * @param methodName + * @param arg + * @return + */ + public static String buildInputXml(String methodName , String... arg){ + String inputXml = ""; + //令牌token的密文 + String tokenCiphertext = AESUtil.Encrypt(DatasyncConstant.token, DatasyncConstant.key); + if (DatasyncConstant.MethodName_CSSD_ClinicNumber.equals(methodName)) { + //请求参数的密文 + String paramCiphertext = AESUtil.Encrypt(""+ arg[0] +"", DatasyncConstant.key); + inputXml = "" + + "" + + "" + + "" + + "" + + "" + + "" + + ""; + + } else if (DatasyncConstant.MethodName_CSSD_HospitalNumber.equals(methodName)) { + //请求参数的密文 + String paramCiphertext = AESUtil.Encrypt(""+ arg[0] +"", DatasyncConstant.key); + inputXml = "" + + "" + + "" + + "" + + "" + + "" + + "" + + ""; + } else if (DatasyncConstant.MethodName_CSSD_Department.equals(methodName) + || DatasyncConstant.MethodName_CSSD_User.equals(methodName)) { + inputXml = "" + + "" + + "" + + "" + + "" + + "" + + "" + + ""; + } else { + throw new RuntimeException("不存在此方法:" + methodName); + } + return inputXml; + } + + /** + * xml格式转json(入库单及明细、退库单及明细等) + * @param xml + * @return + */ + public static JSON xml2JsonCommon(String xml){ + try { + //转json + if (StringUtils.isNotBlank(xml)) { + xml = xml.replace("", ""); + XMLSerializer xmlSerializer = new XMLSerializer(); + JSON json = xmlSerializer.read(xml); + logger.debug("json=" + json); + return json; + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("xml转json失败" + e); + } + return null; + } + + /** + * 用户的xml格式转json + * @param xml + * @return {"STATE":"T","DATAPARAM":"NuAzQxdUij+Ita4HosOVCA=="} + */ + public static JSON userXml2Json(String xml){ + try { + //转json + if (StringUtils.isNotBlank(xml)) { + xml = xml.replace("", ""); + XMLSerializer xmlSerializer = new XMLSerializer(); + JSONObject json = (JSONObject)xmlSerializer.read(xml); + logger.debug("用户信息json=" + json); + if(WebServiceClientHelper.STATE_SUCC.equals(json.optString("STATE"))){ + String dataXmlList = AESUtil.Decrypt(json.optString("DATAPARAM"), DatasyncConstant.key); + JSON userJson = xmlSerializer.read(dataXmlList); + return userJson; + }else{ + throw new RuntimeException("错误码=" + json.optString("ERROR_ERRCODE") + ",错误信息=" + json.optString("ERROR_MSG")); + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("用户信息xml转json失败" + e); + } + return null; + } + + /** + * 科室的xml格式转json + * @param xml + * @return {"STATE":"T","DATAPARAM":"NuAzQxdUij+Ita4HosOVCA=="} + */ + public static JSON orgXml2Json(String xml){ + try { + //转json + if (StringUtils.isNotBlank(xml)) { + xml = xml.replace("", ""); + XMLSerializer xmlSerializer = new XMLSerializer(); + JSONObject json = (JSONObject)xmlSerializer.read(xml); + logger.debug("科室信息json=" + json); + if(WebServiceClientHelper.STATE_SUCC.equals(json.optString("STATE"))){ + String dataXmlList = AESUtil.Decrypt(json.optString("DATAPARAM"), DatasyncConstant.key); + JSON orgJson = xmlSerializer.read(dataXmlList); + return orgJson; + }else{ + throw new RuntimeException("错误码=" + json.optString("ERROR_ERRCODE") + ",错误信息=" + json.optString("ERROR_MSG")); + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("科室信息xml转json失败" + e); + } + return null; + } + + /** + * 病人的xml格式转json + * @param xml + * @return [{"STATE":"T","DATAPARAM":"NuAzQxdUij+Ita4HosOVCA=="}] + */ + public static JSON patientXml2Json(String xml){ + try { + //转json + if (StringUtils.isNotBlank(xml)) { + xml = xml.replace("", ""); + XMLSerializer xmlSerializer = new XMLSerializer(); + //{"STATE":"T","DATAPARAM":"NuAzQxdUij+Ita4HosOVCA=="} + JSONObject json = (JSONObject)xmlSerializer.read(xml); + logger.debug("病人信息json=" + json); + if(WebServiceClientHelper.STATE_SUCC.equals(json.optString("STATE"))){ + // + String dataXmlList = AESUtil.Decrypt(json.optString("DATAPARAM"), DatasyncConstant.key); + JSON patientJson = xmlSerializer.read(dataXmlList); + return patientJson; + }else{ + throw new RuntimeException("错误码=" + json.optString("ERROR_ERRCODE") + ",错误信息=" + json.optString("ERROR_MSG")); + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("病人信息xml转json失败" + e); + } + return null; + } +} Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/SyncSupplierDaoImpl.java =================================================================== diff -u --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/SyncSupplierDaoImpl.java (revision 0) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/SyncSupplierDaoImpl.java (revision 16536) @@ -0,0 +1,7 @@ +package com.forgon.disinfectsystem.datasynchronization.dao.dysrmyy; + +import com.forgon.disinfectsystem.entity.basedatamanager.supplier.Supplier; + +public interface SyncSupplierDaoImpl { + Supplier[] getAllSupplier(); +} Fisheye: Tag 16536 refers to a dead (removed) revision in file `ssts-web/src/main/resources/spring/projects/dysyy/applicationContext-his-gzfdzl.xml'. Fisheye: No comparison available. Pass `N' to diff? Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/FindPatientInfoByTreatmentNumDaoImpl.java =================================================================== diff -u --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/FindPatientInfoByTreatmentNumDaoImpl.java (revision 0) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/dysrmyy/FindPatientInfoByTreatmentNumDaoImpl.java (revision 16536) @@ -0,0 +1,79 @@ +package com.forgon.disinfectsystem.datasynchronization.dao.dysrmyy; + +import net.sf.json.JSON; +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; + +/** + * 根据诊疗号查询病人信息(南山附幼) + * @author shuyongfu + * + */ +public class FindPatientInfoByTreatmentNumDaoImpl implements + FindPatientInfoByTreatmentNumDao { + + Logger logger = Logger.getLogger(FindPatientInfoByTreatmentNumDaoImpl.class); + + /** + * 根据诊疗号查询病人信息 + */ + @Override + public PatientInfoVO[] findPatientInfoByTreatmentNum(String treatmentNum) { + + PatientInfoVO[] patientInfoVOArray = null; + try{ + String xml = CssdUtils.callWebService(DatasyncConstant.WebserviceAddress, + WebServiceClientHelper.buildInputXml(DatasyncConstant.MethodName_CSSD_ClinicNumber, treatmentNum), Constants.CHARSET_UTF8); + JSON patientJson = WebServiceClientHelper.patientXml2Json(xml); + if(patientJson != null){ + JSONObject patientInfo = null; + if(patientJson instanceof JSONObject){ + patientInfo = (JSONObject)patientJson; + }else if(patientJson instanceof JSONArray){ + //拿最近的一次性诊疗记录 + JSONArray jsonArray = (JSONArray)patientJson; + patientInfo = jsonArray.size() > 0 ? jsonArray.optJSONObject(0) : new JSONObject(); + } + Object tNumber = patientInfo.opt("hospitalNumber".toUpperCase()); + Object patientName = patientInfo.opt("patientName".toUpperCase()); + Object patientAge = patientInfo.opt("patientAge".toUpperCase()); + Object patientSex = patientInfo.opt("patientSex".toUpperCase()); + Object patientIDCard = patientInfo.opt("patientIDCard".toUpperCase()); + Object doctorName = patientInfo.opt("doctorName".toUpperCase()); + Object operation = patientInfo.opt("operation".toUpperCase()); + Object patientArea = patientInfo.opt("patientArea".toUpperCase()); + Object bedNumber = patientInfo.opt("bedNumber".toUpperCase()); + Object roomNumber = patientInfo.opt("roomNumber".toUpperCase()); + Object remark = patientInfo.opt("remark".toUpperCase()); + + PatientInfoVO vo = new PatientInfoVO(); + vo.setPatientNumber(tNumber instanceof String ? (String)tNumber : ""); + vo.setClinicNumber(vo.getPatientNumber()); + vo.setType(PatientInfoVO.TYPE_CLINIC); + vo.setPatientName(patientName instanceof String ? (String)patientName : ""); + vo.setPatientAge(patientAge instanceof String ? (String)patientAge : ""); + vo.setPatientSex(patientSex instanceof String ? (String)patientSex : ""); + vo.setPatientIDCard(patientIDCard instanceof String ? (String)patientIDCard : ""); + vo.setDoctorName(doctorName instanceof String ? (String)doctorName : ""); + vo.setOperation(operation instanceof String ? (String)operation : ""); + 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 : ""); + patientInfoVOArray = new PatientInfoVO[] { vo }; + } + }catch(Exception e){ + logger.error("根据诊疗号查询病人信息失败" + e); + } + + return patientInfoVOArray; + } + +} Fisheye: Tag 16536 refers to a dead (removed) revision in file `ssts-web/src/main/resources/config/dysyy/mybatis/SyncOrgUnitAndUserMapper.xml'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 16536 refers to a dead (removed) revision in file `ssts-web/src/main/resources/config/dysyy/mybatis/FindPatientInfoByHospitalNumMapper.xml'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 16536 refers to a dead (removed) revision in file `ssts-web/src/main/resources/config/dysyy/mybatis/FindPatientInfoByTreatmentNumMapper.xml'. Fisheye: No comparison available. Pass `N' to diff?