| 
					
				 | 
			
			
				@ -369,14 +369,14 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BaseDoctorDO remindDoctorDO = baseDoctorDao.findById(senderID); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (remindDoctorDO != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        WxEnterpriseUserDO enterpriseUserDO = wxEnterpriseUserDao.findByEnterpriseIdAndMobile(wechatId,doctorDO.getMobile()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        WxEnterpriseUserDO enterpriseUserDO = wxEnterpriseUserDao.findByEnterpriseIdAndMobile(wechatId,remindDoctorDO.getMobile()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if(enterpriseUserDO==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            logger.info("该用户"+doctorDO.getName()+"没有企业微信手机号,无法推送模版消息,用户ID:"+doctorDO.getId()+"wechatId:"+wechatId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            String title = "待办事项"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            String des = "您好,"+doctorDO.getName()+"已提交每日日报,请点击前往审核。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            String url = "https://ehr.yihu.com/hlwyy/zjxl/healthMonitoring/#/workSummary/commit?mode=verify&docId="+doctorId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            String res = enterpriseService.sendTWMesByDoctor(wechatId,doctorDO.getId(),title,des,url); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            String res = enterpriseService.sendTWMesByDoctor(wechatId,remindDoctorDO.getId(),title,des,url); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    }catch (Exception e){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -503,10 +503,10 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //本人已上报数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String benrenshangbaoTotalSql = " select count(1) from base_doctor_daily_report_upload where doctor_id='"+doctorId+"'  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //本人上级未核实事项数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String benrenVerifiedSql = " select count(de.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String benrenVerifiedSql = " select count(distinct up.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where up.doctor_id='"+doctorId+"' and  de.state=1 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //本人上级已核实事项数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String benrenNotVerifiedSql = " select count(de.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String benrenNotVerifiedSql = " select count(distinct up.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where up.doctor_id='"+doctorId+"' and  de.state=0 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //科室总人数 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -523,10 +523,10 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //今日上报人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlTotalSql = " select count(1) from base_doctor_daily_report_upload  where  report_date>='"+nowDate+"' and report_date<='"+nowDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //今日核实数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            verifiedSql = " select count(de.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            verifiedSql = " select count(distinct up.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " where  de.state=1 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //今日未核实数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            notVerifiedSql = " select count(de.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            notVerifiedSql = " select count(distinct up.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " where   de.state=0 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (level == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //总人次 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -536,11 +536,11 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlTotalSql = " select count(1) from base_doctor_daily_report_upload  where  report_date>='"+nowDate+"' and report_date<='"+nowDate+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " and doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //今日核实数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            verifiedSql = " select count(de.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            verifiedSql = " select count(distinct up.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " where  de.state=1 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " and up.doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //今日未核实数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            notVerifiedSql = " select count(de.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            notVerifiedSql = " select count(distinct up.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " where   de.state=0 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " and up.doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -568,127 +568,6 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 首页统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param idType 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param state 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param startDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param name 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject selectReportTotal(String dept,String idType,String state,String startDate,String endDate,String name){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject object = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String day = DateUtil.getTwoDay(endDate, startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer total = 0;//总人次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select COUNT(DISTINCT d.id) as \"total\" from base_doctor_daily_report_upload d inner join base_daily_report_detail de " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " on d.id = de.report_id where 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String deptCondition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(dept)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            deptCondition += " (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String idTypeCondition = " "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(idType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            idTypeCondition += "  (select d1.id from base_doctor d1 where 1=1 and d1.id_type = '" + idType + "')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(deptCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doctorSql += " and d.id IN " + deptCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(idTypeCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doctorSql += " and d.id IN " + idTypeCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(name)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doctorSql += " and d.name like '%" + name + "%' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer doctorTotal = jdbcTemplate.queryForObject(doctorSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!day.equalsIgnoreCase("0")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            total = doctorTotal * (Integer.parseInt(day)+1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else {//当天 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            total = doctorTotal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer yishangbaoTotal=0;//上传人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer weishangbaoTotal=0;//未上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer notVerified=0;//未核实 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer verified=0;//已核实 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer shangchuanTotal=0;//上传总次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(startDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(state)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and d.state='"+state+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(deptCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and d.doctor_id IN " + deptCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(idTypeCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and d.doctor_id IN " + idTypeCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(name)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and d.doctor_name like '%" + name + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        yishangbaoTotal = jdbcTemplate.queryForObject(sql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //未上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        weishangbaoTotal = total - yishangbaoTotal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String shangchuanTotalSql = "select COUNT(1) as \"total\" from base_doctor_daily_report_upload d where 1=1  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(startDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            shangchuanTotalSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(deptCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            shangchuanTotalSql += " and d.doctor_id IN " + deptCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(idTypeCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            shangchuanTotalSql += " and d.doctor_id IN " + idTypeCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(name)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            shangchuanTotalSql += " and d.doctor_name like '%" + name + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //未核实数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String notVerifiedSql = "select COUNT(DISTINCT de.id) as 'total' from base_doctor_daily_report_upload d inner join base_daily_report_detail de " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " on d.id = de.report_id where de.state=0 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //已核实数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String verifiedSql = "select COUNT(DISTINCT de.id) as 'total' from base_doctor_daily_report_upload d inner join base_daily_report_detail de " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " on d.id = de.report_id where de.state=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(startDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            notVerifiedSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            verifiedSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(deptCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            notVerifiedSql += " and d.doctor_id IN " + deptCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            verifiedSql += " and d.doctor_id IN " + deptCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(idTypeCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            notVerifiedSql += " and d.doctor_id IN " + idTypeCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            verifiedSql += " and d.doctor_id IN " + idTypeCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(name)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            notVerifiedSql += " and d.doctor_name like '%" + name + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            verifiedSql += " and d.doctor_name like '%" + name + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        notVerified = jdbcTemplate.queryForObject(notVerifiedSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        verified = jdbcTemplate.queryForObject(verifiedSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //上传总次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        shangchuanTotal = jdbcTemplate.queryForObject(shangchuanTotalSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("total", total);//总人次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("yishangbaoTotal", yishangbaoTotal);//已上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("weishangbaoTotal", weishangbaoTotal);//未上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("notVerified", notVerified);//未核实数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("verified", verified);//已核实数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("shangchuanTotal", shangchuanTotal);//上传总次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 首页按照科室列表统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -725,10 +604,10 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN(select dh.dept_code,count(up.id) 'yishangbaoTotal' from base_doctor_daily_report_upload up INNER JOIN base_doctor d on up.doctor_id = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "where 1=1 "+doctorSqlCondition+reportCondition+")dh2 ON hd.CODE = dh2.dept_code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN(select dh.dept_code,count(de.id) 'verified' from base_doctor_daily_report_upload up LEFT JOIN base_daily_report_detail de on up.id = de.report_id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN(select dh.dept_code,count(distinct up.id) 'verified' from base_doctor_daily_report_upload up LEFT JOIN base_daily_report_detail de on up.id = de.report_id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "INNER JOIN base_doctor d on up.doctor_id = d.id LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "where 1=1 and de.state=1 "+doctorSqlCondition+reportCondition+" )dh3 ON hd.CODE = dh3.dept_code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN(select dh.dept_code,count(de.id) 'notVerified' from base_doctor_daily_report_upload up LEFT JOIN base_daily_report_detail de on up.id = de.report_id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN(select dh.dept_code,count(distinct up.id) 'notVerified' from base_doctor_daily_report_upload up LEFT JOIN base_daily_report_detail de on up.id = de.report_id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "INNER JOIN base_doctor d on up.doctor_id = d.id LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "where 1=1 and de.state=0 "+doctorSqlCondition+reportCondition+")dh4 ON hd.CODE = dh4.dept_code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN(select dh.dept_code,count(up.id) 'shangchuanTotal' from base_doctor_daily_report_upload up INNER JOIN base_doctor d on up.doctor_id = d.id " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1201,8 +1080,140 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("total", total);//总人次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("yishangbaoTotal", yishangbaoTotal);//已上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("weishangbaoTotal", weishangbaoTotal);//未上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("verifiedTotal", verifiedTotal);//上报正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("notVerifiedTotal", notVerifiedTotal);//上报异常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("verifiedTotal", verifiedTotal);//已核实 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("notVerifiedTotal", notVerifiedTotal);//未核实 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("shangchuanTotal", shangchuanTotal);//上传总次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 首页统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param idType 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param state 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param startDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject selectHeaderTotal(String dept, String idType, String status, String state, String startDate, String endDate, String name) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject object = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String day = DateUtil.getTwoDay(endDate, startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer total = 0;//总人次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select COUNT(DISTINCT d.id) as \"total\" from base_doctor_daily_report_upload d inner join base_daily_report_detail de " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " on d.id = de.report_id where 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String deptCondition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(dept)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            deptCondition += " (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String idTypeCondition = " "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(idType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            idTypeCondition += "  (select d1.id from base_doctor d1 where 1=1 and d1.id_type = '" + idType + "')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(deptCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doctorSql += " and d.id IN " + deptCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(idTypeCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doctorSql += " and d.id IN " + idTypeCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(name)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doctorSql += " and d.name like '%" + name + "%' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        if (StringUtils.isNoneBlank(status)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            if (status.equalsIgnoreCase("1")) {//已上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                doctorSql += " and d.id in(select d1.doctor_id from base_doctor_daily_report_upload d1 where 1=1 and d1.report_date >='" + startDate + "' and d1.report_date<='" + endDate + "' ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            } else if (status.equalsIgnoreCase("2")) {//未上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                doctorSql += " and d.id not in(select d1.doctor_id from base_doctor_daily_report_upload d1 where 1=1 and d1.report_date >='" + startDate + "' and d1.report_date<='" + endDate + "' ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer doctorTotal = jdbcTemplate.queryForObject(doctorSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!day.equalsIgnoreCase("0")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            total = doctorTotal * (Integer.parseInt(day)+1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else {//当天 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            total = doctorTotal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer yishangbaoTotal=0;//上传人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer weishangbaoTotal=0;//未上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer notVerified=0;//未核实 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer verified=0;//已核实 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer shangchuanTotal=0;//上传总次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(startDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(state)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and d.state='"+state+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(deptCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and d.doctor_id IN " + deptCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(idTypeCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and d.doctor_id IN " + idTypeCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(name)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and d.doctor_name like '%" + name + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        yishangbaoTotal = jdbcTemplate.queryForObject(sql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //未上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        weishangbaoTotal = total - yishangbaoTotal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String shangchuanTotalSql = "select COUNT(1) as \"total\" from base_doctor_daily_report_upload d where 1=1  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(startDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            shangchuanTotalSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(deptCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            shangchuanTotalSql += " and d.doctor_id IN " + deptCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(idTypeCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            shangchuanTotalSql += " and d.doctor_id IN " + idTypeCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(name)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            shangchuanTotalSql += " and d.doctor_name like '%" + name + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //未核实数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String notVerifiedSql = "select COUNT(DISTINCT d.id) as 'total' from base_doctor_daily_report_upload d inner join base_daily_report_detail de " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " on d.id = de.report_id where de.state=0 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //已核实数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String verifiedSql = "select COUNT(DISTINCT d.id) as 'total' from base_doctor_daily_report_upload d inner join base_daily_report_detail de " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " on d.id = de.report_id where de.state=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(startDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            notVerifiedSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            verifiedSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(deptCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            notVerifiedSql += " and d.doctor_id IN " + deptCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            verifiedSql += " and d.doctor_id IN " + deptCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(idTypeCondition)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            notVerifiedSql += " and d.doctor_id IN " + idTypeCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            verifiedSql += " and d.doctor_id IN " + idTypeCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(name)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            notVerifiedSql += " and d.doctor_name like '%" + name + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            verifiedSql += " and d.doctor_name like '%" + name + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        notVerified = jdbcTemplate.queryForObject(notVerifiedSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        verified = jdbcTemplate.queryForObject(verifiedSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //上传总次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        shangchuanTotal = jdbcTemplate.queryForObject(shangchuanTotalSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("total", total);//总人次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("yishangbaoTotal", yishangbaoTotal);//已上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("weishangbaoTotal", weishangbaoTotal);//未上报 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("notVerified", notVerified);//未核实数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("verified", verified);//已核实数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        object.put("shangchuanTotal", shangchuanTotal);//上传总次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 |