| 
					
				 | 
			
			
				@ -2181,9 +2181,9 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 管理员日报项目统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 管理员日报项目统计一级 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> statisticReportProjectList(String user, String projectCode,String startDate, String endDate) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> statisticReportProjectList(String user, String projectCode,String startDate, String endDate,String dept,String member) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select * from base_doctor_role where doctor_code='"+user+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (userRoles.size()==0){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2200,6 +2200,12 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(projectCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += " and i.project_code='"+projectCode+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(dept)){//查询指定部门 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += "  and i.dept='"+dept+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(member)){//查询指定员工 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += " and up.doctor_id='"+member+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlList = "  select dict.dict_code project_code,dict.dict_value projectName,IFNULL( A.completionHour,0) 'completionHour', " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " IFNULL(A.doctorTotal,0) 'doctorTotal' from wlyy_hospital_sys_dict dict " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " Left JOIN (" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2210,15 +2216,50 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(projectCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlList +=" and dict.dict_code='"+projectCode+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sqlList += "  order by completionHour desc "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sqlList += "  order by sort, completionHour desc "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return jdbcTemplate.queryForList(sqlList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 管理员日报项目统计二级 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> statisticReportProjectDeptList(String user, String projectCode,String startDate, String endDate,String dept,String member) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select * from base_doctor_role where doctor_code='"+user+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (userRoles.size()==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("您无权限操作"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCondition = "  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += " and up.report_date>='"+startDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += " and up.report_date<='"+endDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(projectCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += " and i.project_code='"+projectCode+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(dept)){//查询指定部门 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += "  and i.dept='"+dept+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(member)){//查询指定员工 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += " and up.doctor_id='"+member+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlList = " select i.dept,i.dept_name deptName,i.project_code,CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " count(distinct up.doctor_id) as doctorTotal from base_daily_report_item i LEFT JOIN base_daily_report_detail de on i.id = de.report_item_id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " INNER JOIN base_doctor_daily_report_upload up on up.id = de.report_id  where i.del=1 "+sqlCondition+" GROUP BY i.project_code,i.dept  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sqlList += "  order by  completionHour desc "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return jdbcTemplate.queryForList(sqlList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 管理员日报项目统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 管理员日报项目统计三级 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop statisticReportItemList(String user, String projectCode,String title, String content, Integer state, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               String startDate, String endDate, String createUser,String createUserName, Integer page, Integer size) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               String startDate, String endDate, String createUser,String createUserName, Integer page, Integer size, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               String dept,String member) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        page = page>0?page-1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select * from base_doctor_role where doctor_code='"+user+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2234,6 +2275,10 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            updateTimeSql += " and up.report_date<='"+endDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(member)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            updateTimeSql +=  " and up.doctor_id='"+member+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlList = " select i.id,CONCAT(i.title,'(',i.dept_name,')') title,i.content,i.state,i.begin_time beginTime,i.end_time endTime, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " i.create_user_name createUserName,IFNULL(A.completionHour,'0') completionHour ,IFNULL(A.doctorTotal,0) doctorTotal " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " from base_daily_report_item i  LEFT JOIN( " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2261,6 +2306,12 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(projectCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += " and i.project_code='"+projectCode+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(dept)){//查询指定部门 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += "  and i.dept='"+dept+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(member)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += "  and exists (select 1 from base_daily_report_item_members mem where i.id =mem.report_item_id and mem.user_id='"+member+"' and mem.del=1  )"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sqlList +=sqlCondition+ " group by i.id order by i.create_time,i.id desc limit "+page*size+","+size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        itemDOS = jdbcTemplate.queryForList(sqlList); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2268,40 +2319,47 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return PageEnvelop.getSuccessListWithPage("查询成功",itemDOS,page,size,count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> statisticReportItemById(String user,String item_id,Integer type,String startDate,String endDate) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> statisticReportItemById(String user,String item_id,Integer type,String startDate,String endDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                            String dept,String member) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select * from base_doctor_role where doctor_code='"+user+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (userRoles.size()==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("您无权限操作"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String updateTimeSql = " "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String itemSql = " "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            updateTimeSql += " and up.report_date>='"+startDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            updateTimeSql += " and up.report_date<='"+endDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(member)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            updateTimeSql +=  " and up.doctor_id='"+member+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(dept)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            itemSql += " and i.dept='"+dept+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(1==type){//天 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = " select i.id,CONCAT(i.title,'(',i.dept_name,')') title,i.content,i.state,i.begin_time beginTime,i.end_time endTime,i.create_user_name createUserName, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time', " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " count(distinct up.doctor_id) as doctorTotal from base_daily_report_item i LEFT JOIN base_daily_report_detail de " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "on i.id = de.report_item_id INNER JOIN base_doctor_daily_report_upload up on up.id = de.report_id " +updateTimeSql+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "where 1=1 and i.id='"+item_id+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "where 1=1 and i.id='"+item_id+"' " +itemSql+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "group by i.id,DATE_FORMAT(de.create_time,'%Y-%m-%d') order by time asc "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if (2==type){//按周 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = " select i.id,CONCAT(i.title,'(',i.dept_name,')') title,i.content,i.state,i.begin_time beginTime,i.end_time endTime,i.create_user_name createUserName, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time', " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " count(distinct up.doctor_id) as doctorTotal from base_daily_report_item i LEFT JOIN base_daily_report_detail de " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "on i.id = de.report_item_id INNER JOIN base_doctor_daily_report_upload up on up.id = de.report_id  " +updateTimeSql+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "where 1=1 and i.id='"+item_id+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "where 1=1 and i.id='"+item_id+"' " +itemSql+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "group by i.id,DATE_FORMAT(de.create_time,'%Y%v') order by time asc "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if (3==type){//月 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = " select i.id,CONCAT(i.title,'(',i.dept_name,')') title,i.content,i.state,i.begin_time beginTime,i.end_time endTime,i.create_user_name createUserName, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m') as 'time', " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " count(distinct up.doctor_id) as doctorTotal from base_daily_report_item i LEFT JOIN base_daily_report_detail de " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "on i.id = de.report_item_id INNER JOIN base_doctor_daily_report_upload up on up.id = de.report_id " +updateTimeSql+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "where 1=1 and i.id='"+item_id+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "where 1=1 and i.id='"+item_id+"' " +itemSql+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "group by i.id,DATE_FORMAT(de.create_time,'%Y-%m') order by time asc "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("查询失败,请检查传入参数"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2590,7 +2648,7 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String projectSql = " select  dict.dict_code project_code,dict.dict_value projectName,i.dept " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " from wlyy_hospital_sys_dict dict INNER JOIN base_daily_report_item i on i.project_code = dict.dict_code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " INNER JOIN base_daily_report_item_members mem on i.id =mem.report_item_id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where dict.dict_name='daily_report_project' and i.dept='"+dept+"'  and mem.user_id='"+memberId+"'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where dict.dict_name='daily_report_project' and i.dept='"+dept+"'  and mem.user_id='"+memberId+"' and mem.del=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " GROUP BY dict.dict_code; "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> deptProjectList = jdbcTemplate.queryForList(projectSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlList = "  select i.project_code,CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,  " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2657,7 +2715,7 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String projectSql = "  select i.id,CONCAT(i.title,'(',i.dept_name,')') title,i.content,i.state,i.begin_time beginTime, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " i.end_time endTime, i.create_user_name createUserName " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  from  base_daily_report_item i INNER JOIN base_daily_report_item_members mem on i.id =mem.report_item_id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where  i.project_code='"+projectCode+"' and mem.user_id='"+memberId+"' and  i.dept='"+dept+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where  i.project_code='"+projectCode+"' and mem.user_id='"+memberId+"' and mem.del=1 and  i.dept='"+dept+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  GROUP BY i.id "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> deptProjectItemList = jdbcTemplate.queryForList(projectSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlList = "  select i.project_code,CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,  " + 
			 |