医案管理
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.peanut.common.utils.Query;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.BookMedicalRecordsEntity;
|
||||
import com.peanut.modules.book.service.BookMedicalRecordsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("book/bookMedicalRecords")
|
||||
public class BookMedicalRecordsController {
|
||||
|
||||
@Autowired
|
||||
private BookMedicalRecordsService bookMedicalRecordsService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
IPage<BookMedicalRecordsEntity> page = bookMedicalRecordsService.page(
|
||||
new Query<BookMedicalRecordsEntity>().getPage(params),
|
||||
new QueryWrapper<BookMedicalRecordsEntity>()
|
||||
.orderByDesc("sort")
|
||||
.eq("del_flag","0"));
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
/**
|
||||
* 根据图书id查询列表
|
||||
*/
|
||||
@RequestMapping("/listByBookId")
|
||||
public R listByBookId(Integer bookId){
|
||||
List list = bookMedicalRecordsService.list(
|
||||
new QueryWrapper<BookMedicalRecordsEntity>()
|
||||
.eq("book_id", bookId)
|
||||
.eq("del_flag","0")
|
||||
.orderByDesc("sort"));
|
||||
return R.ok().put("list", list);
|
||||
}
|
||||
/**
|
||||
* 根据id查询医案
|
||||
*/
|
||||
@RequestMapping("/getById")
|
||||
public R getById(Integer medicalRecordsId){
|
||||
BookMedicalRecordsEntity entity = bookMedicalRecordsService.getOne(
|
||||
new QueryWrapper<BookMedicalRecordsEntity>()
|
||||
.eq("medical_records_id", medicalRecordsId)
|
||||
.eq("del_flag","0"));
|
||||
return R.ok().put("entity", entity);
|
||||
}
|
||||
/**
|
||||
* 新增或修改
|
||||
*/
|
||||
@RequestMapping("/saveOrUpdate")
|
||||
public R save(@RequestBody BookMedicalRecordsEntity entity){
|
||||
try {
|
||||
if (entity.getSort()==null){
|
||||
entity.setSort(1);
|
||||
}
|
||||
if (entity.getDelFlag()==null){
|
||||
entity.setDelFlag(0);
|
||||
}
|
||||
bookMedicalRecordsService.saveOrUpdate(entity);
|
||||
return R.ok();
|
||||
}catch (Exception e) {
|
||||
return R.error("操作失败:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/del")
|
||||
public R del(Integer medicalRecordsId){
|
||||
try {
|
||||
BookMedicalRecordsEntity entity = bookMedicalRecordsService.getOne(
|
||||
new QueryWrapper<BookMedicalRecordsEntity>()
|
||||
.eq("medical_records_id", medicalRecordsId));
|
||||
entity.setDelFlag(1);
|
||||
bookMedicalRecordsService.updateById(entity);
|
||||
return R.ok();
|
||||
}catch (Exception e) {
|
||||
return R.error("删除失败:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.book.dao;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.peanut.modules.book.entity.BookMedicalRecordsEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface BookMedicalRecordsDao extends MPJBaseMapper<BookMedicalRecordsEntity> {
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.peanut.modules.book.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 医案实体
|
||||
*/
|
||||
@Data
|
||||
@TableName("book_medical_records")
|
||||
public class BookMedicalRecordsEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@TableId
|
||||
private Integer medicalRecordsId;
|
||||
/**
|
||||
* 图书id
|
||||
*/
|
||||
private Integer bookId;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
/**
|
||||
* 删除标志
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.modules.book.entity.BookMedicalRecordsEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public interface BookMedicalRecordsService extends IService<BookMedicalRecordsEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.Query;
|
||||
import com.peanut.modules.book.dao.BookMedicalRecordsDao;
|
||||
import com.peanut.modules.book.entity.BookMedicalRecordsEntity;
|
||||
import com.peanut.modules.book.service.BookMedicalRecordsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BookMedicalRecordsServiceImpl extends ServiceImpl<BookMedicalRecordsDao, BookMedicalRecordsEntity> implements BookMedicalRecordsService {
|
||||
|
||||
|
||||
}
|
||||
18
src/main/resources/mapper/book/BookMedicalRecordsDao.xml
Normal file
18
src/main/resources/mapper/book/BookMedicalRecordsDao.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.peanut.modules.book.dao.BookMedicalRecordsDao">
|
||||
|
||||
<!-- 可根据自己的需求,是否要使用 -->
|
||||
<resultMap type="com.peanut.modules.book.entity.BookMedicalRecordsEntity" id="bookMedicalRecordsMap">
|
||||
<result property="medicalRecordsId" column="medical_records_id"/>
|
||||
<result property="bookId" column="book_id"/>
|
||||
<result property="title" column="title"/>
|
||||
<result property="content" column="content"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user