LymsHisInfoController.java 5.28 KB
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
package com.lyms.talkonlineweb.controller;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lyms.talkonlineweb.annotation.Resubmit;
import com.lyms.talkonlineweb.annotation.TokenRequired;
import com.lyms.talkonlineweb.domain.LymsDict;
import com.lyms.talkonlineweb.domain.LymsHisInfo;
import com.lyms.talkonlineweb.domain.LymsUser;
import com.lyms.talkonlineweb.result.BaseResponse;
import com.lyms.talkonlineweb.result.CheckResult;
import com.lyms.talkonlineweb.service.LymsHisInfoService;
import com.lyms.talkonlineweb.service.LymsUserService;
import com.lyms.talkonlineweb.util.JwtUtils;
import com.lyms.talkonlineweb.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;

/**
* 医院his对接
*/
@RestController
@RequestMapping("his")
public class LymsHisInfoController {

@Autowired
private LymsHisInfoService lymsHisInfoService;
@Autowired
private LymsUserService lymsUserService;

/**
* 获取医院患者His列表
* @param hisInfo
* @return
*/
@GetMapping("getHisInfo")
@TokenRequired
public BaseResponse getHisInfo(LymsHisInfo hisInfo, int current, int size, @RequestHeader String authorization){
// LymsUser logUser=lymsUserService.getUserByToken(authorization);//获取token信息的用户数据
BaseResponse baseResponse=new BaseResponse();
Page<LymsHisInfo> page=new Page<>(current,size);
QueryWrapper<LymsHisInfo> query=new QueryWrapper();
if(StringUtil.isNotEmpty(hisInfo.getHospitalId())) {
query.eq("hospitalId", hisInfo.getHospitalId());
}
query.orderByDesc("createdtime");
if(null!=hisInfo.getUpType()){
query.eq("up_type", hisInfo.getUpType());
}
if(StringUtil.isNotEmpty(hisInfo.getSynthesisQuery())){
query.and(wrapper -> wrapper .like("name", hisInfo.getSynthesisQuery())
.or().eq("phone", hisInfo.getSynthesisQuery())
.or().eq("idCard", hisInfo.getSynthesisQuery()));
}
if(StringUtil.isNotEmpty(hisInfo.getStartCreatedtime())){
query.ge("created", hisInfo.getStartCreatedtime());
}
if(StringUtil.isNotEmpty(hisInfo.getEndCreatedtime())){
query.le("created", hisInfo.getEndCreatedtime());
}
Page<LymsHisInfo> hisInfoPage=lymsHisInfoService.page(page,query);
baseResponse.setObject(hisInfoPage);
return baseResponse;
}

/**
* 上传his患者信息
* @param lymsHisInfo
* @return
*/
@PostMapping("upHisInfo")
@TokenRequired
public BaseResponse upHisInfo( @RequestBody @Validated LymsHisInfo lymsHisInfo){
BaseResponse baseResponse=new BaseResponse();
try {
baseResponse.setErrorcode(0);
baseResponse.setErrormsg("患者上传成功");
String result = lymsHisInfoService.upHisInfo(lymsHisInfo);
if(StringUtil.isNotEmpty(result)){
baseResponse.setErrorcode(1);
baseResponse.setErrormsg(result);
}
} catch (Exception e) {
e.printStackTrace();
baseResponse.setErrorcode(1);
baseResponse.setErrormsg("患者上传失败,请联系管理员");
}
return baseResponse;
}
/**
* 一键上传his患者信息
* @param
* @return
*/
@PostMapping("upAllHisInfo")
@TokenRequired
@Resubmit
public BaseResponse upAllHisInfo(){
BaseResponse baseResponse=new BaseResponse();
baseResponse.setErrorcode(0);
baseResponse.setErrormsg("一键上传成功");
lymsHisInfoService.upAllHisInfo();
return baseResponse;
}
/**
* 修改his医院患者身份证号码
* @param hisInfo
* @return
*/
@PostMapping("updataHisIdCard")
@TokenRequired
public BaseResponse updataHisIdCard( @RequestBody LymsHisInfo hisInfo){
BaseResponse baseResponse=new BaseResponse();
try {
final boolean result = lymsHisInfoService.updateById(hisInfo);
if(!result){
baseResponse.setErrorcode(1);
baseResponse.setErrormsg("保存异常!");
}
} catch (Exception e) {
e.printStackTrace();
}
return baseResponse;
}

/**
* 删除his医院患者
* @param id
* @return
*/
@DeleteMapping("delHisInfo")
@TokenRequired
public BaseResponse delHisInfo(Integer id){
BaseResponse baseResponse=new BaseResponse();
try {
final boolean result = lymsHisInfoService.removeById(id);
if(!result){
baseResponse.setErrorcode(1);
baseResponse.setErrormsg("保存异常!");
}
} catch (Exception e) {
e.printStackTrace();
}
return baseResponse;
}



}