| | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum BedStatusEnum implements IntArrayValuable { |
| | | CLOSED((byte)0, "å·²å
³é"), |
| | | CLOSING((byte)1, "å
³éä¸"), |
| | | OPENING((byte)10, "å·²å¼é"), |
| | | DOCTOR_ON((byte)20, "æå»ç"), |
| | | PAUSE((byte)30, "æå"); |
| | | CLOSED(0, "å·²å
³é"), |
| | | CLOSING(1, "å
³éä¸"), |
| | | OPENING(10, "å·²å¼é"), |
| | | DOCTOR_ON(20, "æå»ç"), |
| | | PAUSE(30, "æå"); |
| | | |
| | | public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BedStatusEnum::getStatus).toArray(); |
| | | |
| | | /** |
| | | * ç¶æå¼ |
| | | */ |
| | | private final Byte status; |
| | | private final Integer status; |
| | | /** |
| | | * ç¶æå |
| | | */ |
| | |
| | | package cn.lihu.jh.module.ecg.controller.admin.queue; |
| | | |
| | | import cn.lihu.jh.framework.common.exception.ErrorCode; |
| | | import cn.lihu.jh.framework.security.core.util.SecurityFrameworkUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | BeanUtils.toBean(list, QueueRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/bed-control") |
| | | @Operation(summary = "工使§å¶") |
| | | @GetMapping("/bed-open") |
| | | @Operation(summary = "å·¥ä½å¼é") |
| | | @PreAuthorize("@ss.hasPermission('ecg:queue:bedcontrol')") |
| | | public CommonResult<Integer> bedControl( |
| | | public CommonResult<Integer> bedOpen( |
| | | @RequestParam("roomId") Long roomId, |
| | | @RequestParam("bedNo") String bedNo) |
| | | { |
| | | Integer result = queueService.startBedOpen(roomId, bedNo); |
| | | if (null == result || 0 == result) |
| | | return success(0); |
| | | |
| | | return error(new ErrorCode(result, "åºéäº")); |
| | | } |
| | | |
| | | @GetMapping("/bed-close") |
| | | @Operation(summary = "å·¥ä½å
³é") |
| | | @PreAuthorize("@ss.hasPermission('ecg:queue:bedcontrol')") |
| | | public CommonResult<Integer> bedClose( |
| | | @RequestParam("roomId") Long roomId, |
| | | @RequestParam("bedNo") String bedNo) |
| | | { |
| | | Integer result = queueService.startBedClose(roomId, bedNo); |
| | | if (null == result || 0 == result) |
| | | return success(0); |
| | | |
| | | return error(new ErrorCode(result, "åºéäº")); |
| | | } |
| | | |
| | | @GetMapping("/bed-doctor-pause") |
| | | @Operation(summary = "å»çæå") |
| | | @PreAuthorize("@ss.hasPermission('ecg:queue:bedcontrol')") |
| | | public CommonResult<Integer> bedPause( |
| | | @RequestParam("roomId") Long roomId, |
| | | @RequestParam("bedNo") String bedNo, |
| | | @RequestParam("status") Integer status) |
| | | @RequestParam("docId") Long docId, |
| | | @RequestParam("docName") String docName) |
| | | { |
| | | queueService.bedControl(roomId, bedNo, status); |
| | | return success(0); |
| | | Long userId = SecurityFrameworkUtils.getLoginUserId(); |
| | | String userNickname = SecurityFrameworkUtils.getLoginUserNickname(); |
| | | |
| | | Integer result = queueService.startBedDoctorPause(roomId, bedNo, userId, userNickname); |
| | | if (null == result || 0 == result) |
| | | return success(0); |
| | | |
| | | return error(new ErrorCode(result, "åºéäº")); |
| | | } |
| | | |
| | | @GetMapping("/bed-doctor-on") |
| | | @Operation(summary = "å»çå
¥åº§") |
| | | @PreAuthorize("@ss.hasPermission('ecg:queue:bedcontrol')") |
| | | public CommonResult<Integer> bedDoctorOn( |
| | | @RequestParam("roomId") Long roomId, |
| | | @RequestParam("bedNo") String bedNo) |
| | | { |
| | | Long userId = SecurityFrameworkUtils.getLoginUserId(); |
| | | String userNickname = SecurityFrameworkUtils.getLoginUserNickname(); |
| | | |
| | | Integer result = queueService.startBedDoctorOn(roomId, bedNo, userId, userNickname); |
| | | if (null == result || 0 == result) |
| | | return success(0); |
| | | |
| | | return error(new ErrorCode(result, "åºéäº")); |
| | | } |
| | | |
| | | @GetMapping("/bed-doctor-off") |
| | | @Operation(summary = "å»ç离座") |
| | | @PreAuthorize("@ss.hasPermission('ecg:queue:bedcontrol')") |
| | | public CommonResult<Integer> bedDoctorOff( |
| | | @RequestParam("roomId") Long roomId, |
| | | @RequestParam("bedNo") String bedNo) |
| | | { |
| | | Long userId = SecurityFrameworkUtils.getLoginUserId(); |
| | | String userNickname = SecurityFrameworkUtils.getLoginUserNickname(); |
| | | |
| | | Integer result = queueService.startBedDoctorOff(roomId, bedNo, userId, userNickname); |
| | | if (null == result || 0 == result) |
| | | return success(0); |
| | | |
| | | return error(new ErrorCode(result, "åºéäº")); |
| | | } |
| | | |
| | | @GetMapping("/startbiz") |
| | |
| | | private Integer status; |
| | | |
| | | @Schema(description = "å»çå", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å»çId") |
| | | private Long docId; |
| | | |
| | | @Schema(description = "å»çå", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å»çå") |
| | | private String doctorName; |
| | | private String docName; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | |
| | | package cn.lihu.jh.module.ecg.dal.dataobject.room; |
| | | |
| | | import cn.lihu.jh.module.ecg.enums.BedStatusEnum; |
| | | import lombok.*; |
| | | import java.util.*; |
| | | import java.time.LocalDateTime; |
| | |
| | | private String bedNo; |
| | | |
| | | /** |
| | | * è¯çåºç¶æ 0:åè¯ 10:å¼è¯ 20:æå |
| | | * è¯çåºç¶æ |
| | | * @see BedStatusEnum |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * å»çID |
| | | */ |
| | | private Long docId; |
| | | /** |
| | | * å»çå |
| | | */ |
| | | private String doctorName; |
| | | private String docName; |
| | | } |
| | |
| | | import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomPageReqVO; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomStatisticsDO; |
| | | import cn.lihu.jh.module.ecg.enums.BedStatusEnum; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.apache.ibatis.annotations.Update; |
| | | |
| | |
| | | @Select({ "SELECT room_id, room_name, count(1) as bed_num FROM lihu.clinic_room group by room_id;" }) |
| | | List<RoomStatisticsDO> roomStatistic(); |
| | | |
| | | @Select({ "SELECT id, room_id, room_name, bed_no, status, doctor_name FROM lihu.clinic_room where status > 0;" }) |
| | | @Select({ "SELECT id, room_id, room_name, bed_no, status, doc_id, doc_name FROM lihu.clinic_room where status >= 10;" }) |
| | | List<RoomDO> simpleRoomList(); |
| | | |
| | | @Update( "update lihu.clinic_room set status=#{status} where room_id=#{roomId} and bed_no=#{bedNo}" ) |
| | | Integer setBedStatus(Long roomId, String bedNo, Integer status); |
| | | @Update("<script> " + |
| | | "update lihu.clinic_room set status=#{newStatus.status} where room_id=#{roomId} and bed_no=#{bedNo} " + |
| | | "and status=( " + |
| | | " <foreach collection='curStatusList' separator=',' item='curStatus'>" + |
| | | " #{curStatus.status} " + |
| | | " </foreach> );" + |
| | | "</script>") |
| | | Integer setBedStatus(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("newStatus") BedStatusEnum newStatus, @Param("curStatusList") List<BedStatusEnum> curStatusList); |
| | | |
| | | @Update("<script> " + |
| | | "update lihu.clinic_room set status=#{newStatus.status} " + |
| | | "where room_id=#{roomId} and bed_no=#{bedNo} and doc_id=#{docId} and doc_name=#{docName}" + |
| | | "and status=( " + |
| | | " <foreach collection='curStatusList' separator=',' item='curStatus'>" + |
| | | " #{curStatus.status} " + |
| | | " </foreach> );" + |
| | | "</script>") |
| | | Integer setBedDoctorPause(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("docId")Long docId, @Param("docName")String docName, @Param("newStatus") BedStatusEnum newStatus, @Param("curStatusList") List<BedStatusEnum> curStatusList); |
| | | |
| | | @Update("<script> " + |
| | | "update lihu.clinic_room set status=#{newStatus.status}, doc_id=#{docId}, doc_name=#{docName} " + |
| | | "where room_id=#{roomId} and bed_no=#{bedNo} " + |
| | | "and status=( " + |
| | | " <foreach collection='curStatusList' separator=',' item='curStatus'>" + |
| | | " #{curStatus.status} " + |
| | | " </foreach> );" + |
| | | "</script>") |
| | | Integer setBedDoctorOn(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("docId")Long docId, @Param("docName")String docName, @Param("newStatus") BedStatusEnum newStatus, @Param("curStatusList") List<BedStatusEnum> curStatusList); |
| | | |
| | | @Update("<script> " + |
| | | "update lihu.clinic_room set status=#{newStatus.status}, doc_id=null, doc_name='' " + |
| | | "where room_id=#{roomId} and bed_no=#{bedNo} and doc_id=#{docId} and doc_name=#{docName}" + |
| | | "and status=( " + |
| | | " <foreach collection='curStatusList' separator=',' item='curStatus'>" + |
| | | " #{curStatus.status} " + |
| | | " </foreach> );" + |
| | | "</script>") |
| | | Integer setBedDoctorOff(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("docId")Long docId, @Param("docName")String docName, @Param("newStatus") BedStatusEnum newStatus, @Param("curStatusList") List<BedStatusEnum> curStatusList); |
| | | } |
| | |
| | | System.out.println("åºç¨å¯å¨å®æï¼ç³»ç»åå§ããã"); |
| | | |
| | | String strOpenCloseTime = configApi.getConfigValueByKey(ECG_OPENING_TIME_KEY); |
| | | strOpenCloseTime = "0:00~23:59"; |
| | | List<LocalTime> list = Utils.parseOpeningTime(strOpenCloseTime); |
| | | LocalTime openingTime = list.get(0); |
| | | LocalTime closeTime = list.get(1); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.lihu.jh.module.ecg.service.queue; |
| | | |
| | | import java.util.concurrent.Callable; |
| | | |
| | | public class BedCloseCallable implements Callable<Integer> { |
| | | |
| | | QueueService queueService; |
| | | private Long roomId; |
| | | private String bedNo; |
| | | |
| | | public BedCloseCallable(QueueService queueService, Long roomId, String bedNo) |
| | | { |
| | | super(); |
| | | this.roomId = roomId; |
| | | this.bedNo = bedNo; |
| | | this.queueService = queueService; |
| | | } |
| | | |
| | | public Integer call() throws Exception { |
| | | return queueService.bedClose(roomId, bedNo); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.lihu.jh.module.ecg.service.queue; |
| | | |
| | | import java.util.concurrent.Callable; |
| | | |
| | | public class BedDoctorOffCallable implements Callable<Integer> { |
| | | |
| | | QueueService queueService; |
| | | private Long roomId; |
| | | private String bedNo; |
| | | private Long docId; |
| | | private String docName; |
| | | |
| | | public BedDoctorOffCallable(QueueService queueService, Long roomId, String bedNo, Long docId, String docName) |
| | | { |
| | | super(); |
| | | this.queueService = queueService; |
| | | this.roomId = roomId; |
| | | this.bedNo = bedNo; |
| | | this.docId = docId; |
| | | this.docName = docName; |
| | | } |
| | | |
| | | public Integer call() throws Exception { |
| | | return queueService.bedDoctorOff(roomId, bedNo, docId, docName); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.lihu.jh.module.ecg.service.queue; |
| | | |
| | | import java.util.concurrent.Callable; |
| | | |
| | | public class BedDoctorOnCallable implements Callable<Integer> { |
| | | |
| | | QueueService queueService; |
| | | private Long roomId; |
| | | private String bedNo; |
| | | private Long docId; |
| | | private String docName; |
| | | |
| | | public BedDoctorOnCallable(QueueService queueService, Long roomId, String bedNo, Long docId, String docName) |
| | | { |
| | | super(); |
| | | this.queueService = queueService; |
| | | this.roomId = roomId; |
| | | this.bedNo = bedNo; |
| | | this.docId = docId; |
| | | this.docName = docName; |
| | | } |
| | | |
| | | public Integer call() throws Exception { |
| | | return queueService.bedDoctorOn(roomId, bedNo, docId, docName); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.lihu.jh.module.ecg.service.queue; |
| | | |
| | | import java.util.concurrent.Callable; |
| | | |
| | | public class BedDoctorPauseCallable implements Callable<Integer> { |
| | | |
| | | QueueService queueService; |
| | | private Long roomId; |
| | | private String bedNo; |
| | | private Long docId; |
| | | private String docName; |
| | | |
| | | public BedDoctorPauseCallable(QueueService queueService, Long roomId, String bedNo, Long docId, String docName) |
| | | { |
| | | super(); |
| | | this.queueService = queueService; |
| | | this.roomId = roomId; |
| | | this.bedNo = bedNo; |
| | | this.docId = docId; |
| | | this.docName = docName; |
| | | } |
| | | |
| | | public Integer call() throws Exception { |
| | | return queueService.bedDoctorPause(roomId, bedNo, docId, docName); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.lihu.jh.module.ecg.service.queue; |
| | | |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO; |
| | | import cn.lihu.jh.module.ecg.dal.mysql.queue.queueMapper; |
| | | import cn.lihu.jh.module.ecg.dal.mysql.room.RoomMapper; |
| | | import cn.lihu.jh.module.ecg.enums.BedStatusEnum; |
| | | import cn.lihu.jh.module.ecg.enums.QueueStatusEnum; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.Callable; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.PriorityBlockingQueue; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | import static cn.lihu.jh.module.ecg.service.queue.QueueService.MAX_QUEUE_NUM; |
| | | |
| | | public class BedOpenCallable implements Callable<Integer> { |
| | | |
| | | QueueService queueService; |
| | | private Long roomId; |
| | | private String bedNo; |
| | | |
| | | public BedOpenCallable(QueueService queueService, Long roomId, String bedNo) |
| | | { |
| | | super(); |
| | | this.roomId = roomId; |
| | | this.bedNo = bedNo; |
| | | this.queueService = queueService; |
| | | } |
| | | |
| | | public Integer call() throws Exception { |
| | | return queueService.bedOpen(roomId, bedNo); |
| | | } |
| | | |
| | | } |
| | |
| | | package cn.lihu.jh.module.ecg.service.queue; |
| | | |
| | | import cn.lihu.jh.module.ecg.enums.BedStatusEnum; |
| | | import lombok.Data; |
| | | import org.jetbrains.annotations.NotNull; |
| | | |
| | |
| | | */ |
| | | public interface QueueService { |
| | | |
| | | final static Integer MAX_QUEUE_NUM = 3; |
| | | |
| | | void startBiz(); |
| | | void closeBiz(); |
| | | |
| | |
| | | /** |
| | | * |
| | | */ |
| | | Integer bedControl(Long roomId, String bedNo, Integer status); |
| | | Integer startBedOpen(Long roomId, String bedNo); |
| | | Integer startBedClose(Long roomId, String bedNo); |
| | | Integer startBedDoctorPause(Long roomId, String bedNo, Long docId, String docName); |
| | | Integer startBedDoctorOn(Long roomId, String bedNo, Long docId, String docName); |
| | | Integer startBedDoctorOff(Long roomId, String bedNo, Long docId, String docName); |
| | | |
| | | Integer bedOpen(Long roomId, String bedNo); |
| | | Integer bedClose(Long roomId, String bedNo); |
| | | Integer bedDoctorPause(Long roomId, String bedNo, Long docId, String docName); |
| | | Integer bedDoctorOn(Long roomId, String bedNo, Long docId, String docName); |
| | | Integer bedDoctorOff(Long roomId, String bedNo, Long docId, String docName); |
| | | |
| | | /** |
| | | * è·å¾æé |
| | |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueStatisticDO; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO; |
| | | import cn.lihu.jh.module.ecg.dal.mysql.room.RoomMapper; |
| | | import cn.lihu.jh.module.ecg.enums.BedStatusEnum; |
| | | import cn.lihu.jh.module.ecg.enums.QueueStatusEnum; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | @Service |
| | | @Validated |
| | | public class QueueServiceImpl implements QueueService { |
| | | |
| | | final static Integer MAX_QUEUE_NUM = 3; |
| | | |
| | | @Resource |
| | | private queueMapper queueMapper; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Integer bedControl(Long roomId, String bedNo, Integer status) { |
| | | // è¥ä¸æé´ä¸è½å
³éå·¥ä½ |
| | | if ( status == 0 && openingFlag.get() == 1 ) |
| | | return 301; |
| | | public Integer startBedOpen(Long roomId, String bedNo) { |
| | | Future<Integer> future = singleThreadExecutor.submit( new BedOpenCallable(this, roomId, bedNo)); |
| | | |
| | | // å½åç¶æ |
| | | roomMapper.select |
| | | try { |
| | | Integer ret = future.get(); |
| | | return ret; |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } catch (ExecutionException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return 100; |
| | | } |
| | | |
| | | @Override |
| | | public Integer startBedClose(Long roomId, String bedNo) { |
| | | Future<Integer> future = singleThreadExecutor.submit( new BedCloseCallable(this, roomId, bedNo)); |
| | | |
| | | try { |
| | | Integer ret = future.get(); |
| | | return ret; |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } catch (ExecutionException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return 100; |
| | | } |
| | | |
| | | @Override |
| | | public Integer startBedDoctorPause(Long roomId, String bedNo, Long docId, String docName) { |
| | | Future<Integer> future = singleThreadExecutor.submit( |
| | | new BedDoctorPauseCallable(this, roomId, bedNo, docId, docName) |
| | | ); |
| | | |
| | | try { |
| | | Integer ret = future.get(); |
| | | return ret; |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } catch (ExecutionException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return 100; |
| | | } |
| | | |
| | | @Override |
| | | public Integer startBedDoctorOn(Long roomId, String bedNo, Long docId, String docName) { |
| | | Future<Integer> future = singleThreadExecutor.submit( |
| | | new BedDoctorOnCallable(this, roomId, bedNo, docId, docName) |
| | | ); |
| | | |
| | | try { |
| | | Integer ret = future.get(); |
| | | return ret; |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } catch (ExecutionException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return 100; |
| | | } |
| | | |
| | | @Override |
| | | public Integer startBedDoctorOff(Long roomId, String bedNo, Long docId, String docName) { |
| | | Future<Integer> future = singleThreadExecutor.submit( |
| | | new BedDoctorOffCallable(this, roomId, bedNo, docId, docName) |
| | | ); |
| | | |
| | | try { |
| | | Integer ret = future.get(); |
| | | return ret; |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } catch (ExecutionException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return 100; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å·²å
³é æè
å
³éä¸ï¼å¯ä»¥å¼éå·¥ä½ |
| | | * @param roomId |
| | | * @param bedNo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer bedOpen(Long roomId, String bedNo) { |
| | | // DB update |
| | | Integer updateNum = roomMapper.setBedStatus(roomId, bedNo, status); |
| | | List statusList = new ArrayList<BedStatusEnum>(); |
| | | statusList.add(BedStatusEnum.CLOSED); |
| | | statusList.add(BedStatusEnum.CLOSING); |
| | | Integer updateNum = roomMapper.setBedStatus(roomId, bedNo, |
| | | BedStatusEnum.OPENING, statusList); |
| | | if ( null==updateNum || 0 == updateNum ) |
| | | return 310; |
| | | |
| | | if ( status == 10 ) { |
| | | BedQueueBO bedQueueBO = new BedQueueBO(); |
| | | bedQueueBO.setRoomId(roomId); |
| | | bedQueueBO.setBedNo(bedNo); |
| | | bedQueueBO.setMaxQueueNum(MAX_QUEUE_NUM); |
| | | bedQueueBO.setQueueNum(new AtomicInteger(0)); |
| | | priorityQueue.offer(bedQueueBO); |
| | | mapBedVsQueue.put(String.format("%09d%s", bedQueueBO.roomId, bedQueueBO.bedNo), bedQueueBO); |
| | | } |
| | | List<Byte> queueStatusList = new ArrayList<>(); |
| | | queueStatusList.add(QueueStatusEnum.READY.getStatus()); |
| | | List<QueueDO> queueDOList = queueMapper.getDoctorQueueByStatus(roomId, bedNo, queueStatusList); |
| | | |
| | | // æ°å¢å·¥ä½ ä¼å
éå |
| | | BedQueueBO bedQueueBO = new BedQueueBO(); |
| | | bedQueueBO.setRoomId(roomId); |
| | | bedQueueBO.setBedNo(bedNo); |
| | | bedQueueBO.setMaxQueueNum(MAX_QUEUE_NUM); |
| | | bedQueueBO.setQueueNum(new AtomicInteger(queueDOList.size())); |
| | | priorityQueue.offer(bedQueueBO); |
| | | mapBedVsQueue.put(String.format("%09d%s", roomId, bedNo), bedQueueBO); |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public Integer bedClose(Long roomId, String bedNo) { |
| | | BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo)); |
| | | if (null == bedQueueBO) |
| | | return 320; |
| | | |
| | | // DB update |
| | | List statusList = new ArrayList<BedStatusEnum>(); |
| | | statusList.add(BedStatusEnum.OPENING); |
| | | statusList.add(BedStatusEnum.DOCTOR_ON); |
| | | statusList.add(BedStatusEnum.PAUSE); |
| | | Integer updateNum = roomMapper.setBedStatus(roomId, bedNo, |
| | | BedStatusEnum.CLOSING, statusList); |
| | | if ( null==updateNum || 0 == updateNum ) |
| | | return 321; |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public Integer bedDoctorPause(Long roomId, String bedNo, Long docId, String docName) { |
| | | BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo)); |
| | | if (null == bedQueueBO) |
| | | return 320; |
| | | |
| | | // DB update |
| | | List statusList = new ArrayList<BedStatusEnum>(); |
| | | statusList.add(BedStatusEnum.DOCTOR_ON); |
| | | Integer updateNum = roomMapper.setBedDoctorPause(roomId, bedNo, docId, docName, |
| | | BedStatusEnum.PAUSE, statusList); |
| | | if ( null==updateNum || 0 == updateNum ) |
| | | return 331; |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public Integer bedDoctorOn(Long roomId, String bedNo, Long docId, String docName) { |
| | | BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo)); |
| | | if (null == bedQueueBO) |
| | | return 320; |
| | | |
| | | // DB update |
| | | List statusList = new ArrayList<BedStatusEnum>(); |
| | | statusList.add(BedStatusEnum.OPENING); |
| | | Integer updateNum = roomMapper.setBedDoctorOn(roomId, bedNo, docId, docName, |
| | | BedStatusEnum.DOCTOR_ON, statusList); |
| | | if ( null==updateNum || 0 == updateNum ) |
| | | return 341; |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public Integer bedDoctorOff(Long roomId, String bedNo, Long docId, String docName) { |
| | | BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo)); |
| | | if (null == bedQueueBO) |
| | | return 320; |
| | | |
| | | // DB update |
| | | List statusList = new ArrayList<BedStatusEnum>(); |
| | | statusList.add(BedStatusEnum.DOCTOR_ON); |
| | | Integer updateNum = roomMapper.setBedDoctorOff(roomId, bedNo, docId, docName, |
| | | BedStatusEnum.OPENING, statusList); |
| | | if ( null==updateNum || 0 == updateNum ) |
| | | return 351; |
| | | |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `clinic_room`; |
| | | CREATE TABLE `clinic_room` ( |
| | | `id` int NOT NULL AUTO_INCREMENT COMMENT 'id', |
| | | `room_id` BIGINT NOT NULL COMMENT 'è¯å®¤ç¼å·', |
| | | `room_name` varchar(10) NOT NULL COMMENT 'è¯å®¤åç§°', |
| | | `bed_no` varchar(10) NOT NULL COMMENT 'è¯çåºç¼å·', |
| | | `status` int 0 COMMENT '0:åè¯ 10:å¼è¯ 20:æå', |
| | | `doctor_name` varchar(10) NOT NULL COMMENT 'å»çåç§°', |
| | | `tenant_id` int DEFAULT 1 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 0 COMMENT 'å 餿 è®°', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='è¯å®¤åè¯çåºè¡¨'; |
| | | |
| | | `id` int NOT NULL AUTO_INCREMENT COMMENT 'id', |
| | | `room_id` bigint NOT NULL COMMENT 'è¯å®¤ç¼å·', |
| | | `room_name` varchar(10) NOT NULL COMMENT 'è¯å®¤åç§°', |
| | | `bed_no` varchar(10) NOT NULL COMMENT 'è¯çåºç¼å·', |
| | | `status` int NOT NULL DEFAULT '0', |
| | | `doc_id` bigint DEFAULT NULL, |
| | | `doc_name` varchar(10) DEFAULT '', |
| | | `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`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='è¯å®¤åè¯çåºè¡¨'; |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for device_model |