Browse Source

代码修改

liubing 2 năm trước cách đây
mục cha
commit
ccf4fcd550

+ 21 - 44
business/base-service/src/main/java/com/yihu/jw/dailyReport/service/DailyReportUploadService.java

@ -2080,14 +2080,15 @@ public class DailyReportUploadService {
                " and it.del=1 and it.state>=0 and pd.create_time>='"+startTime+"' and pd.create_time<='"+endTime+"'  " +
                " where (it.completion_time is null or it.completion_time>='"+startTime+"') " ;
        if (!adminFlag){
            sql +=" and i.create_user='"+user+"' ";
            sql +=" and it.create_user='"+user+"' ";
        }
        sql +=  "GROUP BY it.id ORDER BY it.title,it.create_time desc ";
        List<Map<String,Object>> projectlist = jdbcTemplate.queryForList(sql);
        sql = " select up.doctor_id,up.doctor_name,doc.job_title_name,dh.dept_name,up.week_name,up.report_date, " +
                "CASE up.leave_state WHEN 1 THEN '请假' else '未请假' END as 'leave_state',IFNULL(up.leave_hour,0) leave_hour, " +
                "it.title,it.content,rd.sort,rd.report_content,IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0)) 'completion_hour', " +
                "DATE_FORMAT(rd.create_time,'%Y-%m-%d %H:%i:%S') create_time,DATE_FORMAT(rd.verification_time,'%Y-%m-%d %H:%i:%S') verification_time,rd.remark " +
                "DATE_FORMAT(rd.create_time,'%Y-%m-%d %H:%i:%S') create_time,DATE_FORMAT(rd.verification_time,'%Y-%m-%d %H:%i:%S') verification_time," +
                " CASE rd.state WHEN 1 THEN '已核实' ELSE '未核实' END as 'verification_state',rd.verification_user_name,CASE rd.doubt WHEN 1 THEN '存疑' ELSE '无存疑' END as 'doubt', rd.remark " +
                "from base_doctor_daily_report_upload up INNER JOIN base_doctor doc on up.doctor_id = doc.id  " +
                "INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 LEFT JOIN  " +
                "base_daily_report_detail rd on up.id = rd.report_id " +
@ -2145,7 +2146,7 @@ public class DailyReportUploadService {
                "CASE up.leave_state WHEN 1 THEN '请假' else '未请假' END as 'leave_state',IFNULL(up.leave_hour,0) leave_hour, " +
                "it.title,it.content,rd.sort,rd.report_content,IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0)) 'completion_hour', " +
                "DATE_FORMAT(rd.create_time,'%Y-%m-%d %H:%i:%S') create_time,DATE_FORMAT(rd.verification_time,'%Y-%m-%d %H:%i:%S') verification_time," +
                " rd.remark " +
                " CASE rd.state WHEN 1 THEN '已核实' ELSE '未核实' END as 'verification_state',rd.verification_user_name,CASE rd.doubt WHEN 1 THEN '存疑' ELSE '无存疑' END as 'doubt', rd.remark " +
                "from base_doctor_daily_report_upload up INNER JOIN base_doctor doc on up.doctor_id = doc.id  " +
                "INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 LEFT JOIN  " +
                "base_daily_report_detail rd on up.id = rd.report_id " +
@ -2326,61 +2327,31 @@ public class DailyReportUploadService {
        }
        i=2;
        //记录所需要合并的信息 (人员、日期、上报日期)
        int a1=0,b1=0,c1=0,d1=0;//姓名
        int a2=3,b2=0,c2=0,d2=0;//weekName
        int a1=0,b1=0,c1=0,d1=0;//医生姓名
        int a3=4,b3=0,c3=0,d3=0;//上报日期
        String doctorIdMerge =null;
        String doctorNameMerge = null;
        String weekNameMerge = null;
        String reportDateMerge = null;
        for (Map<String,Object> completeTmp:userCompleteList){
            String doctorName = null==completeTmp.get("doctor_name")?"":completeTmp.get("doctor_name").toString();
            String weekName = null==completeTmp.get("week_name")?"":completeTmp.get("week_name").toString();
            String reportDate = null==completeTmp.get("report_date")?"":completeTmp.get("report_date").toString();
            String doctorId = null==completeTmp.get("doctor_id")?"":completeTmp.get("doctor_id").toString();
            if (null==doctorIdMerge){
                doctorIdMerge = doctorId;
                b1=i;
                d1=0;
            }
            if (!doctorId.equals(doctorIdMerge)){
                sheet.mergeCells(a1, b1, c1, d1);
                sheet.mergeCells(a1+1, b1, c1, d1);//部门
                sheet.mergeCells(a1+2, b1, c1, d1);//岗位
                sheet.mergeCells(a2, b2, c2, d2);
                sheet.mergeCells(a3, b3, c3, d3);
                sheet.mergeCells(a3-1, b3, c3, d3);//weekName
                sheet.mergeCells(a3,b3, c3, d3);//上报日期
                sheet.mergeCells(a3+1, b3, c3, d3);//请假
                sheet.mergeCells(a3+2, b3, c3, d3);//请假时长
                doctorIdMerge = doctorId;
                b1=i;d1=0;
                b2=i;d2=0;
                b3=i;d3=0;
            }else {
                if (null==doctorNameMerge){
                    doctorNameMerge = doctorName;
                    b1=i;
                    d1=0;
                }
                if (doctorName.equals(doctorNameMerge)){
                    d1=i;
                }else {
                    doctorNameMerge = doctorName;
                    sheet.mergeCells(a1, b1, c1, d1);
                    sheet.mergeCells(a1+1, b1, c1, d1);//部门
                    sheet.mergeCells(a1+2, b1, c1, d1);//岗位
                    b1=i;
                    d1=0;
                }
                if (null==weekNameMerge){
                    weekNameMerge = weekName;
                    b2=i;
                    d2=0;
                }
                if (weekName.equals(weekNameMerge)){
                    d2=i;
                }else {
                    weekNameMerge = weekName;
                    sheet.mergeCells(a2, b2, c2, d2);
                    b2=i;
                    d2=0;
                }
            }else {//同一个医生。
                d1=i;
                if (null==reportDateMerge){
                    reportDateMerge = reportDate;
                    b3=i;
@ -2390,7 +2361,10 @@ public class DailyReportUploadService {
                    d3=i;
                }else {
                    reportDateMerge = reportDate;
                    sheet.mergeCells(a3-1, b3, c3, d3);//weekName
                    sheet.mergeCells(a3, b3, c3, d3);
                    sheet.mergeCells(a3+1, b3, c3, d3);//请假
                    sheet.mergeCells(a3+2, b3, c3, d3);//请假时长
                    b3=i;
                    d3=0;
                }
@ -2418,8 +2392,11 @@ public class DailyReportUploadService {
        sheet.mergeCells(a1, b1, c1, d1);
        sheet.mergeCells(a1+1, b1, c1, d1);//部门
        sheet.mergeCells(a1+2, b1, c1, d1);//岗位
        sheet.mergeCells(a2, b2, c2, d2);
        sheet.mergeCells(a3, b3, c3, d3);
        sheet.mergeCells(a3-1, b3, c3, d3);//weekName
        sheet.mergeCells(a3,b3, c3, d3);//上报日期
        sheet.mergeCells(a3+1, b3, c3, d3);//请假
        sheet.mergeCells(a3+2, b3, c3, d3);//请假时长
        wwb.write();
        wwb.close();
    }