修改了医生的验证逻辑

This commit is contained in:
wucongxing8150 2025-08-01 10:34:24 +08:00
parent 462318b5ec
commit eacc43c2d8
2 changed files with 32 additions and 64 deletions

View File

@ -841,7 +841,7 @@ public class CaseClinicalVideoService {
for (addClinicalVideoApp.Author author : addList){
// 获取医生数据
GetUserInfoResponse result = userInfo.getUserInfoByUuid(author.getDoctorIden());
CaseClinicalDoctorModel caseClinicalDoctor = userService.GetCaseClinicalDoctor(result);
CaseClinicalDoctorModel caseClinicalDoctor = userService.GetAppCaseClinicalDoctor(result);
CaseClinicalVideoAuthorModel caseClinicalVideoAuthor = new CaseClinicalVideoAuthorModel();
caseClinicalVideoAuthor.setVideoId(caseClinicalVideo.getVideoId());
@ -917,66 +917,6 @@ public class CaseClinicalVideoService {
// 相等
b.getCaseClinicalDoctor().setDoctorIden(a.getDoctorIden());
caseClinicalDoctorDao.updateById(b.getCaseClinicalDoctor());
CaseClinicalVideoAuthorModel caseClinicalVideoAuthor = new CaseClinicalVideoAuthorModel();
caseClinicalVideoAuthor.setVideoId(caseClinicalVideo.getVideoId());
caseClinicalVideoAuthor.setDoctorId(String.valueOf(caseClinicalDoctor.getDoctorId()));
caseClinicalVideoAuthorDao.insert(caseClinicalVideoAuthor);
LocalDateTime lastPushDate = caseClinicalVideoDao.selectLastVideoPushDateByDoctorId(caseClinicalDoctor.getDoctorId());
// 新增作者统计
caseClinicalService.IncStatsCaseClinicalDoctor(String.valueOf(caseClinicalDoctor.getDoctorId()),2,lastPushDate);
// 新增医院统计
caseClinicalService.IncStatsCaseClinicalHospital(String.valueOf(caseClinicalDoctor.getHospitalId()),2,lastPushDate);
// 生成用户证书-文章/视频
if (qrCodeByte == null || qrCodeByte.length == 0) {
// 生成二维码图片
if (caseClinicalVideo.getShareQrcode() == null){
try {
// 生成用户分享二维码-文章/视频
qrCodeByte = userService.CreateUserCaseClinicalUnlimitedQrcode(String.valueOf(caseClinicalVideo.getVideoId()),2);
} catch (Exception e) {
// 不处理
throw new BusinessException("-1", "无法完成此操作");
}
}else{
// 下载二维码图片
qrCodeByte = Oss.getObjectToByte(caseClinicalVideo.getShareQrcode().replaceFirst("^/+", ""));
if (qrCodeByte == null) {
throw new BusinessException("-1", "无法完成此操作");
}
}
}
// 下载头像
byte[] avatarByte = new byte[0];
if (caseClinicalDoctor.getAvatar() != null) {
avatarByte = Oss.getObjectToByte(caseClinicalDoctor.getAvatar().replaceFirst("^/+", ""));
}else{
try {
avatarByte = ImageUtil.readImageToBytes("src/main/resources/static/cert/avatar.png");
} catch (Exception e) {
throw new BusinessException("-1", e.getMessage());
}
}
if (avatarByte == null) {
throw new BusinessException("-1", "无法完成此操作");
}
userService.CreateUserCert(
String.valueOf(caseClinicalVideo.getVideoId()),
2,
String.valueOf(caseClinicalDoctor.getDoctorId()),
qrCodeByte,
avatarByte
);
}
}
}

View File

@ -309,10 +309,10 @@ public class UserService {
}
/**
* 获取临床医生数据
* 获取app医生数据
* @return UserModel
*/
public CaseClinicalDoctorModel GetCaseClinicalDoctor(GetUserInfoResponse r) throws BusinessException {
public CaseClinicalDoctorModel GetAppCaseClinicalDoctor(GetUserInfoResponse r) throws BusinessException {
GetUserInfoResponse.ResponsData data = r.getData();
// 获取app医院数据
@ -322,12 +322,25 @@ public class UserService {
LambdaQueryWrapper<CaseClinicalDoctorModel> caseClinicalDoctorWrapper = new LambdaQueryWrapper<>();
caseClinicalDoctorWrapper.eq(CaseClinicalDoctorModel::getDoctorIden, data.getUuid());
CaseClinicalDoctorModel caseClinicalDoctor = caseClinicalDoctorDao.selectOne(caseClinicalDoctorWrapper);
if (caseClinicalDoctor == null){
// 二次匹配通过姓名-医院获取医生信息
caseClinicalDoctorWrapper = new LambdaQueryWrapper<>();
caseClinicalDoctorWrapper.eq(CaseClinicalDoctorModel::getDoctorName, data.getRealname());
caseClinicalDoctorWrapper.eq(CaseClinicalDoctorModel::getHospitalId, basicHospital.getHospitalId());
caseClinicalDoctor = caseClinicalDoctorDao.selectOne(caseClinicalDoctorWrapper);
}
if (caseClinicalDoctor == null){
caseClinicalDoctor = new CaseClinicalDoctorModel();
caseClinicalDoctor.setDoctorName(data.getRealname());
caseClinicalDoctor.setDoctorIden(data.getUuid());
caseClinicalDoctor.setHospitalId(basicHospital.getHospitalId());
caseClinicalDoctor.setAvatar(data.getPhoto());
if (data.getPhoto() != null) {
String ossPath = handleUserImage(data.getImg_host() + data.getPhoto());
caseClinicalDoctor.setAvatar(ossPath);
}else{
caseClinicalDoctor.setAvatar("");
}
int res = caseClinicalDoctorDao.insert(caseClinicalDoctor);
if (res <= 0){
throw new BusinessException("操作失败");
@ -341,12 +354,27 @@ public class UserService {
caseClinicalDoctor.setHospitalId(basicHospital.getHospitalId());
}
if (!Objects.equals(data.getUuid(), caseClinicalDoctor.getDoctorIden())){
caseClinicalDoctor.setDoctorIden(data.getUuid());
}
if (data.getPhoto() != null) {
try {
String ossPath = handleUserImage(data.getImg_host() + data.getPhoto());
caseClinicalDoctor.setAvatar(ossPath);
}catch (Exception e){
// 不处理
}
}
caseClinicalDoctorDao.updateById(caseClinicalDoctor);
}
return caseClinicalDoctor;
}
/**
* 发放积分
* @param type 类型1:文章 2:视频 3:病例交流