|  | @ -34,6 +34,7 @@ import com.yihu.jw.patient.dao.BasePatientDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.base.BaseRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.iot.IotRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.common.IdCardUtil;
 | 
	
	
		
			
				|  | @ -451,119 +452,26 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String updateYkTDoctor()throws Exception{
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         String url = "http://www.yanketong.com:133/api/doc_jkzl/doctor_list_had_bind_account?hospital_code=sb&page=1";
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |         logger.info("response:"+response);
 | 
	
		
			
				|  |  |         JSONObject rs = JSON.parseObject(response);
 | 
	
		
			
				|  |  |         Integer status = rs.getInteger("code");
 | 
	
		
			
				|  |  |         if(status!=null&&status == 200){
 | 
	
		
			
				|  |  |             JSONObject object = rs.getJSONObject("data");
 | 
	
		
			
				|  |  |             JSONArray array = object.getJSONArray("list");
 | 
	
		
			
				|  |  |             logger.info("doctor size:"+array.size());
 | 
	
		
			
				|  |  |             if(array!=null&&array.size()>0) {
 | 
	
		
			
				|  |  |                 for (int i = 0; i < array.size(); i++) {
 | 
	
		
			
				|  |  |                     JSONObject doctorJson = array.getJSONObject(i);
 | 
	
		
			
				|  |  |                     String idcard = doctorJson.getString("idcard");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     //过滤身份证脏数据
 | 
	
		
			
				|  |  |                     if(idcard.length()>=15){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         List<BaseDoctorDO> doctorDOs = baseDoctorDao.findByIdcard(idcard);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         if(doctorDOs!=null&&doctorDOs.size()>0){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             BaseDoctorDO doctor = doctorDOs.get(0);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             String salt = randomString(5);
 | 
	
		
			
				|  |  |                             String pw = idcard.substring(idcard.length() - 6);
 | 
	
		
			
				|  |  |                             doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
 | 
	
		
			
				|  |  |                             doctor.setSalt(salt);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             doctor.setJobTitleCode(doctorJson.getString("jobtitlecode"));
 | 
	
		
			
				|  |  |                             doctor.setJobTitleName(doctorJson.getString("jobTitleName"));
 | 
	
		
			
				|  |  | //                            doctor.setExpertise(doctorJson.getString("expertise"));
 | 
	
		
			
				|  |  | //                            doctor.setIntroduce(doctorJson.getString("introduce"));
 | 
	
		
			
				|  |  | //                            doctor.setMobile(doctorJson.getString("mobile"));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             BaseDoctorDO temp = baseDoctorDao.save(doctor);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByOrgCodeAndDeptCodeAndDoctorCode(orgCode,doctorJson.getString("dept"),doctor.getId());
 | 
	
		
			
				|  |  |                             if(hospitalDOs!=null&&hospitalDOs.size()>0){
 | 
	
		
			
				|  |  |                                 //机构信息部门信息
 | 
	
		
			
				|  |  |                                 BaseDoctorHospitalDO hospitalDO = hospitalDOs.get(0);
 | 
	
		
			
				|  |  |                                 hospitalDO.setDeptCode(doctorJson.getString("dept"));
 | 
	
		
			
				|  |  |                                 hospitalDO.setDeptName(doctorJson.getString("deptName"));
 | 
	
		
			
				|  |  |                                 hospitalDO.setDel("1");
 | 
	
		
			
				|  |  |                                 baseDoctorHospitalDao.save(hospitalDO);
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         }else{
 | 
	
		
			
				|  |  |                             //新增医生
 | 
	
		
			
				|  |  |                             BaseDoctorDO doctor = new BaseDoctorDO();
 | 
	
		
			
				|  |  |                             doctor.setName(doctorJson.getString("name"));
 | 
	
		
			
				|  |  |                             doctor.setIdcard(idcard);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             doctor.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(idcard)));
 | 
	
		
			
				|  |  |                             doctor.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             doctor.setProvinceCode("350000");
 | 
	
		
			
				|  |  |                             doctor.setProvinceName("福建省");
 | 
	
		
			
				|  |  |                             doctor.setTownCode("350203");
 | 
	
		
			
				|  |  |                             doctor.setTownName("思明区");
 | 
	
		
			
				|  |  |                             doctor.setCityCode("350200");
 | 
	
		
			
				|  |  |                             doctor.setCityName("厦门市");
 | 
	
		
			
				|  |  | //                            doctor.setExpertise(doctorJson.getString("expertise"));
 | 
	
		
			
				|  |  | //                            doctor.setIntroduce(doctorJson.getString("introduce"));
 | 
	
		
			
				|  |  | //                            doctor.setMobile(doctorJson.getString("mobile"));
 | 
	
		
			
				|  |  |                             //认证信息设置
 | 
	
		
			
				|  |  |                             String salt = randomString(5);
 | 
	
		
			
				|  |  |                             String pw = idcard.substring(idcard.length() - 6);
 | 
	
		
			
				|  |  |                             doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
 | 
	
		
			
				|  |  |                             doctor.setSalt(salt);
 | 
	
		
			
				|  |  |                             doctor.setDel("1");
 | 
	
		
			
				|  |  |                             doctor.setEnabled(1);
 | 
	
		
			
				|  |  |                             doctor.setLocked(0);
 | 
	
		
			
				|  |  |                             doctor.setCreateTime(new Date());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             doctor.setJobTitleCode(doctorJson.getString("jobtitlecode"));
 | 
	
		
			
				|  |  |                             doctor.setJobTitleName(doctorJson.getString("jobTitleName"));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             BaseDoctorDO temp = baseDoctorDao.save(doctor);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             //机构信息部门信息
 | 
	
		
			
				|  |  |                             BaseDoctorHospitalDO hospitalDO = new BaseDoctorHospitalDO();
 | 
	
		
			
				|  |  |                             hospitalDO.setDoctorCode(temp.getId());
 | 
	
		
			
				|  |  |                             hospitalDO.setOrgCode(orgCode);
 | 
	
		
			
				|  |  |                             hospitalDO.setOrgName(orgName);
 | 
	
		
			
				|  |  |                             hospitalDO.setDeptCode(doctorJson.getString("dept"));
 | 
	
		
			
				|  |  |                             hospitalDO.setDeptName(doctorJson.getString("deptName"));
 | 
	
		
			
				|  |  |                             hospitalDO.setDel("1");
 | 
	
		
			
				|  |  |                             baseDoctorHospitalDao.save(hospitalDO);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             //保存角色
 | 
	
		
			
				|  |  |                             BaseDoctorRoleDO role = new BaseDoctorRoleDO();
 | 
	
		
			
				|  |  |                             role.setDoctorCode(temp.getId());
 | 
	
		
			
				|  |  |                             role.setRoleCode("specialist");
 | 
	
		
			
				|  |  |                             baseDoctorRoleDao.save(role);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             //保存mapping
 | 
	
		
			
				|  |  |                             DoctorMappingDO mappingDO = new DoctorMappingDO();
 | 
	
		
			
				|  |  |                             mappingDO.setIdcard(idcard);
 | 
	
		
			
				|  |  |                             mappingDO.setDoctor(temp.getId());
 | 
	
		
			
				|  |  |                             mappingDO.setDoctorName(temp.getName());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             mappingDO.setOrgCode(orgCode);
 | 
	
		
			
				|  |  |                             mappingDO.setOrgName(orgName);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             mappingDO.setMappingCode(doctorJson.getString("code"));
 | 
	
		
			
				|  |  |                             mappingDO.setMappingName(temp.getName());
 | 
	
		
			
				|  |  |                             mappingDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             doctorMappingDao.save(mappingDO);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |         List<BaseDoctorDO> baseDoctorDOS = baseDoctorDao.findByDel();
 | 
	
		
			
				|  |  |         for (BaseDoctorDO baseDoctorDO:baseDoctorDOS){
 | 
	
		
			
				|  |  |             String response="";
 | 
	
		
			
				|  |  |             String url = "http://www.yanketong.com:133/api/doc_jkzl/doctor_list_had_bind_account?hospital_code=sb&page=1&id_card="+baseDoctorDO.getIdcard();
 | 
	
		
			
				|  |  |             response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |             logger.info("response:"+response);
 | 
	
		
			
				|  |  |             JSONObject rs = JSON.parseObject(response);
 | 
	
		
			
				|  |  |             Integer status = rs.getInteger("code");
 | 
	
		
			
				|  |  |             if(status!=null&&status == 200){
 | 
	
		
			
				|  |  |                 JSONObject object = rs.getJSONObject("data");
 | 
	
		
			
				|  |  |                 JSONArray array = object.getJSONArray("list");
 | 
	
		
			
				|  |  |                 if (array!=null&&array.size()!=0){
 | 
	
		
			
				|  |  |                     JSONObject jsonObject = array.getJSONObject(0);
 | 
	
		
			
				|  |  |                     DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(baseDoctorDO.getId());
 | 
	
		
			
				|  |  |                     String mappingCode = jsonObject.getString("DOCTORCODE");
 | 
	
		
			
				|  |  |                     doctorMappingDO.setMappingCode(mappingCode);
 | 
	
		
			
				|  |  |                     doctorMappingDao.save(doctorMappingDO);
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     baseDoctorDO.setDel("0");
 | 
	
		
			
				|  |  |                     baseDoctorDao.save(baseDoctorDO);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -1184,7 +1092,9 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |                 hlwCf01DO.setJZKH(wlyyPrescriptionVO.getSsc());
 | 
	
		
			
				|  |  |                 hlwCf01DO.setGUID(getCode());
 | 
	
		
			
				|  |  |                 hlwCf01DO.setSJLY(1);
 | 
	
		
			
				|  |  |                 hlwCf01DO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
 | 
	
		
			
				|  |  |                 if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
 | 
	
		
			
				|  |  |                     hlwCf01DO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                /* hibenateUtils.save(hlwCf01DO);*/
 | 
	
		
			
				|  |  |                 if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getRealOrder())){
 | 
	
		
			
				|  |  |                     hlwCf01DO.setCFSB(Integer.parseInt(wlyyPrescriptionVO.getRealOrder()));
 |