|  | @ -2,6 +2,7 @@ package com.yihu.jw.care.service.doctor;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.dao.doorCoach.BaseDoorCoachOrderDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.birthday.BirthdayWishesService;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.device.DeviceService;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.role.RoleService;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 | 
	
	
		
			
				|  | @ -59,6 +60,8 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
 | 
	
		
			
				|  |  |     private ImService imService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private DeviceService deviceService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BirthdayWishesService birthdayWishesService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取医生简单详情
 | 
	
	
		
			
				|  | @ -75,7 +78,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
 | 
	
		
			
				|  |  |         String sql1 = "SELECT COUNT(DISTINCT sr.patient) FROM " +
 | 
	
		
			
				|  |  |                 " base_service_package_sign_record sr, base_service_package_record r, base_service_package_item i, base_team_member m " +
 | 
	
		
			
				|  |  |                 " WHERE  sr.id = r.sign_id and sr.status=1  AND r.service_package_id = i.service_package_id " +
 | 
	
		
			
				|  |  |                 " AND i.del = 1 and m.team_code = i.team_code " +
 | 
	
		
			
				|  |  |                 " AND i.del = 1 and m.team_code = r.team_code " +
 | 
	
		
			
				|  |  |                 "  and m.del = '1' and m.doctor_code = '"+doctorId+"'";
 | 
	
		
			
				|  |  |         Integer signNum = jdbcTemplate.queryForObject(sql1,Integer.class);
 | 
	
		
			
				|  |  |         String sqlLife= "SELECT COUNT(*) from base_life_care_order where `status` = 2";
 | 
	
	
		
			
				|  | @ -550,7 +553,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
 | 
	
		
			
				|  |  |         JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  |         result.put("lifeCare",0);
 | 
	
		
			
				|  |  |         result.put("emergencyAssistance",0);
 | 
	
		
			
				|  |  |         result.put("patientCare",0);
 | 
	
		
			
				|  |  |         result.put("patientCare",0);//人文关怀
 | 
	
		
			
				|  |  |         result.put("security",0);
 | 
	
		
			
				|  |  |         List<BaseDoctorHospitalDO> doctorHospitalDOs = doctorHospitalDao.findByDoctorCode(doctor);
 | 
	
		
			
				|  |  |         String hospital = doctorHospitalDOs.get(0).getOrgCode();
 | 
	
	
		
			
				|  | @ -568,11 +571,34 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
 | 
	
		
			
				|  |  |             result.put("lifeCare",count);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //紧急救助
 | 
	
		
			
				|  |  | //        countSql = " select ord.status,count(ord.id) count from base_emergency_assistance_order ord where 1=1  "
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         countSql = " select count(ord.id) count from base_emergency_assistance_order ord where ord.status=1 " +
 | 
	
		
			
				|  |  |                 "AND EXISTS (SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
 | 
	
		
			
				|  |  |                 " base_service_package_item i ,base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and " +
 | 
	
		
			
				|  |  |                 " sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and  m.team_code = r.team_code " +
 | 
	
		
			
				|  |  |                 "  and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
 | 
	
		
			
				|  |  |         count = jdbcTemplate.queryForObject(countSql,Long.class);
 | 
	
		
			
				|  |  |         if (count>0){
 | 
	
		
			
				|  |  |             result.put("emergencyAssistance",count);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //安防工单
 | 
	
		
			
				|  |  |         countSql = " select count(ord.id) count from base_security_monitoring_order ord where ord.status=1 " +
 | 
	
		
			
				|  |  |                 "AND EXISTS (SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
 | 
	
		
			
				|  |  |                 " base_service_package_item i ,base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and " +
 | 
	
		
			
				|  |  |                 " sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and  m.team_code = r.team_code " +
 | 
	
		
			
				|  |  |                 "  and i.del = 1 and sr.`status`=1  and i.topic_item='security' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
 | 
	
		
			
				|  |  |         count = jdbcTemplate.queryForObject(countSql,Long.class);
 | 
	
		
			
				|  |  |         if (count>0){
 | 
	
		
			
				|  |  |             result.put("security",count);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //人文关怀
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             Integer counts = birthdayWishesService.getPatientByDoctorCount(doctor);
 | 
	
		
			
				|  |  |             if (count>0){
 | 
	
		
			
				|  |  |                 result.put("patientCare",count);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 |