Browse Source

Merge branch 'dev' of liubing/wlyy2.0 into dev

liubing 2 years ago
parent
commit
5ec8c29034

+ 34 - 14
business/base-service/src/main/java/com/yihu/jw/dailyReport/service/DailyReportUploadService.java

@ -2245,10 +2245,14 @@ public class DailyReportUploadService {
        if (StringUtils.isNotBlank(endDate)){
            updateTimeSql += " and up.report_date<='"+endDate+"' ";
        }
        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," +
                " 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 " +
                "  LEFT JOIN base_doctor_daily_report_upload up on up.id = de.report_id "+updateTimeSql+" where i.del=1 ";
        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( " +
                " select de.report_item_id,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_detail de Inner JOIN base_doctor_daily_report_upload up on up.id = de.report_id " +updateTimeSql+
                "  group by de.report_item_id " +
                " )A on i.id = A.report_item_id where i.del=1 ";
        String sqlCount = " select count(distinct i.id) from base_daily_report_item i where i.del=1 ";
        if (StringUtils.isNotBlank(title)){
            sqlCondition +=" and i.title like '%"+title+"%' ";
@ -2275,31 +2279,39 @@ public class DailyReportUploadService {
        return PageEnvelop.getSuccessListWithPage("查询成功",itemDOS,page,size,count);
    }
    public List<Map<String,Object>> statisticReportItemById(String user,String item_id,Integer type) throws Exception {
    public List<Map<String,Object>> statisticReportItemById(String user,String item_id,Integer type,String startDate,String endDate) 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 = " ";
        if (StringUtils.isNotBlank(startDate)){
            updateTimeSql += " and up.report_date>='"+startDate+"' ";
        }
        if (StringUtils.isNotBlank(endDate)){
            updateTimeSql += " and up.report_date<='"+endDate+"' ";
        }
        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 " +
                    "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+"' " +
                    "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  " +
                    "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+"' " +
                    "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 " +
                    "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+"' " +
                    "group by i.id,DATE_FORMAT(de.create_time,'%Y-%m') order by time asc ";
        }else {
@ -2325,7 +2337,7 @@ public class DailyReportUploadService {
        return list;
    }
    public List<Map<String,Object>> statisticReportItemMembersById(String user,String item_id,Integer type,String member) throws Exception {
    public List<Map<String,Object>> statisticReportItemMembersById(String user,String item_id,Integer type,String member,String startDate,String endDate ) 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){
@ -2335,6 +2347,14 @@ public class DailyReportUploadService {
        if (StringUtils.isNotBlank(member)){
            memberSql = " and up.doctor_id='"+member+"' ";
        }
        String updateTimeSql = " ";
        if (StringUtils.isNotBlank(startDate)){
            updateTimeSql += " and up.report_date>='"+startDate+"' ";
        }
        if (StringUtils.isNotBlank(endDate)){
            updateTimeSql += " and up.report_date<='"+endDate+"' ";
        }
        String searchTimeFormat = "";
        String uploadTimeFormat = "";
        if(0==type){
@ -2342,7 +2362,7 @@ public class DailyReportUploadService {
                    " 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'," +
                    " DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'searchTime' " +
                    "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 de.report_id = up.id " +
                    "on i.id = de.report_item_id INNER JOIN base_doctor_daily_report_upload up on de.report_id = up.id " +updateTimeSql+
                    "where 1=1 and i.id='"+item_id+"' " +memberSql+
                    "group by i.id,up.doctor_id order by completionHour desc ";
            searchTimeFormat=" DATE_FORMAT(de.create_time,'%Y-%m-%d') ";
@ -2353,7 +2373,7 @@ public class DailyReportUploadService {
                    " 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', " +
                    "DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'searchTime' " +
                    "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 de.report_id = up.id " +
                    "on i.id = de.report_item_id INNER JOIN base_doctor_daily_report_upload up on de.report_id = up.id " +updateTimeSql+
                    "where 1=1 and i.id='"+item_id+"' " +
                    "group by i.id,up.doctor_id  order by time asc ";
            searchTimeFormat=" DATE_FORMAT(de.create_time,'%Y-%m-%d') ";
@ -2363,7 +2383,7 @@ public class DailyReportUploadService {
                    " 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', " +
                    "DATE_FORMAT(de.create_time,'%Y%v') as 'searchTime' " +
                    "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 de.report_id = up.id " +
                    "on i.id = de.report_item_id INNER JOIN base_doctor_daily_report_upload up on de.report_id = up.id " +updateTimeSql+
                    "where 1=1 and i.id='"+item_id+"' " +memberSql+
                    "group by i.id,up.doctor_id  order by time asc ";
            searchTimeFormat=" DATE_FORMAT(de.create_time,'%Y%v') ";
@ -2373,7 +2393,7 @@ public class DailyReportUploadService {
                    " 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', " +
                    "DATE_FORMAT(de.create_time,'%Y-%m') as 'searchTime' " +
                    "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 de.report_id = up.id " +
                    "on i.id = de.report_item_id INNER JOIN base_doctor_daily_report_upload up on de.report_id = up.id " +updateTimeSql+
                    "where 1=1 and i.id='"+item_id+"' " +memberSql+
                    "group by i.id,up.doctor_id  order by time asc ";
            searchTimeFormat=" DATE_FORMAT(de.create_time,'%Y-%m') ";
@ -2393,7 +2413,7 @@ public class DailyReportUploadService {
                tmp.put("timeRange",getRangeDouble(completionHour,totalHour));
                String doctorId = tmp.get("doctor_id").toString();
                sql = " select up.doctor_name,"+uploadTimeFormat+" as report_date ,CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour " +
                        " from base_daily_report_detail de  INNER JOIN base_doctor_daily_report_upload up on de.report_id = up.id  " +
                        " from base_daily_report_detail de  INNER JOIN base_doctor_daily_report_upload up on de.report_id = up.id  " +updateTimeSql+
                        "where  de.report_item_id='"+item_id+"' and up.doctor_id='"+doctorId+"' " +
                        "GROUP BY "+searchTimeFormat+" ORDER BY report_date asc ";
                List<Map<String,Object>> timeUseList = jdbcTemplate.queryForList(sql);

+ 10 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/dailyReport/DailyReportUploadPoint.java

@ -706,10 +706,14 @@ public class DailyReportUploadPoint extends EnvelopRestEndpoint {
                                               @RequestParam(value = "user", required = true) String user,
                                               @ApiParam(name = "item_id", value = "item_id")
                                               @RequestParam(value = "item_id", required = true) String item_id,
                                               @ApiParam(name = "startDate", value = "startDate")
                                                   @RequestParam(value = "startDate", required = false) String startDate,
                                               @ApiParam(name = "endDate", value = "endDate")
                                                   @RequestParam(value = "endDate", required = false) String endDate,
                                               @ApiParam(name = "type", value = "1天、2周、3月")
                                               @RequestParam(value = "type",defaultValue = "1", required = false) Integer type) {
        try {
            return ListEnvelop.getSuccess("success",dailyReportUploadService.statisticReportItemById(user,item_id,type));
            return ListEnvelop.getSuccess("success",dailyReportUploadService.statisticReportItemById(user,item_id,type,startDate,endDate));
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
@ -721,12 +725,16 @@ public class DailyReportUploadPoint extends EnvelopRestEndpoint {
                                               @RequestParam(value = "user", required = true) String user,
                                               @ApiParam(name = "item_id", value = "item_id")
                                               @RequestParam(value = "item_id", required = true) String item_id,
                                               @ApiParam(name = "startDate", value = "startDate")
                                               @RequestParam(value = "startDate", required = false) String startDate,
                                               @ApiParam(name = "endDate", value = "endDate")
                                               @RequestParam(value = "endDate", required = false) String endDate,
                                               @ApiParam(name = "type", value = "0全部不按日期进行统计,1天、2周、3月")
                                               @RequestParam(value = "type",defaultValue = "1", required = false) Integer type,
                                               @ApiParam(name = "member", value = "指定查看某个成员的用时")
                                               @RequestParam(value = "member", required = false) String member) {
        try {
            return ListEnvelop.getSuccess("success",dailyReportUploadService.statisticReportItemMembersById(user,item_id,type,member));
            return ListEnvelop.getSuccess("success",dailyReportUploadService.statisticReportItemMembersById(user,item_id,type,member,startDate,endDate));
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }