| 
					
				 | 
			
			
				@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.fasterxml.jackson.databind.ObjectMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.base.dao.dict.DictJobTitleDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.base.dao.doctor.BaseDoctorIncentiveDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.base.dao.team.BaseTeamDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.base.dao.team.BaseTeamMemberDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.base.service.dict.DictDoctorDutyService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.base.service.org.OrgTree; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -25,6 +27,8 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.doctor.BaseDoctorIncentiveDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.org.BaseOrgDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.team.BaseTeamDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.team.BaseTeamMemberDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.exception.business.ManageException; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -117,6 +121,8 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseDoctorIncentiveDao baseDoctorIncentiveDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseIncentiveDictDao baseIncentiveDictDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseTeamMemberDao baseTeamMemberDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value("${wechat.flag}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private boolean flag; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -131,6 +137,8 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private HibenateUtils hibenateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseTeamDao baseTeamDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -157,10 +165,22 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //医生归属业务模块角色信息,非必填,数据可有可没有 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String[] paramNames = {"doctorCode"}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Object[] paramValue = {doctorId}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseDoctorRoleDO> roleList = baseDoctorRoleService.findByFields(paramNames,paramValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseTeamMemberDO> baseTeamMemberDO = baseTeamMemberDao.findUseDoctorCode(doctorId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseTeamDO> teamlist = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (baseTeamMemberDO!=null&&baseTeamMemberDO.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (BaseTeamMemberDO baseTeamMemberDO1:baseTeamMemberDO){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String teamCode = baseTeamMemberDO1.getTeamCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BaseTeamDO baseTeamDO = baseTeamDao.findOne(teamCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                teamlist.add(baseTeamDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("teamInfo",teamlist); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseDoctorRoleDO> roleList = baseDoctorRoleService.findByFields(paramNames,paramValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("doctor",doctors); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("role",roleList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseDoctorHospitalDO> baseDoctorHospitalDO = baseDoctorHospitalDao.findByDoctorCode(doctorId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("hospital",baseDoctorHospitalDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("response",ConstantUtils.SUCCESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("msg",jsonObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -413,6 +433,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject jsonObject = JSONObject.parseObject(jsonData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject doctor = jsonObject.getJSONObject("doctor"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray role = jsonObject.getJSONArray("role"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String teamCode = jsonObject.getString("teamCode"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray hospital = jsonObject.getJSONArray("hospital"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String doctorMappingCode = jsonObject.getString("doctorMappingCode"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null == doctor) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -423,6 +444,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //组装医生信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BaseDoctorDO baseDoctorDO = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BaseDoctorDO baseDoctorvo = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String orgCode = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DoctorMappingDO doctorMappingDO = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            baseDoctorvo = objectMapper.readValue(doctor.toJSONString(), BaseDoctorDO.class); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -517,7 +539,6 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!CollectionUtils.isEmpty(hospital)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BaseDoctorHospitalDO baseDoctorHospitalDO = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<BaseDoctorHospitalDO> hospitalDOList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String orgCode = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String orgName = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (Object object : hospital) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -553,6 +574,22 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return result.toJSONString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isEmpty(teamCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String[] teamCodeList = teamCode.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i=0;i<teamCodeList.length;i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BaseTeamMemberDO mems = baseTeamMemberDao.findUseDoctorCodeAndTeamCode(baseDoctorDO.getId(),teamCodeList[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (mems==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    mems = new BaseTeamMemberDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                mems.setTeamCode(teamCodeList[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                mems.setDoctorCode(baseDoctorDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                mems.setOrgCode(orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                mems.setDel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                mems.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                baseTeamMemberDao.save(mems); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("response", ConstantUtils.SUCCESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("msg", baseDoctorDO); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -573,6 +610,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result.toJSONString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject jsonObject = JSONObject.parseObject(jsonData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String teamCode = jsonObject.getString("teamCode"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject doctor = jsonObject.getJSONObject("doctor"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray role = jsonObject.getJSONArray("role"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String doctorMappingCode = jsonObject.getString("doctorMappingCode"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -582,6 +620,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("response", ConstantUtils.FAIL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result.toJSONString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String orgCode=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //判断医生id是否存在 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isEmpty(doctor.getString("id"))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("msg","parameter id for doctor is null when update doctor"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -656,7 +695,6 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(!CollectionUtils.isEmpty(hospital)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BaseDoctorHospitalDO baseDoctorHospitalDO = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Set<Object> hospitalIdList = baseDoctorHospitalService.findDocHospIdList(baseDoctorDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String orgCode = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String orgName=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 for(Object object : hospital){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -672,11 +710,14 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     orgCode = baseDoctorHospitalDO.getOrgCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     orgName = baseDoctorHospitalDO.getOrgName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     baseDoctorHospitalDO.setDel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     baseDoctorHospitalService.save(baseDoctorHospitalDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 doctorMappingDO.setOrgCode(orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 doctorMappingDO.setOrgName(orgName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 doctorMappingDao.save(doctorMappingDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if(doctorMappingDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     doctorMappingDO.setOrgCode(orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     doctorMappingDO.setOrgName(orgName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     doctorMappingDao.save(doctorMappingDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } catch (IOException e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 result.put("msg","convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 result.put("response",ConstantUtils.FAIL); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -685,7 +726,33 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 baseDoctorHospitalService.delete(hospitalIdList.toArray()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isEmpty(teamCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String[] teamCodeList = teamCode.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<BaseTeamMemberDO> tmlist = baseTeamMemberDao.findUseDoctorCode(baseDoctorDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (BaseTeamMemberDO baseTeamMemberDO:tmlist){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                baseTeamMemberDO.setDel("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            baseTeamMemberDao.save(tmlist); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i=0;i<teamCodeList.length;i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BaseTeamMemberDO mems = baseTeamMemberDao.findUseDoctorCodeAndTeamCode(baseDoctorDO.getId(),teamCodeList[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (mems==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    mems = new BaseTeamMemberDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                mems.setTeamCode(teamCodeList[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                mems.setDoctorCode(baseDoctorDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                mems.setOrgCode(orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                mems.setDel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                mems.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                baseTeamMemberDao.save(mems); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<BaseTeamMemberDO> tmlist = baseTeamMemberDao.findUseDoctorCode(baseDoctorDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (BaseTeamMemberDO baseTeamMemberDO:tmlist){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                baseTeamMemberDO.setDel("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            baseTeamMemberDao.save(tmlist); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("response",ConstantUtils.SUCCESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("msg",baseDoctorDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result.toJSONString(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1071,9 +1138,6 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if (list.get(j).getIncentiveId().equalsIgnoreCase(incentiveId[i])&&"1".equalsIgnoreCase(list.get(j).getIsDel())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            throw new Exception("该激励已经保存过"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        }else if (list.get(j).getIncentiveId().equalsIgnoreCase(incentiveId[i])&&"0".equalsIgnoreCase(list.get(j).getIsDel())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            list.get(j).setIsDel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            saveList.add(list.get(j)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            BaseDoctorIncentiveDO baseDoctorIncentiveDO = new BaseDoctorIncentiveDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            baseDoctorIncentiveDO.setIsDel("1"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1131,9 +1195,25 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return envelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findIncentiveByDoctor(String doctorId, Integer page, Integer pageSize) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findIncentiveByDoctor(String doctorId,String name, Integer page, Integer pageSize) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        MixEnvelop mixEnvelop = new MixEnvelop(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseDoctorIncentiveDO> list = baseDoctorIncentiveDao.findByDoctorCodeList(doctorId,creatPage(page,pageSize,"")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select t.id as \"id\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.doctor_code as \"doctorCode\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.doctor_name as \"doctorName\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.incentive_id as \"incentiveId\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "b.incentive_code as \"incentiveCode\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.incentive_img as \"incentiveImg\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.incentive_name as \"incentiveName\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.create_time as \"createTime\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.is_del as \"isDel\" from base_doctor_incentive t left join base_incentive_dict b " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " on b.id = t.incentive_id where t.is_del =1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isEmpty(doctorId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" and t.doctor_code ='"+doctorId+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isEmpty(name)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" and t.incentive_name like '%"+name+"%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list  = hibenateUtils.createSQLQuery(sql,page,pageSize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseDoctorIncentiveDO> listCount = baseDoctorIncentiveDao.findByDoctorCodeListCount(doctorId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        mixEnvelop.setPageSize(pageSize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        mixEnvelop.setCurrPage(page); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1149,13 +1229,11 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "b.is_del as \"isDel\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "b.incentive_code as \"incentiveCode\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "b.create_time as \"createTime\"" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "from base_incentive_dict b left join base_doctor_incentive d" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " on b.id = d.incentive_id where is_del = '1'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "from base_incentive_dict b where b.is_del = '1' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isEmpty(doctorCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and d.doctor_code!='"+doctorCode+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and b.id not in (select  d.incentive_id from base_doctor_incentive d where d.doctor_code ='"+doctorCode+"'  and d.is_del= '1'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "  group by  d.incentive_id)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql+=" group by  b.id,b.incentive_img,b.incentive_name" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "b.incentive_status ,b.is_del, b.incentive_code,b.create_time"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyHospitalSysDictDO> sysDictDOS=wlyyHospitalSysDictDao.findByDictName("drugStoreStatus"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (sysDictDOS!=null&&list.size()>0){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1169,4 +1247,20 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //医生重置密码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String  resetDoctorPwd(String doctor){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BaseDoctorDO baseDoctorDO= baseDoctorDao.findById(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (baseDoctorDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String salt = baseDoctorDO.getSalt(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isEmpty(salt)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                salt = randomString(5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                baseDoctorDO.setSalt(salt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            baseDoctorDO.setPassword(MD5.md5Hex(baseDoctorDO.getIdcard().substring(12, 18) + "{" + salt + "}")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            baseDoctorDao.save(baseDoctorDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "操作成功"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return "医生不存在"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |