token相关
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run
This commit is contained in:
parent
fbd881ed14
commit
59afc49a23
@ -120,6 +120,14 @@
|
|||||||
<groupId>com.xingyuv</groupId>
|
<groupId>com.xingyuv</groupId>
|
||||||
<artifactId>spring-boot-starter-captcha-plus</artifactId> <!-- 验证码,一般用于登录使用 -->
|
<artifactId>spring-boot-starter-captcha-plus</artifactId> <!-- 验证码,一般用于登录使用 -->
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--JWT解析库-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.auth0</groupId>
|
||||||
|
<artifactId>java-jwt</artifactId>
|
||||||
|
<version>4.4.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.outapi;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.config.*;
|
||||||
|
import cn.iocoder.yudao.framework.web.config.*;
|
||||||
|
import org.springframework.boot.autoconfigure.*;
|
||||||
|
import org.springframework.web.servlet.config.annotation.*;
|
||||||
|
|
||||||
|
@AutoConfiguration(after = YudaoWebAutoConfiguration.class, before = YudaoApiLogAutoConfiguration.class)
|
||||||
|
public class JwtTokenAutoConfiguration implements WebMvcConfigurer {
|
||||||
|
@Override
|
||||||
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
|
registry.addInterceptor(new JwtTokenInterceptor())
|
||||||
|
.addPathPatterns("/admin-api/ultrasoniccom/ultrasonic/InsImageInfo",
|
||||||
|
"/admin-api/tblist/patientexamlist/addPatientExamInfo");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.outapi;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.*;
|
||||||
|
import cn.iocoder.yudao.module.system.service.outapi.*;
|
||||||
|
import io.swagger.v3.oas.annotations.*;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.*;
|
||||||
|
import org.springframework.validation.annotation.*;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - jwtToken")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/jwtToken")
|
||||||
|
@Validated
|
||||||
|
public class JwtTokenController {
|
||||||
|
@GetMapping("/getToken")
|
||||||
|
@Operation(summary = "获取Token")
|
||||||
|
public CommonResult<String> getToken(@RequestParam("key_public") String key_public) {
|
||||||
|
String _out = "";
|
||||||
|
if (key_public != null && !"".equals(key_public.trim()) &&
|
||||||
|
JwtTokenService.isKeyPublic(key_public.trim(), JwtTokenService.KEY_PUBLIC_1))
|
||||||
|
_out = JwtTokenService.createToken();
|
||||||
|
else
|
||||||
|
_out = "key_public_error";
|
||||||
|
return success(_out);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.outapi;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||||
|
import cn.iocoder.yudao.module.system.service.outapi.*;
|
||||||
|
import org.springframework.web.servlet.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class JwtTokenInterceptor implements HandlerInterceptor {
|
||||||
|
@Override
|
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||||
|
boolean _out = false;
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
String token = request.getHeader("AuthToken");
|
||||||
|
if (token != null && !"".equals(token.trim())) {
|
||||||
|
if (JwtTokenService.verifyToken(token.trim()))
|
||||||
|
_out = true;
|
||||||
|
else {
|
||||||
|
params.put("code", "TokenError");
|
||||||
|
params.put("msg", "TokenError");
|
||||||
|
responseReturn(response, params);
|
||||||
|
_out = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
params.put("code", "TokenEmpty");
|
||||||
|
params.put("msg", "TokenEmpty");
|
||||||
|
responseReturn(response, params);
|
||||||
|
_out = false;
|
||||||
|
}
|
||||||
|
return _out;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void responseReturn(HttpServletResponse response, Map<String, Object> params) {
|
||||||
|
if (response != null) {
|
||||||
|
String result = "";
|
||||||
|
if (params == null || params.size() <= 0)
|
||||||
|
params = new HashMap<>();
|
||||||
|
result = JsonUtils.toJsonString(params);
|
||||||
|
PrintWriter writer = null;
|
||||||
|
response.setContentType("application/json");
|
||||||
|
response.setCharacterEncoding("UTF-8");
|
||||||
|
try {
|
||||||
|
writer = response.getWriter();
|
||||||
|
writer.write(result);
|
||||||
|
|
||||||
|
} catch (IOException ex) {
|
||||||
|
} finally {
|
||||||
|
if (writer != null) {
|
||||||
|
writer.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.outapi;
|
||||||
|
|
||||||
|
import com.auth0.jwt.*;
|
||||||
|
import com.auth0.jwt.algorithms.*;
|
||||||
|
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||||
|
import org.springframework.stereotype.*;
|
||||||
|
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class JwtTokenService {
|
||||||
|
//属性
|
||||||
|
private static final long EXPIRE_DATE = 30 * 60 * 1000;
|
||||||
|
private static final String TOKEN_SECRET = "LLCfasfhua12afvQedaWSkqqklshQDB456FQAwu20flyWE";
|
||||||
|
public static final String KEY_PUBLIC_1 = "FLY_kyqqklsh_18152QFDW";
|
||||||
|
|
||||||
|
//方法
|
||||||
|
public static String createToken() {
|
||||||
|
String token = null;
|
||||||
|
try {
|
||||||
|
//参数
|
||||||
|
Date date = new Date(System.currentTimeMillis() + EXPIRE_DATE);
|
||||||
|
Algorithm algorithm = Algorithm.HMAC256(TOKEN_SECRET);
|
||||||
|
Map<String, Object> header = new HashMap<>();
|
||||||
|
header.put("typ", "JWT");
|
||||||
|
header.put("alg", "HS256");
|
||||||
|
//携带信息,生成签名
|
||||||
|
token = JWT.create()
|
||||||
|
.withHeader(header)
|
||||||
|
.withClaim("tokenid", UUID.randomUUID().toString().replace("-", ""))
|
||||||
|
.withExpiresAt(date)
|
||||||
|
.sign(algorithm);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
token = null;
|
||||||
|
}
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean verifyToken(String token) {
|
||||||
|
boolean _out = false;
|
||||||
|
if (token != null && !"".equals(token.trim())) {
|
||||||
|
try {
|
||||||
|
Algorithm algorithm = Algorithm.HMAC256(TOKEN_SECRET);
|
||||||
|
JWTVerifier verifier = JWT.require(algorithm).build();
|
||||||
|
DecodedJWT jwt = verifier.verify(token.trim());
|
||||||
|
_out = true;
|
||||||
|
} catch (Exception ex) {
|
||||||
|
_out = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isKeyPublic(String input, String KEY_PUBLIC) {
|
||||||
|
String _temp = "";
|
||||||
|
if (KEY_PUBLIC != null && !"".equals(KEY_PUBLIC.trim())) {
|
||||||
|
try {
|
||||||
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
|
byte[] digest = md.digest(KEY_PUBLIC.trim().getBytes());
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (byte b : digest) {
|
||||||
|
sb.append(String.format("%02x", b));
|
||||||
|
}
|
||||||
|
_temp = sb.toString().trim();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
_temp = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_temp != "" && input != null && input.trim().equals(_temp))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
cn.iocoder.yudao.module.system.controller.admin.outapi.JwtTokenAutoConfiguration
|
@ -174,6 +174,12 @@ public class PatientexamlistController {
|
|||||||
return success(_out);
|
return success(_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/addPatientExamInfo")
|
||||||
|
@Operation(summary = "患者信息")
|
||||||
|
public CommonResult<List<String>> addPatientExamInfo(@Valid @RequestBody List<PatientExamInfoAddReqVO> createReqVOs) {
|
||||||
|
return success(patientexamlistService.addPatientExamInfo(createReqVOs));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/getCheckRecord")
|
@GetMapping("/getCheckRecord")
|
||||||
@Operation(summary = "云胶片-getCheckRecord")
|
@Operation(summary = "云胶片-getCheckRecord")
|
||||||
public CommonResult<Map<String, Object>> getCheckRecord(@RequestParam("no") String no, @RequestParam("orgId") String orgId) {
|
public CommonResult<Map<String, Object>> getCheckRecord(@RequestParam("no") String no, @RequestParam("orgId") String orgId) {
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
package cn.iocoder.yudao.module.tblist.controller.admin.patientexamlist.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.time.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - PatientExamInfoAddReqVO")
|
||||||
|
@Data
|
||||||
|
public class PatientExamInfoAddReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", example = "23598")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "检查ID:体检编号、住院号、门诊号等", example = "26467")
|
||||||
|
private String examId;
|
||||||
|
|
||||||
|
@Schema(description = "患者姓名", example = "赵六")
|
||||||
|
private String pname;
|
||||||
|
|
||||||
|
@Schema(description = "性别")
|
||||||
|
private String gender;
|
||||||
|
|
||||||
|
@Schema(description = "出生日期")
|
||||||
|
private LocalDateTime birthday;
|
||||||
|
|
||||||
|
@Schema(description = "设备类型:CT DR MR B超 彩超等", example = "2")
|
||||||
|
private String deviceType;
|
||||||
|
|
||||||
|
@Schema(description = "影像设备名称")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
@Schema(description = "seri_dicomCount:序列数量/dicom数量")
|
||||||
|
private String seDc;
|
||||||
|
|
||||||
|
@Schema(description = "检查日期:年月日时分秒")
|
||||||
|
private LocalDateTime examDate;
|
||||||
|
|
||||||
|
@Schema(description = "检查项目代码", example = "16416496")
|
||||||
|
private String examItemCode;
|
||||||
|
|
||||||
|
@Schema(description = "检查项目名称", example = "张三")
|
||||||
|
private String examItemName;
|
||||||
|
|
||||||
|
@Schema(description = "报告状态", example = "1")
|
||||||
|
private String reportstatus;
|
||||||
|
|
||||||
|
@Schema(description = "申请日期:年月日时分秒")
|
||||||
|
private LocalDateTime applicationDate;
|
||||||
|
|
||||||
|
@Schema(description = "机构ID", example = "29289")
|
||||||
|
private String orgId;
|
||||||
|
|
||||||
|
@Schema(description = "机构名称", example = "芋艿")
|
||||||
|
private String orgName;
|
||||||
|
|
||||||
|
@Schema(description = "登记单号")
|
||||||
|
private String regId;
|
||||||
|
}
|
@ -78,6 +78,14 @@ public interface PatientexamlistService extends IService<PatientexamlistDO> {
|
|||||||
*/
|
*/
|
||||||
List<String> dicomDataSync();
|
List<String> dicomDataSync();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 患者信息
|
||||||
|
*
|
||||||
|
* @param createReqVOs 创建信息
|
||||||
|
* @return 编号集合
|
||||||
|
*/
|
||||||
|
List<String> addPatientExamInfo(@Valid List<PatientExamInfoAddReqVO> createReqVOs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新examItemName
|
* 更新examItemName
|
||||||
*
|
*
|
||||||
|
@ -186,6 +186,36 @@ public class PatientexamlistServiceImpl extends ServiceImpl<PatientexamlistMappe
|
|||||||
return _out;
|
return _out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> addPatientExamInfo(List<PatientExamInfoAddReqVO> createReqVOs) {
|
||||||
|
List<String> ids = new ArrayList<>();
|
||||||
|
|
||||||
|
LocalDateTime dateTime = null;
|
||||||
|
UUID guid = null;
|
||||||
|
PatientexamlistDO patientexamlist = null;
|
||||||
|
if (createReqVOs != null && createReqVOs.size() > 0) {
|
||||||
|
for (PatientExamInfoAddReqVO createReqVO : createReqVOs) {
|
||||||
|
if (createReqVO != null) {
|
||||||
|
patientexamlist = BeanUtils.toBean(createReqVO, PatientexamlistDO.class);
|
||||||
|
|
||||||
|
dateTime = LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
guid = UUID.randomUUID();
|
||||||
|
|
||||||
|
patientexamlist.setId(guid.toString());
|
||||||
|
patientexamlist.setPName(createReqVO.getPname());
|
||||||
|
patientexamlist.setCreateDate(dateTime);
|
||||||
|
|
||||||
|
ids.add(patientexamlist.getId());
|
||||||
|
patientexamlistMapper.insert(patientexamlist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(ids != null && ids.size() > 0))
|
||||||
|
ids = Collections.emptyList();
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateExamItemNameById(String id, String examItemName) {
|
public void updateExamItemNameById(String id, String examItemName) {
|
||||||
validatePatientexamlistExists(id);
|
validatePatientexamlistExists(id);
|
||||||
|
@ -41,7 +41,6 @@ import org.apache.commons.net.ftp.FTP;
|
|||||||
import org.apache.commons.net.ftp.FTPClient;
|
import org.apache.commons.net.ftp.FTPClient;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -493,10 +492,8 @@ public class ultrasonicController {
|
|||||||
|
|
||||||
@PostMapping("/InsImageInfo")
|
@PostMapping("/InsImageInfo")
|
||||||
@Operation(summary = "影像信息")
|
@Operation(summary = "影像信息")
|
||||||
public CommonResult<String> InsImageInfo(@RequestBody List<PatientInfoVO> patientInfoVOS,@RequestHeader HttpHeaders headers) throws ParseException {
|
public CommonResult<String> InsImageInfo(@RequestBody List<PatientInfoVO> patientInfoVOS) throws ParseException {
|
||||||
try {
|
try {
|
||||||
// 从headers中获取特定的header参数
|
|
||||||
// String someHeaderValue = headers.getFirst("Some-Header-Name");
|
|
||||||
if(!patientInfoVOS.isEmpty())
|
if(!patientInfoVOS.isEmpty())
|
||||||
{
|
{
|
||||||
List<dicompatientsDO> dicompatientsDOList=new ArrayList<>();
|
List<dicompatientsDO> dicompatientsDOList=new ArrayList<>();
|
||||||
|
@ -160,6 +160,8 @@ yudao:
|
|||||||
- /admin-api/tblist/patientexamlist/getCheckRecord
|
- /admin-api/tblist/patientexamlist/getCheckRecord
|
||||||
- /admin-api/ultrasoniccom/ultrasonic/insimagescreenshot
|
- /admin-api/ultrasoniccom/ultrasonic/insimagescreenshot
|
||||||
- /admin-api/ultrasoniccom/ultrasonic/InsImageInfo
|
- /admin-api/ultrasoniccom/ultrasonic/InsImageInfo
|
||||||
|
- /admin-api/tblist/patientexamlist/addPatientExamInfo
|
||||||
|
- /admin-api/system/jwtToken/getToken
|
||||||
websocket:
|
websocket:
|
||||||
enable: true # websocket的开关
|
enable: true # websocket的开关
|
||||||
path: /infra/ws # 路径
|
path: /infra/ws # 路径
|
||||||
@ -205,6 +207,8 @@ yudao:
|
|||||||
- /admin-api/tblist/patientexamlist/getCheckRecord
|
- /admin-api/tblist/patientexamlist/getCheckRecord
|
||||||
- /admin-api/ultrasoniccom/ultrasonic/insimagescreenshot
|
- /admin-api/ultrasoniccom/ultrasonic/insimagescreenshot
|
||||||
- /admin-api/ultrasoniccom/ultrasonic/InsImageInfo
|
- /admin-api/ultrasoniccom/ultrasonic/InsImageInfo
|
||||||
|
- /admin-api/tblist/patientexamlist/addPatientExamInfo
|
||||||
|
- /admin-api/system/jwtToken/getToken
|
||||||
ignore-tables:
|
ignore-tables:
|
||||||
- system_tenant
|
- system_tenant
|
||||||
- system_tenant_package
|
- system_tenant_package
|
||||||
|
Loading…
Reference in New Issue
Block a user