Compare commits

..

16 Commits
a1 ... master

Author SHA1 Message Date
31353 f9b71548f6 再次修改 2023-12-24 21:31:05 +08:00
31353 4e2e86d5d3 第一次修改 2023-12-23 09:34:28 +08:00
guoxubao af7946ac09 Merge pull request 'xiaopang' (#1) from xiaopang into master
Reviewed-on: #1
2023-12-22 20:38:47 +08:00
31353 1b61bce8e1 xiaopang 2023-12-22 20:30:29 +08:00
31353 53b63e681e 合并后 2023-12-17 14:59:18 +08:00
31353 fe52549585 Merge remote-tracking branch 'origin/ftx'
# Conflicts:
#	.idea/encodings.xml
#	.idea/inspectionProfiles/Project_Default.xml
#	.idea/workspace.xml
#	bwie-common/src/main/java/com/bwie/common/domain/User.java
2023-12-17 14:52:54 +08:00
ftx d4235d79b7 病例增删改查 2023-12-17 14:33:15 +08:00
ftx 54908cdb36 病例增伤盖茶 2023-12-17 14:31:08 +08:00
ftx 606caba223 查询不了 2023-12-17 11:38:37 +08:00
31353 466be363e6 郝森 2023-12-17 11:16:08 +08:00
31353 9184f9129e Merge remote-tracking branch 'origin/a2'
# Conflicts:
#	.idea/encodings.xml
#	.idea/workspace.xml
#	bwie-modules/pom.xml
2023-12-17 11:05:06 +08:00
31353 55e7732de2 张耀东 2023-12-17 10:57:58 +08:00
31353 8dfb2e3fb2 Merge remote-tracking branch 'origin/a1'
# Conflicts:
#	.idea/encodings.xml
#	bwie-modules/pom.xml
2023-12-17 10:51:22 +08:00
guoxubao e27dae32f1 健康教育 列表 2023-12-17 10:44:57 +08:00
31353 ffd27b6729 登录 2023-12-17 10:40:17 +08:00
31353 d48f779680 登录 2023-12-16 13:55:24 +08:00
68 changed files with 1909 additions and 238 deletions

8
.idea/.gitignore vendored 100644
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -7,10 +7,16 @@
<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/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/bwie-formation/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-health/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-user/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-user/src/main/resources" 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$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
<file url="file://$APPLICATION_HOME_DIR$/jbr/bin/src/main/java" charset="UTF-8" />
<file url="file://$APPLICATION_HOME_DIR$/jbr/bin/src/main/resources" charset="UTF-8" />
</component>
</project>

View File

@ -0,0 +1,14 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AliAccessStaticViaInstance" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AliArrayNamingShouldHaveBracket" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AliControlFlowStatementWithoutBraces" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AliDeprecation" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AliEqualsAvoidNull" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AliLongLiteralsEndingWithLowercaseL" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AliMissingOverrideAnnotation" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AliWrapperTypeEquality" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MapOrSetKeyShouldOverrideHashCodeEquals" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
<option value="$PROJECT_DIR$/bwie-modules/bwie-cases/pom.xml" />
</list>
</option>
</component>

View File

@ -5,19 +5,6 @@
</component>
<component name="ChangeListManager">
<list default="true" id="22f6834d-badb-4960-b20c-230dd62138eb" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bwie-common/src/main/java/com/bwie/common/domain/Health.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-health/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-health/pom.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-health/src/main/java/com/bwie/health/HealthApplication.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-health/src/main/java/com/bwie/health/controller/HealthController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-health/src/main/java/com/bwie/health/mapper/HealthMapper.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-health/src/main/java/com/bwie/health/service/HealthService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-health/src/main/java/com/bwie/health/service/impl/HealthServiceImpl.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-health/src/main/resources/bootstrap.yml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-health/src/main/resources/mapper/HealthMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/encodings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bwie-modules/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/pom.xml" afterDir="false" />
</list>
@ -38,6 +25,9 @@
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectColorInfo"><![CDATA[{
"associatedIndex": 1
}]]></component>
<component name="ProjectId" id="2ZeGwUKqC4hiI7DWBCSZlktoN5x" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
<ConfirmationsSetting value="2" id="Add" />
@ -46,27 +36,27 @@
<option name="showLibraryContents" value="true" />
<option name="showVisibilityIcons" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RequestMappingsPanelOrder0": "0",
"RequestMappingsPanelOrder1": "1",
"RequestMappingsPanelWidth0": "75",
"RequestMappingsPanelWidth1": "75",
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"WebServerToolWindowFactoryState": "false",
"git-widget-placeholder": "master",
"jdk.selected.JAVA_MODULE": "1.8",
"last_opened_file_path": "Z:/JavaHeathl/bwie-modules/bwie-health/src/main/resources",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"vue.rearranger.settings.migration": "true"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;RequestMappingsPanelOrder0&quot;: &quot;0&quot;,
&quot;RequestMappingsPanelOrder1&quot;: &quot;1&quot;,
&quot;RequestMappingsPanelWidth0&quot;: &quot;75&quot;,
&quot;RequestMappingsPanelWidth1&quot;: &quot;75&quot;,
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
&quot;git-widget-placeholder&quot;: &quot;master&quot;,
&quot;jdk.selected.JAVA_MODULE&quot;: &quot;1.8&quot;,
&quot;last_opened_file_path&quot;: &quot;Z:/JavaHeathl/bwie-modules/bwie-health/src/main/resources&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}
}]]></component>
}</component>
<component name="ReactorSettings">
<option name="notificationShown" value="true" />
</component>
@ -123,10 +113,22 @@
<option name="presentableId" value="Default" />
<updated>1702775369535</updated>
<workItem from="1702775370735" duration="3984000" />
<workItem from="1702795938832" duration="394000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
</project>

View File

@ -0,0 +1,18 @@
package com.bwie;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* @author gxb
* @description TODO
* @date 2023-12-16 12:19
*/
@SpringBootApplication
@EnableFeignClients
public class AuthAppliction {
public static void main(String[] args) {
SpringApplication.run(AuthAppliction.class,args);
}
}

View File

@ -0,0 +1,14 @@
package com.bwie.config;
import feign.Retryer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class FeignConfig {
@Bean
public Retryer retry(){
return new Retryer.Default(5000,30000,3);
}
}

View File

@ -0,0 +1,37 @@
package com.bwie.controller;
import com.bwie.common.domain.request.LoginRequest;
import com.bwie.common.result.Result;
import com.bwie.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @author gxb
* @description TODO
* @date 2023-12-08 20:10
*/
@RestController
public class AuthController {
@Autowired
private AuthService authService;
/**
*
*/
@PostMapping("/login")
public Result login(@RequestBody LoginRequest loginRequest){
return authService.login(loginRequest);
}
/**
*
*/
@GetMapping("/Info")
public Result Info(){
return authService.Info();
}
}

View File

@ -0,0 +1,21 @@
package com.bwie.feign;
import com.bwie.common.domain.User;
import com.bwie.common.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author gxb
* @description TODO
* @date 2023-12-08 20:10
*/
@FeignClient("bwie-user")
public interface AuthFeign {
/**
*
*/
@PostMapping("/findName")
public Result<User> findName(@RequestParam String username);
}

View File

@ -0,0 +1,16 @@
package com.bwie.service;
import com.bwie.common.domain.request.LoginRequest;
import com.bwie.common.result.Result;
/**
* @author gxb
* @description TODO
* @date 2023-12-08 20:10
*/
public interface AuthService {
Result login(LoginRequest loginRequest);
Result Info();
}

View File

@ -0,0 +1,112 @@
package com.bwie.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.nacos.common.utils.UuidUtils;
import com.bwie.common.constants.JwtConstants;
import com.bwie.common.constants.TokenConstants;
import com.bwie.common.domain.User;
import com.bwie.common.domain.request.LoginRequest;
import com.bwie.common.domain.response.JwtResponse;
import com.bwie.common.result.Result;
import com.bwie.common.utils.JwtUtils;
import com.bwie.feign.AuthFeign;
import com.bwie.service.AuthService;
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.HashMap;
import java.util.concurrent.TimeUnit;
/**
* @author gxb
* @description TODO
* @date 2023-12-08 20:11
*/
@Service
public class AuthServicelmpl implements AuthService {
@Autowired
private AuthFeign authFeign;
@Autowired
private RedisTemplate<String,String> redisTemplate;
@Autowired
private HttpServletRequest request;
/**
*
* @param loginRequest
* @return
*/
@Override
public Result login(LoginRequest loginRequest) {
/**
*
*/
Boolean userPwd = this.isUserPwd(loginRequest.getPassword());
if (!userPwd){
return Result.error("密码由不超过16位的数字、英文、下划线组成");
}
/**
*
*/
User user = authFeign.findName(loginRequest.getUsername()).getData();
if (null==user){
return Result.error("用户名不存在,请先注册");
}
if (!user.getPassword().equals(loginRequest.getPassword())){
return Result.error("密码输入错误,请重新输入");
}
Integer role = user.getRole();
Integer role1 = loginRequest.getRole();
int a = role;
int b = role1;
boolean c = a == b;
if (!c){
return Result.error("登录身份选择错误");
}
JwtResponse token = this.getToken(user);
if (1==user.getRole()){
return Result.success(token,"医生登录成功");
}
return Result.success(token,"病人(家属)登录成功");
}
@Override
public Result Info() {
String token = request.getHeader("token");
String userKey = JwtUtils.getUserKey(token);
String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey);
User user = JSON.parseObject(s, User.class);
return Result.success(user,"当前登录人");
}
//生成token
private JwtResponse getToken(User user){
HashMap<String, Object> map = new HashMap<>();
String userKey = UuidUtils.generateUuid().replaceAll("-", "");
map.put(JwtConstants.USER_KEY,userKey);
String token = JwtUtils.createToken(map);
redisTemplate.opsForValue().set(TokenConstants.LOGIN_TOKEN_KEY+userKey,
JSON.toJSONString(user),15, TimeUnit.MINUTES);
return new JwtResponse(token);
}
//编号必填且必须是6位数字
private Boolean isUserBh(String userBh){
String str = "^\\d{6}$";
return userBh.matches(str);
}
//密码必填由不超过16位的数字、英文、下划线组成
private Boolean isUserPwd(String userPwd){
String str = "^[\\w]{1,16}$";
return userPwd.matches(str);
}
//手机号验证
private Boolean isPhone(String userPhone){
String str= "^1[3-9]\\d{9}$";
return userPhone.matches(str);
}
}

View File

@ -0,0 +1,12 @@
<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>
</dependencies>

View File

@ -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;
}

View File

@ -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;
}

View File

@ -0,0 +1,25 @@
package com.bwie.common.domain;
import lombok.Data;
import java.util.Date;
@Data
public class Formation {
private Integer formationId;//用户具体信息表
private Integer formationPress;//血压
private Integer formationSugar;//血糖
private Date formationDate;//加入时间
private String formationAddress;//住址
private Integer userId; //用户Id
private String userName;//用户名
private String userPwd;//密码
private String formationPhone;//手机号
private Integer formationAge; //年龄
private String formationSex;//性别
private String formationName;//昵称
private Integer isDele;
}

View File

@ -0,0 +1,32 @@
package com.bwie.common.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author gxb
* @description TODO
* @date 2023-12-22 20:28
*/
@Data
public class Manage {
// 管理员ID
private Integer manageId;
// 案件ID
private Integer caseId;
// 问题ID
private Integer id;
// 案件名称
private String caseName;
// 案件时间
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date caseTime;
// 案件信息
private String caseMessage;
// 用户名
private String username;
}

View File

@ -0,0 +1,20 @@
package com.bwie.common.domain;
import lombok.Data;
/**
* @author gxb
* @description TODO
* @date 2023-12-08 20:47
*/
@Data
public class Sign {
//名称
private String username;
//密码
private String password;
// 1 - 管理员 2 - 用户
private Integer role;
private String phone;
}

View File

@ -1,19 +0,0 @@
package com.bwie.common.domain;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @author gxb
* @description TODO
* @date 2023-12-23 10:12
*/
@Data
public class Trees {
private Integer id;
private Integer treesId;
private String treesName;
private List<Trees> children = new ArrayList<>();
}

View File

@ -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;
}

View File

@ -0,0 +1,15 @@
package com.bwie.common.domain.request;
import lombok.Data;
/**
* @author gxb
* @description TODO
* @date 2023-12-16 11:44
*/
@Data
public class LoginRequest {
private String username;
private String password;
private Integer role;
}

View File

@ -0,0 +1,18 @@
package com.bwie.common.domain.request;
import lombok.Data;
/**
* @author gxb
* @description TODO
* @date 2023-12-16 13:19
*/
@Data
public class Retri {
/**
*
*/
private String phone;
private Integer role;
}

View File

@ -0,0 +1,16 @@
package com.bwie.common.domain.response;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* @author gxb
* @description TODO
* @date 2023-12-08 20:20
*/
@Data
@AllArgsConstructor
public class JwtResponse {
private String token;
}

View File

@ -9,8 +9,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* @date 2023-12-16 8:35
*/
@SpringBootApplication
public class GatewayAppliction {
public class GatewayApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayAppliction.class,args);
SpringApplication.run(GatewayApplication.class,args);
}
}
}

View File

@ -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>

View File

@ -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);
}
}

View File

@ -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(@RequestBody CaseRequest caseRequest) {
System.out.println(caseRequest + "---------");
return caseService.selCase(caseRequest);
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -0,0 +1,138 @@
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 {
// 调用caseMapper的insertCase方法插入cases
row = caseMapper.insertCase(cases);
} catch (Exception e) {
// 抛出运行时异常
throw new RuntimeException(e);
}
// 如果row等于0抛出非法访问错误
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());
// caseRequest.setUserId(user.getId());
// 调用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);
}
}

View File

@ -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 "删除成功";
}
}

View File

@ -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

View File

@ -0,0 +1,39 @@
<?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>
<if test="2==roleId">
case.user_id = #{userId}
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

View File

@ -1,50 +1,56 @@
<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">
<?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>Java-Heathl</artifactId>
<artifactId>bwie-modules</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>bwie-trees</artifactId>
<artifactId>bwie-formation</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 -->
<!-- SpringBoot Web-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Druid -->
<!-- Druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.2.8</version>
</dependency>
<!-- Mysql Connector -->
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- Mybatis 依赖配置 -->
<!-- Mybatis 依赖配置 -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.2</version>
</dependency>
<!-- Pagehelper -->
<!-- Pagehelper -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.4.1</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,13 @@
package com.bwie.formaiton;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan("com.bwie.formaiton.mapper")
public class FormaitonAppliaction {
public static void main(String[] args) {
SpringApplication.run(FormaitonAppliaction.class,args);
}
}

View File

@ -0,0 +1,28 @@
package com.bwie.formaiton.controller;
import com.bwie.common.domain.Formation;
import com.bwie.common.result.Result;
import com.bwie.formaiton.service.FormationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class FormationController {
@Autowired
private FormationService formationService;
@PostMapping("/list")
public Result<List<Formation>> list(){
return formationService.list();
}
@PostMapping("/insert")
public Result<Integer> insert(@RequestBody Formation formation){
return formationService.insert(formation);
}
}

View File

@ -0,0 +1,11 @@
package com.bwie.formaiton.mapper;
import com.bwie.common.domain.Formation;
import java.util.List;
public interface FormationMapper {
List<Formation> list();
Integer insert(Formation formation);
}

View File

@ -0,0 +1,12 @@
package com.bwie.formaiton.service;
import com.bwie.common.domain.Formation;
import com.bwie.common.result.Result;
import java.util.List;
public interface FormationService {
Result<List<Formation>> list();
Result<Integer> insert(Formation formation);
}

View File

@ -0,0 +1,54 @@
package com.bwie.formaiton.service.impl;
import com.alibaba.fastjson.JSON;
import com.bwie.common.constants.TokenConstants;
import com.bwie.common.domain.Formation;
import com.bwie.common.domain.User;
import com.bwie.common.result.Result;
import com.bwie.common.utils.JwtUtils;
import com.bwie.formaiton.mapper.FormationMapper;
import com.bwie.formaiton.service.FormationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Service
public class FormationServiceImpl implements FormationService {
@Autowired
private FormationMapper formationMapper;
@Autowired
private StringRedisTemplate redisTemplate;
@Autowired
private HttpServletRequest request;
@Override
public Result<List<Formation>> list() {
// 调用formationMapper的list方法获取Formation列表
List<Formation> list = formationMapper.list();
// 返回成功结果包含Formation列表
return Result.success(list);
}
@Override
public Result<Integer> insert(Formation formation) {
// 获取token
String token = request.getHeader(TokenConstants.TOKEN);
// 获取用户key
String userKey = JwtUtils.getUserKey(token);
// 从redis中获取用户信息
String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey);
// 将用户信息转换成User对象
User user = JSON.parseObject(s, User.class);
// 将用户信息设置到formation对象中
formation.setUserId(user.getId());
formation.setUserName(user.getUsername());
formation.setUserPwd(user.getPassword());
// 插入formation表
Integer i = formationMapper.insert(formation);
// 返回插入的条数
return Result.success(i);
}
}

View File

@ -0,0 +1,29 @@
# Tomcat
server:
port: 9002
# Spring
spring:
main:
allow-circular-references: true
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
application:
# 应用名称
name: bwie-formation
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 122.51.35.58:8848
config:
# 配置中心地址
server-addr: 122.51.35.58:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

View File

@ -0,0 +1,13 @@
<?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.formaiton.mapper.FormationMapper">
<insert id="insert">
INSERT INTO `health`.`formation` (`formation_press`, `formation_sugar`, `formation_date`, `formation_address`, `user_id`, `user_name`, `user_pwd`, `formation_phone`,`formation_age`, `formation_sex`, `formation_name`, `is_dele`) VALUES
(#{formationPress}, #{formationSugar}, now(), #{formationAddress}, #{userId}, #{userName}, #{userPwd}, #{formationPhone},#{formationAge}, #{formationSex}, #{formationName}, 1);
</insert>
<select id="list" resultType="com.bwie.common.domain.Formation">
select * from formation f left join user u on f.user_id=u.id
</select>
</mapper>

View File

@ -3,6 +3,7 @@ package com.bwie.health.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.bwie.common.constants.TokenConstants;
import com.bwie.common.domain.Health;
import com.bwie.common.domain.User;
import com.bwie.common.result.Result;
import com.bwie.common.utils.JwtUtils;
import com.bwie.health.mapper.HealthMapper;
@ -27,25 +28,35 @@ public class HealthServiceImpl implements HealthService{
private HttpServletRequest request;
/*查看内容*/
@Override
@Override
public Result<PageInfo<Health>> list(Health health) {
// 调用PageHelper的startPage方法传入当前页码和每页条数
PageHelper.startPage(health.getPageNum(),health.getPageSize());
// 调用healthMapper的list方法传入health参数
List<Health> list = healthMapper.list(health);
// 创建PageInfo对象传入list
PageInfo<Health> info = new PageInfo<>(list);
// 返回Result.success方法传入info
return Result.success(info);
}
/*健康教育信息录入*/
@Override
@Override
public Result<Integer> addHealth(Health health) {
// String token1 = request.getHeader("token");
// String userKey = JwtUtils.getUserKey(token1);
// String token = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY+userKey);
// User o = JSONObject.parseObject(token, User.class);
// health.setUserId(o.Id);
//获取token
String token1 = request.getHeader("token");
//根据token获取用户key
String userKey = JwtUtils.getUserKey(token1);
//根据用户key获取token
String token = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY+userKey);
//根据token解析出用户信息
User o = JSONObject.parseObject(token, User.class);
//将用户信息设置到health中
health.setUserId(o.getId());
//调用healthMapper的addHealth方法添加health
Integer i = healthMapper.addHealth(health);
//根据返回结果返回对应信息
return Result.success(i,i>0?"录入成功":"录入失败");
}
@ -55,7 +66,7 @@ public class HealthServiceImpl implements HealthService{
Integer i = healthMapper.updateHealth(health);
return Result.success(i,i>0?"修改成功":"修改失败");
}
/*健康教育记录删除*/
@Override
public Result<Integer> deleteHealth(String healthId) {

View File

@ -18,10 +18,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 124.221.211.96:8848
server-addr: 43.143.161.183:8848
config:
# 配置中心地址
server-addr: 124.221.211.96:8848
server-addr: 43.143.161.183:8848
# 配置文件格式
file-extension: yml
# 共享配置
@ -40,4 +40,4 @@ fdfs:
# 生成缩略图
thumb-image:
height: 500
width: 500
width: 500

View File

@ -0,0 +1,56 @@
<?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-manage</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>
</dependencies>
</project>

View File

@ -0,0 +1,11 @@
package com.bwie.manage;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ManageApp {
public static void main(String[] args) {
SpringApplication.run(ManageApp.class);
}
}

View File

@ -0,0 +1,36 @@
package com.bwie.manage.controller;
import com.bwie.common.domain.Case;
import com.bwie.common.domain.Manage;
import com.bwie.common.result.Result;
import com.bwie.manage.service.ManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ManageController {
@Autowired
private ManageService manageService;
@PostMapping("/list")
public Result list(){
return manageService.list();
}
@PostMapping("/add")
public Result add(@RequestBody Manage manage){
return manageService.add(manage);
}
@PostMapping("/upd")
public Result upd(@RequestBody Manage manage){
return manageService.upd(manage);
}
@PostMapping("/del")
public Result del(@RequestParam Integer manageId){
return manageService.del(manageId);
}
}

View File

@ -0,0 +1,22 @@
package com.bwie.manage.mapper;
import com.bwie.common.domain.Manage;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
import java.util.List;
@Mapper
@Component
public interface ManageMapper {
List<Manage> list();
Integer add(Manage manage);
Integer upd(Manage manage);
Integer del(Integer manageId);
Manage findAll(Manage manage);
}

View File

@ -0,0 +1,14 @@
package com.bwie.manage.service;
import com.bwie.common.domain.Manage;
import com.bwie.common.result.Result;
public interface ManageService {
Result list();
Result add(Manage manage);
Result upd(Manage manage);
Result del(Integer manageId);
}

View File

@ -0,0 +1,60 @@
package com.bwie.manage.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.bwie.common.constants.TokenConstants;
import com.bwie.common.domain.Manage;
import com.bwie.common.domain.User;
import com.bwie.common.result.Result;
import com.bwie.common.utils.JwtUtils;
import com.bwie.manage.mapper.ManageMapper;
import com.bwie.manage.service.ManageService;
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;
@Service
public class ManageServiceCs implements ManageService {
@Autowired
private ManageMapper manageMapper;
@Autowired
private RedisTemplate<String ,String > redisTemplate;
@Autowired
private HttpServletRequest request;
@Override
public Result list() {
List<Manage> list = manageMapper.list();
return Result.success(list,"列表");
}
@Override
public Result add(Manage manage) {
String token = request.getHeader("token");
String userKey = JwtUtils.getUserKey(token);
String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey);
User user = JSONObject.parseObject(s, User.class);
manage.setId(user.getId());
Manage all = manageMapper.findAll(manage);
if (all!=null){
return Result.error("存在此病人不能添加");
}
Integer add=manageMapper.add(manage);
return Result.success(add>0?200:500,add>0?"添加成功":"添加失败");
}
@Override
public Result upd(Manage manage) {
Integer upd=manageMapper.upd(manage);
return Result.success(upd>0?200:500,upd>0?"添加成功":"添加失败");
}
@Override
public Result del(Integer manageId) {
Integer del=manageMapper.del(manageId);
return Result.success(del>0?200:500,del>0?"删除成功":"删除失败");
}
}

View File

@ -0,0 +1,29 @@
# Tomcat
server:
port: 9005
# Spring
spring:
main:
allow-circular-references: true
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
application:
# 应用名称
name: bwie-manage
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}

View File

@ -0,0 +1,23 @@
<?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.manage.mapper.ManageMapper">
<insert id="add">
INSERT INTO `health`.`t_manage` (`case_id`, `id`)
VALUES (#{caseId}, #{id});
</insert>
<update id="upd">
UPDATE `health`.`t_manage` SET `case_id` = #{caseId},
`id` = #{id}
WHERE `manage_id` = #{manageId};
</update>
<delete id="del">
delete from t_manage where manage_id=#{manageId}
</delete>
<select id="list" resultType="com.bwie.common.domain.Manage">
select m.*,c.case_name,c.case_time,c.case_message,u.username from t_manage m left join cases c on m.case_id=c.case_id
left join user u on m.id=u.id
</select>
<select id="findAll" resultType="com.bwie.common.domain.Manage">
select *from t_manage where case_id=#{caseId} and id=#{id}
</select>
</mapper>

View File

@ -1,13 +0,0 @@
package com.bwie.trees;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@EnableDiscoveryClient
public class TreesApplication{
public static void main(String[] args) {
SpringApplication.run(TreesApplication.class,args);
}
}

View File

@ -1,36 +0,0 @@
package com.bwie.trees.controller;
import com.bwie.common.domain.Trees;
import com.bwie.common.result.Result;
import com.bwie.trees.service.TreesService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@RestController
@Log4j2
@RequestMapping("/tress")
public class TreesController{
@Autowired
private TreesService treesService;
@Autowired
private HttpServletRequest request;
@PostMapping("/selectOne")
public Result<List<Trees>> Select(){
return treesService.treesSelect();
}
// @PostMapping("/SelectOne")
// public Result<List<Trees>> SelectOne(){
// return treesService.treesSelectOne();
// }
@PostMapping("/selectTwo")
public Result<List<Trees>> SelectTwo(){
return treesService.treesSelectTwo();
}
}

View File

@ -1,12 +0,0 @@
package com.bwie.trees.mapper;
import com.bwie.common.domain.Trees;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface TreesMapper{
List<Trees> treesSelect();
}

View File

@ -1,15 +0,0 @@
package com.bwie.trees.service;
import com.bwie.common.domain.Trees;
import com.bwie.common.result.Result;
import java.util.List;
public interface TreesService{
Result<List<Trees>> treesSelect();
// Result<List<Trees>> treesSelectOne();
Result<List<Trees>> treesSelectTwo();
}

View File

@ -1,64 +0,0 @@
package com.bwie.trees.service.impl;
import com.bwie.common.domain.Trees;
import com.bwie.common.result.Result;
import com.bwie.trees.mapper.TreesMapper;
import com.bwie.trees.service.TreesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class TreesServiceImpl implements TreesService{
@Autowired
private TreesMapper treesMapper;
@Override/*1.查询表*/
public Result<List<Trees>> treesSelect() {
List<Trees> list = treesMapper.treesSelect();
return Result.success(list,"查询成功");
}
// @Override
// public Result<List<Trees>> treesSelectOne() {
// Result<List<Trees>> listResult = this.treesSelect();
// List<Trees> treesList = listResult.getData();
// List<Trees> collect = treesList.stream().
// filter(trees -> trees.getTreesId() == 0).
// peek(trees -> trees.setChildren(getChildren(trees,treesList).isEmpty() ? null : getChildren(trees,treesList))).
// sorted().
// collect(Collectors.toList());
// return Result.success(collect);
// }
@Override
public Result<List<Trees>> treesSelectTwo() {
Result<List<Trees>> listResult = this.treesSelect();
List<Trees> treesList = listResult.getData();
List<Trees> collect = treesList
.stream()
.filter(trees -> trees.getTreesId() == 0)
.peek(trees -> trees.setChildren(getChildren(trees, treesList).isEmpty() ? null : getChildren(trees,treesList)))
.collect(Collectors.toList());
return Result.success(collect);
}
private List<Trees> getChildren(Trees tree, List<Trees> treesList){
List<Trees> collect = treesList.stream()//转Stream型
.filter(trees -> trees.getTreesId() == tree.getId())//过滤父类ID是否等于主键ID
.peek(trees -> trees.setChildren(getChildren(trees, treesList).isEmpty() ? null : getChildren(trees, treesList)))//给属性设置
.collect(Collectors.toList());
return collect;
}
// private List<Trees> getCidrens(//对象 ,//list集合)
// {
// 将list集合转stream
// .filter来进行一个过滤
// .peek设置属性
// .collect存入list
// }
}

View File

@ -1,9 +0,0 @@
<?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.trees.mapper.TreesMapper">
<select id="treesSelect" resultType="com.bwie.common.domain.Trees">
select * from trees
</select>
</mapper>

View File

@ -0,0 +1,54 @@
<?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-user</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>
</dependencies>
</project>

View File

@ -0,0 +1,16 @@
package com.bwie.user;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author gxb
* @description TODO
* @date 2023-12-16 12:18
*/
@SpringBootApplication
public class UserAppliction {
public static void main(String[] args) {
SpringApplication.run(UserAppliction.class,args);
}
}

View File

@ -0,0 +1,66 @@
package com.bwie.user.controller;
import com.bwie.common.domain.Sign;
import com.bwie.common.domain.User;
import com.bwie.common.domain.request.Retri;
import com.bwie.common.result.Result;
import com.bwie.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author gxb
* @description TODO
* @date 2023-12-08 20:05
*/
@RestController
public class UserController {
@Autowired
private UserService userService;
/**
*
*/
@PostMapping("/findName")
public Result<User> findName(@RequestParam String username){
return userService.findName(username);
}
/**
*
*/
@PostMapping("/Retrieve")
public Result Retrieve(@RequestBody Retri retri){
return userService.Retrieve(retri);
}
// /**
// * 修改密码
// */
@PostMapping("/updPwd")
public Result updPwd(@RequestParam String userPwd){
return userService.updPwd(userPwd);
}
// /**
// * 注册
// */
@PostMapping("/sign")
public Result sign(@RequestBody Sign sign){
return userService.sign(sign);
}
// /**
// * 管理员管理
// */
@GetMapping("/Role")
public Result Role(){
return userService.Role();
}
// /**
// * 管理员添加
// */
@PostMapping("/Irole")
public Result Irole(@RequestParam Integer num){
if (2==num){
return Result.success(200,"暂未升级管理员");
}
return userService.Irole();
}
}

View File

@ -0,0 +1,36 @@
package com.bwie.user.mapper;
import com.bwie.common.domain.Sign;
import com.bwie.common.domain.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author gxb
* @description TODO
* @date 2023-12-08 20:05
*/
@Component
@Mapper
public interface UserMapper {
// User finduserBh(String userBh);
//
User finduserPhone(String userPhone);
//
//
void Inter(Sign sign);
//
//
User findName(String username);
void updPwds(@Param("id") Integer id, @Param("userPwd") String userPwd);
void UpdRoles(Integer id);
List<User> userList(int i);
}

View File

@ -0,0 +1,30 @@
package com.bwie.user.service;
import com.bwie.common.domain.Sign;
import com.bwie.common.domain.User;
import com.bwie.common.domain.request.Retri;
import com.bwie.common.result.Result;
/**
* @author gxb
* @description TODO
* @date 2023-12-08 20:06
*/
public interface UserService {
// Result<User> finduserBh(String userBh);
//找回密码
Result Retrieve(Retri retri);
//修改密码
Result updPwd(String userPwd);
//
Result sign(Sign sign);
//
Result Irole();
//
//
Result Role();
Result<User> findName(String username);
}

View File

@ -0,0 +1,156 @@
package com.bwie.user.service.impl;
import com.alibaba.fastjson.JSON;
import com.bwie.common.constants.TokenConstants;
import com.bwie.common.domain.Sign;
import com.bwie.common.domain.User;
import com.bwie.common.domain.request.Retri;
import com.bwie.common.result.Result;
import com.bwie.common.utils.JwtUtils;
import com.bwie.user.mapper.UserMapper;
import com.bwie.user.service.UserService;
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 gxb
* @description TODO
* @date 2023-12-08 20:06
*/
@Service
public class UserServicelmpl implements UserService {
@Autowired
private UserMapper userMapper;
@Autowired
private RedisTemplate<String, String> redisTemplate;
@Autowired
private HttpServletRequest request;
/**
*
* @param username
* @return
*/
@Override
public Result<User> findName(String username) {
User user = userMapper.findName(username);
return Result.success(user);
}
// /**
// * 找回密码
// *
// * @param retri
// * @return
// */
@Override
public Result Retrieve(Retri retri) {
Boolean phone = this.isPhone(retri.getPhone());
if (!phone) {
return Result.error("手机号格式错误");
}
User user = userMapper.finduserPhone(retri.getPhone());
if (null == user) {
return Result.error("手机号不存在,请注册");
}
if (!(retri.getRole() == user.getRole())) {
return Result.error("身份选择错误,请重新选择身份信息");
}
return Result.success("您的密码为:"+user.getPassword(), "找回成功");
}
// /**
// * 修改密码
// *
// * @param userPwd
// * @return
// */
@Override
public Result updPwd(String userPwd) {
Boolean pwd = this.isUserPwd(userPwd);
if (!pwd) {
return Result.error("不超过16位的数字、英文、下划线组成");
}
//获取当前登录人
String token = request.getHeader("token");
String userKey = JwtUtils.getUserKey(token);
String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey);
User user = JSON.parseObject(s, User.class);
if (user.getPassword().equals(userPwd)) {
return Result.error("不能使用旧密码,请重新输入");
}
userMapper.updPwds(user.getId(), userPwd);
return Result.success(200, "修改成功");
}
// /**
// * 注册
// *
// * @param sign
// * @return
// */
@Override
public Result sign(Sign sign) {
Boolean phone = this.isPhone(sign.getPhone());
if (!phone) {
return Result.error("手机号格式错误");
}
Boolean userPwd = this.isUserPwd(sign.getPassword());
if (!userPwd) {
return Result.error("密码由不超过16位的数字、英文、下划线组成");
}
User user = userMapper.finduserPhone(sign.getPhone());
if (null != user) {
return Result.error("账号已存在,请前往登录");
}
userMapper.Inter(sign);
return Result.success(200,"注册成功");
}
// /**
// * 添加管理员
// * @return
// */
@Override
public Result Irole() {
String token = request.getHeader("token");
String userKey = JwtUtils.getUserKey(token);
String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey);
User user = JSON.parseObject(s, User.class);
if (1==user.getRole()){
return Result.success(200,"您已经是管理员了,无需升级");
}
userMapper.UpdRoles(user.getId());
return Result.success(200,"恭喜您升级成管理员");
}
//
// /**
// * 管理员管理
// * @return
// */
@Override
public Result Role() {
List<User> userList = userMapper.userList(1);
return Result.success(userList,"管理员列表");
}
//密码必填由不超过16位的数字、英文、下划线组成
private Boolean isUserPwd(String userPwd) {
String str = "^[\\w]{1,16}$";
return userPwd.matches(str);
}
//手机号验证
private Boolean isPhone(String userPhone) {
String str = "^1[3-9]\\d{9}$";
return userPhone.matches(str);
}
}

View File

@ -1,6 +1,6 @@
# Tomcat
server:
port: 9005
port: 9009
# Spring
spring:
main:
@ -10,31 +10,30 @@ spring:
time-zone: GMT+8
application:
# 应用名称
name: bwie-trees
name: bwie-user
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地
server-addr: 124.221.211.96:8848
# 服务注册地
server-addr: 43.143.161.183:8848
config:
# 配置中心地址
server-addr: 124.221.211.96:8848
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: 124.221.211.96:22122
web-server-url: 124.221.211.96:8888
tracker-list: 121.40.42.67:22122
web-server-url: 121.40.42.67:8888
pool:
jmx-enabled: false
# 生成缩略图

View File

@ -0,0 +1,38 @@
<?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.user.mapper.UserMapper">
<sql id="user">
id,username,password,`role`,phone
</sql>
<insert id="Inter">
INSERT INTO `health`.`user`
(`username`, `password`, `role`, `phone`) VALUES
( #{username},#{password} , #{role}, #{phone} );
</insert>
<update id="updPwd">
</update>
<update id="updPwds">
update user set password = #{userPwd} where id = #{id}
</update>
<update id="UpdRoles">
update user set role = 1 where id=#{id}
</update>
<select id="finduserBh" resultType="com.bwie.common.domain.User">
select <include refid="user"></include>
from user where role = #{userBh} ;
</select>
<select id="finduserPhone" resultType="com.bwie.common.domain.User">
select <include refid="user"></include> from user where phone = #{userPhone}
</select>
<select id="findName" resultType="com.bwie.common.domain.User">
select <include refid="user"></include> from user where username = #{username};
</select>
<select id="userList" resultType="com.bwie.common.domain.User">
select <include refid="user"></include>
from user where role = #{i} ;
</select>
</mapper>

View File

@ -12,9 +12,11 @@
<artifactId>bwie-modules</artifactId>
<packaging>pom</packaging>
<modules>
<module>bwie-user</module>
<module>bwie-health</module>
<module>bwie-trees</module>
<module>bwie-formation</module>
<module>bwie-cases</module>
<module>bwie-manage</module>
</modules>
<properties>

View File

@ -10,9 +10,9 @@
<packaging>pom</packaging>
<modules>
<module>bwie-common</module>
<module>bwie-auth</module>
<module>bwie-gateway</module>
<module>bwie-modules</module>
<module>bwie-auth</module>
</modules>
<properties>