Commit 18174a848fd39a3bd6f67bdb0d2eb89bf497a0b6

Authored by cfl
1 parent f861aa39bc
Exists in dev

修改追访记录接口

Showing 10 changed files with 152 additions and 6 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/aop/LogsAspect.java View file @ 18174a8
  1 +package com.lyms.talkonlineweb.aop;
  2 +
  3 +import lombok.extern.log4j.Log4j2;
  4 +import lombok.extern.slf4j.Slf4j;
  5 +import org.aspectj.lang.JoinPoint;
  6 +import org.aspectj.lang.annotation.AfterReturning;
  7 +import org.aspectj.lang.annotation.Aspect;
  8 +import org.aspectj.lang.annotation.Before;
  9 +import org.aspectj.lang.annotation.Pointcut;
  10 +import org.springframework.stereotype.Component;
  11 +import org.springframework.web.context.request.RequestContextHolder;
  12 +import org.springframework.web.context.request.ServletRequestAttributes;
  13 +
  14 +import javax.servlet.http.HttpServletRequest;
  15 +import java.util.Arrays;
  16 +
  17 +/**
  18 + * @Author: cfl
  19 + * @Description:切面日志管理
  20 + * @Date:Created in 2023/9/8 19:03.
  21 + */
  22 +@Aspect
  23 +@Component
  24 +@Log4j2
  25 +public class LogsAspect {
  26 +
  27 +
  28 + ThreadLocal<Long> startTime = new ThreadLocal();
  29 +
  30 + @Pointcut("execution(public * com.lyms.talkonlineweb.controller..*.*(..))")
  31 + public void webLog(){}
  32 +
  33 + @Before("webLog()")
  34 + public void doBefore(JoinPoint joinPoint) throws Throwable {
  35 + startTime.set(System.currentTimeMillis());
  36 + // 接收到请求,记录请求内容
  37 + ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
  38 + HttpServletRequest request = attributes.getRequest();
  39 +
  40 + // 记录下请求内容
  41 + log.info("请求URL : " + request.getRequestURL().toString());
  42 + log.info("请求方式HTTP_METHOD : " + request.getMethod());
  43 + log.info("IP地址 : " + request.getRemoteAddr());
  44 + log.info("设计类CLASS_METHOD : " + joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName());
  45 + log.info("参数ARGS : " + Arrays.toString(joinPoint.getArgs()));
  46 +
  47 + }
  48 +
  49 + @AfterReturning(returning = "ret", pointcut = "webLog()")
  50 + public void doAfterReturning(Object ret) throws Throwable {
  51 + //处理完返回内容
  52 + log.info("返回RESPONSE : " + ret);
  53 + log.info("时间SPEND TIME : " + (System.currentTimeMillis() - startTime.get()));
  54 + }
  55 +
  56 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/XljcPatientController.java View file @ 18174a8
... ... @@ -9,6 +9,7 @@
9 9 import com.lyms.talkonlineweb.result.XljcPatientResult;
10 10 import com.lyms.talkonlineweb.service.LymsUserService;
11 11 import com.lyms.talkonlineweb.service.LymsXljcRecordService;
  12 +import com.lyms.talkonlineweb.util.BeanUtils;
12 13 import com.lyms.talkonlineweb.util.StringUtil;
13 14 import org.springframework.beans.factory.annotation.Autowired;
14 15 import org.springframework.web.bind.annotation.*;
... ... @@ -43,6 +44,10 @@
43 44  
44 45 Page<XljcPatientResult> page = new Page<>(current,size);
45 46 Page<XljcPatientResult> patientResults = lymsXljcRecordService.queryPatientList(page,patientRequest);
  47 +
  48 + for(XljcPatientResult result : patientResults.getRecords()){
  49 + result.setSexText(BeanUtils.tranferSexToText(result.getSex()));
  50 + }
46 51  
47 52 return BaseResponse.ok(patientResults);
48 53 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/XljcTraceController.java View file @ 18174a8
... ... @@ -2,17 +2,20 @@
2 2  
3 3 import cn.afterturn.easypoi.excel.ExcelExportUtil;
4 4 import cn.afterturn.easypoi.excel.entity.ExportParams;
  5 +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5 6 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 7 import com.lyms.talkonlineweb.annotation.TokenRequired;
7 8 import com.lyms.talkonlineweb.domain.LymsUser;
8 9 import com.lyms.talkonlineweb.domain.LymsXljcRecordTrace;
9 10 import com.lyms.talkonlineweb.enums.TraceStatusEnum;
  11 +import com.lyms.talkonlineweb.enums.TraceWayEnum;
10 12 import com.lyms.talkonlineweb.request.XljcTraceRequest;
11 13 import com.lyms.talkonlineweb.result.BaseResponse;
12 14 import com.lyms.talkonlineweb.result.XljcTraceRecord;
13 15 import com.lyms.talkonlineweb.service.LymsUserService;
14 16 import com.lyms.talkonlineweb.service.LymsXljcRecordTraceService;
15 17 import com.lyms.talkonlineweb.util.BeanUtils;
  18 +import com.lyms.talkonlineweb.util.DateUtil;
16 19 import com.lyms.talkonlineweb.util.StringUtil;
17 20 import org.apache.poi.ss.usermodel.Workbook;
18 21 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -21,6 +24,7 @@
21 24 import javax.servlet.ServletOutputStream;
22 25 import javax.servlet.http.HttpServletResponse;
23 26 import java.net.URLEncoder;
  27 +import java.util.ArrayList;
24 28 import java.util.Date;
25 29 import java.util.List;
26 30  
... ... @@ -73,6 +77,29 @@
73 77 record.setNextExamineStatusText(TraceStatusEnum.getName(record.getNextExamineStatus()));
74 78 }
75 79 return BaseResponse.ok(traceRecords);
  80 + }
  81 +
  82 + @GetMapping("/list/his/{archId}")
  83 + @TokenRequired
  84 + public BaseResponse traceArchHis(@PathVariable("archId") Integer archId, @RequestHeader String authorization){
  85 + //参数处理
  86 + //LymsUser curUser=lymsUserService.getUserByToken(authorization);
  87 + QueryWrapper<LymsXljcRecordTrace> queryWrapper = new QueryWrapper();
  88 + queryWrapper.eq("arch_id",archId);
  89 + queryWrapper.eq("next_examine_status",TraceStatusEnum.HAVE_TRACE.getCode());
  90 + List<LymsXljcRecordTrace> lymsXljcRecordTraces = lymsXljcRecordTraceService.list(queryWrapper);
  91 + List<XljcTraceRecord> records = new ArrayList<>();
  92 + for(LymsXljcRecordTrace recordTrace : lymsXljcRecordTraces){
  93 + XljcTraceRecord record = new XljcTraceRecord();
  94 + record.setTraceDate(DateUtil.getyyyy_MM_dd_HH_mm_ss(recordTrace.getTraceTime()));
  95 + record.setTracePerson(recordTrace.getTracePerson());
  96 + record.setTraceWayText(TraceWayEnum.getName(recordTrace.getTraceWay()));
  97 + record.setResult(recordTrace.getResult());
  98 + record.setNextExamineDate(DateUtil.getyyyy_MM_dd1(recordTrace.getNextExamineDate()));
  99 + records.add(record);
  100 + }
  101 +
  102 + return BaseResponse.ok(records);
76 103 }
77 104  
78 105 @PostMapping("/export")
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsXljcRecordTrace.java View file @ 18174a8
... ... @@ -64,7 +64,7 @@
64 64 private String tracePerson;
65 65  
66 66 /**
67   - * 追访方式
  67 + * 追访方式 1 电话追访 2 上门追访 3 其他
68 68 */
69 69 @TableField(value = "trace_way")
70 70 private Integer traceWay;
talkonlineweb/src/main/java/com/lyms/talkonlineweb/enums/TraceWayEnum.java View file @ 18174a8
  1 +package com.lyms.talkonlineweb.enums;
  2 +
  3 +import lombok.Getter;
  4 +
  5 +/**
  6 + * 追访方式
  7 + *
  8 + */
  9 +@Getter
  10 +public enum TraceWayEnum {
  11 +
  12 + WAY_TEL(1,"电话追访"),
  13 + WAY_HOME(2,"上门追访"),
  14 + WAY_OTHER(3,"其他");
  15 +
  16 + private Integer code;
  17 + private String name;
  18 +
  19 + TraceWayEnum(Integer code, String name){
  20 + this.code = code;
  21 + this.name = name;
  22 + }
  23 + public static String getName(Integer code) {
  24 + TraceWayEnum[] values = TraceWayEnum.values();
  25 + for (TraceWayEnum value : values) {
  26 + if (value.getCode().equals(code)) {
  27 + return value.getName();
  28 + }
  29 + }
  30 + return "";
  31 + }
  32 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/request/XljcTraceRequest.java View file @ 18174a8
... ... @@ -9,6 +9,10 @@
9 9  
10 10 private Integer overDays;
11 11  
  12 + private Integer overDaysMin;
  13 +
  14 + private Integer overDaysMax;
  15 +
12 16 private String traceTimeStart;
13 17  
14 18 private String traceTimeEnd;
talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/XljcArchiveResult.java View file @ 18174a8
... ... @@ -21,5 +21,7 @@
21 21  
22 22 @Excel(name = "电话", width = 15,orderNum = "5")
23 23 private String tel;
  24 +
  25 + private String birth;
24 26 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/XljcTraceRecord.java View file @ 18174a8
... ... @@ -8,8 +8,12 @@
8 8 @ExcelTarget("lyms_xljc_examine_trace")
9 9 public class XljcTraceRecord extends XljcArchiveResult{
10 10  
  11 +
  12 +
11 13 private Integer traceId;
12 14  
  15 + private Integer archId;
  16 +
13 17 private Integer rid;
14 18  
15 19 @Excel(name = "序号", width = 10,orderNum = "0")
... ... @@ -31,6 +35,10 @@
31 35  
32 36 @Excel(name = "追访结果", width = 15,orderNum = "10")
33 37 private String result;
  38 +
  39 + private String tracePerson;
  40 +
  41 + private String traceWayText;
34 42  
35 43  
36 44  
talkonlineweb/src/main/resources/mapper/LymsXljcRecordMapper.xml View file @ 18174a8
... ... @@ -184,6 +184,7 @@
184 184 a.tel,
185 185 a.age,
186 186 a.sex,
  187 + a.birth,
187 188 case when r.upload_status = 0 then '未上传' else '已上传' end uploadStatusText,
188 189 r.upload_time uploadTime,
189 190 r.examine_time examineTime,
talkonlineweb/src/main/resources/mapper/LymsXljcRecordTraceMapper.xml View file @ 18174a8
... ... @@ -22,8 +22,10 @@
22 22  
23 23 <select id="queryXljcTraceRecords" parameterType="com.lyms.talkonlineweb.request.XljcTraceRequest"
24 24 resultType="com.lyms.talkonlineweb.result.XljcTraceRecord">
  25 + select * from (
25 26 select
26 27 r.id as rid,
  28 + r.arch_id as archId,
27 29 trace.id as traceId,
28 30 a.pname,
29 31 a.idno,
... ... @@ -34,7 +36,7 @@
34 36 trace.next_examine_status as nextExamineStatus,
35 37 trace.trace_time as traceTime,
36 38 DATEDIFF((case when next_examine_status = 0 then now() else trace_time end),
37   - next_examine_date) as overDays,
  39 + next_examine_date) as overDays,
38 40 trace.result
39 41 from
40 42 lyms_xljc_archive a,
41 43  
42 44  
... ... @@ -44,12 +46,12 @@
44 46 a.id = r.arch_id
45 47 and r.id = trace.rid
46 48 and trace.yn = 1
47   - and trace.next_examine_date &lt; DATE_SUB(CURDATE() ,INTERVAL 7 DAY)
  49 + and trace.next_examine_date &lt;= DATE_SUB(CURDATE() ,INTERVAL 7 DAY)
48 50 <if test="trace.examineHid != null">
49   - and r.examine_hid = #{trace.examineHid}
  51 + and r.examine_hid = #{trace.examineHid}
50 52 </if>
51 53 <if test="trace.overDays != null">
52   - and trace.next_examine_date = DATE_SUB(CURDATE() ,INTERVAL #{trace.overDays} DAY)
  54 + and trace.next_examine_date = DATE_SUB(CURDATE() ,INTERVAL #{trace.overDays} DAY)
53 55 </if>
54 56 <if test="trace.traceTimeStart != null and trace.traceTimeStart != '' ">
55 57 and trace.trace_time > STR_TO_DATE(#{trace.traceTimeStart},'%Y-%m-%d')
... ... @@ -64,7 +66,16 @@
64 66 <if test="trace.key != null and trace.key != '' ">
65 67 and (a.pname = #{trace.key } or a.idno = #{trace.key } or a.tel = #{trace.key })
66 68 </if>
67   - order by trace.next_examine_date
  69 + ) a
  70 + where 1=1
  71 + <if test="trace.overDaysMin != null">
  72 + and a.overDays >= #{trace.overDaysMin}
  73 + </if>
  74 + <if test="trace.overDaysMax != null">
  75 + and a.overDays &lt;= #{trace.overDaysMax}
  76 + </if>
  77 +
  78 + order by a.nextExamineDate
68 79  
69 80 </select>
70 81