eight
2024-09-19 a940b56e9781e2b4e56dbe05a896dba33a6905c6
重叫功能 完成
已添加9个文件
已修改3个文件
627 ■■■■■ 文件已修改
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/call/CallController.java 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/call/vo/CallPageReqVO.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/call/vo/CallRespVO.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/call/vo/CallSaveReqVO.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/call/CallDO.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/call/CallMapper.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/call/CallService.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/call/CallServiceImpl.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/call/CallMapper.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
sql/mysql/jh.sql 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
@@ -34,4 +34,6 @@
    ErrorCode DEV_DISMANTLE_EXIST = new ErrorCode(1_010_005_006, "当天已有拆机");
    ErrorCode JOB_RECORD_NOT_EXISTS = new ErrorCode(1_010_006_000, "工作记录不存在");
    ErrorCode CALL_NOT_EXISTS = new ErrorCode(1_010_007_000, "叫号不存在");
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/call/CallController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,83 @@
package cn.lihu.jh.module.ecg.controller.admin.call;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import java.util.*;
import java.io.IOException;
import cn.lihu.jh.framework.common.pojo.PageParam;
import cn.lihu.jh.framework.common.pojo.PageResult;
import cn.lihu.jh.framework.common.pojo.CommonResult;
import cn.lihu.jh.framework.common.util.object.BeanUtils;
import static cn.lihu.jh.framework.common.pojo.CommonResult.success;
import cn.lihu.jh.framework.excel.core.util.ExcelUtils;
import cn.lihu.jh.framework.apilog.core.annotation.ApiAccessLog;
import static cn.lihu.jh.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.lihu.jh.module.ecg.controller.admin.call.vo.*;
import cn.lihu.jh.module.ecg.dal.dataobject.call.CallDO;
import cn.lihu.jh.module.ecg.service.call.CallService;
import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
@Tag(name = "管理后台 - å«å·")
@RestController
@RequestMapping("/ecg/call")
@Validated
public class CallController {
    @Resource
    private CallService callService;
    @PostMapping("/create")
    @Operation(summary = "创建叫号")
    @PreAuthorize("@ss.hasPermission('ecg:call:create')")
    public CommonResult<Integer> createCall(@Valid @RequestBody CallSaveReqVO createReqVO) {
        return success(callService.createCall(createReqVO));
    }
    @PutMapping("/update")
    @Operation(summary = "更新叫号")
    @PreAuthorize("@ss.hasPermission('ecg:call:update')")
    public CommonResult<Boolean> updateCall(@Valid @RequestBody CallSaveReqVO updateReqVO) {
        callService.updateCall(updateReqVO);
        return success(true);
    }
    @DeleteMapping("/delete")
    @Operation(summary = "删除叫号")
    @Parameter(name = "id", description = "编号", required = true)
    @PreAuthorize("@ss.hasPermission('ecg:call:delete')")
    public CommonResult<Boolean> deleteCall(@RequestParam("id") Integer id) {
        callService.deleteCall(id);
        return success(true);
    }
    @GetMapping("/get")
    @Operation(summary = "获得叫号")
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
    @PreAuthorize("@ss.hasPermission('ecg:call:query')")
    public CommonResult<CallRespVO> getCall(@RequestParam("id") Integer id) {
        CallDO call = callService.getCall(id);
        return success(BeanUtils.toBean(call, CallRespVO.class));
    }
    @GetMapping("/next")
    @Operation(summary = "获得下一个叫号")
    @PermitAll
    public CommonResult<CallRespVO> nextCall() {
        CallDO call = callService.getNextCall();
        return success(BeanUtils.toBean(call, CallRespVO.class));
    }
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/call/vo/CallPageReqVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,55 @@
package cn.lihu.jh.module.ecg.controller.admin.call.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.lihu.jh.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.lihu.jh.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - å«å·åˆ†é¡µ Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CallPageReqVO extends PageParam {
    @Schema(description = "患者编号", example = "1991")
    private String patId;
    @Schema(description = "患者姓名", example = "李四")
    private String patName;
    @Schema(description = "患者性别")
    private Integer patGender;
    @Schema(description = "排队序号")
    private Integer seqNum;
    @Schema(description = "过号标记")
    private Integer passed;
    @Schema(description = "预约过期标记")
    private Integer expired;
    @Schema(description = "叫号状态 0 æœªæ’­ 1 å·²æ’­ ")
    private Integer called;
    @Schema(description = "插队标记")
    private Integer jumpFlag;
    @Schema(description = "诊室编号", example = "30859")
    private Long roomId;
    @Schema(description = "诊室名称", example = "李四")
    private String roomName;
    @Schema(description = "诊疗床编号")
    private String bedNo;
    @Schema(description = "创建时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime[] createTime;
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/call/vo/CallRespVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,67 @@
package cn.lihu.jh.module.ecg.controller.admin.call.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - å«å· Response VO")
@Data
@ExcelIgnoreUnannotated
public class CallRespVO {
    @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "20296")
    @ExcelProperty("id")
    private Integer id;
    @Schema(description = "患者编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1991")
    @ExcelProperty("患者编号")
    private String patId;
    @Schema(description = "患者姓名", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
    @ExcelProperty("患者姓名")
    private String patName;
    @Schema(description = "患者性别")
    @ExcelProperty("患者性别")
    private Integer patGender;
    @Schema(description = "排队序号")
    @ExcelProperty("排队序号")
    private Integer seqNum;
    @Schema(description = "过号标记")
    @ExcelProperty("过号标记")
    private Integer passed;
    @Schema(description = "预约过期标记")
    @ExcelProperty("预约过期标记")
    private Integer expired;
    @Schema(description = "叫号状态 0 æœªæ’­ 1 å·²æ’­ ")
    @ExcelProperty("叫号状态 0 æœªæ’­ 1 å·²æ’­ ")
    private Integer called;
    @Schema(description = "插队标记")
    @ExcelProperty("插队标记")
    private Integer jumpFlag;
    @Schema(description = "诊室编号", example = "30859")
    @ExcelProperty("诊室编号")
    private Long roomId;
    @Schema(description = "诊室名称", example = "李四")
    @ExcelProperty("诊室名称")
    private String roomName;
    @Schema(description = "诊疗床编号")
    @ExcelProperty("诊疗床编号")
    private String bedNo;
    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/call/vo/CallSaveReqVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,51 @@
package cn.lihu.jh.module.ecg.controller.admin.call.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import javax.validation.constraints.NotEmpty;
import java.util.*;
@Schema(description = "管理后台 - å«å·æ–°å¢ž/修改 Request VO")
@Data
public class CallSaveReqVO {
    @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "20296")
    private Integer id;
    @Schema(description = "患者编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1991")
    @NotEmpty(message = "患者编号不能为空")
    private String patId;
    @Schema(description = "患者姓名", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
    @NotEmpty(message = "患者姓名不能为空")
    private String patName;
    @Schema(description = "患者性别")
    private Integer patGender;
    @Schema(description = "排队序号")
    private Integer seqNum;
    @Schema(description = "过号标记")
    private Integer passed;
    @Schema(description = "预约过期标记")
    private Integer expired;
    @Schema(description = "叫号状态 0 æœªæ’­ 1 å·²æ’­ ")
    private Integer called;
    @Schema(description = "插队标记")
    private Integer jumpFlag;
    @Schema(description = "诊室编号", example = "30859")
    private Long roomId;
    @Schema(description = "诊室名称", example = "李四")
    private String roomName;
    @Schema(description = "诊疗床编号")
    private String bedNo;
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java
@@ -4,15 +4,18 @@
import cn.lihu.jh.framework.common.pojo.CommonResult;
import cn.lihu.jh.framework.common.util.object.BeanUtils;
import cn.lihu.jh.framework.security.core.util.SecurityFrameworkUtils;
import cn.lihu.jh.module.ecg.controller.admin.call.vo.CallSaveReqVO;
import cn.lihu.jh.module.ecg.controller.admin.queue.vo.PatientStatisticVO;
import cn.lihu.jh.module.ecg.controller.admin.queue.vo.QueueRespVO;
import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomRespVO;
import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO;
import cn.lihu.jh.module.ecg.enums.QueueStatusEnum;
import cn.lihu.jh.module.ecg.service.call.CallService;
import cn.lihu.jh.module.ecg.service.queue.QueueService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -20,19 +23,25 @@
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import static cn.lihu.jh.framework.common.exception.enums.GlobalErrorCodeConstants.SUCCESS;
import static cn.lihu.jh.framework.common.pojo.CommonResult.error;
import static cn.lihu.jh.framework.common.pojo.CommonResult.success;
import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.ECG_INNER_ERROR;
@Tag(name = "管理后台 - åŒ»ç”Ÿå«å·")
@RestController
@RequestMapping("/ecg/doctor")
@Validated
@Slf4j
public class DoctorController {
    @Resource
    private QueueService queueService;
    @Resource
    private CallService callService;
    @GetMapping("/bed-doctor-pause")
    @Operation(summary = "医生暂停")
@@ -131,6 +140,15 @@
        queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus());
        queueStatusList.add(QueueStatusEnum.PASSED.getStatus());
        List<QueueDO> queueDOList = queueService.getDoctorQueueByStatus(roomId, bedNo, queueStatusList);
        // è¿‡æ»¤å‡º  å°±è¯Šä¸­çš„,准备叫号
        QueueDO onStageItem = queueDOList.stream().filter(item -> Objects.equals(item.getStatus(), QueueStatusEnum.ONSTAGE.getStatus())).findFirst().orElse(null);
        if (null != onStageItem) {
            CallSaveReqVO callSaveReqVO = BeanUtils.toBean(onStageItem, CallSaveReqVO.class);
            callSaveReqVO.setId(null);
            callService.createCall(callSaveReqVO);
        }
        return success(BeanUtils.toBean(queueDOList, QueueRespVO.class));
    }
@@ -150,9 +168,47 @@
        queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus());
        queueStatusList.add(QueueStatusEnum.PASSED.getStatus());
        List<QueueDO> queueDOList = queueService.getDoctorQueueByStatus(roomId, bedNo, queueStatusList);
        // è¿‡æ»¤å‡º  å°±è¯Šä¸­çš„,准备叫号
        QueueDO onStageItem = queueDOList.stream().filter(item -> Objects.equals(item.getStatus(), QueueStatusEnum.ONSTAGE.getStatus())).findFirst().orElse(null);
        if (null != onStageItem) {
            CallSaveReqVO callSaveReqVO = BeanUtils.toBean(onStageItem, CallSaveReqVO.class);
            callSaveReqVO.setId(null);
            callService.createCall(callSaveReqVO);
        }
        return success(BeanUtils.toBean(queueDOList, QueueRespVO.class));
    }
    @GetMapping("/call-again")
    @Operation(summary = "重叫、患者")
    @Parameter(name = "roomId", description = "诊室编号", required = true, example = "116")
    @Parameter(name = "bedNo", description = "工位编号", required = true, example = "B2")
    @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
    public CommonResult<String> callAgainPatient(
            @RequestParam("roomId") Long roomId,
            @RequestParam("bedNo") String bedNo)
    {
        List<Byte> queueStatusList = new ArrayList<>();
        queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus());
        List<QueueDO> queueDOList = queueService.getDoctorQueueByStatus(roomId, bedNo, queueStatusList);
        if (queueDOList.isEmpty())
            return success("无就诊中患者");
        if (queueDOList.size() > 1) {
            log.error("room {} bed {} have {} å°±è¯Šä¸­æ‚£è€…", roomId, bedNo, queueDOList.size());
            return error(ECG_INNER_ERROR);
        }
        QueueDO onStageItem = queueDOList.get(0);
        CallSaveReqVO callSaveReqVO = BeanUtils.toBean(onStageItem, CallSaveReqVO.class);
        callSaveReqVO.setId(null);
        callService.callAgain(callSaveReqVO);
        return success("操作成功");
    }
    @GetMapping("/get-patient-list")
    @Operation(summary = "取患者列表")
    @Parameter(name = "roomId", description = "诊室编号", required = true, example = "116")
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/call/CallDO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,75 @@
package cn.lihu.jh.module.ecg.dal.dataobject.call;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.lihu.jh.framework.mybatis.core.dataobject.BaseDO;
/**
 * å«å· DO
 *
 * @author é©¬å‰‘æ³¢
 */
@TableName("call_patient")
@KeySequence("call_seq") // ç”¨äºŽ Oracle、PostgreSQL、Kingbase、DB2、H2 æ•°æ®åº“的主键自增。如果是 MySQL ç­‰æ•°æ®åº“,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CallDO extends BaseDO {
    /**
     * id
     */
    @TableId
    private Integer id;
    /**
     * æ‚£è€…编号
     */
    private String patId;
    /**
     * æ‚£è€…姓名
     */
    private String patName;
    /**
     * æ‚£è€…性别
     */
    private Integer patGender;
    /**
     * æŽ’队序号
     */
    private Integer seqNum;
    /**
     * è¿‡å·æ ‡è®°
     */
    private Integer passed;
    /**
     * é¢„约过期标记
     */
    private Integer expired;
    /**
     * å«å·çŠ¶æ€ 0 æœªæ’­ 1 å·²æ’­
     */
    private Integer called;
    /**
     * æ’队标记
     */
    private Integer jumpFlag;
    /**
     * è¯Šå®¤ç¼–号
     */
    private Long roomId;
    /**
     * è¯Šå®¤åç§°
     */
    private String roomName;
    /**
     * è¯Šç–—床编号
     */
    private String bedNo;
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/call/CallMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,44 @@
package cn.lihu.jh.module.ecg.dal.mysql.call;
import java.util.*;
import cn.lihu.jh.framework.common.pojo.PageResult;
import cn.lihu.jh.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.lihu.jh.framework.mybatis.core.mapper.BaseMapperX;
import cn.lihu.jh.module.ecg.dal.dataobject.call.CallDO;
import org.apache.ibatis.annotations.Mapper;
import cn.lihu.jh.module.ecg.controller.admin.call.vo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
 * å«å· Mapper
 *
 * @author é©¬å‰‘æ³¢
 */
@Mapper
public interface CallMapper extends BaseMapperX<CallDO> {
    default PageResult<CallDO> selectPage(CallPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CallDO>()
                .eqIfPresent(CallDO::getPatId, reqVO.getPatId())
                .likeIfPresent(CallDO::getPatName, reqVO.getPatName())
                .eqIfPresent(CallDO::getPatGender, reqVO.getPatGender())
                .eqIfPresent(CallDO::getSeqNum, reqVO.getSeqNum())
                .eqIfPresent(CallDO::getPassed, reqVO.getPassed())
                .eqIfPresent(CallDO::getExpired, reqVO.getExpired())
                .eqIfPresent(CallDO::getCalled, reqVO.getCalled())
                .eqIfPresent(CallDO::getJumpFlag, reqVO.getJumpFlag())
                .eqIfPresent(CallDO::getRoomId, reqVO.getRoomId())
                .likeIfPresent(CallDO::getRoomName, reqVO.getRoomName())
                .eqIfPresent(CallDO::getBedNo, reqVO.getBedNo())
                .betweenIfPresent(CallDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CallDO::getId));
    }
    @Select("select * from lihu.call_patient where pat_id = #{patId} order by id desc limit 1")
    CallDO getLatestPatientCall(@Param("patId") String patId);
    @Select("select * from lihu.call_patient where called = 0 order by id limit 1")
    CallDO getNextCall();
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/call/CallService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,70 @@
package cn.lihu.jh.module.ecg.service.call;
import java.util.*;
import cn.lihu.jh.module.ecg.controller.admin.call.vo.*;
import cn.lihu.jh.module.ecg.dal.dataobject.call.CallDO;
import cn.lihu.jh.framework.common.pojo.PageResult;
import cn.lihu.jh.framework.common.pojo.PageParam;
import javax.validation.Valid;
/**
 * å«å· Service æŽ¥å£
 *
 * @author é©¬å‰‘æ³¢
 */
public interface CallService {
    /**
     * åˆ›å»ºå«å·
     *
     * @param createReqVO åˆ›å»ºä¿¡æ¯
     * @return ç¼–号
     */
    Integer createCall(@Valid CallSaveReqVO createReqVO);
    /**
     * æ›´æ–°å«å·
     *
     * @param updateReqVO æ›´æ–°ä¿¡æ¯
     */
    void updateCall(@Valid CallSaveReqVO updateReqVO);
    /**
     * åˆ é™¤å«å·
     *
     * @param id ç¼–号
     */
    void deleteCall(Integer id);
    /**
     * èŽ·å¾—å«å·
     *
     * @param id ç¼–号
     * @return å«å·
     */
    CallDO getCall(Integer id);
    /**
     * èŽ·å¾—ä¸‹ä¸€ä¸ªå«å·
     *
     * @return å«å·
     */
    CallDO getNextCall();
    /**
     * èŽ·å¾—å«å·åˆ†é¡µ
     *
     * @param pageReqVO åˆ†é¡µæŸ¥è¯¢
     * @return å«å·åˆ†é¡µ
     */
    PageResult<CallDO> getCallPage(CallPageReqVO pageReqVO);
    /**
     * é‡å«
     *
     * @param createReqVO åˆ›å»ºä¿¡æ¯
     * @return ç¼–号
     */
    Integer callAgain(@Valid CallSaveReqVO createReqVO);
}
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/call/CallServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,86 @@
package cn.lihu.jh.module.ecg.service.call;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import cn.lihu.jh.module.ecg.controller.admin.call.vo.*;
import cn.lihu.jh.module.ecg.dal.dataobject.call.CallDO;
import cn.lihu.jh.framework.common.pojo.PageResult;
import cn.lihu.jh.framework.common.util.object.BeanUtils;
import cn.lihu.jh.module.ecg.dal.mysql.call.CallMapper;
import javax.annotation.Resource;
import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*;
/**
 * å«å· Service å®žçŽ°ç±»
 *
 * @author é©¬å‰‘æ³¢
 */
@Service
@Validated
public class CallServiceImpl implements CallService {
    @Resource
    private CallMapper callMapper;
    @Override
    public Integer createCall(CallSaveReqVO createReqVO) {
        // æ’å…¥
        CallDO call = BeanUtils.toBean(createReqVO, CallDO.class);
        callMapper.insert(call);
        // è¿”回
        return call.getId();
    }
    @Override
    public void updateCall(CallSaveReqVO updateReqVO) {
        // æ ¡éªŒå­˜åœ¨
        validateCallExists(updateReqVO.getId());
        // æ›´æ–°
        CallDO updateObj = BeanUtils.toBean(updateReqVO, CallDO.class);
        callMapper.updateById(updateObj);
    }
    @Override
    public void deleteCall(Integer id) {
        // æ ¡éªŒå­˜åœ¨
        validateCallExists(id);
        // åˆ é™¤
        callMapper.deleteById(id);
    }
    private void validateCallExists(Integer id) {
        if (callMapper.selectById(id) == null) {
            throw exception(CALL_NOT_EXISTS);
        }
    }
    @Override
    public CallDO getCall(Integer id) {
        return callMapper.selectById(id);
    }
    @Override
    public CallDO getNextCall() {
        CallDO callDO = callMapper.getNextCall();
        return callDO;
    }
    @Override
    public PageResult<CallDO> getCallPage(CallPageReqVO pageReqVO) {
        return callMapper.selectPage(pageReqVO);
    }
    @Override
    public Integer callAgain(CallSaveReqVO createReqVO) {
        CallDO callDO = callMapper.getLatestPatientCall(createReqVO.getPatId());
        if (null != callDO && callDO.getCalled() == 0)
            return 0;
        return createCall(createReqVO);
    }
}
jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/call/CallMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
<?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="cn.lihu.jh.module.ecg.dal.mysql.call.CallMapper">
    <!--
        ä¸€èˆ¬æƒ…况下,尽可能使用 Mapper è¿›è¡Œ CRUD å¢žåˆ æ”¹æŸ¥å³å¯ã€‚
        æ— æ³•满足的场景,例如说多表关联查询,才使用 XML ç¼–写 SQL。
        ä»£ç ç”Ÿæˆå™¨æš‚时只生成 Mapper XML æ–‡ä»¶æœ¬èº«ï¼Œæ›´å¤šæŽ¨è MybatisX å¿«é€Ÿå¼€å‘插件来生成查询。
        æ–‡æ¡£å¯è§ï¼šhttps://www.iocoder.cn/MyBatis/x-plugins/
     -->
</mapper>
sql/mysql/jh.sql
@@ -189,3 +189,29 @@
  KEY `idx_rent_id` (`rent_id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='工作记录表';
-- ----------------------------
-- Table structure for call
-- ----------------------------
DROP TABLE IF EXISTS `call_patient`;
SELECT * FROM lihu.call_patient;CREATE TABLE `call_patient` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
  `pat_id` varchar(30) NOT NULL COMMENT '患者编号',
  `pat_name` varchar(10) NOT NULL COMMENT '患者姓名',
  `pat_gender` int DEFAULT NULL COMMENT '患者性别',
  `seq_num` int DEFAULT NULL COMMENT '排队序号',
  `passed` int DEFAULT '0' COMMENT '过号标记',
  `expired` int DEFAULT '0' COMMENT '预约过期标记',
  `called` int DEFAULT '0' COMMENT '叫号状态 0 æœªæ’­ 1 å·²æ’­ ',
  `jump_flag` int DEFAULT '0' COMMENT '插队标记',
  `room_id` bigint DEFAULT '0' COMMENT '诊室编号',
  `room_name` varchar(10) DEFAULT '' COMMENT '诊室名称',
  `bed_no` varchar(10) DEFAULT '' COMMENT '诊疗床编号',
  `creator` varchar(10) DEFAULT '' COMMENT '创建者',
  `create_time` datetime NOT NULL COMMENT '创建时间',
  `updater` varchar(10) DEFAULT '' COMMENT '更新者',
  `update_time` datetime NOT NULL COMMENT '更新时间',
  `deleted` bit(1) DEFAULT b'0' COMMENT '删除标记',
  PRIMARY KEY (`id`),
  KEY `idx_pat` (`pat_id`) USING BTREE,
  KEY `idx_called` (`called`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='叫号表';