| 
					
				 | 
			
			
				@ -3785,8 +3785,11 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> doctorTypeHourList = jdbcTemplate.queryForList(doctorTypeSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("doctorTypeHourList",doctorTypeHourList);//按人员统计总用时与参与人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject bugObj = selectBugTotal(memberId,startDate,endDate,dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.putAll(bugObj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //BUG数量统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNoneBlank(memberId)||StringUtils.isNoneBlank(dept)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject bugObj = selectBugTotal(memberId,startDate,endDate,dept,false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.putAll(bugObj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3975,11 +3978,12 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //判断导出人权限 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select * from base_doctor_role where doctor_code='"+user+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        boolean adminFlag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (userRoles.size()==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String role_code = userRoles.get(0).get("role_code").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("admin".equals(role_code)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                adminFlag = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if ("deptAdmin".equals(role_code)) {//查询出管理员所在部门 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(StringUtils.isBlank(dept)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sql = " select dh.dept_code from base_doctor doc INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4191,6 +4195,11 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> doctorTypeHourList = jdbcTemplate.queryForList(doctorTypeSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("doctorTypeHourList",doctorTypeHourList);//按人员统计总用时与参与人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //BUG数量统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNoneBlank(memberId)||StringUtils.isNoneBlank(dept)||adminFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject bugObj = selectBugTotal(memberId,startDate,endDate,dept,adminFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.putAll(bugObj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5058,13 +5067,22 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject selectBugTotal(String doctorId, String startDate, String endDate, String dept) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject selectBugTotal(String doctorId, String startDate, String endDate, String dept,boolean adminFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCondition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("bugtotal",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("resolveBugTotal",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("unresolvedBugTotal",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (adminFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition = " SELECT d.zt_id as ztId FROM base_doctor d LEFT JOIN base_doctor_hospital dh ON d.id=dh.doctor_code where d.del=1 and dh.del=1 and d.zt_id is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(dept)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition = " SELECT d.zt_id as ztId FROM base_doctor d LEFT JOIN base_doctor_hospital dh ON d.id=dh.doctor_code where d.del=1 and dh.del=1 and dh.dept_code='"+dept+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition = " SELECT d.zt_id as ztId FROM base_doctor d LEFT JOIN base_doctor_hospital dh ON d.id=dh.doctor_code where d.del=1 and dh.del=1 and dh.dept_code='"+dept+"' and d.zt_id is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(doctorId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition = " SELECT d.zt_id as ztId FROM base_doctor d where d.id = '"+doctorId+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition = " SELECT d.zt_id as ztId FROM base_doctor d where d.id = '"+doctorId+"' and d.zt_id is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sqlCondition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String str = ""; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5073,56 +5091,59 @@ public class DailyReportUploadService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                str += "'"+map.get("ztId")+"',"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        str = str.substring(0,str.length()-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sqlCondition = " "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += " and lastEditedDate>='"+startDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += " and lastEditedDate<='"+endDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "  select * from ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " select count(distinct id) total,'resolve' `status` from zt_bug " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where  (resolvedBy in ("+str+")) or  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " (assignedTo in ("+str+") and `status` in ('closed')) or " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " (closedBy in ("+str+")and `status` in ('closed')) " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  and deleted='0' " +sqlCondition+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " union ALL " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " select count(distinct id) total,'unresolved' `status` from zt_bug " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where assignedTo in ("+str+") and `status` in ('active','resolved') and deleted='0' " +sqlCondition+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " )A "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String url = "http://172.19.103.134:10023/ykyy/jdbcSQLQuery"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> params = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("sql",sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpResponse response = HttpUtils.doGet(url,params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String content = response.getContent(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("response:"+content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject rs = JSON.parseObject(content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long total = 0l;//总bug数; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long resolveBugTotal=0l;//已解决BUG数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long unresolvedBugTotal=0l;//待解决BUG数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer status = rs.getInteger("status"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(status!=null&&status == 200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray array = rs.getJSONArray("detailModelList"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (array!=null&&array.size()!=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                total = array.stream().mapToLong(t ->((JSONObject)t).get("total") == null ? 0 :Long.parseLong(((JSONObject)t).getString("total"))).sum(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (int i=0;i<array.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    JSONObject tmp = array.getJSONObject(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String bugStatus = tmp.getString("status"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Long statusTotal  =Long.parseLong(tmp.getString("total")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if("resolve".equals(bugStatus)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        resolveBugTotal = statusTotal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        unresolvedBugTotal = statusTotal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(str)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            str = str.substring(0,str.length()-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition = " "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(startDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                startDate = DateUtil.strToStrShort(startDate)+" 00:00:00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sqlCondition += " and lastEditedDate>='"+startDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(endDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                endDate = DateUtil.strToStrShort(endDate)+" 23:59:59"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sqlCondition += " and lastEditedDate<='"+endDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sql = "  select * from ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " select count(distinct id) total,'resolve' `status` from zt_bug " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " where  ((resolvedBy in ("+str+")) or  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " (assignedTo in ("+str+") and `status` in ('closed')) or " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " (closedBy in ("+str+")and `status` in ('closed'))) " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "  and deleted='0' " +sqlCondition+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " union ALL " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " select count(distinct id) total,'unresolved' `status` from zt_bug " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " where assignedTo in ("+str+") and `status` in ('active','resolved') and deleted='0' " +sqlCondition+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " )A "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String url = "http://172.19.103.134:10023/ykyy/jdbcSQLQuery"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String,Object> params = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("sql",sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            HttpResponse response = HttpUtils.doGet(url,params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String content = response.getContent(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("response:"+content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject rs = JSON.parseObject(content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Long total = 0l;//总bug数; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Long resolveBugTotal=0l;//已解决BUG数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Long unresolvedBugTotal=0l;//待解决BUG数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer status = rs.getInteger("status"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(status!=null&&status == 200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONArray array = rs.getJSONArray("detailModelList"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (array!=null&&array.size()!=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    total = array.stream().mapToLong(t ->((JSONObject)t).get("total") == null ? 0 :Long.parseLong(((JSONObject)t).getString("total"))).sum(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    for (int i=0;i<array.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        JSONObject tmp = array.getJSONObject(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        String bugStatus = tmp.getString("status"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        Long statusTotal  =Long.parseLong(tmp.getString("total")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if("resolve".equals(bugStatus)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            resolveBugTotal = statusTotal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            unresolvedBugTotal = statusTotal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("bugtotal",total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("resolveBugTotal",resolveBugTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("unresolvedBugTotal",unresolvedBugTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("bugtotal",total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("resolveBugTotal",resolveBugTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("unresolvedBugTotal",unresolvedBugTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |