| 
					
				 | 
			
			
				@ -9,10 +9,13 @@ import com.yihu.jw.dict.dao.DictHospitalDeptDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.doctor.dao.BaseDoctorDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.login.BaseLoginLogDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.patient.BasePatientDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.patient.Patient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.es.util.ElasticsearchUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.es.util.SaveModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.im.util.ImUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.org.dao.BaseOrgDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.BasePatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.PageEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.collections.map.HashedMap; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -52,6 +55,8 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private StatisticsUtilService statisticsUtilService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private ImUtil imUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BasePatientDao patientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private static final String defalutArea = "330100"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -141,6 +146,56 @@ public class StatisticsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop getAllDynamics(Integer page,Integer size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List result = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select * from base_login_log order by create_time desc limit "+ (page-1)*size+","+size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCount = "select count(id) from base_login_log"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long count = jdbcTemplate.queryForObject(sqlCount,Long.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseLoginLogDO> loginLogDOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(BaseLoginLogDO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (BaseLoginLogDO log:loginLogDOs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject object = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("patient",log.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BasePatientDO patient = patientDao.findById(log.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (patient != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String archive_type = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Integer onLineFlag =0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                switch (patient.getArchiveType().toString()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    case "1": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        archive_type = "older";//老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    case "2": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        archive_type = "child";//新生儿 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("archiveType",patient.getArchiveType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String onLineStr = imUtil.findByUserIdAndType(log.getUserId().toString(),archive_type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject oneLineObj = JSONObject.parseObject(onLineStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (200 == oneLineObj.getInteger("status")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (oneLineObj.getInteger("data")>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        onLineFlag=1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("onLineFlag", onLineFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Integer onLineFlag =0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String onLineStr = imUtil.findByUserIdAndType(log.getUserId().toString(),"helper"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject oneLineObj = JSONObject.parseObject(onLineStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (200 == oneLineObj.getInteger("status")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (oneLineObj.getInteger("data")>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        onLineFlag=1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("onLineFlag", onLineFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("archiveType","0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("name",log.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("createTime", log.getCreateTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("clientType", log.getClientType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.add(object); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return PageEnvelop.getSuccessListWithPage("查询成功",result,page,size,count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 服务排名分析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endDate 
			 |