预约管理
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package com.openhis.web.appointmentmanage.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.ClinicRoom;
|
||||
|
||||
public interface IClinicRoomAppService {
|
||||
|
||||
/**
|
||||
* 分页查询诊室列表
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 每页条数
|
||||
* @param orgName 卫生机构名称
|
||||
* @param roomName 诊室名称
|
||||
* @return 分页查询结果
|
||||
*/
|
||||
R<?> selectClinicRoomPage(Integer pageNum, Integer pageSize, String orgName, String roomName);
|
||||
|
||||
/**
|
||||
* 查询诊室详情
|
||||
* @param id 诊室ID
|
||||
* @return 诊室详情
|
||||
*/
|
||||
R<?> selectClinicRoomById(Long id);
|
||||
|
||||
/**
|
||||
* 新增诊室
|
||||
* @param clinicRoom 诊室信息
|
||||
* @return 新增结果
|
||||
*/
|
||||
R<?> insertClinicRoom(ClinicRoom clinicRoom);
|
||||
|
||||
/**
|
||||
* 更新诊室
|
||||
* @param clinicRoom 诊室信息
|
||||
* @return 更新结果
|
||||
*/
|
||||
R<?> updateClinicRoom(ClinicRoom clinicRoom);
|
||||
|
||||
/**
|
||||
* 删除诊室
|
||||
* @param id 诊室ID
|
||||
* @return 删除结果
|
||||
*/
|
||||
R<?> deleteClinicRoomById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.openhis.web.appointmentmanage.appservice.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.ClinicRoom;
|
||||
import com.openhis.appointmentmanage.service.IClinicRoomService;
|
||||
import com.openhis.web.appointmentmanage.appservice.IClinicRoomAppService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
public class ClinicRoomAppServiceImpl implements IClinicRoomAppService {
|
||||
|
||||
@Resource
|
||||
private IClinicRoomService clinicRoomService;
|
||||
|
||||
@Override
|
||||
public R<?> selectClinicRoomPage(Integer pageNum, Integer pageSize, String orgName, String roomName) {
|
||||
// 构建查询条件
|
||||
ClinicRoom clinicRoom = new ClinicRoom();
|
||||
if (orgName != null && ObjectUtil.isNotEmpty(orgName)) {
|
||||
clinicRoom.setOrgName(orgName);
|
||||
}
|
||||
if (roomName != null && ObjectUtil.isNotEmpty(roomName)) {
|
||||
clinicRoom.setRoomName(roomName);
|
||||
}
|
||||
|
||||
// 分页查询
|
||||
Page<ClinicRoom> page = new Page<>(pageNum, pageSize);
|
||||
Page<ClinicRoom> result = clinicRoomService.selectClinicRoomPage(page, clinicRoom);
|
||||
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> selectClinicRoomById(Long id) {
|
||||
ClinicRoom clinicRoom = clinicRoomService.selectClinicRoomById(id);
|
||||
if (clinicRoom == null) {
|
||||
return R.fail(404, "诊室不存在");
|
||||
}
|
||||
return R.ok(clinicRoom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> insertClinicRoom(ClinicRoom clinicRoom) {
|
||||
// 数据校验
|
||||
if (ObjectUtil.isEmpty(clinicRoom.getRoomName())) {
|
||||
return R.fail(400, "诊室名称不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(clinicRoom.getDepartment())) {
|
||||
return R.fail(400, "科室名称不能为空");
|
||||
}
|
||||
if (clinicRoom.getRoomName().length() > 50) {
|
||||
return R.fail(400, "诊室名称长度不能超过50个字符");
|
||||
}
|
||||
if (clinicRoom.getRemarks() != null && clinicRoom.getRemarks().length() > 500) {
|
||||
return R.fail(400, "备注长度不能超过500个字符");
|
||||
}
|
||||
|
||||
// 新增诊室
|
||||
int result = clinicRoomService.insertClinicRoom(clinicRoom);
|
||||
if (result > 0) {
|
||||
return R.ok(null, "新增成功");
|
||||
} else {
|
||||
return R.fail("新增失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> updateClinicRoom(ClinicRoom clinicRoom) {
|
||||
// 数据校验
|
||||
if (ObjectUtil.isEmpty(clinicRoom.getId())) {
|
||||
return R.fail(400, "诊室ID不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(clinicRoom.getRoomName())) {
|
||||
return R.fail(400, "诊室名称不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(clinicRoom.getDepartment())) {
|
||||
return R.fail(400, "科室名称不能为空");
|
||||
}
|
||||
if (clinicRoom.getRoomName().length() > 50) {
|
||||
return R.fail(400, "诊室名称长度不能超过50个字符");
|
||||
}
|
||||
if (clinicRoom.getRemarks() != null && clinicRoom.getRemarks().length() > 500) {
|
||||
return R.fail(400, "备注长度不能超过500个字符");
|
||||
}
|
||||
|
||||
// 检查诊室是否存在
|
||||
ClinicRoom existingClinicRoom = clinicRoomService.selectClinicRoomById(clinicRoom.getId());
|
||||
if (existingClinicRoom == null) {
|
||||
return R.fail(404, "诊室不存在");
|
||||
}
|
||||
|
||||
// 更新诊室
|
||||
int result = clinicRoomService.updateClinicRoom(clinicRoom);
|
||||
if (result > 0) {
|
||||
return R.ok(null, "修改成功");
|
||||
} else {
|
||||
return R.fail("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> deleteClinicRoomById(Long id) {
|
||||
// 检查诊室是否存在
|
||||
ClinicRoom existingClinicRoom = clinicRoomService.selectClinicRoomById(id);
|
||||
if (existingClinicRoom == null) {
|
||||
return R.fail(404, "诊室不存在");
|
||||
}
|
||||
|
||||
// 删除诊室
|
||||
int result = clinicRoomService.deleteClinicRoomById(id);
|
||||
if (result > 0) {
|
||||
return R.ok(null, "删除成功");
|
||||
} else {
|
||||
return R.fail("删除失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.openhis.web.appointmentmanage.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.ClinicRoom;
|
||||
import com.openhis.web.appointmentmanage.appservice.IClinicRoomAppService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/appoinment/clinic-room")
|
||||
public class ClinicRoomController {
|
||||
|
||||
@Resource
|
||||
private IClinicRoomAppService clinicRoomAppService;
|
||||
|
||||
/**
|
||||
* 分页查询诊室列表
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 每页条数
|
||||
* @param orgName 卫生机构名称
|
||||
* @param roomName 诊室名称
|
||||
* @return 分页查询结果
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<?> selectClinicRoomPage(
|
||||
@RequestParam(required = true) Integer pageNum,
|
||||
@RequestParam(required = true) Integer pageSize,
|
||||
@RequestParam(required = false) String orgName,
|
||||
@RequestParam(required = false) String roomName) {
|
||||
return clinicRoomAppService.selectClinicRoomPage(pageNum, pageSize, orgName, roomName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询诊室详情
|
||||
* @param id 诊室ID
|
||||
* @return 诊室详情
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<?> selectClinicRoomById(@PathVariable Long id) {
|
||||
return clinicRoomAppService.selectClinicRoomById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增诊室
|
||||
* @param clinicRoom 诊室信息
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public R<?> insertClinicRoom(@RequestBody ClinicRoom clinicRoom) {
|
||||
return clinicRoomAppService.insertClinicRoom(clinicRoom);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新诊室
|
||||
* @param clinicRoom 诊室信息
|
||||
* @return 更新结果
|
||||
*/
|
||||
@PutMapping
|
||||
public R<?> updateClinicRoom(@RequestBody ClinicRoom clinicRoom) {
|
||||
return clinicRoomAppService.updateClinicRoom(clinicRoom);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除诊室
|
||||
* @param id 诊室ID
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public R<?> deleteClinicRoomById(@PathVariable Long id) {
|
||||
return clinicRoomAppService.deleteClinicRoomById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?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.openhis.appointmentmanage.mapper.ClinicRoomMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="ClinicRoomResult" type="com.openhis.appointmentmanage.domain.ClinicRoom">
|
||||
<id property="id" column="id" />
|
||||
<result property="orgName" column="org_name" />
|
||||
<result property="roomName" column="room_name" />
|
||||
<result property="department" column="department" />
|
||||
<result property="building" column="building" />
|
||||
<result property="floor" column="floor" />
|
||||
<result property="roomNo" column="room_no" />
|
||||
<result property="isDisabled" column="is_disabled" />
|
||||
<result property="remarks" column="remarks" />
|
||||
<result property="voided" column="void" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, org_name, room_name, department, building, floor, room_no, is_disabled, remarks, void, create_by, create_time, update_by, update_time
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectClinicRoomPage" parameterType="com.openhis.appointmentmanage.domain.ClinicRoom" resultMap="ClinicRoomResult">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from clinic_room
|
||||
where 1 = 1
|
||||
<if test="orgName != null and orgName != ''">
|
||||
and org_name like concat('%', #{orgName}, '%')
|
||||
</if>
|
||||
<if test="roomName != null and roomName != ''">
|
||||
and room_name like concat('%', #{roomName}, '%')
|
||||
</if>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<!-- 查询详情 -->
|
||||
<select id="selectClinicRoomById" parameterType="Long" resultMap="ClinicRoomResult">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from clinic_room
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 新增 -->
|
||||
<insert id="insertClinicRoom" parameterType="com.openhis.appointmentmanage.domain.ClinicRoom" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into clinic_room
|
||||
(org_name, room_name, department, building, floor, room_no, is_disabled, remarks, void, create_by, create_time, update_by, update_time)
|
||||
values
|
||||
(#{orgName}, #{roomName}, #{department}, #{building}, #{floor}, #{roomNo}, #{isDisabled}, #{remarks}, #{voided}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
<!-- 更新 -->
|
||||
<update id="updateClinicRoom" parameterType="com.openhis.appointmentmanage.domain.ClinicRoom">
|
||||
update clinic_room
|
||||
set
|
||||
org_name = #{orgName},
|
||||
room_name = #{roomName},
|
||||
department = #{department},
|
||||
building = #{building},
|
||||
floor = #{floor},
|
||||
room_no = #{roomNo},
|
||||
is_disabled = #{isDisabled},
|
||||
remarks = #{remarks},
|
||||
void = #{voided},
|
||||
update_by = #{updateBy},
|
||||
update_time = #{updateTime}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除 -->
|
||||
<delete id="deleteClinicRoomById" parameterType="Long">
|
||||
delete from clinic_room where id = #{id}
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user