12.21
This commit is contained in:
parent
b026492565
commit
719c3b3285
|
@ -38,7 +38,7 @@ public class DoctorInfo extends BaseEntity {
|
|||
|
||||
@Schema(description = "科室id")
|
||||
@TableField(value = "department_id")
|
||||
private String departmentId;
|
||||
private Long departmentId;
|
||||
|
||||
@Schema(description = "简介")
|
||||
@TableField(value = "briefly")
|
||||
|
|
|
@ -41,7 +41,7 @@ public class ArticleInfoController {
|
|||
@Operation(summary = "删除医说")
|
||||
@PostMapping("deleteArticle")
|
||||
public Result deleteArticle(@RequestBody List<Long> ids) {
|
||||
service.removeBatchByIds(ids);
|
||||
service.deleteArticle(ids);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -8,10 +8,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "医生信息管理")
|
||||
@RestController
|
||||
|
@ -25,8 +24,21 @@ public class DoctorInfoController {
|
|||
@PostMapping("getDoctorPageItem")
|
||||
public Result<IPage<DoctorInfoVo>> getDoctorPageItem(@RequestParam Integer current, @RequestParam Integer size, @RequestParam(required = false) String name) {
|
||||
Page<DoctorInfoVo> page = new Page<>(current, size);
|
||||
IPage<DoctorInfoVo> result = service.getDoctorPageItem(page,name);
|
||||
IPage<DoctorInfoVo> result = service.getDoctorPageItem(page, name);
|
||||
return Result.ok(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "增加/更新医生")
|
||||
@PostMapping("saveOrUpdateDoctor")
|
||||
public Result saveOrUpdateDoctor(@RequestBody DoctorInfoVo doctorInfoVo) {
|
||||
service.saveOrUpdateDoctor(doctorInfoVo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "删除医生")
|
||||
@PostMapping("deleteDoctor")
|
||||
public Result deleteDoctor(@RequestParam List<Long> ids) {
|
||||
service.deleteDoctor(ids);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ArticleInfoService extends IService<ArticleInfo> {
|
||||
IPage<ArticleListVo> getArticlePageItem(Page<ArticleListVo> page, String title);
|
||||
|
||||
void saveOrUpdateArticle(ArticleInfoVo articleInfoVo);
|
||||
|
||||
void deleteArticle(List<Long> ids);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DoctorInfoService extends IService<DoctorInfo> {
|
||||
IPage<DoctorInfoVo> getDoctorPageItem(Page<DoctorInfoVo> page,String name);
|
||||
|
||||
void saveOrUpdateDoctor(DoctorInfoVo doctorInfoVo);
|
||||
|
||||
void deleteDoctor(List<Long> ids);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ArticleInfoServiceImpl extends ServiceImpl<ArticleInfoMapper, ArticleInfo> implements ArticleInfoService {
|
||||
|
@ -51,7 +52,7 @@ public class ArticleInfoServiceImpl extends ServiceImpl<ArticleInfoMapper, Artic
|
|||
articleInfo.setTitleSmall(articleInfoVo.getTitleSmall());
|
||||
articleInfo.setContent(articleInfoVo.getContent());
|
||||
articleInfo.setDoctorId(articleInfoVo.getDoctorId());
|
||||
articleInfo.setNumber(0);
|
||||
articleInfo.setNumber(articleInfoVo.getNumber());
|
||||
|
||||
articleInfoMapper.insertOrUpdate(articleInfo);
|
||||
|
||||
|
@ -59,9 +60,18 @@ public class ArticleInfoServiceImpl extends ServiceImpl<ArticleInfoMapper, Artic
|
|||
graphInfo.setIsDeleted((byte) 0);
|
||||
graphInfo.setItemType(GraphItemType.ARTICLE);
|
||||
graphInfo.setUrl(articleInfoVo.getUrl());
|
||||
graphInfo.setItemId(articleInfoMapper.selectOne(new QueryWrapper<ArticleInfo>().select("max(id)")).getId());
|
||||
graphInfo.setItemId(articleInfo.getId());
|
||||
graphInfo.setName(articleInfoVo.getName());
|
||||
|
||||
graphInfoMapper.insertOrUpdate(graphInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteArticle(List<Long> ids) {
|
||||
for (Long id : ids) {
|
||||
graphInfoMapper.delete(new LambdaQueryWrapper<GraphInfo>().eq(GraphInfo::getItemId, id).eq(GraphInfo::getItemType, GraphItemType.ARTICLE));
|
||||
}
|
||||
|
||||
articleInfoMapper.deleteByIds(ids);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,45 @@
|
|||
package com.atjy.web.admin.service.impl;
|
||||
|
||||
import com.atjy.model.entity.DoctorInfo;
|
||||
import com.atjy.web.admin.mapper.DoctorInfoMapper;
|
||||
import com.atjy.common.exception.HassleFreeException;
|
||||
import com.atjy.common.result.ResultCodeEnum;
|
||||
import com.atjy.model.entity.*;
|
||||
import com.atjy.model.enums.GraphItemType;
|
||||
import com.atjy.web.admin.mapper.*;
|
||||
import com.atjy.web.admin.service.DoctorInfoService;
|
||||
import com.atjy.web.admin.vo.doctor.DoctorInfoVo;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DoctorInfoServiceImpl extends ServiceImpl<DoctorInfoMapper, DoctorInfo> implements DoctorInfoService {
|
||||
|
||||
@Autowired
|
||||
private DoctorInfoMapper doctorInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private DepartmentInfoMapper departmentInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private HospitalInfoMapper hospitalInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private GraphInfoMapper graphInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private DoctorAppointmentMapper doctorAppointmentMapper;
|
||||
|
||||
@Autowired
|
||||
private ArticleInfoMapper articleInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private UserAppointmentMapper userAppointmentMapper;
|
||||
|
||||
@Override
|
||||
public IPage<DoctorInfoVo> getDoctorPageItem(Page<DoctorInfoVo> page, String name) {
|
||||
IPage<DoctorInfoVo> result;
|
||||
|
@ -26,4 +50,50 @@ public class DoctorInfoServiceImpl extends ServiceImpl<DoctorInfoMapper, DoctorI
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveOrUpdateDoctor(DoctorInfoVo doctorInfoVo) {
|
||||
DoctorInfo doctorInfo = new DoctorInfo();
|
||||
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.setIsDeleted((byte) 0);
|
||||
doctorInfo.setDoctorName(doctorInfo.getDoctorName());
|
||||
doctorInfo.setBriefly(doctorInfoVo.getBriefly());
|
||||
doctorInfo.setSource(doctorInfoVo.getSource());
|
||||
doctorInfo.setLevel(doctorInfoVo.getLevel());
|
||||
doctorInfo.setExpertise(doctorInfoVo.getExpertise());
|
||||
doctorInfo.setAppointmentNumber(doctorInfoVo.getAppointmentNumber());
|
||||
|
||||
doctorInfoMapper.insertOrUpdate(doctorInfo);
|
||||
|
||||
GraphInfo graphInfo = new GraphInfo();
|
||||
graphInfo.setIsDeleted((byte) 0);
|
||||
graphInfo.setItemType(GraphItemType.DOCTOR);
|
||||
graphInfo.setUrl(doctorInfoVo.getUrl());
|
||||
graphInfo.setItemId(doctorInfo.getId());
|
||||
graphInfo.setName(doctorInfoVo.getGraphName());
|
||||
|
||||
graphInfoMapper.insertOrUpdate(graphInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDoctor(List<Long> ids) {
|
||||
for (Long id : ids) {
|
||||
if (doctorAppointmentMapper.selectOne(new LambdaQueryWrapper<DoctorAppointment>().eq(DoctorAppointment::getDoctorId, id)) != null) {
|
||||
throw new HassleFreeException(ResultCodeEnum.DELETE_ERROR);
|
||||
}
|
||||
if (articleInfoMapper.selectOne(new LambdaQueryWrapper<ArticleInfo>().eq(ArticleInfo::getDoctorId, id)) != null) {
|
||||
throw new HassleFreeException(ResultCodeEnum.DELETE_ERROR);
|
||||
}
|
||||
if (userAppointmentMapper.selectOne(new LambdaQueryWrapper<UserAppointment>().eq(UserAppointment::getDoctorId, id)) != null) {
|
||||
throw new HassleFreeException(ResultCodeEnum.DELETE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
for (Long id : ids) {
|
||||
graphInfoMapper.delete(new LambdaQueryWrapper<GraphInfo>().eq(GraphInfo::getItemId, id).eq(GraphInfo::getItemType, GraphItemType.DOCTOR));
|
||||
}
|
||||
|
||||
doctorInfoMapper.deleteByIds(ids);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,9 @@ import java.util.Date;
|
|||
@Schema(description = "医说列表实体")
|
||||
public class ArticleListVo {
|
||||
|
||||
@Schema(description = "阅读量")
|
||||
private Integer number;
|
||||
|
||||
@Schema(description = "大标题")
|
||||
private String titleBig;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
ai.title_big,
|
||||
ai.title_small,
|
||||
ai.publish_time,
|
||||
ai.number,
|
||||
ai.content,
|
||||
di.id doctor_id,
|
||||
di.doctor_name,
|
||||
|
@ -38,6 +39,7 @@
|
|||
ai.title_big,
|
||||
ai.title_small,
|
||||
ai.publish_time,
|
||||
ai.number,
|
||||
ai.content,
|
||||
di.id doctor_id,
|
||||
di.doctor_name,
|
||||
|
|
|
@ -24,6 +24,21 @@
|
|||
|
||||
|
||||
<select id="getDoctorPageItemByName" resultType="com.atjy.web.admin.vo.doctor.DoctorInfoVo">
|
||||
|
||||
select distinct di.id,
|
||||
di.doctor_name,
|
||||
di.level,
|
||||
di.source,
|
||||
di.appointment_number,
|
||||
di.expertise,
|
||||
di.briefly,
|
||||
hi.hospital_name,
|
||||
d.name department_name,
|
||||
gi.url
|
||||
from doctor_info di
|
||||
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 graph_info gi on gi.item_type = 3 and gi.item_id = di.id and gi.is_deleted = 0
|
||||
where di.is_deleted = 0
|
||||
and di.doctor_name like '${name}'
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue