| 
					
				 | 
			
			
				@ -16,10 +16,12 @@ import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.doctor.BaseDoctorDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.notice.UserNoticeDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.patient.BasePatientDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.care.device.DeviceDetail; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.care.message.OrgNoticeDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.patient.BaseDeviceRepairEntity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.message.dao.SystemMessageDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.BasePatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.ResponseContant; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.Envelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.ObjEnvelop; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -67,6 +69,8 @@ public class DoctorMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PatientMessageService patientMessageService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private DeviceDetailDao deviceDetailDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BasePatientDao basePatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -508,8 +512,6 @@ public class DoctorMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        baseDeviceRepairEntity.setDeviceSn(deviceCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isBlank(deviceName)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //查设备 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //String sql = "SELECT IFNULL(device_name,'') from wlyy_devices where device_code = '"+relationCode+"' limit 1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //device_name = jdbcTemplate.queryForObject(sql, String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            DeviceDetail bySn = deviceDetailDao.findBySn(deviceCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(bySn != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                deviceName = bySn.getDeviceName(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -518,8 +520,11 @@ public class DoctorMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        baseDeviceRepairEntity.setDeviceName(deviceName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        baseDeviceRepairEntity.setBindUser(patientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //查居民名字 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String nameSql = "SELECT name from base_patient where id = '"+patientId+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String userName = jdbcTemplate.queryForObject(nameSql, String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO byId = basePatientDao.findById(patientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String userName = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(byId != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            userName = byId.getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        baseDeviceRepairEntity.setBindUserName(userName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        baseDeviceRepairEntity.setStatus(1); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -548,7 +553,7 @@ public class DoctorMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop getRepairMassageList(String doctorId,Integer page,Integer pageSize,String name){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        page = page>0?page-1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String selectSql = "SELECT re.id,re.order_id orderId,p.name patientName,re.device_sn deviceSn,re.device_name deviceName,CAST(DATE_FORMAT(re.deal_time,'%Y-%m-%d %H:%i:%S') as char) dealTime,re.deal_peoper dealPeoper,re.deal_peoper_name dealPeoperName,p.photo "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String selectSql = "SELECT re.id,re.order_id orderId,p.name patientName,re.device_sn deviceSn,re.device_name deviceName,CAST(DATE_FORMAT(re.deal_time,'%Y-%m-%d %H:%i:%S') as char) dealTime,UNIX_TIMESTAMP(re.deal_time) dealTimeNum,re.deal_peoper dealPeoper,re.deal_peoper_name dealPeoperName,p.photo "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " from base_device_repair re left join base_patient p on re.bind_user = p.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where re.type = 0 and re.status = 1 and re.deal_peoper = '"+doctorId+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(name)){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -558,6 +563,11 @@ public class DoctorMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = jdbcTemplate.queryForList(selectSql + sql + pageSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String countSql = "SELECT COUNT(re.id) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long total = jdbcTemplate.queryForObject(countSql + sql, Long.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //计算时间差 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> map : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Long l1 = (Long) map.get("dealTimeNum"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("timeAgoStr",DateUtil.getTimeAgeStr(l1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return PageEnvelop.getSuccessListWithPage("获取成功",list,page,pageSize,total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -567,9 +577,11 @@ public class DoctorMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ObjEnvelop getRepairMessageListById(Integer id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT re.id,re.order_id orderId,p.name patientName,re.device_sn deviceSn,re.device_name deviceName,CAST(DATE_FORMAT(re.deal_time,'%Y-%m-%d %H:%i:%S') as char) dealTime,re.deal_peoper dealPeoper,re.deal_peoper_name dealPeoperName,p.photo,re.feedback,re.img " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT re.id,re.order_id orderId,p.name patientName,re.device_sn deviceSn,re.device_name deviceName,CAST(DATE_FORMAT(re.deal_time,'%Y-%m-%d %H:%i:%S') as char) dealTime,UNIX_TIMESTAMP(re.deal_time) dealTimeNum,re.deal_peoper dealPeoper,re.deal_peoper_name dealPeoperName,p.photo,re.feedback,re.img " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " from base_device_repair re left join base_patient p on re.bind_user = p.id where re.type = 0 and re.id = "+id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> map = jdbcTemplate.queryForMap(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long l1 = (Long) map.get("dealTimeNum"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        map.put("timeAgoStr",DateUtil.getTimeAgeStr(l1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return ObjEnvelop.getSuccess("获取成功",map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 |