医生常用语模板维护->后端接口开发、数据库建表。

This commit is contained in:
2025-12-22 16:45:40 +08:00
parent 91d673de77
commit 25b3c26ec2
14 changed files with 277 additions and 1 deletions

View File

@@ -0,0 +1,16 @@
package com.openhis.web.doctorstation.appservice;
import com.core.common.core.domain.R;
import com.openhis.template.domain.DoctorPhrase;
public interface IDoctorPhraseAppService {
R<?> getDoctorPhraseList();
R<?> searchDoctorPhraseList(String phraseType);
R<?> addDoctorPhrase(DoctorPhrase doctorPhrase);
R<?> updateDoctorPhrase(DoctorPhrase doctorPhrase);
R<?> deleteDoctorPhrase(Integer doctorPhraseId);
}

View File

@@ -0,0 +1,73 @@
package com.openhis.web.doctorstation.appservice.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.core.common.core.domain.R;
import com.openhis.template.domain.DoctorPhrase;
import com.openhis.template.service.IDoctorPhraseService;
import com.openhis.web.doctorstation.appservice.IDoctorPhraseAppService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class DoctorPhraesAppServiceImpl implements IDoctorPhraseAppService {
@Resource
private IDoctorPhraseService doctorPhraseService;
@Override
public R<?> getDoctorPhraseList() {
List<DoctorPhrase> list = doctorPhraseService.list();
return R.ok(list);
}
@Override
public R<?> searchDoctorPhraseList(String phraseType) {
//1.数据校验
if (phraseType == null || phraseType.equals("")) {
return R.fail("模板类型不能为空");
}
//2.查询
LambdaQueryWrapper<DoctorPhrase> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(DoctorPhrase::getPhraseType, phraseType);
List<DoctorPhrase> list = doctorPhraseService.list(wrapper);
return R.ok(list);
}
@Override
public R<?> addDoctorPhrase(DoctorPhrase doctorPhrase) {
//1.数据校验
if(ObjectUtil.isEmpty(doctorPhrase)){
return R.fail("医生常用语不能为空");
}
//2.新增
boolean save = doctorPhraseService.save(doctorPhrase);
return R.ok(save);
}
@Override
public R<?> updateDoctorPhrase(DoctorPhrase doctorPhrase) {
//1.数据校验
if(ObjectUtil.isEmpty(doctorPhrase)){
return R.fail("医生常用语不能为空");
}
//2.更新
boolean updateById = doctorPhraseService.updateById(doctorPhrase);
return R.ok(updateById);
}
@Override
public R<?> deleteDoctorPhrase(Integer doctorPhraseId) {
//1.数据校验
if(doctorPhraseId == null){
return R.fail("ID不能为空");
}
//2.删除
boolean removeById = doctorPhraseService.removeById(doctorPhraseId);
return R.ok(removeById);
}
}

View File

@@ -0,0 +1,75 @@
package com.openhis.web.doctorstation.controller;
import com.core.common.core.domain.R;
import com.openhis.template.domain.DoctorPhrase;
import com.openhis.web.doctorstation.appservice.IDoctorPhraseAppService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController
@Slf4j
@RequestMapping("/Doctor-phrase")
public class DoctorPhraseController {
@Resource
private IDoctorPhraseAppService doctorPhraseAppService;
/**
* 获取医生常用语List
*
* @return 结果
*/
@GetMapping("/list")
public R<?> getDoctorPhraseList(){
return R.ok(doctorPhraseAppService.getDoctorPhraseList());
}
/**
* 查询医生常用语
*
* @param phraseType 模板级别
* @return 结果
*/
@GetMapping("/search")
public R<?> searchDoctorPhraseList(
@RequestParam(required = false) String phraseType
){
return R.ok(doctorPhraseAppService.searchDoctorPhraseList(phraseType));
}
/**
* 新增医生常用语
*
* @param doctorPhrase 医生常用语
* @return 结果
*/
@PostMapping("/add")
public R<?> addDoctorPhrase(@RequestBody DoctorPhrase doctorPhrase){
return R.ok(doctorPhraseAppService.addDoctorPhrase(doctorPhrase));
}
/**
* 更新医生常用语
*
* @param doctorPhrase 医生常用语
* @return 结果
*/
@PostMapping("/update")
public R<?> updateDoctorPhrase(@RequestBody DoctorPhrase doctorPhrase){
return R.ok(doctorPhraseAppService.updateDoctorPhrase(doctorPhrase));
}
/**
* 删除医生常用语
*
* @param DoctorPhraseId 医生常用语ID
* @return 结果
*/
@PostMapping("/delete/{DoctorPhraseId}")
public R<?> deleteDoctorPhrase(@PathVariable Integer DoctorPhraseId){
return R.ok(doctorPhraseAppService.deleteDoctorPhrase(DoctorPhraseId));
}
}

View File

@@ -0,0 +1,7 @@
package com.openhis.web.doctorstation.mapper;
import org.springframework.stereotype.Repository;
@Repository
public interface DoctorPhraseAppMapper {
}