|
@ -1082,6 +1082,80 @@ public class EntranceService {
|
|
|
return hospitalDeptMappingDOS;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 科室字典更新同步
|
|
|
*
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
// @org.springframework.transaction.annotation.Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean updateMS02001(boolean demoFlag) throws Exception {
|
|
|
String fid = MS02001;
|
|
|
String resp = "";
|
|
|
if (demoFlag) {
|
|
|
resp = getJosnFileResullt(fid);
|
|
|
} else {
|
|
|
StringBuffer sbs = new StringBuffer();
|
|
|
//AccessControl :用户、密码、服务id
|
|
|
sbs.append("<ESBEntry><AccessControl><Fid>" + fid + "</Fid><UserName>" + mqUser + "</UserName><Password>" + mqPwd + "</Password></AccessControl>");
|
|
|
//MessageHeader :固定值 消费方系统编号 S60,提供方系统编号 S01
|
|
|
sbs.append("<MessageHeader><Fid>" + fid + "</Fid><MsgDate>" + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_HH_MM_SS) + "</MsgDate><SourceSysCode>" + sourceSysCode + "</SourceSysCode><TargetSysCode>" + targetSysCode + "</TargetSysCode></MessageHeader>");
|
|
|
//查询信息拼接
|
|
|
sbs.append("<MsgInfo><endNum>1000</endNum><Msg></Msg>");
|
|
|
sbs.append("<startNum>1</startNum></MsgInfo></ESBEntry>");
|
|
|
resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
|
|
|
resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
|
|
|
}
|
|
|
JSONArray jsonArray = ConvertUtil.convertListEnvelopInBody(resp);
|
|
|
List<DictHospitalDeptDO> hospitalDeptMappingDOS = new ArrayList<>();
|
|
|
DictHospitalDeptDO hdmDo;
|
|
|
String orgCode = "350211A1002";
|
|
|
Map<String, String> orgCodeMap = new HashMap<>();
|
|
|
//6总部7金榜8夏禾
|
|
|
orgCodeMap.put("6", orgCode);
|
|
|
orgCodeMap.put("7", "");
|
|
|
orgCodeMap.put("8", "");
|
|
|
|
|
|
List<DictHospitalDeptDO> oriDict = dictHospitalDeptDao.findByOrgCode(orgCode);
|
|
|
|
|
|
for (Object object : jsonArray) {
|
|
|
hdmDo = new DictHospitalDeptDO();
|
|
|
net.sf.json.JSONObject jsonObjectBody = (net.sf.json.JSONObject) object;
|
|
|
String deptCode = null == jsonObjectBody.get("Dept_Code") ? "" : jsonObjectBody.get("Dept_Code").toString();
|
|
|
|
|
|
if(!checkDeptExist(oriDict,deptCode)){
|
|
|
String deptTypeCode = null == jsonObjectBody.get("Dept_Type_Code") ? "" : jsonObjectBody.get("Dept_Type_Code").toString();
|
|
|
if (StringUtils.isNotBlank(orgCodeMap.get(deptTypeCode))) {
|
|
|
hdmDo.setOrgCode(orgCode);
|
|
|
hdmDo.setCode(null == jsonObjectBody.get("Dept_Code") ? "" : jsonObjectBody.get("Dept_Code").toString());
|
|
|
hdmDo.setName(null == jsonObjectBody.get("Dept_Name") ? "" : jsonObjectBody.get("Dept_Name").toString());
|
|
|
hdmDo.setDeptTypeCode(deptTypeCode);
|
|
|
hdmDo.setFatherDeptCode(null == jsonObjectBody.get("Father_Dept_Code") ? "" : jsonObjectBody.get("Father_Dept_Code").toString());
|
|
|
hdmDo.setFatherDeptName(null == jsonObjectBody.get("Father_Dept_Name") ? "" : jsonObjectBody.get("Father_Dept_Name").toString());
|
|
|
hdmDo.setCreateTime(new Date());
|
|
|
hdmDo.setDeptType(null == jsonObjectBody.get("Dept_Type") ? "" : jsonObjectBody.get("Dept_Type").toString());
|
|
|
hdmDo.setDeptPosition(null == jsonObjectBody.get("Dept_Position") ? "" : jsonObjectBody.get("Dept_Position").toString());
|
|
|
hdmDo.setConsultDeptFlag("0");
|
|
|
hospitalDeptMappingDOS.add(hdmDo);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if(hospitalDeptMappingDOS!=null&&hospitalDeptMappingDOS.size()>0){
|
|
|
logger.info("dept:"+hospitalDeptMappingDOS.size());
|
|
|
}
|
|
|
dictHospitalDeptDao.save(hospitalDeptMappingDOS);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
public Boolean checkDeptExist(List<DictHospitalDeptDO> oriDict,String code){
|
|
|
for(DictHospitalDeptDO dept:oriDict){
|
|
|
if(code.equals(dept.getCode())){
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 号别字典
|
|
|
*
|