| 
					
				 | 
			
			
				@ -2152,4 +2152,134 @@ public class EntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return ConvertUtil.convertListEnvelopInBodyRow(resp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 同步医生信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param demoFlag 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public int sysDoctorInfo(String docIdCard,boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int i = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String fid = "MS02003"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resp = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (demoFlag) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resp = getJosnFileResullt(fid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resp = MqSdkUtil.xml2jsonArrayRootRowMS02003(resp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 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>10000</endNum><Msg></Msg><startNum>1</startNum></MsgInfo></ESBEntry>"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resp = MqSdkUtil.xml2jsonArrayRootRowMS02003(resp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        net.sf.json.JSONObject jsonObject= net.sf.json.JSONObject.fromObject(resp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(null!=jsonObjectMgsInfo){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (Object object : jsonObjectMgsInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    net.sf.json.JSONObject jsonArraySub = (net.sf.json.JSONObject) object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    jsonObjectMgsInfo=(JSONArray)jsonArraySub.get("body"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(jsonObjectMgsInfo instanceof JSONArray){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        for (Object objectSub : jsonObjectMgsInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            net.sf.json.JSONObject jsonObjectBody = (net.sf.json.JSONObject) objectSub; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            String doctorCode = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            String doctorName = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            if (null != jsonObjectBody) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                //获取中山医院的医生 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                String winNo = "6"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                doctorCode = null == jsonObjectBody.get("Emp_Code") ? "" : jsonObjectBody.get("Emp_Code").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                //根据医生及分部,获取医生号别 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                net.sf.json.JSONArray jsonArrayCharge = BS55010(winNo, doctorCode, null, false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                String chareType=null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                if(null!=jsonArrayCharge){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    for (Object objectCharge : jsonArrayCharge) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        net.sf.json.JSONObject jsonObjectBodyCharge = (net.sf.json.JSONObject) objectCharge; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        if (null != jsonObjectBodyCharge) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            chareType = null == jsonObjectBodyCharge.get("charge_type") ? null : jsonObjectBodyCharge.get("charge_type").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                //保存医生信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                BaseDoctorDO baseDoctorDO = new BaseDoctorDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                String idCard = null == jsonObjectBody.get("Card_Id") ? "" : jsonObjectBody.get("Card_Id").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                //同步单条信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                if(docIdCard.equals(idCard)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    baseDoctorDO.setIdcard(idCard); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    baseDoctorDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idCard)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    baseDoctorDO.setSex(Integer.valueOf(IdCardUtil.getSexForIdcard(idCard))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    baseDoctorDO.setLocked(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    baseDoctorDO.setEnabled(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    //拼音码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    baseDoctorDO.setSpell(null == jsonObjectBody.get("PinYin_Code") ? "" : jsonObjectBody.get("PinYin_Code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    String disableFlag = null == jsonObjectBody.get("Disable_Flag") ? "" : jsonObjectBody.get("Disable_Flag").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    //互联网医院:1停用,0使用  转 i健康:1正常,0作废 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    baseDoctorDO.setDel("1".equals(disableFlag) ? "0" : "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    //姓名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    doctorName = null == jsonObjectBody.get("Emp_Name") ? "" : jsonObjectBody.get("Emp_Name").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    //号别 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    baseDoctorDO.setChargeType(chareType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    if (StringUtils.isNotBlank(idCard)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        baseDoctorDO.setSalt(PwdUtil.randomString(5)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex(baseDoctorDO.getIdcard().substring(baseDoctorDO.getIdcard().length()-6) + "{" + baseDoctorDO.getSalt() + "}")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            logger.error(e.getMessage()+"docotr="+doctorCode+";idcard="+baseDoctorDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex("123456"+ "{" + baseDoctorDO.getSalt() + "}")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    baseDoctorDO.setName(doctorName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    baseDoctorDO.setIsFamous(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    baseDoctorDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    baseDoctorDO.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    baseDoctorDO.setMobile("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    baseDoctorDO = baseDoctorDao.save(baseDoctorDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    //根据医生和机构判断数据是否存在,若不存在则在mapping中追加记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    List<DoctorMappingDO> doctorMappingDOS = doctorMappingDao.findByDoctorAndOrgCode(baseDoctorDO.getId(), "350211A1002"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    if (!(null != doctorMappingDOS && doctorMappingDOS.size() > 0)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        DoctorMappingDO doctorMappingDO = new DoctorMappingDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        doctorMappingDO.setDoctor(baseDoctorDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        doctorMappingDO.setDoctorName(doctorName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        doctorMappingDO.setMappingCode(doctorCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        doctorMappingDO.setMappingName(doctorName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        doctorMappingDO.setOrgCode("350211A1002"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        doctorMappingDO.setOrgName("厦门大学附属中山医院"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        doctorMappingDao.save(doctorMappingDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    // 用医生和机构id、部门判断数据是否存在,若不存在则保存医生机构关联关系 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    String deptCode = null == jsonObjectBody.get("Dept_Code") ? "" : jsonObjectBody.get("Dept_Code").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    List<BaseDoctorHospitalDO> baseDoctorHospitalDOS = baseDoctorHospitalDao.findByOrgCodeAndDeptCodeAndDoctorCode("350211A1002", deptCode, baseDoctorDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    if (!(null != baseDoctorHospitalDOS && baseDoctorHospitalDOS.size() > 0)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        baseDoctorHospitalDO.setOrgCode("350211A1002"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        baseDoctorHospitalDO.setOrgName("厦门大学附属中山医院"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        baseDoctorHospitalDO.setDeptCode(deptCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        //根据机构编码获取机构名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        List<DictHospitalDeptDO>  dictHospitalDeptDOS=  dictHospitalDeptDao.findByOrgCodeAndCode("350211A1002",deptCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        if(null!=dictHospitalDeptDOS&&dictHospitalDeptDOS.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            DictHospitalDeptDO dictHospitalDeptDO=dictHospitalDeptDOS.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            baseDoctorHospitalDO.setDeptName(dictHospitalDeptDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        baseDoctorHospitalDO.setDel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        baseDoctorHospitalDao.save(baseDoctorHospitalDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    i++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return i; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |