Compare commits

...

2 Commits

Author SHA1 Message Date
BLRTTX e1abcbef16 12.22 2024-12-22 20:50:55 +08:00
BLRTTX b889206ab4 12.22 2024-12-22 18:56:39 +08:00
11 changed files with 86 additions and 14 deletions

View File

@ -3,7 +3,7 @@ package com.atjy.model.entity;
import com.atjy.model.enums.ArticleItemType; import com.atjy.model.enums.ArticleItemType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -30,7 +30,7 @@ public class ArticleInfo extends BaseEntity {
@Schema(description = "发布时间") @Schema(description = "发布时间")
@TableField(value = "publish_time") @TableField(value = "publish_time")
@JsonIgnore @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date publishTime; private Date publishTime;
@Schema(description = "医生id") @Schema(description = "医生id")

View File

@ -3,6 +3,7 @@ package com.atjy.web.admin.service.impl;
import com.atjy.model.entity.AppointmentInfo; import com.atjy.model.entity.AppointmentInfo;
import com.atjy.model.entity.ArticleInfo; import com.atjy.model.entity.ArticleInfo;
import com.atjy.model.entity.GraphInfo; import com.atjy.model.entity.GraphInfo;
import com.atjy.model.enums.ArticleItemType;
import com.atjy.model.enums.BaseStatus; import com.atjy.model.enums.BaseStatus;
import com.atjy.model.enums.GraphItemType; import com.atjy.model.enums.GraphItemType;
import com.atjy.web.admin.mapper.ArticleInfoMapper; import com.atjy.web.admin.mapper.ArticleInfoMapper;
@ -13,6 +14,7 @@ import com.atjy.web.admin.vo.article.ArticleListVo;
import com.baomidou.mybatisplus.core.conditions.interfaces.Func; import com.baomidou.mybatisplus.core.conditions.interfaces.Func;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -21,6 +23,7 @@ import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects;
@Service @Service
public class ArticleInfoServiceImpl extends ServiceImpl<ArticleInfoMapper, ArticleInfo> implements ArticleInfoService { public class ArticleInfoServiceImpl extends ServiceImpl<ArticleInfoMapper, ArticleInfo> implements ArticleInfoService {
@ -45,14 +48,25 @@ public class ArticleInfoServiceImpl extends ServiceImpl<ArticleInfoMapper, Artic
@Override @Override
public void saveOrUpdateArticle(ArticleInfoVo articleInfoVo) { public void saveOrUpdateArticle(ArticleInfoVo articleInfoVo) {
ArticleInfo articleInfo = new ArticleInfo(); ArticleInfo articleInfo = new ArticleInfo();
if (articleInfoVo.getId() != null) {
articleInfo.setId(articleInfoVo.getId());
}
articleInfo.setPublishTime(new Date()); articleInfo.setPublishTime(new Date());
articleInfo.setIsDeleted((byte) 0); articleInfo.setIsDeleted((byte) 0);
articleInfo.setType(articleInfoVo.getType());
articleInfo.setTitleBig(articleInfoVo.getTitleBig()); articleInfo.setTitleBig(articleInfoVo.getTitleBig());
articleInfo.setTitleSmall(articleInfoVo.getTitleSmall()); articleInfo.setTitleSmall(articleInfoVo.getTitleSmall());
articleInfo.setContent(articleInfoVo.getContent()); articleInfo.setContent(articleInfoVo.getContent());
articleInfo.setDoctorId(articleInfoVo.getDoctorId()); articleInfo.setDoctorId(articleInfoVo.getDoctorId());
articleInfo.setNumber(articleInfoVo.getNumber()); articleInfo.setNumber(articleInfoVo.getNumber());
if (ArticleItemType.FIGHT_EPIDEMIC.getName().equals(articleInfoVo.getTypeName())) {
articleInfo.setType(ArticleItemType.FIGHT_EPIDEMIC);
} else if (ArticleItemType.HEALTH.getName().equals(articleInfoVo.getTypeName())) {
articleInfo.setType(ArticleItemType.HEALTH);
} else if (ArticleItemType.MEDICAL.getName().equals(articleInfoVo.getTypeName())) {
articleInfo.setType(ArticleItemType.MEDICAL);
} else {
articleInfo.setType(ArticleItemType.PARENTING);
}
articleInfoMapper.insertOrUpdate(articleInfo); articleInfoMapper.insertOrUpdate(articleInfo);
@ -62,8 +76,16 @@ public class ArticleInfoServiceImpl extends ServiceImpl<ArticleInfoMapper, Artic
graphInfo.setUrl(articleInfoVo.getUrl()); graphInfo.setUrl(articleInfoVo.getUrl());
graphInfo.setItemId(articleInfo.getId()); graphInfo.setItemId(articleInfo.getId());
graphInfo.setName(articleInfoVo.getName()); graphInfo.setName(articleInfoVo.getName());
if (articleInfoVo.getUrlId() != null) {
graphInfo.setId(articleInfoVo.getUrlId());
graphInfoMapper.insertOrUpdate(graphInfo); graphInfoMapper.insertOrUpdate(graphInfo);
} else {
if (graphInfoMapper.selectOne(new LambdaQueryWrapper<GraphInfo>().eq(GraphInfo::getItemId, articleInfo.getId()).eq(GraphInfo::getItemType, GraphItemType.ARTICLE)) != null) {
graphInfoMapper.update(new UpdateWrapper<GraphInfo>().eq("item_type", GraphItemType.ARTICLE).eq("item_id", articleInfoVo.getId()).set("name", articleInfoVo.getName()).set("url", articleInfoVo.getUrl()));
} else {
graphInfoMapper.insertOrUpdate(graphInfo);
}
}
} }
@Override @Override

View File

@ -8,6 +8,7 @@ import com.atjy.web.admin.mapper.*;
import com.atjy.web.admin.service.DoctorInfoService; import com.atjy.web.admin.service.DoctorInfoService;
import com.atjy.web.admin.vo.doctor.DoctorInfoVo; import com.atjy.web.admin.vo.doctor.DoctorInfoVo;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -54,10 +55,13 @@ public class DoctorInfoServiceImpl extends ServiceImpl<DoctorInfoMapper, DoctorI
@Override @Override
public void saveOrUpdateDoctor(DoctorInfoVo doctorInfoVo) { public void saveOrUpdateDoctor(DoctorInfoVo doctorInfoVo) {
DoctorInfo doctorInfo = new DoctorInfo(); DoctorInfo doctorInfo = new DoctorInfo();
if (doctorInfoVo.getId() != null) {
doctorInfo.setId(doctorInfoVo.getId());
}
doctorInfo.setDepartmentId(departmentInfoMapper.selectOne(new LambdaQueryWrapper<DepartmentInfo>().eq(DepartmentInfo::getName, doctorInfoVo.getDepartmentName())).getId()); doctorInfo.setDepartmentId(departmentInfoMapper.selectOne(new LambdaQueryWrapper<DepartmentInfo>().eq(DepartmentInfo::getName, doctorInfoVo.getDepartmentName())).getId());
doctorInfo.setHospitalId(hospitalInfoMapper.selectOne(new LambdaQueryWrapper<HospitalInfo>().eq(HospitalInfo::getHospitalName, doctorInfoVo.getHospitalName())).getId()); doctorInfo.setHospitalId(hospitalInfoMapper.selectOne(new LambdaQueryWrapper<HospitalInfo>().eq(HospitalInfo::getHospitalName, doctorInfoVo.getHospitalName())).getId());
doctorInfo.setIsDeleted((byte) 0); doctorInfo.setIsDeleted((byte) 0);
doctorInfo.setDoctorName(doctorInfo.getDoctorName()); doctorInfo.setDoctorName(doctorInfoVo.getDoctorName());
doctorInfo.setBriefly(doctorInfoVo.getBriefly()); doctorInfo.setBriefly(doctorInfoVo.getBriefly());
doctorInfo.setSource(doctorInfoVo.getSource()); doctorInfo.setSource(doctorInfoVo.getSource());
doctorInfo.setLevel(doctorInfoVo.getLevel()); doctorInfo.setLevel(doctorInfoVo.getLevel());
@ -73,7 +77,16 @@ public class DoctorInfoServiceImpl extends ServiceImpl<DoctorInfoMapper, DoctorI
graphInfo.setItemId(doctorInfo.getId()); graphInfo.setItemId(doctorInfo.getId());
graphInfo.setName(doctorInfoVo.getGraphName()); graphInfo.setName(doctorInfoVo.getGraphName());
if (doctorInfoVo.getUrlId() != null) {
graphInfo.setId(doctorInfoVo.getUrlId());
graphInfoMapper.insertOrUpdate(graphInfo); graphInfoMapper.insertOrUpdate(graphInfo);
} else {
if (graphInfoMapper.selectOne(new LambdaQueryWrapper<GraphInfo>().eq(GraphInfo::getItemId, doctorInfo.getId()).eq(GraphInfo::getItemType, GraphItemType.DOCTOR)) != null) {
graphInfoMapper.update(new UpdateWrapper<GraphInfo>().eq("item_type", GraphItemType.DOCTOR).eq("item_id", doctorInfo.getId()).set("name", doctorInfoVo.getGraphName()).set("url", doctorInfoVo.getUrl()));
} else {
graphInfoMapper.insertOrUpdate(graphInfo);
}
}
} }
@Override @Override

View File

@ -8,6 +8,7 @@ import com.atjy.web.admin.mapper.*;
import com.atjy.web.admin.service.HospitalInfoService; import com.atjy.web.admin.service.HospitalInfoService;
import com.atjy.web.admin.vo.hospital.HospitalInfoVo; import com.atjy.web.admin.vo.hospital.HospitalInfoVo;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -80,6 +81,17 @@ public class HospitalInfoServiceImpl extends ServiceImpl<HospitalInfoMapper, Hos
graphInfo.setItemId(hospitalInfo.getId()); graphInfo.setItemId(hospitalInfo.getId());
graphInfo.setName(hospitalInfoVo.getGraphName()); graphInfo.setName(hospitalInfoVo.getGraphName());
if (hospitalInfoVo.getUrlId() != null) {
graphInfo.setId(hospitalInfoVo.getUrlId());
graphInfoMapper.insertOrUpdate(graphInfo);
} else {
if (graphInfoMapper.selectOne(new LambdaQueryWrapper<GraphInfo>().eq(GraphInfo::getItemId, hospitalInfo.getId()).eq(GraphInfo::getItemType, GraphItemType.DOCTOR)) != null) {
graphInfoMapper.update(new UpdateWrapper<GraphInfo>().eq("item_type", GraphItemType.HOSPITAL).eq("item_id", hospitalInfo.getId()).set("name", hospitalInfoVo.getGraphName()).set("url", hospitalInfoVo.getUrl()));
} else {
graphInfoMapper.insertOrUpdate(graphInfo);
}
}
graphInfoMapper.insertOrUpdate(graphInfo); graphInfoMapper.insertOrUpdate(graphInfo);
} }

View File

@ -1,6 +1,8 @@
package com.atjy.web.admin.vo.article; package com.atjy.web.admin.vo.article;
import com.atjy.model.entity.ArticleInfo; import com.atjy.model.entity.ArticleInfo;
import com.atjy.model.enums.ArticleItemType;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -12,4 +14,10 @@ public class ArticleInfoVo extends ArticleInfo {
@Schema(description = "图片名称") @Schema(description = "图片名称")
private String name; private String name;
@Schema(description = "医说所属类型")
private String typeName;
@Schema(description = "图片id")
private Long urlId;
} }

View File

@ -1,7 +1,7 @@
package com.atjy.web.admin.vo.article; package com.atjy.web.admin.vo.article;
import com.atjy.web.admin.vo.doctor.DoctorVo; import com.atjy.web.admin.vo.doctor.DoctorVo;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -24,7 +24,7 @@ public class ArticleListVo {
private Long id; private Long id;
@Schema(description = "发布时间") @Schema(description = "发布时间")
@JsonIgnore @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date publishTime; private Date publishTime;
@Schema(description = "医生详情") @Schema(description = "医生详情")
@ -34,11 +34,14 @@ public class ArticleListVo {
private String content; private String content;
@Schema(description = "医说所属类型") @Schema(description = "医说所属类型")
private String type; private String typeName;
@Schema(description = "图片地址") @Schema(description = "图片地址")
private String url; private String url;
@Schema(description = "图片名称") @Schema(description = "图片名称")
private String name; private String name;
@Schema(description = "图片id")
private Long urlId;
} }

View File

@ -1,6 +1,7 @@
package com.atjy.web.admin.vo.doctor; package com.atjy.web.admin.vo.doctor;
import com.atjy.model.entity.DoctorInfo; import com.atjy.model.entity.DoctorInfo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -10,6 +11,9 @@ import java.util.List;
@Schema(description = "医生信息实体") @Schema(description = "医生信息实体")
public class DoctorInfoVo extends DoctorInfo { public class DoctorInfoVo extends DoctorInfo {
@Schema(description = "图片id")
private Long urlId;
@Schema(description = "图片名称") @Schema(description = "图片名称")
private String graphName; private String graphName;

View File

@ -7,6 +7,9 @@ import lombok.Data;
@Schema(description = "文件实体") @Schema(description = "文件实体")
public class FileVo { public class FileVo {
@Schema(description = "图片id")
private Long urlId;
@Schema(description = "图片url") @Schema(description = "图片url")
private String url; private String url;

View File

@ -9,6 +9,9 @@ import lombok.Data;
@Schema(description = "医院信息实体") @Schema(description = "医院信息实体")
public class HospitalInfoVo extends HospitalInfo { public class HospitalInfoVo extends HospitalInfo {
@Schema(description = "图片id")
private Long urlId;
@Schema(description = "图片名称") @Schema(description = "图片名称")
private String graphName; private String graphName;

View File

@ -21,6 +21,7 @@
ai.content, ai.content,
di.id doctor_id, di.id doctor_id,
di.doctor_name, di.doctor_name,
gi.id url_id,
gi.url, gi.url,
gi.name, gi.name,
case case
@ -28,7 +29,7 @@
when ai.type = 2 then "健康养生" when ai.type = 2 then "健康养生"
when ai.type = 3 then "医疗动态" when ai.type = 3 then "医疗动态"
when ai.type = 4 then "育儿专区" when ai.type = 4 then "育儿专区"
end as type end as type_name
from article_info ai from article_info ai
join doctor_info di on ai.doctor_id = di.id and di.is_deleted = 0 join doctor_info di on ai.doctor_id = di.id and di.is_deleted = 0
join hassle_free.graph_info gi on gi.item_type = 4 and gi.item_id = ai.id and gi.is_deleted = 0 join hassle_free.graph_info gi on gi.item_type = 4 and gi.item_id = ai.id and gi.is_deleted = 0
@ -44,6 +45,7 @@
ai.content, ai.content,
di.id doctor_id, di.id doctor_id,
di.doctor_name, di.doctor_name,
gi.id url_id,
gi.url, gi.url,
gi.name, gi.name,
case case
@ -51,7 +53,7 @@
when ai.type = 2 then "健康养生" when ai.type = 2 then "健康养生"
when ai.type = 3 then "医疗动态" when ai.type = 3 then "医疗动态"
when ai.type = 4 then "育儿专区" when ai.type = 4 then "育儿专区"
end as type end as type_name
from article_info ai from article_info ai
join doctor_info di on ai.doctor_id = di.id and di.is_deleted = 0 join doctor_info di on ai.doctor_id = di.id and di.is_deleted = 0
join hassle_free.graph_info gi on gi.item_type = 4 and gi.item_id = ai.id and gi.is_deleted = 0 join hassle_free.graph_info gi on gi.item_type = 4 and gi.item_id = ai.id and gi.is_deleted = 0

View File

@ -14,8 +14,9 @@
di.briefly, di.briefly,
hi.hospital_name, hi.hospital_name,
d.name department_name, d.name department_name,
gi.id url_id,
gi.url, gi.url,
gi.name gi.name graph_name
from doctor_info di from doctor_info di
join hospital_info hi on di.hospital_id = hi.id and hi.is_deleted = 0 join hospital_info hi on di.hospital_id = hi.id and hi.is_deleted = 0
join department_info d on di.department_id = d.id and d.is_deleted = 0 join department_info d on di.department_id = d.id and d.is_deleted = 0
@ -34,7 +35,8 @@
di.briefly, di.briefly,
hi.hospital_name, hi.hospital_name,
d.name department_name, d.name department_name,
gi.name, gi.id url_id,
gi.name graph_name,
gi.url gi.url
from doctor_info di from doctor_info di
join hospital_info hi on di.hospital_id = hi.id and hi.is_deleted = 0 join hospital_info hi on di.hospital_id = hi.id and hi.is_deleted = 0