更正患者注册的mapper

master
冯凯 2023-10-28 19:58:03 +08:00
parent 8747dd90b2
commit 1b94640aeb
17 changed files with 340 additions and 7 deletions

View File

@ -21,7 +21,7 @@
<dependency>
<groupId>com.health</groupId>
<artifactId>health-common-core</artifactId>
<version>3.6.5</version>
<version>3.6.7</version>
</dependency>

View File

@ -0,0 +1,30 @@
package com.health.system.common.domain;
import lombok.Data;
/**
* @author
* @version 1.0
* @description:
* @date 2023/10/28 15:04
*/
@Data
public class BankCard {
/*
id
*/
private Integer bankId;
/*
*/
private String bankNumber;
/*
*/
private String bankName;
/*
id
*/
private String userId;
}

View File

@ -0,0 +1,52 @@
package com.health.system.common.domain;
import lombok.Data;
/**
* @author
* @version 1.0
* @description:
* @date 2023/10/28 15:01
*/
@Data
public class IdCard {
/*
id
*/
private Integer cardId;
/*
id
*/
private Long userId;
/*
*/
private String name;
/*
*/
private String sex;
/*
*/
private String nation;
/*
*/
private String birthday;
/*
*/
private String address;
/*
*/
private String idNumber;
/*
*/
private String issueOffice;
}

View File

@ -112,7 +112,12 @@
<dependency>
<groupId>com.health</groupId>
<artifactId>health-common-core</artifactId>
<version>3.6.5</version>
<version>3.6.7</version>
</dependency>
<dependency>
<groupId>com.dtflys.forest</groupId>
<artifactId>forest-spring-boot-starter</artifactId>
<version>1.5.33</version>
</dependency>
</dependencies>
<build>

View File

@ -1,10 +1,12 @@
package com.health.system.server;
import com.dtflys.forest.springboot.annotation.ForestScan;
import com.health.common.security.annotation.EnableCustomConfig;
import com.health.common.security.annotation.EnableRyFeignClients;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration;
/**
*
@ -12,7 +14,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* @author health
*/
@EnableCustomConfig
@Configuration(value = "com.health.common.core.utils.userSelf.ForestClientInterface")
@EnableRyFeignClients
@SpringBootApplication
@MapperScan(value = "com.health.system.server.mapper")

View File

@ -0,0 +1,35 @@
package com.health.system.server.config;
import com.health.common.core.domain.Configure;
import com.health.common.core.utils.userSelf.ForestClientInterface;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.HashMap;
import java.util.Map;
/**
* @author
* @version 1.0
* @description:
* @date 2023/10/28 19:40
*/
@Configuration
public class AppConfig implements ForestClientInterface{
@Override
public Map helloForestFace(String s) {
return helloForestFace(s);
}
@Override
public Map helloForestBack(String s, Configure configure) {
return helloForestBack(s,configure);
}
@Override
public Map helloForestBank(String s) {
return helloForestBank(s);
}
}

View File

@ -0,0 +1,29 @@
package com.health.system.server.controller;
import com.health.common.core.domain.Result;
import com.health.system.server.service.SysBankCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
/**
* @author
* @version 1.0
* @description:
* @date 2023/10/28 15:10
*/
@RestController("/bankCard")
public class SysBankCardController {
/*
*/
@Autowired
private SysBankCardService sysBankCardService;
@PostMapping("/bindUserBank")
public Result bindUserBank(@RequestParam("bankImage") MultipartFile bankImage){
return Result.success();
}
}

View File

@ -0,0 +1,78 @@
package com.health.system.server.controller;
import com.health.common.core.domain.Configure;
import com.health.common.core.domain.Result;
import com.health.common.core.enums.IdCardConfigureType;
import com.health.common.core.utils.userSelf.ForestClientInterface;
import com.health.common.security.utils.SecurityUtils;
import com.health.system.common.domain.IdCard;
import com.health.system.server.service.SysIdCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.rmi.ServerException;
import java.util.Base64;
import java.util.Map;
/**
* @author
* @version 1.0
* @description:
* @date 2023/10/28 15:06
*/
@RestController("/idCard")
public class SysIdCardController {
/*
forest
*/
@Autowired
private ForestClientInterface forestClientInterface;
/*
*/
@Autowired
private SysIdCardService sysIdCardService;
@PostMapping("/bindIdCard")
public Result bindIdCard(@RequestParam("faceImage")MultipartFile faceImage,@RequestParam("backImage") MultipartFile backImage) throws IOException {
//获取正面头像照片的字节流
String username = SecurityUtils.getUsername();
byte[] faceImageBytes = faceImage.getBytes();
//获取反面国徽面的字节流
byte[] backImageBytes = backImage.getBytes();
String face = Base64.getEncoder().encodeToString(faceImageBytes);
Map faceMap = forestClientInterface.helloForestFace(face);
String address = (String) faceMap.get("address");
String birthday = (String) faceMap.get("birth");
String name = (String) faceMap.get("name");
String sex = (String) faceMap.get("sex");
String nation = (String) faceMap.get("nationality");
String num = (String) faceMap.get("num");
if (!name.equals(username)){
throw new ServerException("请选择自己的身份证进行绑定");
}
String back = Base64.getEncoder().encodeToString(backImageBytes);
Configure configure = new Configure();
configure.setSide(IdCardConfigureType.Back.getType());
Map backMap = forestClientInterface.helloForestBack(back, configure);
String issueOffice = (String) backMap.get("issue");
IdCard idCard = new IdCard();
idCard.setName(name);
idCard.setBirthday(birthday);
idCard.setName(name);
idCard.setSex(sex);
idCard.setNation(nation);
idCard.setIdNumber(num);
idCard.setIssueOffice(issueOffice);
idCard.setAddress(address);
idCard.setUserId(SecurityUtils.getUserId());
return Result.success();
}
}

View File

@ -0,0 +1,13 @@
package com.health.system.server.mapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author
* @version 1.0
* @description:
* @date 2023/10/28 15:12
*/
@Mapper
public interface SysBankCardMapper {
}

View File

@ -0,0 +1,13 @@
package com.health.system.server.mapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author
* @version 1.0
* @description:
* @date 2023/10/28 15:09
*/
@Mapper
public interface SysIdCardMapper {
}

View File

@ -0,0 +1,10 @@
package com.health.system.server.service;
/**
* @author
* @version 1.0
* @description:
* @date 2023/10/28 15:11
*/
public interface SysBankCardService {
}

View File

@ -0,0 +1,10 @@
package com.health.system.server.service;
/**
* @author
* @version 1.0
* @description:
* @date 2023/10/28 15:08
*/
public interface SysIdCardService {
}

View File

@ -0,0 +1,22 @@
package com.health.system.server.service.impl;
import com.health.system.server.mapper.SysBankCardMapper;
import com.health.system.server.service.SysBankCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author
* @version 1.0
* @description:
* @date 2023/10/28 15:12
*/
@Service
public class SysBankCardServiceImpl implements SysBankCardService {
/*
*/
@Autowired
private SysBankCardMapper sysBankCardMapper;
}

View File

@ -0,0 +1,22 @@
package com.health.system.server.service.impl;
import com.health.system.server.mapper.SysIdCardMapper;
import com.health.system.server.service.SysIdCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author
* @version 1.0
* @description:
* @date 2023/10/28 15:08
*/
@Service
public class SysIdCardServiceImpl implements SysIdCardService {
/*
*/
@Autowired
private SysIdCardMapper sysIdCardMapper;
}

View File

@ -0,0 +1,6 @@
<?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.health.system.server.mapper.SysBankCardMapper">
</mapper>

View File

@ -0,0 +1,6 @@
<?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.health.system.server.mapper.SysIdCardMapper">
</mapper>

View File

@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.health.system.server.mapper.SysRoleMapper">
<resultMap type="SysRole" id="SysRoleResult">
<resultMap type="com.health.system.common.domain.SysRole" id="SysRoleResult">
<id property="roleId" column="role_id" />
<result property="roleName" column="role_name" />
<result property="roleKey" column="role_key" />
@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sys_dept d on u.dept_id = d.dept_id
</sql>
<select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult">
<select id="selectRoleList" parameterType="com.health.system.common.domain.SysRole" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.del_flag = '0'
<if test="roleId != null and roleId != 0">
@ -101,7 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!--用户角色sql-->
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
<insert id="insertRole" parameterType="com.health.system.common.domain.SysRole" useGeneratedKeys="true" keyProperty="roleId">
insert into sys_role(
<if test="roleId != null and roleId != 0">role_id,</if>
<if test="roleName != null and roleName != ''">role_name,</if>
@ -129,7 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</insert>
<update id="updateRole" parameterType="SysRole">
<update id="updateRole" parameterType="com.health.system.common.domain.SysRole">
update sys_role
<set>
<if test="roleName != null and roleName != ''">role_name = #{roleName},</if>