first commit
This commit is contained in:
15
app_sb/src/main/java/com/luowei/app_sb/AppSbApplication.java
Normal file
15
app_sb/src/main/java/com/luowei/app_sb/AppSbApplication.java
Normal file
@ -0,0 +1,15 @@
|
||||
package com.luowei.app_sb;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class AppSbApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AppSbApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,148 @@
|
||||
package com.luowei.app_sb.controller;
|
||||
|
||||
import com.luowei.app_sb.entity.Person_805Entity;
|
||||
import com.luowei.app_sb.entity.Person_health_805Entity;
|
||||
import com.luowei.app_sb.entity.User_70Entity;
|
||||
import com.luowei.app_sb.service.Person_805Service;
|
||||
import com.luowei.app_sb.service.User_70Service;
|
||||
import com.luowei.app_sb.vo.PersonHealthVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class ApiController {
|
||||
@RequestMapping("get_1")
|
||||
public String get_1(){
|
||||
return "spring-boot";
|
||||
}
|
||||
@RequestMapping("get_2")
|
||||
public String get_2(String name){
|
||||
return name;
|
||||
}
|
||||
@Autowired
|
||||
User_70Service user_70Service;
|
||||
@RequestMapping("register_803_2")
|
||||
public String register_803_2(User_70Entity user_70Entity){
|
||||
if(user_70Service.select(user_70Entity.getName())==null){
|
||||
//md5的处理 md5(aaaa)
|
||||
user_70Entity.setPassword(DigestUtils.md5DigestAsHex(user_70Entity.getPassword().getBytes()));
|
||||
user_70Service.insert(user_70Entity);
|
||||
return "新用户注册成功";
|
||||
}else{
|
||||
user_70Entity.setPassword(DigestUtils.md5DigestAsHex(user_70Entity.getPassword().getBytes()));
|
||||
user_70Service.update(user_70Entity);
|
||||
return "用户密码修改成功";
|
||||
}
|
||||
}
|
||||
//java session
|
||||
@RequestMapping("login_803_2")
|
||||
public String login_803_2(User_70Entity user_70Entity,
|
||||
HttpServletRequest httpServletRequest){
|
||||
user_70Entity.setPassword(DigestUtils.md5DigestAsHex(user_70Entity.getPassword().getBytes()));
|
||||
HttpSession httpSession=httpServletRequest.getSession();
|
||||
if(user_70Service.login(user_70Entity)==1){
|
||||
httpSession.setAttribute("name",user_70Entity.getName());// $_SESSION["name"]="mike"
|
||||
return "登录成功";
|
||||
|
||||
}else{
|
||||
httpSession.setAttribute("name","");// $_SESSION["name"]=""
|
||||
return "登录失败";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@RequestMapping("list_803_2")
|
||||
public String list_803_2(HttpServletRequest httpServletRequest){
|
||||
HttpSession httpSession=httpServletRequest.getSession();
|
||||
String returnValue="";
|
||||
try {
|
||||
returnValue=httpSession.getAttribute("name").toString();
|
||||
if(returnValue==""){
|
||||
returnValue="未受权,请先登录";
|
||||
}
|
||||
}catch (Exception e){
|
||||
returnValue="未受权,请先登录";
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@RequestMapping("set_803")
|
||||
public User_70Entity set_803(@RequestParam String name,@RequestParam String address){
|
||||
return user_70Service.setUserInfo(name, address);
|
||||
}
|
||||
|
||||
@RequestMapping("get_803")
|
||||
public String get_803(@RequestParam String name){
|
||||
return user_70Service.getUserAddress(name);
|
||||
}
|
||||
|
||||
@RequestMapping("register_803_1")
|
||||
public String register_803_1(@RequestParam String name,@RequestParam String password){
|
||||
return user_70Service.registerUser(name, password);
|
||||
}
|
||||
|
||||
@RequestMapping("login_803_1")
|
||||
public String login_803_1(@RequestParam String name,@RequestParam String password){
|
||||
return user_70Service.loginUser(name, password);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
Person_805Entity person_805Entity;
|
||||
@Autowired
|
||||
Person_health_805Entity person_health_805Entity;
|
||||
@Autowired
|
||||
Person_805Service person_805Service;
|
||||
|
||||
//提交的表单对应vo层
|
||||
@RequestMapping("ehrSet_805")
|
||||
public String ehrSet_805(PersonHealthVo personHealthVo){
|
||||
String id= UUID.randomUUID().toString().replace("_","").toLowerCase();//生成混杂数字英文的字符串,类似于php中的uniquID
|
||||
//时间戳
|
||||
long now = new Date().getTime()/1000;
|
||||
person_805Entity.setSfz_id(personHealthVo.getSfz_id());
|
||||
person_805Entity.setName(personHealthVo.getName());
|
||||
person_805Entity.setGender(personHealthVo.getGender());
|
||||
person_805Entity.setEmr(personHealthVo.getEmr());
|
||||
if (person_805Service.selectPerson_805(personHealthVo.getSfz_id())==null){
|
||||
//新增
|
||||
person_805Entity.setCreate_time(now);
|
||||
person_805Entity.setUpdate_time(now);
|
||||
person_805Entity.setId(id);
|
||||
person_805Service.insertPerson_805(person_805Entity);
|
||||
}else {
|
||||
//编辑
|
||||
person_805Entity.setUpdate_time(now);
|
||||
person_805Service.updatePerson_805(person_805Entity);
|
||||
}
|
||||
person_health_805Entity.setId(id);
|
||||
person_health_805Entity.setSfz_id(personHealthVo.getSfz_id());
|
||||
person_health_805Entity.setSbp(personHealthVo.getSbp());
|
||||
person_health_805Entity.setDbp(personHealthVo.getDbp());
|
||||
person_health_805Entity.setCreate_time(now);
|
||||
person_health_805Entity.setUpdate_time(now);
|
||||
person_805Service.insertPerson_health_805Entity(person_health_805Entity);
|
||||
|
||||
return person_805Entity.getName();
|
||||
}
|
||||
@RequestMapping("ehrGet_805")
|
||||
public PersonHealthVo ehrGet_805(String sfz_id){
|
||||
return person_805Service.selectPersonHealthVo(sfz_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,58 @@
|
||||
package com.luowei.app_sb.controller;
|
||||
import com.luowei.app_sb.entity.Person_805Entity;
|
||||
import com.luowei.app_sb.entity.Person_health_805Entity;
|
||||
import com.luowei.app_sb.service.Person_805Service;
|
||||
import com.luowei.app_sb.vo.PersonHealthVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("emr")
|
||||
public class EmrController {
|
||||
@Autowired
|
||||
Person_805Entity person_805Entity;
|
||||
@Autowired
|
||||
Person_health_805Entity person_health_805Entity;
|
||||
@Autowired
|
||||
Person_805Service person_805Service;
|
||||
|
||||
//提交的表单对应vo层
|
||||
@RequestMapping("ehrSet_805")
|
||||
public String ehrSet_805(PersonHealthVo personHealthVo){
|
||||
String id= UUID.randomUUID().toString().replace("_","").toLowerCase();//生成混杂数字英文的字符串,类似于php中的uniquID
|
||||
//时间戳
|
||||
long now = new Date().getTime()/1000;
|
||||
person_805Entity.setSfz_id(personHealthVo.getSfz_id());
|
||||
person_805Entity.setName(personHealthVo.getName());
|
||||
person_805Entity.setGender(personHealthVo.getGender());
|
||||
person_805Entity.setEmr(personHealthVo.getEmr());
|
||||
if (person_805Service.selectPerson_805(personHealthVo.getSfz_id())==null){
|
||||
//新增
|
||||
person_805Entity.setCreate_time(now);
|
||||
person_805Entity.setUpdate_time(now);
|
||||
person_805Entity.setId(id);
|
||||
person_805Service.insertPerson_805(person_805Entity);
|
||||
}else {
|
||||
//编辑
|
||||
person_805Entity.setUpdate_time(now);
|
||||
person_805Service.updatePerson_805(person_805Entity);
|
||||
}
|
||||
person_health_805Entity.setId(id);
|
||||
person_health_805Entity.setSfz_id(personHealthVo.getSfz_id());
|
||||
person_health_805Entity.setSbp(personHealthVo.getSbp());
|
||||
person_health_805Entity.setDbp(personHealthVo.getDbp());
|
||||
person_health_805Entity.setCreate_time(now);
|
||||
person_health_805Entity.setUpdate_time(now);
|
||||
person_805Service.insertPerson_health_805Entity(person_health_805Entity);
|
||||
|
||||
return person_805Entity.getName();
|
||||
}
|
||||
@RequestMapping("ehrGet_805")
|
||||
public PersonHealthVo ehrGet_805(String sfz_id){
|
||||
return person_805Service.selectPersonHealthVo(sfz_id);
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package com.luowei.app_sb.controller;
|
||||
|
||||
import com.luowei.app_sb.service.PersonBaseInfo_881_1Service;
|
||||
import com.luowei.app_sb.utility.ResponseUtility;
|
||||
import com.luowei.app_sb.vo.PersonBaseInfo_881_1Vo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
//这版不如20250605上课时讲的写得好。在E:\test\2xuewei\20250301\html5\2班\20250605中
|
||||
@RestController
|
||||
@RequestMapping("PersonBaseInfo_881_1")
|
||||
public class PersonBaseInfo_881_1Controller {
|
||||
@Autowired
|
||||
PersonBaseInfo_881_1Service personBaseInfo_881_1Service;
|
||||
@Autowired
|
||||
ResponseUtility R;
|
||||
//http://localhost:58301/personBaseInfo_881_1/selectAll
|
||||
@RequestMapping("selectAll")
|
||||
public ResponseUtility selectAll(){
|
||||
List<PersonBaseInfo_881_1Vo> personBaseInfo_881_1Vos=personBaseInfo_881_1Service.selectAll();
|
||||
if(personBaseInfo_881_1Vos.size()>0){
|
||||
R.setResponseCode("1");
|
||||
R.setResponseString("查询数据成功");
|
||||
R.setResponseData(personBaseInfo_881_1Vos);
|
||||
}else{
|
||||
R.setResponseCode("2");
|
||||
R.setResponseString("查询数据失败");
|
||||
R.setResponseData(null);
|
||||
}
|
||||
System.out.println(R);
|
||||
return R;
|
||||
}
|
||||
|
||||
//http://localhost:58301/PersonBaseInfo_881_1/select?id=510103234
|
||||
@RequestMapping("select")
|
||||
public ResponseUtility select(String id){
|
||||
PersonBaseInfo_881_1Vo PersonBaseInfo_881_1Vo=personBaseInfo_881_1Service.select(id);
|
||||
if(PersonBaseInfo_881_1Vo!=null){
|
||||
R.setResponseCode("1");
|
||||
R.setResponseString("查询数据成功");
|
||||
R.setResponseData(PersonBaseInfo_881_1Vo);
|
||||
}else{
|
||||
R.setResponseCode("2");
|
||||
R.setResponseString("查询数据失败");
|
||||
R.setResponseData(null);
|
||||
}
|
||||
return R;
|
||||
}
|
||||
//http://localhost:58301/PersonBaseInfo_881_1/insert?id=001&name=luowei2008&sbp=123&dbp=75
|
||||
@RequestMapping("insert")
|
||||
public ResponseUtility insert(PersonBaseInfo_881_1Vo PersonBaseInfo_881_1Vo) throws IOException {
|
||||
return personBaseInfo_881_1Service.insert(PersonBaseInfo_881_1Vo);
|
||||
}
|
||||
//http://localhost:58301/PersonBaseInfo_881_1/update?id=001&name=luowei&sbp=123&dbp=77
|
||||
@RequestMapping("update")
|
||||
//public ResponseUtility update(PersonBaseInfo_881_1Vo PersonBaseInfo_881_1Vo, @RequestParam("photoData")MultipartFile photoData) throws IOException {
|
||||
public ResponseUtility update(PersonBaseInfo_881_1Vo PersonBaseInfo_881_1Vo) throws IOException {
|
||||
|
||||
return personBaseInfo_881_1Service.update(PersonBaseInfo_881_1Vo);
|
||||
|
||||
}
|
||||
//http://localhost:58301/PersonBaseInfo_881_1/delete?id=001
|
||||
@RequestMapping("delete")
|
||||
public ResponseUtility delete(String id){
|
||||
System.out.println(id);
|
||||
return personBaseInfo_881_1Service.delete(id);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.luowei.app_sb.entity;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class PersonBaseInfo_881_1Entity {
|
||||
private String id;
|
||||
private String name;
|
||||
private int sbp;
|
||||
private int dbp;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getSbp() {
|
||||
return sbp;
|
||||
}
|
||||
|
||||
public void setSbp(int sbp) {
|
||||
this.sbp = sbp;
|
||||
}
|
||||
|
||||
public int getDbp() {
|
||||
return dbp;
|
||||
}
|
||||
|
||||
public void setDbp(int dbp) {
|
||||
this.dbp = dbp;
|
||||
}
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package com.luowei.app_sb.entity;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class Person_805Entity {
|
||||
//id,sfz_id,name,gender,password,hometown,chronic_disease,birthday,emr,create_time,update_time
|
||||
private String id;
|
||||
private String sfz_id;
|
||||
private String name;
|
||||
private String gender;
|
||||
private String password;
|
||||
private String hometown;
|
||||
private String chronic_disease;
|
||||
private long birthday;
|
||||
private String emr;
|
||||
private long create_time;
|
||||
private long update_time;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSfz_id() {
|
||||
return sfz_id;
|
||||
}
|
||||
|
||||
public void setSfz_id(String sfz_id) {
|
||||
this.sfz_id = sfz_id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getHometown() {
|
||||
return hometown;
|
||||
}
|
||||
|
||||
public void setHometown(String hometown) {
|
||||
this.hometown = hometown;
|
||||
}
|
||||
|
||||
public String getChronic_disease() {
|
||||
return chronic_disease;
|
||||
}
|
||||
|
||||
public void setChronic_disease(String chronic_disease) {
|
||||
this.chronic_disease = chronic_disease;
|
||||
}
|
||||
|
||||
public long getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public void setBirthday(long birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
public String getEmr() {
|
||||
return emr;
|
||||
}
|
||||
|
||||
public void setEmr(String emr) {
|
||||
this.emr = emr;
|
||||
}
|
||||
|
||||
public long getCreate_time() {
|
||||
return create_time;
|
||||
}
|
||||
|
||||
public void setCreate_time(long create_time) {
|
||||
this.create_time = create_time;
|
||||
}
|
||||
|
||||
public long getUpdate_time() {
|
||||
return update_time;
|
||||
}
|
||||
|
||||
public void setUpdate_time(long update_time) {
|
||||
this.update_time = update_time;
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package com.luowei.app_sb.entity;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class Person_health_805Entity {
|
||||
//id,sfz_id,height,weight,heart_rate,sbp,dbp,blood_sugar,create_time,update_time
|
||||
private String id;
|
||||
private String sfz_id;
|
||||
private String height;
|
||||
private String weight;
|
||||
private String heart_rate;
|
||||
private int sbp;
|
||||
private int dbp;
|
||||
private int blood_sugar;
|
||||
private long create_time;
|
||||
private long update_time;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSfz_id() {
|
||||
return sfz_id;
|
||||
}
|
||||
|
||||
public void setSfz_id(String sfz_id) {
|
||||
this.sfz_id = sfz_id;
|
||||
}
|
||||
|
||||
public String getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(String height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public String getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(String weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public String getHeart_rate() {
|
||||
return heart_rate;
|
||||
}
|
||||
|
||||
public void setHeart_rate(String heart_rate) {
|
||||
this.heart_rate = heart_rate;
|
||||
}
|
||||
|
||||
public int getSbp() {
|
||||
return sbp;
|
||||
}
|
||||
|
||||
public void setSbp(int sbp) {
|
||||
this.sbp = sbp;
|
||||
}
|
||||
|
||||
public int getDbp() {
|
||||
return dbp;
|
||||
}
|
||||
|
||||
public void setDbp(int dbp) {
|
||||
this.dbp = dbp;
|
||||
}
|
||||
|
||||
public int getBlood_sugar() {
|
||||
return blood_sugar;
|
||||
}
|
||||
|
||||
public void setBlood_sugar(int blood_sugar) {
|
||||
this.blood_sugar = blood_sugar;
|
||||
}
|
||||
|
||||
public long getCreate_time() {
|
||||
return create_time;
|
||||
}
|
||||
|
||||
public void setCreate_time(long create_time) {
|
||||
this.create_time = create_time;
|
||||
}
|
||||
|
||||
public long getUpdate_time() {
|
||||
return update_time;
|
||||
}
|
||||
|
||||
public void setUpdate_time(long update_time) {
|
||||
this.update_time = update_time;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.luowei.app_sb.entity;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class User_70Entity {
|
||||
private String name;
|
||||
private String address;
|
||||
private String password;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.luowei.app_sb.mapper;
|
||||
|
||||
import com.luowei.app_sb.entity.PersonBaseInfo_881_1Entity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface PersonBaseInfo_881_1Mapper {
|
||||
List<PersonBaseInfo_881_1Entity> selectAll();
|
||||
PersonBaseInfo_881_1Entity select(String id);
|
||||
int insert(PersonBaseInfo_881_1Entity personBaseInfo_881_1Entity);
|
||||
int update(PersonBaseInfo_881_1Entity personBaseInfo_881_1Entity);
|
||||
int delete(String id);
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.luowei.app_sb.mapper;
|
||||
|
||||
import com.luowei.app_sb.entity.Person_805Entity;
|
||||
import com.luowei.app_sb.entity.Person_health_805Entity;
|
||||
import com.luowei.app_sb.vo.PersonHealthVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@Mapper
|
||||
public interface Person_805Mapper {
|
||||
Person_805Entity selectPerson_805(String sfz_id);
|
||||
int insertPerson_805(Person_805Entity person_805Entity);
|
||||
int updatePerson_805(Person_805Entity person_805Entity);
|
||||
//本来下面应该写到独立的Mapper文件中。为了简化写在了一起。
|
||||
int insertPerson_health_805(Person_health_805Entity person_health_805Entity);
|
||||
//视图查询
|
||||
PersonHealthVo selectPersonHealthVo(String sfz_id);
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.luowei.app_sb.mapper;
|
||||
|
||||
import com.luowei.app_sb.entity.User_70Entity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@Mapper
|
||||
public interface User_70Mapper {
|
||||
User_70Entity select(String name);
|
||||
int insert(User_70Entity user_70Entity);
|
||||
int update(User_70Entity user_70Entity);
|
||||
int login(User_70Entity user_70Entity);
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
package com.luowei.app_sb.service;
|
||||
|
||||
import com.luowei.app_sb.entity.PersonBaseInfo_881_1Entity;
|
||||
import com.luowei.app_sb.mapper.PersonBaseInfo_881_1Mapper;
|
||||
import com.luowei.app_sb.utility.ResponseUtility;
|
||||
import com.luowei.app_sb.vo.PersonBaseInfo_881_1Vo;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class PersonBaseInfo_881_1Service {
|
||||
@Autowired
|
||||
private PersonBaseInfo_881_1Mapper personBaseInfo_881_1Mapper;
|
||||
@Autowired
|
||||
private ResponseUtility R;
|
||||
|
||||
public List<PersonBaseInfo_881_1Vo> selectAll() {
|
||||
List<PersonBaseInfo_881_1Entity> personBaseInfo_881_1EntityList = personBaseInfo_881_1Mapper.selectAll();
|
||||
List<PersonBaseInfo_881_1Vo> personBaseInfo_881_1VoList = new ArrayList<>();
|
||||
|
||||
for (PersonBaseInfo_881_1Entity personBaseInfo_881_1Entity : personBaseInfo_881_1EntityList
|
||||
) {
|
||||
PersonBaseInfo_881_1Vo personBaseInfo_881_1Vo = new PersonBaseInfo_881_1Vo();
|
||||
BeanUtils.copyProperties(personBaseInfo_881_1Entity, personBaseInfo_881_1Vo);
|
||||
personBaseInfo_881_1VoList.add(personBaseInfo_881_1Vo);
|
||||
|
||||
}
|
||||
|
||||
return personBaseInfo_881_1VoList;
|
||||
}
|
||||
|
||||
public PersonBaseInfo_881_1Vo select(String id) {
|
||||
PersonBaseInfo_881_1Entity personBaseInfo_881_1Entity = personBaseInfo_881_1Mapper.select(id);
|
||||
PersonBaseInfo_881_1Vo personBaseInfo_881_1Vo = null;
|
||||
if (personBaseInfo_881_1Entity != null) {
|
||||
personBaseInfo_881_1Vo = new PersonBaseInfo_881_1Vo();
|
||||
BeanUtils.copyProperties(personBaseInfo_881_1Entity, personBaseInfo_881_1Vo);
|
||||
}
|
||||
|
||||
return personBaseInfo_881_1Vo;
|
||||
}
|
||||
|
||||
|
||||
public ResponseUtility insert(PersonBaseInfo_881_1Vo personBaseInfo_881_1Vo) throws IOException {
|
||||
|
||||
if (personBaseInfo_881_1Mapper.select(personBaseInfo_881_1Vo.getId()) == null) {
|
||||
|
||||
PersonBaseInfo_881_1Entity personBaseInfo_881_1Entity = new PersonBaseInfo_881_1Entity();
|
||||
BeanUtils.copyProperties(personBaseInfo_881_1Vo, personBaseInfo_881_1Entity);
|
||||
personBaseInfo_881_1Mapper.insert(personBaseInfo_881_1Entity);
|
||||
|
||||
R.setResponseCode("1");
|
||||
R.setResponseString("新增数据成功");
|
||||
R.setResponseData(personBaseInfo_881_1Vo);
|
||||
} else {
|
||||
R.setResponseCode("2");
|
||||
R.setResponseString("此身份证已存在,新增数据失败");
|
||||
R.setResponseData(null);
|
||||
}
|
||||
|
||||
return R;
|
||||
}
|
||||
|
||||
public ResponseUtility update(PersonBaseInfo_881_1Vo personBaseInfo_881_1Vo) throws IOException {
|
||||
|
||||
|
||||
PersonBaseInfo_881_1Entity personBaseInfo_881_1Entity = new PersonBaseInfo_881_1Entity();
|
||||
BeanUtils.copyProperties(personBaseInfo_881_1Vo, personBaseInfo_881_1Entity);
|
||||
personBaseInfo_881_1Mapper.update(personBaseInfo_881_1Entity);
|
||||
|
||||
R.setResponseCode("1");
|
||||
R.setResponseString("更新数据成功");
|
||||
R.setResponseData(personBaseInfo_881_1Vo);
|
||||
return R;
|
||||
}
|
||||
|
||||
public ResponseUtility delete(String id) {
|
||||
personBaseInfo_881_1Mapper.delete(id);
|
||||
R.setResponseCode("1");
|
||||
R.setResponseString("删除数据成功");
|
||||
R.setResponseData(null);
|
||||
return R;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.luowei.app_sb.service;
|
||||
|
||||
import com.luowei.app_sb.entity.Person_805Entity;
|
||||
import com.luowei.app_sb.entity.Person_health_805Entity;
|
||||
import com.luowei.app_sb.mapper.Person_805Mapper;
|
||||
import com.luowei.app_sb.vo.PersonHealthVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class Person_805Service {
|
||||
//注入Person_805Mapper
|
||||
@Autowired
|
||||
Person_805Mapper person_805Mapper;
|
||||
public Person_805Entity selectPerson_805(String sfz_id){
|
||||
return person_805Mapper.selectPerson_805(sfz_id);
|
||||
}
|
||||
public int updatePerson_805(Person_805Entity person_805Entity){
|
||||
return person_805Mapper.updatePerson_805(person_805Entity);
|
||||
}
|
||||
public int insertPerson_805(Person_805Entity person_805Entity){
|
||||
return person_805Mapper.insertPerson_805(person_805Entity);
|
||||
}
|
||||
public int insertPerson_health_805Entity(Person_health_805Entity person_health_805Entity){
|
||||
return person_805Mapper.insertPerson_health_805(person_health_805Entity);
|
||||
}
|
||||
public PersonHealthVo selectPersonHealthVo(String sfz_id){
|
||||
return person_805Mapper.selectPersonHealthVo(sfz_id);
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package com.luowei.app_sb.service;
|
||||
|
||||
import com.luowei.app_sb.entity.User_70Entity;
|
||||
import com.luowei.app_sb.mapper.User_70Mapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.DigestUtils;
|
||||
|
||||
@Service
|
||||
public class User_70Service {
|
||||
@Autowired
|
||||
User_70Mapper user_70Mapper;
|
||||
public User_70Entity select(String name){
|
||||
return user_70Mapper.select(name);
|
||||
}
|
||||
public int insert(User_70Entity user_70Entity){
|
||||
return user_70Mapper.insert(user_70Entity);
|
||||
}
|
||||
public int update(User_70Entity user_70Entity){
|
||||
return user_70Mapper.update(user_70Entity);
|
||||
}
|
||||
public int login(User_70Entity user_70Entity){
|
||||
return user_70Mapper.login(user_70Entity);
|
||||
}
|
||||
public User_70Entity setUserInfo(String name,String address){
|
||||
User_70Entity user = select(name);
|
||||
if (user!=null){
|
||||
user.setAddress(address);
|
||||
update(user);
|
||||
}else {
|
||||
user = new User_70Entity();
|
||||
user.setName(name);
|
||||
user.setAddress(address);
|
||||
insert(user);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
public String getUserAddress(String name){
|
||||
User_70Entity user = select(name);
|
||||
if (user!=null){
|
||||
return user.getAddress();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//注册用户
|
||||
public String registerUser(String name, String password){
|
||||
User_70Entity user = select(name);
|
||||
String encryptedPassword = DigestUtils.md5DigestAsHex(password.getBytes());
|
||||
if (user == null){
|
||||
User_70Entity newUser = new User_70Entity();
|
||||
newUser.setName(name);
|
||||
newUser.setPassword(encryptedPassword);
|
||||
insert(newUser);
|
||||
return "新用户注册成功";
|
||||
}else {
|
||||
user.setPassword(encryptedPassword);
|
||||
update(user);
|
||||
return "用户密码修改成功";
|
||||
}
|
||||
}
|
||||
//登陆用户
|
||||
public String loginUser(String name,String password){
|
||||
String encryptedPassword = DigestUtils.md5DigestAsHex(password.getBytes());;
|
||||
User_70Entity user = select(name);
|
||||
if (user!=null && user.getPassword().equals(encryptedPassword)){
|
||||
return "登录成功";
|
||||
}
|
||||
return "登录失败";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
package com.luowei.app_sb.utility;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ResponseUtility {
|
||||
private String responseCode;
|
||||
private String responseString;
|
||||
private Object responseData;
|
||||
|
||||
public String getResponseCode() {
|
||||
return responseCode;
|
||||
}
|
||||
|
||||
public void setResponseCode(String responseCode) {
|
||||
this.responseCode = responseCode;
|
||||
}
|
||||
|
||||
public String getResponseString() {
|
||||
return responseString;
|
||||
}
|
||||
|
||||
public void setResponseString(String responseString) {
|
||||
this.responseString = responseString;
|
||||
}
|
||||
|
||||
public Object getResponseData() {
|
||||
return responseData;
|
||||
}
|
||||
|
||||
public void setResponseData(Object responseData) {
|
||||
this.responseData = responseData;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.luowei.app_sb.vo;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class PersonBaseInfo_881_1Vo {
|
||||
private String id;
|
||||
private String name;
|
||||
private int sbp;
|
||||
private int dbp;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getSbp() {
|
||||
return sbp;
|
||||
}
|
||||
|
||||
public void setSbp(int sbp) {
|
||||
this.sbp = sbp;
|
||||
}
|
||||
|
||||
public int getDbp() {
|
||||
return dbp;
|
||||
}
|
||||
|
||||
public void setDbp(int dbp) {
|
||||
this.dbp = dbp;
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package com.luowei.app_sb.vo;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
//给用户展示的视图层
|
||||
@Component
|
||||
public class PersonHealthVo {
|
||||
private String sfz_id;
|
||||
private String name;
|
||||
private String gender;
|
||||
private String emr;
|
||||
private int sbp;
|
||||
private int dbp;
|
||||
private long create_time;
|
||||
private long update_time;
|
||||
|
||||
public String getSfz_id() {
|
||||
return sfz_id;
|
||||
}
|
||||
|
||||
public void setSfz_id(String sfz_id) {
|
||||
this.sfz_id = sfz_id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getEmr() {
|
||||
return emr;
|
||||
}
|
||||
|
||||
public void setEmr(String emr) {
|
||||
this.emr = emr;
|
||||
}
|
||||
|
||||
public int getSbp() {
|
||||
return sbp;
|
||||
}
|
||||
|
||||
public void setSbp(int sbp) {
|
||||
this.sbp = sbp;
|
||||
}
|
||||
|
||||
public int getDbp() {
|
||||
return dbp;
|
||||
}
|
||||
|
||||
public void setDbp(int dbp) {
|
||||
this.dbp = dbp;
|
||||
}
|
||||
|
||||
public long getCreate_time() {
|
||||
return create_time;
|
||||
}
|
||||
|
||||
public void setCreate_time(long create_time) {
|
||||
this.create_time = create_time;
|
||||
}
|
||||
|
||||
public long getUpdate_time() {
|
||||
return update_time;
|
||||
}
|
||||
|
||||
public void setUpdate_time(long update_time) {
|
||||
this.update_time = update_time;
|
||||
}
|
||||
}
|
1
app_sb/src/main/resources/application.properties
Normal file
1
app_sb/src/main/resources/application.properties
Normal file
@ -0,0 +1 @@
|
||||
spring.application.name=app_sb
|
31
app_sb/src/main/resources/application.yml
Normal file
31
app_sb/src/main/resources/application.yml
Normal file
@ -0,0 +1,31 @@
|
||||
server:
|
||||
port: 58310
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
username: root
|
||||
password: 123456
|
||||
url: jdbc:mysql://localhost:3306/exam_20250612_58009?characterEncoding=utf-8&serverTimezone=UTC&useSSL=false
|
||||
|
||||
mybatis:
|
||||
mapper-locations: classpath:mapper/*Mapper.xml
|
||||
type-aliases-package: com.luowei.exam
|
||||
configuration:
|
||||
#log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
|
||||
# create database exam_20250612_58056;
|
||||
# use exam_20250612_58056;
|
||||
# drop table user_70;
|
||||
# create table user_70(name char(50),address char(50),password char(50))ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
# insert into user_70(name,address,password)values('mike','shanghai','c4ca4238a0b923820dcc509a6f75849b');
|
||||
# insert into user_70(name,address,password)values('rose','beijing','c4ca4238a0b923820dcc509a6f75849b');
|
||||
|
||||
# create database exam_20250612_58056;
|
||||
# use exam_20250612_58056;
|
||||
# drop table person_base_info_881_1;
|
||||
# create table person_base_info_881_1(id varchar(18),name varchar(20),sbp int,dbp int)ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
# insert into person_base_info_881_1(id,name,sbp,dbp)values('510103234','罗维','114','70');
|
||||
# insert into person_base_info_881_1(id,name,sbp,dbp)values('510103239','洪七公','134','89');
|
@ -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.luowei.app_sb.mapper.PersonBaseInfo_881_1Mapper">
|
||||
|
||||
<select id="select" parameterType="String">
|
||||
SELECT * FROM person_base_info_881_1 WHERE id=#{id};
|
||||
</select>
|
||||
<select id="selectAll" resultType="com.luowei.app_sb.entity.PersonBaseInfo_881_1Entity">
|
||||
SELECT * FROM person_base_info_881_1;
|
||||
</select>
|
||||
<update id="update" parameterType="com.luowei.app_sb.entity.PersonBaseInfo_881_1Entity">
|
||||
UPDATE person_base_info_881_1 set name=#{name},sbp=#{sbp},dbp=#{dbp} WHERE id=#{id}
|
||||
</update>
|
||||
<insert id="insert" parameterType="com.luowei.app_sb.entity.PersonBaseInfo_881_1Entity">
|
||||
INSERT INTO person_base_info_881_1 (id,name,sbp,dbp)VALUES(#{id},#{name},#{sbp},#{dbp})
|
||||
</insert>
|
||||
<delete id="delete" parameterType="String">
|
||||
DELETE FROM person_base_info_881_1 WHERE id=#{id}
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
29
app_sb/src/main/resources/mapper/Person_805Mapper.xml
Normal file
29
app_sb/src/main/resources/mapper/Person_805Mapper.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?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.luowei.app_sb.mapper.Person_805Mapper">
|
||||
|
||||
<!-- 805-->
|
||||
<select id="selectPerson_805" resultType="com.luowei.app_sb.entity.Person_805Entity">
|
||||
SELECT * FROM person_805 WHERE sfz_id=#{sfz_id};
|
||||
</select>
|
||||
|
||||
<insert id="insertPerson_805" parameterType="com.luowei.app_sb.entity.Person_805Entity">
|
||||
INSERT INTO person_805 (id,sfz_id,name,gender,emr,create_time,update_time)VALUES(#{id},#{sfz_id},#{name},#{gender},#{emr},#{create_time},#{update_time})
|
||||
</insert>
|
||||
<!-- 编辑时不处理id与create_time-->
|
||||
<insert id="updatePerson_805" parameterType="com.luowei.app_sb.entity.Person_805Entity">
|
||||
UPDATE person_805 SET name=#{name},gender=#{gender},emr=#{emr},update_time=#{update_time} WHERE sfz_id=#{sfz_id}
|
||||
</insert>
|
||||
|
||||
|
||||
<insert id="insertPerson_health_805" parameterType="com.luowei.app_sb.entity.Person_health_805Entity">
|
||||
INSERT INTO person_health_805 (id,sfz_id,sbp,dbp,create_time,update_time)VALUES(#{id},#{sfz_id},#{sbp},#{dbp},#{create_time},#{update_time})
|
||||
</insert>
|
||||
|
||||
<select id="selectPersonHealthVo" resultType="com.luowei.app_sb.vo.PersonHealthVo">
|
||||
SELECT t1.sfz_id,t1.name,t1.gender,t1.emr,t2.sbp,t2.dbp,t2.create_time,t2.update_time FROM person_805 AS t1 INNER JOIN person_health_805 AS t2 ON t1.sfz_id=t2.sfz_id WHERE t1.sfz_id=#{sfz_id} ORDER BY t2.update_time DESC LIMIT 0,1;
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
16
app_sb/src/main/resources/mapper/User_70Mapper.xml
Normal file
16
app_sb/src/main/resources/mapper/User_70Mapper.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?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.luowei.app_sb.mapper.User_70Mapper">
|
||||
<select id="select" resultType="com.luowei.app_sb.entity.User_70Entity">
|
||||
SELECT * FROM user_70 WHERE name=#{name}
|
||||
</select>
|
||||
<update id="update" parameterType="com.luowei.app_sb.entity.User_70Entity">
|
||||
UPDATE user_70 set password=#{password},address=#{address} WHERE name=#{name}
|
||||
</update>
|
||||
<insert id="insert" parameterType="com.luowei.app_sb.entity.User_70Entity">
|
||||
INSERT INTO user_70 (name,password,address)VALUES (#{name},#{password},#{address})
|
||||
</insert>
|
||||
<select id="login" parameterType="com.luowei.app_sb.entity.User_70Entity">
|
||||
SELECT COUNT(*) as counter FROM user_70 WHERE name=#{name} AND password=#{password}
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,13 @@
|
||||
package com.luowei.app_sb;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class AppSbApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user