Commit 0f123e92fb315553b209cb93722beb0f662ed44e

Authored by liquanyu
1 parent f874f4a232
Exists in master and in 1 other branch dev

患者端功能开发

Showing 25 changed files with 1078 additions and 8 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/annotation/Resubmit.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.annotation;
  2 +
  3 +
  4 +import java.lang.annotation.*;
  5 +
  6 +/**
  7 + * @author lqy
  8 + * 表单重复提交注解
  9 + */
  10 +@Target(ElementType.METHOD)
  11 +@Retention(RetentionPolicy.RUNTIME)
  12 +@Documented
  13 +public @interface Resubmit {
  14 + /**
  15 + * 延时时间 在延时多久后可以再次提交
  16 + *
  17 + * @return Time unit is one second
  18 + */
  19 + int delaySeconds() default 6;
  20 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/aop/ResubmitDataAspect.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.aop;
  2 +
  3 +
  4 +
  5 +import com.lyms.talkonlineweb.annotation.Resubmit;
  6 +import com.lyms.talkonlineweb.domain.BaseModel;
  7 +import com.lyms.talkonlineweb.lock.ResubmitLock;
  8 +import com.lyms.talkonlineweb.result.BaseResponse;
  9 +import com.lyms.talkonlineweb.util.JsonUtil;
  10 +import com.lyms.talkonlineweb.util.StringUtil;
  11 +import lombok.extern.slf4j.Slf4j;
  12 +import org.aspectj.lang.ProceedingJoinPoint;
  13 +import org.aspectj.lang.annotation.Around;
  14 +import org.aspectj.lang.annotation.Aspect;
  15 +import org.aspectj.lang.reflect.MethodSignature;
  16 +import org.springframework.stereotype.Component;
  17 +
  18 +
  19 +import java.lang.reflect.Method;
  20 +
  21 +/**
  22 + * @author lqy
  23 + * 重复提交处理
  24 + */
  25 +@Slf4j
  26 +@Aspect
  27 +@Component
  28 +public class ResubmitDataAspect {
  29 +
  30 + private final static Object PRESENT = new Object();
  31 +
  32 + @Around("@annotation(resubmit)")
  33 + public Object handleResubmit(ProceedingJoinPoint joinPoint, Resubmit resubmit) throws Throwable {
  34 + Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
  35 + //获取注解信息
  36 + Resubmit annotation = method.getAnnotation(Resubmit.class);
  37 + int delaySeconds = annotation.delaySeconds();
  38 + Object[] pointArgs = joinPoint.getArgs();
  39 + StringBuilder key = new StringBuilder();
  40 + if (pointArgs != null && pointArgs.length > 0)
  41 + {
  42 + for (Object param : pointArgs)
  43 + {
  44 + if (param instanceof BaseModel) {
  45 + String paramStr = JsonUtil.obj2Str(param);
  46 + //生成加密参数 使用了content_MD5的加密方式
  47 + key.append(ResubmitLock.handleKey(paramStr));
  48 + }
  49 + else if (param != null)
  50 + {
  51 + key.append(ResubmitLock.handleKey(param.toString()));
  52 + }
  53 + }
  54 +
  55 + if (StringUtil.isNotEmpty(key.toString()))
  56 + {
  57 + //执行锁
  58 + boolean lock = false;
  59 + try
  60 + {
  61 + //设置解锁key
  62 + lock = ResubmitLock.getInstance().lock(key.toString(), PRESENT);
  63 + if (lock)
  64 + { //放行
  65 + return joinPoint.proceed();
  66 + }
  67 + else
  68 + { //响应重复提交异常
  69 + BaseResponse response = new BaseResponse();
  70 + response.setErrorcode(1);
  71 + response.setErrormsg("请勿重复提交");
  72 + return response;
  73 + }
  74 + }
  75 + finally
  76 + {
  77 + //设置解锁key和解锁时间
  78 + ResubmitLock.getInstance().unLock(lock, key.toString(), delaySeconds);
  79 + }
  80 + }
  81 + }
  82 + return joinPoint.proceed();
  83 + }
  84 +
  85 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java View file @ 0f123e9
1 1 package com.lyms.talkonlineweb.controller;
2 2  
3   -import com.alibaba.fastjson.JSONArray;
4   -import com.alibaba.fastjson.JSONObject;
5   -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
6 3 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
7 4 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8 5 import com.lyms.talkonlineweb.domain.*;
9 6 import com.lyms.talkonlineweb.result.BaseResponse;
10 7 import com.lyms.talkonlineweb.service.*;
11 8 import com.lyms.talkonlineweb.util.Constant;
12   -import com.lyms.talkonlineweb.util.HXService;
13 9 import com.lyms.talkonlineweb.util.JwtUtils;
14 10 import lombok.extern.log4j.Log4j2;
15   -import lombok.extern.slf4j.Slf4j;
16 11 import org.springframework.beans.factory.annotation.Autowired;
17 12 import org.springframework.validation.BindingResult;
18 13 import org.springframework.validation.annotation.Validated;
19 14 import org.springframework.web.bind.annotation.*;
20 15  
21   -import java.util.*;
22   -import java.util.stream.Collectors;
  16 +import java.util.Date;
  17 +import java.util.HashMap;
  18 +import java.util.List;
  19 +import java.util.Map;
23 20  
24 21 /**
25 22 * 患者管理
26 23 */
27 24 @RestController
28 25 @RequestMapping("pat")
29   -@Slf4j
  26 +@Log4j2
30 27 public class PatientController {
31 28  
32 29 @Autowired
... ... @@ -39,6 +36,9 @@
39 36 private LymsIllnessService lymsIllnessService;//疾病
40 37  
41 38 @Autowired
  39 + private LymsTkcardService lymsTkcardService;//问诊记录
  40 +
  41 + @Autowired
42 42 private PatientInfoService patientInfoService;//患者视图
43 43  
44 44 @Autowired
... ... @@ -50,6 +50,15 @@
50 50 @Autowired
51 51 private HXService hxService;
52 52  
  53 + //医院
  54 + @Autowired
  55 + private LymsHospitalService lymsHospitalService;
  56 + //医生
  57 + @Autowired
  58 + private LymsDoctorService lymsDoctorService;
  59 + //关注
  60 + @Autowired
  61 + private LymsAttentionService lymsAttentionService;
53 62  
54 63 /**
55 64 * 获取患者列表
... ... @@ -125,6 +134,9 @@
125 134 f=lymsPcaseService.saveOrUpdate(pcase);
126 135 String[] iArr=illness.split(",");
127 136  
  137 + log.info(patient);
  138 + log.info(pcase);
  139 +
128 140 Map param=new HashMap();
129 141  
130 142 for (int i = 0; i < iArr.length; i++) {
... ... @@ -248,5 +260,242 @@
248 260 return baseResponse;
249 261 }
250 262  
  263 +
  264 + /**
  265 + * 传入患者id,获取病历对应的医院列表
  266 + * @param lymsPcase
  267 + * @return
  268 + */
  269 + @GetMapping("getPatientHospitals")
  270 + public BaseResponse getPatientHospitals(LymsPcase lymsPcase){
  271 + BaseResponse baseResponse = new BaseResponse();
  272 + List<LymsPcase> pcases =lymsPcaseService.list(Wrappers.query(lymsPcase));
  273 + baseResponse.setObject(pcases);
  274 + return baseResponse;
  275 + }
  276 +
  277 +
  278 + /**
  279 + * 查询患者在某个医院的详细诊断病历
  280 + * 需要传入患者id和医院id
  281 + * @param pid 患者id
  282 + * @param hid 医院id
  283 + * @return
  284 + */
  285 + @GetMapping("getPatientHospitalPcase")
  286 + public BaseResponse getPatientHospitalPcase(int pid,int hid,
  287 + @RequestParam(required = false) String keyword){
  288 + BaseResponse baseResponse = new BaseResponse();
  289 + Map data = new HashMap(5);
  290 + LymsPatient patient = lymsPatientService.getById(pid);
  291 + //患者基本信息
  292 + data.put("patient",patient);
  293 +
  294 + //医院信息
  295 + LymsHospital hospital = lymsHospitalService.getById(pid);
  296 + data.put("hospital",hospital);
  297 +
  298 + List<Integer> ilist = new ArrayList<>();
  299 + if (StringUtil.isNotEmpty(keyword)){
  300 + LambdaQueryWrapper<LymsIllness> iwrapper = new QueryWrapper().lambda();
  301 + iwrapper.like(LymsIllness::getIname, keyword);
  302 + List<LymsIllness> illnesses = lymsIllnessService.list(iwrapper);
  303 + if (CollectionUtils.isNotEmpty(illnesses)){
  304 + illnesses.stream().forEach(i -> {
  305 + ilist.add(i.getPcid());
  306 + });
  307 + }
  308 + }
  309 + //查询患者的就诊记录
  310 + LambdaQueryWrapper<LymsPcase> wrapper = new QueryWrapper().lambda();
  311 + wrapper.eq(LymsPcase::getPid, pid);
  312 + wrapper.eq(LymsPcase::getHid, hid);
  313 + if (StringUtil.isNotEmpty(keyword)){
  314 + wrapper.and(i -> i.like(LymsPcase::getDname, keyword).or().like(LymsPcase::getDtname, keyword));
  315 + if (CollectionUtils.isNotEmpty(ilist)){
  316 + wrapper.or(i -> i.in(LymsPcase::getPcid, ilist));
  317 + }
  318 + }
  319 + wrapper.orderByDesc(LymsPcase::getCreatedtime);
  320 + List<LymsPcase> lymsPcaseList = lymsPcaseService.list(wrapper);
  321 +
  322 + List<PatientPcaseResult> pcases = new ArrayList<>();
  323 + if (CollectionUtils.isNotEmpty(lymsPcaseList)){
  324 + lymsPcaseList.forEach(destModel -> {
  325 + PatientPcaseResult result = new PatientPcaseResult();
  326 + result.setPid(destModel.getPid());
  327 + result.setDepartName(destModel.getDname());
  328 + result.setDoctorName(destModel.getDtname());
  329 + result.setCardNo(patient.getIdno());
  330 + result.setPatientName(patient.getPname());
  331 + result.setCcnt(patient.getCcnt());
  332 + result.setPhxid(patient.getHxid());
  333 + LymsDoctor doctor = lymsDoctorService.getById(destModel.getDtid());
  334 + result.setDhxid(doctor.getHxid());
  335 + result.setDtid(destModel.getDtid());
  336 + result.setCreatedby(DateUtil.getYyyyMmDdHhMmSs(destModel.getCreatedtime()));
  337 + pcases.add(result);
  338 + });
  339 + }
  340 + data.put("pcases",pcases);
  341 +
  342 + baseResponse.setObject(data);
  343 + return baseResponse;
  344 + }
  345 +
  346 +
  347 + /**
  348 + * 通过患者id查询患者的基本信息
  349 + * @param lymsPatient
  350 + * @return
  351 + */
  352 + @GetMapping("getPatientBaseInfo")
  353 + public BaseResponse getPatientBaseInfo(LymsPatient lymsPatient){
  354 +
  355 + BaseResponse baseResponse = new BaseResponse();
  356 +
  357 + Map data = new HashMap(6);
  358 + LymsPatient patients = lymsPatientService.getById(lymsPatient.getId());
  359 +
  360 + //查询患者的就诊记录
  361 + LambdaQueryWrapper<LymsPcase> wrapper = new QueryWrapper().lambda();
  362 + wrapper.eq(LymsPcase::getPid, lymsPatient.getId());
  363 + wrapper.orderByDesc(LymsPcase::getCreatedtime);
  364 + List<LymsPcase> lymsPcaseList = lymsPcaseService.list(wrapper);
  365 +
  366 + data.put("pid",patients.getId());
  367 + data.put("pname",patients.getPname());
  368 + data.put("psex",patients.getSex());
  369 + data.put("birth",patients.getBirth());
  370 + if (CollectionUtils.isNotEmpty(lymsPcaseList))
  371 + {
  372 + data.put("mobile",lymsPcaseList.get(0).getMobile());
  373 + }
  374 + baseResponse.setObject(data);
  375 + return baseResponse;
  376 + }
  377 +
  378 +
  379 + /**
  380 + * 更新患者信息
  381 + * @param request
  382 + * @return
  383 + */
  384 + @PutMapping("updatePatientInfo")
  385 + public BaseResponse updatePatientInfo(@RequestBody PatientInfoRequest request){
  386 + BaseResponse baseResponse=new BaseResponse();
  387 + LymsPatient patients = lymsPatientService.getById(request.getPid());
  388 + patients.setBirth(request.getBirth());
  389 + patients.setPname(request.getPname());
  390 + patients.setSex(request.getPsex());
  391 + lymsPatientService.updateById(patients);
  392 +
  393 + //查询患者的就诊记录
  394 + LambdaQueryWrapper<LymsPcase> wrapper = new QueryWrapper().lambda();
  395 + wrapper.eq(LymsPcase::getPid, request.getPid());
  396 + wrapper.orderByDesc(LymsPcase::getCreatedtime);
  397 + List<LymsPcase> lymsPcaseList = lymsPcaseService.list(wrapper);
  398 + if (CollectionUtils.isNotEmpty(lymsPcaseList))
  399 + {
  400 + lymsPcaseList.forEach(lymsPcase -> {
  401 + lymsPcase.setMobile(request.getMobile());
  402 + lymsPcaseService.updateById(lymsPcase);
  403 + });
  404 + }
  405 + return baseResponse;
  406 + }
  407 +
  408 +
  409 + /**
  410 + * 患者的问诊记录接口
  411 + * @param lymsTkrecord 传入患者id参数
  412 + * @return
  413 + */
  414 + @GetMapping("getPatienttkrecord")
  415 + public BaseResponse getPatienttkrecord(LymsTkrecord lymsTkrecord){
  416 +
  417 + BaseResponse baseResponse = new BaseResponse();
  418 + LymsPatient patients = lymsPatientService.getById(lymsTkrecord.getPid());
  419 +
  420 + //查询患者的就诊记录
  421 + LambdaQueryWrapper<LymsTkrecord> wrapper = new QueryWrapper().lambda();
  422 + wrapper.eq(LymsTkrecord::getPid, lymsTkrecord.getPid());
  423 + wrapper.orderByDesc(LymsTkrecord::getCreatedtime);
  424 + List<LymsTkrecord> lymsTkrecords = lymsTkcardService.list(wrapper);
  425 +
  426 + List<Map> list = new ArrayList<>();
  427 + if (CollectionUtils.isNotEmpty(lymsTkrecords))
  428 + {
  429 + for(LymsTkrecord record : lymsTkrecords)
  430 + {
  431 + LymsPcase pcase = lymsPcaseService.getById(record.getPcid());
  432 +
  433 + Map data = new HashMap(20);
  434 + data.put("hospitalName",pcase.getHname());
  435 + data.put("hospitalLevel","");
  436 + data.put("doctorName",pcase.getDtname());
  437 + data.put("departName",pcase.getDname());
  438 + data.put("doctorLevel","");
  439 + data.put("patientName",patients.getPname());
  440 +
  441 + StringBuilder sb = new StringBuilder();
  442 + LambdaQueryWrapper<LymsIllness> iwrapper = new QueryWrapper().lambda();
  443 + iwrapper.like(LymsIllness::getPcid, pcase.getPcid());
  444 + List<LymsIllness> illnesses = lymsIllnessService.list(iwrapper);
  445 + if (CollectionUtils.isNotEmpty(illnesses))
  446 + {
  447 + illnesses.forEach(lymsIllness -> {
  448 + sb.append(lymsIllness.getIname());
  449 + sb.append(" ");
  450 + });
  451 + }
  452 +
  453 + data.put("iname",sb.toString());
  454 + data.put("createTime",DateUtil.getDateTime(record.getCreatedtime(),DateUtil.YYYY_MM_DD));
  455 + data.put("stat",record.getStat());
  456 +
  457 +
  458 + list.add(data);
  459 + }
  460 + }
  461 + baseResponse.setObject(list);
  462 + return baseResponse;
  463 + }
  464 +
  465 + /**
  466 + * 查询患者关注的医生记录
  467 + * @param lymsAttention 传入患者id参数
  468 + * @return
  469 + */
  470 + @GetMapping("getPatientAttentions")
  471 + public BaseResponse getPatientAttentions(LymsAttention lymsAttention){
  472 +
  473 + BaseResponse baseResponse = new BaseResponse();
  474 + //查询患者的关注医生记录
  475 + LambdaQueryWrapper<LymsAttention> wrapper = new QueryWrapper().lambda();
  476 + wrapper.eq(LymsAttention::getPid, lymsAttention.getPid());
  477 + wrapper.orderByDesc(LymsAttention::getCreatedtime);
  478 + List<LymsAttention> lymsAttentions = lymsAttentionService.list(wrapper);
  479 +
  480 + List<Map> list = new ArrayList<>();
  481 + if (CollectionUtils.isNotEmpty(lymsAttentions))
  482 + {
  483 + for(LymsAttention attention : lymsAttentions)
  484 + {
  485 + LymsDoctor doctor = lymsDoctorService.getById(attention.getDid());
  486 +
  487 + Map data = new HashMap(20);
  488 + data.put("doctorName",doctor.getDname());
  489 + data.put("departName",doctor.getDdname());
  490 + data.put("doctorLevel","");
  491 + data.put("hospitalName",doctor.getHname());
  492 + data.put("hospitalLevel","");
  493 + data.put("doctorDesc",doctor.getIntro());
  494 + list.add(data);
  495 + }
  496 + }
  497 + baseResponse.setObject(list);
  498 + return baseResponse;
  499 + }
251 500 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/BaseModel.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.domain;
  2 +
  3 +/**
  4 + * @ProjectName: talkonline
  5 + * @Package: com.lyms.talkonlineweb.domain
  6 + * @ClassName: BaseModel
  7 + * @Author: lqy
  8 + * @Description: 基础实体
  9 + * @Date: 2021-09-10 20:34
  10 + * @Version:
  11 + */
  12 +
  13 +public class BaseModel {
  14 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsAttention.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.domain;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.IdType;
  4 +import com.baomidou.mybatisplus.annotation.TableField;
  5 +import com.baomidou.mybatisplus.annotation.TableId;
  6 +import com.baomidou.mybatisplus.annotation.TableName;
  7 +import lombok.Data;
  8 +import lombok.ToString;
  9 +
  10 +import java.io.Serializable;
  11 +import java.util.Date;
  12 +
  13 +/**
  14 + * @ProjectName: talkonline
  15 + * @Package: com.lyms.talkonlineweb.domain
  16 + * @ClassName: LymsAttention
  17 + * @Author: lqy
  18 + * @Description: 关注表
  19 + * @Date: 2021-09-10 16:08
  20 + * @Version:
  21 + */
  22 +@TableName(value ="lyms_attention")
  23 +@Data
  24 +@ToString
  25 +public class LymsAttention implements Serializable {
  26 +
  27 + /**
  28 + *
  29 + */
  30 + @TableId(value = "id", type = IdType.AUTO)
  31 + private Integer id;
  32 +
  33 + /**
  34 + * 患者id
  35 + */
  36 + @TableField(value = "pid")
  37 + private Integer pid;
  38 +
  39 + /**
  40 + * 问诊医生
  41 + */
  42 + @TableField(value = "did")
  43 + private Integer did;
  44 +
  45 + /**
  46 + * 创建时间
  47 + */
  48 + @TableField(value = "createdtime")
  49 + private Date createdtime;
  50 +
  51 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsOrder.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.domain;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.IdType;
  4 +import com.baomidou.mybatisplus.annotation.TableField;
  5 +import com.baomidou.mybatisplus.annotation.TableId;
  6 +import com.baomidou.mybatisplus.annotation.TableName;
  7 +import lombok.Data;
  8 +import lombok.ToString;
  9 +
  10 +import java.io.Serializable;
  11 +import java.util.Date;
  12 +
  13 +/**
  14 + * @ProjectName: talkonline
  15 + * @Package: com.lyms.talkonlineweb.domain
  16 + * @ClassName: LymsAttention
  17 + * @Author: lqy
  18 + * @Description: 订单
  19 + * @Date: 2021-09-10 16:08
  20 + * @Version:
  21 + */
  22 +@TableName(value ="lyms_order")
  23 +@Data
  24 +@ToString
  25 +public class LymsOrder extends BaseModel implements Serializable {
  26 +
  27 + /**
  28 + *
  29 + */
  30 + @TableId(value = "id", type = IdType.AUTO)
  31 + private Integer id;
  32 +
  33 + /**
  34 + * 订单编号
  35 + */
  36 + @TableField(value = "orderno")
  37 + private String orderno;
  38 +
  39 + /**
  40 + * 患者id
  41 + */
  42 + @TableField(value = "pid")
  43 + private Integer pid;
  44 +
  45 + /**
  46 + * 商品编号
  47 + */
  48 + @TableField(value = "gid")
  49 + private Integer gid;
  50 +
  51 +
  52 + /**
  53 + * 价格
  54 + */
  55 + @TableField(value = "price")
  56 + private Integer price;
  57 + /**
  58 + * 购买数量
  59 + */
  60 + @TableField(value = "cnt")
  61 + private Integer cnt;
  62 +
  63 +
  64 + /**
  65 + * 创建人
  66 + */
  67 + @TableField(value = "createdby")
  68 + private Integer createdby;
  69 +
  70 + /**
  71 + * 创建时间
  72 + */
  73 + @TableField(value = "createdtime")
  74 + private Date createdtime;
  75 +
  76 + /**
  77 + * 更新人
  78 + */
  79 + @TableField(value = "updatedby")
  80 + private String updatedby;
  81 +
  82 + /**
  83 + * 更新时间
  84 + */
  85 + @TableField(value = "updatedtime")
  86 + private Date updatedtime;
  87 +
  88 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPatient.java View file @ 0f123e9
... ... @@ -40,6 +40,13 @@
40 40 private String ppasswd;
41 41  
42 42 /**
  43 + * 生日
  44 + */
  45 + @TableField(value = "birth")
  46 + private String birth;
  47 +
  48 +
  49 + /**
43 50 * 性别
44 51 */
45 52 @TableField(value = "sex")
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsTkrecord.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.domain;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.IdType;
  4 +import com.baomidou.mybatisplus.annotation.TableField;
  5 +import com.baomidou.mybatisplus.annotation.TableId;
  6 +import com.baomidou.mybatisplus.annotation.TableName;
  7 +import lombok.Data;
  8 +import lombok.ToString;
  9 +
  10 +import java.io.Serializable;
  11 +import java.util.Date;
  12 +
  13 +/**
  14 + * 问诊记录
  15 + * @TableName lyms_tkrecord
  16 + */
  17 +@TableName(value ="lyms_tkrecord")
  18 +@Data
  19 +@ToString
  20 +public class LymsTkrecord implements Serializable {
  21 +
  22 + /**
  23 + *
  24 + */
  25 + @TableId(value = "id", type = IdType.AUTO)
  26 + private Integer id;
  27 +
  28 + /**
  29 + * 患者id
  30 + */
  31 + @TableField(value = "pid")
  32 + private Integer pid;
  33 +
  34 + /**
  35 + * 问诊医生
  36 + */
  37 + @TableField(value = "did")
  38 + private Integer did;
  39 +
  40 + /**
  41 + * 诊断id
  42 + */
  43 + @TableField(value = "pcid")
  44 + private Integer pcid;
  45 +
  46 +
  47 + /**
  48 + * 问诊状态
  49 + */
  50 + @TableField(value = "stat")
  51 + private Integer stat;
  52 +
  53 +
  54 + /**
  55 + * 创建人
  56 + */
  57 + @TableField(value = "createdby")
  58 + private Integer createdby;
  59 +
  60 + /**
  61 + * 创建时间
  62 + */
  63 + @TableField(value = "createdtime")
  64 + private Date createdtime;
  65 +
  66 + /**
  67 + * 更新人
  68 + */
  69 + @TableField(value = "updatedby")
  70 + private Integer updatedby;
  71 +
  72 + /**
  73 + * 更新时间
  74 + */
  75 + @TableField(value = "updated_time")
  76 + private Date updatedTime;
  77 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/lock/ResubmitLock.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.lock;
  2 +
  3 +import com.lyms.talkonlineweb.util.MD5Util;
  4 +import lombok.extern.slf4j.Slf4j;
  5 +
  6 +import java.util.Objects;
  7 +import java.util.concurrent.ConcurrentHashMap;
  8 +import java.util.concurrent.ScheduledThreadPoolExecutor;
  9 +import java.util.concurrent.ThreadPoolExecutor;
  10 +import java.util.concurrent.TimeUnit;
  11 +
  12 +@Slf4j
  13 +public class ResubmitLock {
  14 + private static final ConcurrentHashMap<String, Object> LOCK_CACHE = new ConcurrentHashMap<>(200);
  15 + private static final ScheduledThreadPoolExecutor EXECUTOR = new ScheduledThreadPoolExecutor(5, new ThreadPoolExecutor.DiscardPolicy());
  16 +
  17 +
  18 + private ResubmitLock() {
  19 + }
  20 +
  21 + /**
  22 + * 静态内部类 单例模式
  23 + *
  24 + * @return
  25 + */
  26 + private static class SingletonInstance {
  27 + private static final ResubmitLock INSTANCE = new ResubmitLock();
  28 + }
  29 +
  30 + public static ResubmitLock getInstance() {
  31 + return SingletonInstance.INSTANCE;
  32 + }
  33 +
  34 +
  35 + public static String handleKey(String param) {
  36 + return MD5Util.md5(param == null ? "" : param);
  37 + }
  38 +
  39 + /**
  40 + * 加锁 putIfAbsent 是原子操作保证线程安全
  41 + *
  42 + * @param key 对应的key
  43 + * @param value
  44 + * @return
  45 + */
  46 + public boolean lock(final String key, Object value) {
  47 + return Objects.isNull(LOCK_CACHE.putIfAbsent(key, value));
  48 + }
  49 +
  50 + /**
  51 + * 延时释放锁 用以控制短时间内的重复提交
  52 + *
  53 + * @param lock 是否需要解锁
  54 + * @param key 对应的key
  55 + * @param delaySeconds 延时时间
  56 + */
  57 + public void unLock(final boolean lock, final String key, final int delaySeconds) {
  58 + if (lock) {
  59 + EXECUTOR.schedule(() -> {
  60 + LOCK_CACHE.remove(key);
  61 + }, delaySeconds, TimeUnit.SECONDS);
  62 + }
  63 + }
  64 +
  65 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsAttentionMapper.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.mapper;
  2 +
  3 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import com.lyms.talkonlineweb.domain.LymsAttention;
  5 +
  6 +/**
  7 + * @Entity com.lyms.talkonlineweb.domain.LymsAttention
  8 + */
  9 +public interface LymsAttentionMapper extends BaseMapper<LymsAttention> {
  10 +
  11 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsOrderMapper.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.mapper;
  2 +
  3 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import com.lyms.talkonlineweb.domain.LymsAttention;
  5 +import com.lyms.talkonlineweb.domain.LymsOrder;
  6 +
  7 +/**
  8 + * @Entity com.lyms.talkonlineweb.domain.LymsOrder
  9 + */
  10 +public interface LymsOrderMapper extends BaseMapper<LymsOrder> {
  11 +
  12 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsTkcardMapper.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.mapper;
  2 +
  3 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import com.lyms.talkonlineweb.domain.LymsTkrecord;
  5 +
  6 +/**
  7 + * @Entity com.lyms.talkonlineweb.domain.LymsTkrecord
  8 + */
  9 +public interface LymsTkcardMapper extends BaseMapper<LymsTkrecord> {
  10 +
  11 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/request/PatientInfoRequest.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.request;
  2 +
  3 +import lombok.Data;
  4 +
  5 +/**
  6 + * @ProjectName: talkonline
  7 + * @Package: com.lyms.talkonlineweb.request
  8 + * @ClassName: PatientInfoRequest
  9 + * @Author: lqy
  10 + * @Description: 修改个人信息
  11 + * @Date: 2021-09-08 19:37
  12 + * @Version:
  13 + */
  14 +@Data
  15 +public class PatientInfoRequest {
  16 + private int pid;
  17 + private String pname;
  18 + private int psex;
  19 + private String birth;
  20 + private String mobile;
  21 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/IResultConvert.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.result;
  2 +
  3 +/**
  4 + * @ProjectName: talkonline
  5 + * @Package: com.lyms.talkonlineweb.result
  6 + * @ClassName: IResultConvert
  7 + * @Author: lqy
  8 + * @Description: 返回转换类
  9 + * @Date: 2021-09-08 14:57
  10 + * @Version:
  11 + */
  12 +
  13 +public interface IResultConvert<T,V> {
  14 + T convertToResult(V destModel);
  15 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/PatientPcaseResult.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.result;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.TableField;
  4 +import com.lyms.talkonlineweb.domain.LymsPcase;
  5 +import lombok.Data;
  6 +
  7 +import java.io.Serializable;
  8 +
  9 +/**
  10 + * @ProjectName: talkonline
  11 + * @Package: com.lyms.talkonlineweb.result
  12 + * @ClassName: PatientPcaseResult
  13 + * @Author: lqy
  14 + * @Description: 小程序患者就诊病历返回对象
  15 + * @Date: 2021-09-08 14:55
  16 + * @Version:
  17 + */
  18 +@Data
  19 +public class PatientPcaseResult {
  20 + //患者id
  21 + private int pid;
  22 + //医院名称
  23 + private String hname;
  24 + //医院id
  25 + private String hid;
  26 + //科室名称
  27 + private String departName;
  28 + //医生名称
  29 + private String doctorName;
  30 + //医生id;
  31 + private int dtid;
  32 + //医生环信id
  33 + private String dhxid;
  34 + //医生职位
  35 + private String doctorLvl;
  36 + //患者姓名
  37 + private String patientName;
  38 + //患者环信id
  39 + private String phxid;
  40 + //身份证号码
  41 + private String cardNo;
  42 + //疾病名称
  43 + private String iname;
  44 + //就诊时间
  45 + private String createdby;
  46 +
  47 + //问诊卡数量
  48 + private Integer ccnt;
  49 +
  50 +
  51 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsAttentionService.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.service;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.IService;
  4 +import com.lyms.talkonlineweb.domain.LymsAttention;
  5 +
  6 +/**
  7 + *
  8 + */
  9 +public interface LymsAttentionService extends IService<LymsAttention> {
  10 +
  11 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsOrderService.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.service;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.IService;
  4 +import com.lyms.talkonlineweb.domain.LymsAttention;
  5 +import com.lyms.talkonlineweb.domain.LymsOrder;
  6 +
  7 +/**
  8 + *
  9 + */
  10 +public interface LymsOrderService extends IService<LymsOrder> {
  11 +
  12 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsTkcardService.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.service;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.IService;
  4 +import com.lyms.talkonlineweb.domain.LymsTkrecord;
  5 +
  6 +/**
  7 + *
  8 + */
  9 +public interface LymsTkcardService extends IService<LymsTkrecord> {
  10 +
  11 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsAttentionServiceImpl.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.service.impl;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  4 +import com.lyms.talkonlineweb.domain.LymsAttention;
  5 +import com.lyms.talkonlineweb.mapper.LymsAttentionMapper;
  6 +import com.lyms.talkonlineweb.service.LymsAttentionService;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +/**
  10 + *
  11 + */
  12 +@Service
  13 +public class LymsAttentionServiceImpl extends ServiceImpl<LymsAttentionMapper, LymsAttention>
  14 + implements LymsAttentionService {
  15 +
  16 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsOrderServiceImpl.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.service.impl;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  4 +import com.lyms.talkonlineweb.domain.LymsAttention;
  5 +import com.lyms.talkonlineweb.domain.LymsOrder;
  6 +import com.lyms.talkonlineweb.mapper.LymsAttentionMapper;
  7 +import com.lyms.talkonlineweb.mapper.LymsOrderMapper;
  8 +import com.lyms.talkonlineweb.service.LymsAttentionService;
  9 +import com.lyms.talkonlineweb.service.LymsOrderService;
  10 +import org.springframework.stereotype.Service;
  11 +
  12 +/**
  13 + *
  14 + */
  15 +@Service
  16 +public class LymsOrderServiceImpl extends ServiceImpl<LymsOrderMapper, LymsOrder>
  17 + implements LymsOrderService {
  18 +
  19 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsTkcardServiceImpl.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.service.impl;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  4 +import com.lyms.talkonlineweb.domain.LymsTkrecord;
  5 +import com.lyms.talkonlineweb.mapper.LymsTkcardMapper;
  6 +import com.lyms.talkonlineweb.service.LymsTkcardService;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +/**
  10 + *
  11 + */
  12 +@Service
  13 +public class LymsTkcardServiceImpl extends ServiceImpl<LymsTkcardMapper, LymsTkrecord>
  14 + implements LymsTkcardService {
  15 +
  16 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/DateUtil.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.util;
  2 +
  3 +import lombok.extern.slf4j.Slf4j;
  4 +
  5 +import java.text.DateFormat;
  6 +import java.text.SimpleDateFormat;
  7 +import java.util.Date;
  8 +import java.util.concurrent.ConcurrentHashMap;
  9 +import java.util.concurrent.locks.Lock;
  10 +import java.util.concurrent.locks.ReentrantLock;
  11 +
  12 +/**
  13 + * @ProjectName: talkonline
  14 + * @Package: com.lyms.talkonlineweb.util
  15 + * @ClassName: DateUtil
  16 + * @Author: lqy
  17 + * @Description: 时间格式类
  18 + * @Date: 2021-09-07 17:53
  19 + * @Version:
  20 + */
  21 +public class DateUtil {
  22 + /**
  23 + * 缓存时间格式化
  24 + */
  25 + private static ConcurrentHashMap<String, DateFormat> dateFormatCache = new ConcurrentHashMap<String, DateFormat>();
  26 + private static Lock lock = new ReentrantLock();
  27 +
  28 + public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
  29 + public static final String YYYY_MM_DD = "yyyy-MM-dd";
  30 + /**
  31 + * 私有构造方法,禁止对该类进行实例化
  32 + */
  33 + private DateUtil() {
  34 + }
  35 +
  36 + public static String getYyyyMmDdHhMmSs(Date datetime) {
  37 + return getDateTime(datetime, YYYY_MM_DD_HH_MM_SS);
  38 + }
  39 +
  40 + public static String getDateTime(Date date, String pattern) {
  41 + if (date == null) {
  42 + return "";
  43 + }
  44 +
  45 + DateFormat format = getDateFormat(pattern);
  46 + lock.lock();
  47 + try {
  48 + return format.format(date);
  49 + } finally {
  50 + lock.unlock();
  51 + }
  52 + }
  53 +
  54 + public static DateFormat getDateFormat(String pattern) {
  55 + if (StringUtil.isEmpty(pattern)) {
  56 + pattern = YYYY_MM_DD;
  57 + }
  58 +
  59 + if (dateFormatCache.get(pattern) != null) {
  60 + return dateFormatCache.get(pattern);
  61 + }
  62 + lock.lock();
  63 + try {
  64 + DateFormat format = new SimpleDateFormat(pattern);
  65 + dateFormatCache.put(pattern, format);
  66 + return format;
  67 + } catch (Exception e) {
  68 + } finally {
  69 + lock.unlock();
  70 + }
  71 + return null;
  72 + }
  73 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/JsonUtil.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.util;
  2 +
  3 +import com.fasterxml.jackson.databind.ObjectMapper;
  4 +
  5 +
  6 +/**
  7 + * Created by Administrator on 2019-09-06.
  8 + */
  9 +public class JsonUtil {
  10 +
  11 +
  12 +
  13 + /**
  14 + * 对象转换为String
  15 + * @param cls
  16 + * @return
  17 + */
  18 + public static String obj2Str(
  19 + Object cls) {
  20 + try {
  21 + ObjectMapper objectMapper = new ObjectMapper();
  22 + objectMapper.setDateFormat(DateUtil.getDateFormat(DateUtil.YYYY_MM_DD_HH_MM_SS));
  23 + return objectMapper.writeValueAsString(cls);
  24 + } catch (Exception e) {
  25 +
  26 + }
  27 + return null;
  28 + }
  29 +
  30 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/MD5Util.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.util;
  2 +
  3 +import java.security.MessageDigest;
  4 +import java.security.NoSuchAlgorithmException;
  5 +
  6 +/**
  7 + */
  8 +public class MD5Util {
  9 +
  10 + /**
  11 + * md5加密
  12 + * @param plainText
  13 + * @return
  14 + */
  15 + public static String md5(String plainText) {
  16 + try {
  17 + if (plainText == null) {
  18 + return null;
  19 + }
  20 + MessageDigest md = MessageDigest.getInstance("MD5");
  21 + md.update(plainText.getBytes());
  22 + byte b[] = md.digest();
  23 + int i;
  24 + StringBuffer buf = new StringBuffer("");
  25 + for (int offset = 0; offset < b.length; offset++) {
  26 + i = b[offset];
  27 + if (i < 0)
  28 + i += 256;
  29 + if (i < 16)
  30 + buf.append("0");
  31 + buf.append(Integer.toHexString(i));
  32 + }
  33 + return buf.toString().toUpperCase();
  34 + } catch (NoSuchAlgorithmException e) {
  35 + e.printStackTrace();
  36 + return null;
  37 + }
  38 + }
  39 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/StringUtil.java View file @ 0f123e9
  1 +package com.lyms.talkonlineweb.util;
  2 +
  3 +/**
  4 + * @ProjectName: talkonline
  5 + * @Package: com.lyms.talkonlineweb.util
  6 + * @ClassName: Stringutil
  7 + * @Author: lqy
  8 + * @Description: 字符串处理类
  9 + * @Date: 2021-09-07 17:50
  10 + * @Version:
  11 + */
  12 +
  13 +public class StringUtil {
  14 +
  15 + public static boolean isEmpty(String str) {
  16 + if (str == null || "".equals(str)) {
  17 + return true;
  18 + }
  19 + return false;
  20 + }
  21 +
  22 + public static boolean isNotEmpty(String str) {
  23 + if (str != null && !"".equals(str)) {
  24 + return true;
  25 + }
  26 + return false;
  27 + }
  28 +
  29 + /**
  30 + * //+表示1个或多个(如"3"或"225"),*表示0个或多个([0-9]*)(如""或"1"或"22"),
  31 + * ?表示0个或1个([0-9]?)(如""或"7")
  32 + *
  33 + * @param str
  34 + * @return
  35 + */
  36 + public static boolean isNum(String str) {
  37 + if (!isEmpty(str)) {
  38 + return str.matches("[0-9]+");
  39 + }
  40 + return false;
  41 + }
  42 +}