医生常用语页面开发,接口实现.
This commit is contained in:
@@ -6,7 +6,7 @@ import com.openhis.template.domain.DoctorPhrase;
|
||||
public interface IDoctorPhraseAppService {
|
||||
R<?> getDoctorPhraseList();
|
||||
|
||||
R<?> searchDoctorPhraseList(String phraseName ,String phraseType);
|
||||
R<?> searchDoctorPhraseList(String phraseName ,Integer phraseType);
|
||||
|
||||
R<?> addDoctorPhrase(DoctorPhrase doctorPhrase);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.openhis.web.doctorstation.appservice.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.template.domain.DoctorPhrase;
|
||||
import com.openhis.template.service.IDoctorPhraseService;
|
||||
@@ -24,14 +25,15 @@ public class DoctorPhraesAppServiceImpl implements IDoctorPhraseAppService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> searchDoctorPhraseList(String phraseName,String phraseType) {
|
||||
//1.数据校验
|
||||
if (phraseType == null || phraseType.equals("")) {
|
||||
return R.fail("模板类型不能为空");
|
||||
public R<?> searchDoctorPhraseList(String phraseName,Integer phraseType) {
|
||||
LambdaQueryWrapper<DoctorPhrase> wrapper = new LambdaQueryWrapper<>();
|
||||
if (phraseName !=null && ObjectUtil.isNotEmpty(phraseName)) {
|
||||
wrapper.like(DoctorPhrase::getPhraseName, phraseName);
|
||||
}
|
||||
if (phraseType !=null && ObjectUtil.isNotEmpty(phraseType)) {
|
||||
wrapper.eq(DoctorPhrase::getPhraseType, phraseType);
|
||||
}
|
||||
//2.查询
|
||||
LambdaQueryWrapper<DoctorPhrase> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(DoctorPhrase::getPhraseName, phraseName).eq(DoctorPhrase::getPhraseType, phraseType);
|
||||
List<DoctorPhrase> list = doctorPhraseService.list(wrapper);
|
||||
return R.ok(list);
|
||||
}
|
||||
@@ -42,8 +44,16 @@ public class DoctorPhraesAppServiceImpl implements IDoctorPhraseAppService {
|
||||
if(ObjectUtil.isEmpty(doctorPhrase)){
|
||||
return R.fail("医生常用语不能为空");
|
||||
}
|
||||
//2.新增
|
||||
//2.名称唯一性校验
|
||||
LambdaUpdateWrapper<DoctorPhrase> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(DoctorPhrase::getPhraseName, doctorPhrase.getPhraseName());
|
||||
DoctorPhrase one = doctorPhraseService.getOne(wrapper);
|
||||
if(ObjectUtil.isNotEmpty(one)){
|
||||
return R.fail("该名称已经存在");
|
||||
}
|
||||
//3.新增
|
||||
boolean save = doctorPhraseService.save(doctorPhrase);
|
||||
System.out.println(save);
|
||||
return R.ok(save);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class DoctorPhraseController {
|
||||
*/
|
||||
@GetMapping("/search")
|
||||
public R<?> searchDoctorPhraseList(
|
||||
@RequestParam(required = false) String phraseType,
|
||||
@RequestParam(required = false) Integer phraseType,
|
||||
@RequestParam(required = false) String phraseName
|
||||
){
|
||||
return R.ok(doctorPhraseAppService.searchDoctorPhraseList(phraseName,phraseType));
|
||||
@@ -57,7 +57,7 @@ public class DoctorPhraseController {
|
||||
* @param doctorPhrase 医生常用语
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@PutMapping("/update")
|
||||
public R<?> updateDoctorPhrase(@RequestBody DoctorPhrase doctorPhrase){
|
||||
return R.ok(doctorPhraseAppService.updateDoctorPhrase(doctorPhrase));
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class DoctorPhraseController {
|
||||
* @param DoctorPhraseId 医生常用语ID
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/delete/{DoctorPhraseId}")
|
||||
@DeleteMapping("/delete/{DoctorPhraseId}")
|
||||
public R<?> deleteDoctorPhrase(@PathVariable Integer DoctorPhraseId){
|
||||
return R.ok(doctorPhraseAppService.deleteDoctorPhrase(DoctorPhraseId));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.openhis.template.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -9,10 +11,11 @@ import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableName("adm_doctor_phrase")
|
||||
@TableName("adm_doctor_phrases")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class DoctorPhrase {
|
||||
/** id */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/** 短语编码 */
|
||||
|
||||
Reference in New Issue
Block a user