查询不了
parent
11354d3505
commit
606caba223
|
@ -7,6 +7,7 @@
|
||||||
<file url="file://$PROJECT_DIR$/bwie-common/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-common/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-cases/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,com.github.pagehelper.page.PageMethod,startPage" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="myValues">
|
||||||
|
<value>
|
||||||
|
<list size="19">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="nobr" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="noembed" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="comment" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="noscript" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="embed" />
|
||||||
|
<item index="5" class="java.lang.String" itemvalue="script" />
|
||||||
|
<item index="6" class="java.lang.String" itemvalue="el-form-item" />
|
||||||
|
<item index="7" class="java.lang.String" itemvalue="el-button" />
|
||||||
|
<item index="8" class="java.lang.String" itemvalue="el-form" />
|
||||||
|
<item index="9" class="java.lang.String" itemvalue="el-input" />
|
||||||
|
<item index="10" class="java.lang.String" itemvalue="el-table" />
|
||||||
|
<item index="11" class="java.lang.String" itemvalue="el-table-column" />
|
||||||
|
<item index="12" class="java.lang.String" itemvalue="el-popover" />
|
||||||
|
<item index="13" class="java.lang.String" itemvalue="el-tag" />
|
||||||
|
<item index="14" class="java.lang.String" itemvalue="el-date-picker" />
|
||||||
|
<item index="15" class="java.lang.String" itemvalue="el-col" />
|
||||||
|
<item index="16" class="java.lang.String" itemvalue="el-time-picker" />
|
||||||
|
<item index="17" class="java.lang.String" itemvalue="el-pagination" />
|
||||||
|
<item index="18" class="java.lang.String" itemvalue="el-dialog" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="myCustomValuesEnabled" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="ADDITIONAL_TAGS" value="date,Package,BelongsProject:,BelongsPackage:,Author:,CreateTime:,description:" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
|
@ -5,6 +5,7 @@
|
||||||
<option name="originalFiles">
|
<option name="originalFiles">
|
||||||
<list>
|
<list>
|
||||||
<option value="$PROJECT_DIR$/pom.xml" />
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/bwie-modules/bwie-cases/pom.xml" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.bwie.common.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Handsome boy
|
||||||
|
* @Package com.bwie.common.domain
|
||||||
|
* @date 2023/12/8 20:22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Case {
|
||||||
|
private Integer caseId;
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
private String caseName;
|
||||||
|
private String caseTime;
|
||||||
|
private String caseMessage;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.bwie.common.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Handsome boy
|
||||||
|
* @Package com.bwie.common.domain
|
||||||
|
* @date 2023/12/16 11:51
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CaseRequest {
|
||||||
|
private Integer pageSize;
|
||||||
|
private Integer pageNum;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer roleId;
|
||||||
|
private Integer userId;
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.bwie.common.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author gxb
|
||||||
|
* @description TODO
|
||||||
|
* @date 2023-12-16 11:43
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class User {
|
||||||
|
/**
|
||||||
|
* Id
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
/**
|
||||||
|
* 1 - 医生 2-用户
|
||||||
|
*/
|
||||||
|
private Integer role;
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
}
|
|
@ -9,8 +9,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
* @date 2023-12-16 8:35
|
* @date 2023-12-16 8:35
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class GatewayAppliction {
|
public class GatewayApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(GatewayAppliction.class,args);
|
SpringApplication.run(GatewayApplication.class,args);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>bwie-modules</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>bwie-cases</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<!-- 系统公共 依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>bwie-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- SpringBoot Web-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Druid -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>1.2.8</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Mybatis 依赖配置 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>2.2.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Pagehelper -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- test -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.tobato</groupId>
|
||||||
|
<artifactId>fastdfs-client</artifactId>
|
||||||
|
<version>1.26.5</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.bwie.xxxxxx;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Handsome boy
|
||||||
|
* @Package com.bwie.xxxxxx
|
||||||
|
* @date 2023/12/16 12:02
|
||||||
|
*/
|
||||||
|
@SpringBootApplication
|
||||||
|
public class CasesApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(CasesApplication.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.bwie.xxxxxx.controller;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.Case;
|
||||||
|
import com.bwie.common.domain.CaseRequest;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.xxxxxx.service.CaseService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Handsome boy
|
||||||
|
* @Package com.bwie.xxxxxx.controller
|
||||||
|
* @date 2023/12/8 20:21
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Log4j2
|
||||||
|
public class CaseController {
|
||||||
|
final CaseService caseService;
|
||||||
|
|
||||||
|
public CaseController(CaseService caseService) {
|
||||||
|
this.caseService = caseService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加病例
|
||||||
|
*
|
||||||
|
* @param cases;
|
||||||
|
*/
|
||||||
|
@PostMapping("/case")
|
||||||
|
public Result<Object> insertCase(@RequestBody Case cases) {
|
||||||
|
log.info(cases);
|
||||||
|
return caseService.insertCase(cases);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除病例
|
||||||
|
*
|
||||||
|
* @param caseId;
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/case/{caseId}")
|
||||||
|
public Result<Object> deleteCase(@PathVariable Integer caseId) {
|
||||||
|
return caseService.deleteCase(caseId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改病例
|
||||||
|
*
|
||||||
|
* @param cases;
|
||||||
|
*/
|
||||||
|
@PutMapping("/case")
|
||||||
|
public Result<Object> updateCase(@RequestBody Case cases) {
|
||||||
|
return caseService.updateCase(cases);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询病历表
|
||||||
|
*
|
||||||
|
* @return ;
|
||||||
|
*/
|
||||||
|
@GetMapping("/case")
|
||||||
|
public Result<PageResult<Case>> selCase(CaseRequest caseRequest) {
|
||||||
|
System.out.println(caseRequest + "---------");
|
||||||
|
return caseService.selCase(caseRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.bwie.xxxxxx.mapper;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.Case;
|
||||||
|
import com.bwie.common.domain.CaseRequest;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Handsome boy
|
||||||
|
* @Package com.bwie.xxxxxx.mapper
|
||||||
|
* @date 2023/12/8 20:21
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface CaseMapper {
|
||||||
|
/**
|
||||||
|
* 添加病历表
|
||||||
|
* @return ;
|
||||||
|
* @param cases;
|
||||||
|
*/
|
||||||
|
int insertCase(Case cases);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除病例
|
||||||
|
* @return ;
|
||||||
|
* @param caseId;
|
||||||
|
*/
|
||||||
|
int deleteCase(Integer caseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改病历
|
||||||
|
* @param cases ;
|
||||||
|
* @return ;
|
||||||
|
*/
|
||||||
|
int updateCase(Case cases);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询病例表
|
||||||
|
* @param caseRequest;
|
||||||
|
* @return ;
|
||||||
|
*/
|
||||||
|
List<Case> selCase(CaseRequest caseRequest);
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.bwie.xxxxxx.service;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.Case;
|
||||||
|
import com.bwie.common.domain.CaseRequest;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Handsome boy
|
||||||
|
* @Package com.bwie.xxxxxx.service
|
||||||
|
* @date 2023/12/8 20:21
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface CaseService {
|
||||||
|
/**
|
||||||
|
* 添加病例
|
||||||
|
* @return ;
|
||||||
|
* @param cases;
|
||||||
|
*/
|
||||||
|
Result<Object> insertCase(Case cases);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除病例
|
||||||
|
* @return ;
|
||||||
|
* @param caseId;
|
||||||
|
*/
|
||||||
|
Result<Object> deleteCase(Integer caseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改病例
|
||||||
|
* @return ;
|
||||||
|
* @param cases;
|
||||||
|
*/
|
||||||
|
Result<Object> updateCase(Case cases);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询病例
|
||||||
|
* @param caseRequest;
|
||||||
|
* @return ;
|
||||||
|
*/
|
||||||
|
Result<PageResult<Case>> selCase(CaseRequest caseRequest);
|
||||||
|
}
|
|
@ -0,0 +1,133 @@
|
||||||
|
package com.bwie.xxxxxx.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.bwie.common.constants.TokenConstants;
|
||||||
|
import com.bwie.common.domain.Case;
|
||||||
|
import com.bwie.common.domain.CaseRequest;
|
||||||
|
import com.bwie.common.domain.User;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.common.utils.JwtUtils;
|
||||||
|
import com.bwie.xxxxxx.mapper.CaseMapper;
|
||||||
|
import com.bwie.xxxxxx.service.CaseService;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Handsome boy
|
||||||
|
* @Package com.bwie.xxxxxx.service.impl
|
||||||
|
* @date 2023/12/8 20:21
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CaseServiceImpl implements CaseService {
|
||||||
|
|
||||||
|
final CaseMapper caseMapper;
|
||||||
|
final HttpServletRequest request;
|
||||||
|
final RedisTemplate<String, String> redisTemplate;
|
||||||
|
|
||||||
|
public CaseServiceImpl(CaseMapper caseMapper, HttpServletRequest request, RedisTemplate<String, String> redisTemplate) {
|
||||||
|
this.caseMapper = caseMapper;
|
||||||
|
this.request = request;
|
||||||
|
this.redisTemplate = redisTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加病例
|
||||||
|
*
|
||||||
|
* @param cases;
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<Object> insertCase(Case cases) {
|
||||||
|
int row;
|
||||||
|
try {
|
||||||
|
row = caseMapper.insertCase(cases);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
if (row == 0) {
|
||||||
|
throw new IllegalAccessError("添加异常");
|
||||||
|
}
|
||||||
|
return Result.success("添加病例成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除病例
|
||||||
|
*
|
||||||
|
* @param caseId;
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<Object> deleteCase(Integer caseId) {
|
||||||
|
int row;
|
||||||
|
try {
|
||||||
|
row = caseMapper.deleteCase(caseId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
if (row == 0) {
|
||||||
|
throw new IllegalAccessError("删除异常");
|
||||||
|
}
|
||||||
|
return Result.success("删除病例成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改病例
|
||||||
|
*
|
||||||
|
* @param cases;
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<Object> updateCase(Case cases) {
|
||||||
|
int row;
|
||||||
|
try {
|
||||||
|
row = caseMapper.updateCase(cases);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
if (row == 0) {
|
||||||
|
throw new IllegalAccessError("修改异常");
|
||||||
|
}
|
||||||
|
return Result.success("修改病例成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<PageResult<Case>> selCase(CaseRequest caseRequest) {
|
||||||
|
// 调用PageHelper的startPage方法,传入当前页码和每页条数
|
||||||
|
PageHelper.startPage(caseRequest.getPageNum(), caseRequest.getPageSize());
|
||||||
|
//获取登录人信息
|
||||||
|
// User user = getToken();
|
||||||
|
// if (user == null){
|
||||||
|
// return Result.error("未登录");
|
||||||
|
// }
|
||||||
|
// caseRequest.setRoleId(user.getRole());
|
||||||
|
// 调用caseMapper的selCase方法,传入CaseRequest参数
|
||||||
|
List<Case> list = caseMapper.selCase(caseRequest);
|
||||||
|
// 调用PageInfo的构造方法,传入list参数
|
||||||
|
PageInfo<Case> page = new PageInfo<>(list);
|
||||||
|
// 调用Result的success方法,传入PageResult.toPageResult方法,传入page.getTotal()和list参数
|
||||||
|
return PageResult.toResult(page.getTotal() ,list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取登录人信息
|
||||||
|
*
|
||||||
|
* @return ;
|
||||||
|
*/
|
||||||
|
private User getToken() {
|
||||||
|
//获取token
|
||||||
|
String token = request.getHeader("token");
|
||||||
|
//获取用户key
|
||||||
|
String userKey = JwtUtils.getUserKey(token);
|
||||||
|
//从redis中获取用户信息
|
||||||
|
String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey);
|
||||||
|
//将用户信息转换为User对象
|
||||||
|
return JSON.parseObject(s, User.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.bwie.xxxxxx.util;
|
||||||
|
|
||||||
|
import com.github.tobato.fastdfs.domain.fdfs.StorePath;
|
||||||
|
import com.github.tobato.fastdfs.service.FastFileStorageClient;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @BelongsProject: 0107day02
|
||||||
|
* @BelongsPackage: com.bw.config
|
||||||
|
* @Author: zhupengfei
|
||||||
|
* @CreateTime: 2023-02-01 08:52
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class FastUtil {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(FastUtil.class);
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FastFileStorageClient storageClient ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传文件
|
||||||
|
*/
|
||||||
|
public String upload(MultipartFile multipartFile) throws Exception{
|
||||||
|
String originalFilename = multipartFile.getOriginalFilename().
|
||||||
|
substring(multipartFile.getOriginalFilename().
|
||||||
|
lastIndexOf(".") + 1);
|
||||||
|
StorePath storePath = this.storageClient.uploadImageAndCrtThumbImage(
|
||||||
|
multipartFile.getInputStream(),
|
||||||
|
multipartFile.getSize(),originalFilename , null);
|
||||||
|
return storePath.getFullPath() ;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除文件
|
||||||
|
*/
|
||||||
|
public String deleteFile(String fileUrl) {
|
||||||
|
if (StringUtils.isEmpty(fileUrl)) {
|
||||||
|
log.info("fileUrl == >>文件路径为空...");
|
||||||
|
return "文件路径不能为空";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
StorePath storePath = StorePath.parseFromUrl(fileUrl);
|
||||||
|
storageClient.deleteFile(storePath.getGroup(), storePath.getPath());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
}
|
||||||
|
return "删除成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9099
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
main:
|
||||||
|
allow-circular-references: true
|
||||||
|
jackson:
|
||||||
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
time-zone: GMT+8
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: bwie-case
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 43.143.161.183:8848
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 43.143.161.183:8848
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
fdfs:
|
||||||
|
so-timeout: 1500 # socket 连接时长
|
||||||
|
connect-timeout: 600 # 连接 tracker 服务器超时时长
|
||||||
|
# 这两个是你服务器的 IP 地址,注意 23000 端口也要打开,阿里云服务器记得配置安全组。tracker 要和 stroage 服务进行交流
|
||||||
|
tracker-list: 43.143.161.183:22122
|
||||||
|
web-server-url: 43.143.161.183:8888
|
||||||
|
pool:
|
||||||
|
jmx-enabled: false
|
||||||
|
# 生成缩略图
|
||||||
|
thumb-image:
|
||||||
|
height: 500
|
||||||
|
width: 500
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper namespace="com.bwie.xxxxxx.mapper.CaseMapper">
|
||||||
|
|
||||||
|
<!-- 添加病历表 -->
|
||||||
|
<insert id="insertCase">
|
||||||
|
insert into cases
|
||||||
|
values (null, #{caseName}, #{caseMessage}, #{caseTime}, #{userId})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- 修改病历表 -->
|
||||||
|
<update id="updateCase">
|
||||||
|
update cases
|
||||||
|
set case_name=#{caseName},
|
||||||
|
case_message=#{caseMessage},
|
||||||
|
case_Time=#{caseTime}
|
||||||
|
where case_id = #{caseId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- 删除病例表 -->
|
||||||
|
<delete id="deleteCase">
|
||||||
|
delete
|
||||||
|
from cases
|
||||||
|
where case_id = #{caseId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<!-- 查询病历表 -->
|
||||||
|
<select id="selCase" resultType="com.bwie.common.domain.Case">
|
||||||
|
select *
|
||||||
|
from cases
|
||||||
|
where user_id = #{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue