• 尚医通-预约挂号


    预约挂号详情

    1、接口分析

    (1)根据预约周期,展示可预约日期数据,按分页展示

    (2)选择日期展示当天可预约列表(该接口后台已经实现过)

    2、页面展示分析

    (1)分页展示可预约日期,根据有号、无号、约满等状态展示不同颜色,以示区分

    (2)可预约最后一个日期为即将放号日期,根据放号时间页面展示倒计时

    最后效果如图

    image-20221128150026249

    后端

    涉及到两个接口,这两个接口我没具体写,比较复杂

    //获取可预约排班数据
    @ApiOperation(value = "获取可预约排班数据")
    @GetMapping("auth/getBookingScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    public Result getBookingSchedule(
            @ApiParam(name = "page", value = "当前页码", required = true)
            @PathVariable Integer page,
            @ApiParam(name = "limit", value = "每页记录数", required = true)
            @PathVariable Integer limit,
            @ApiParam(name = "hoscode", value = "医院code", required = true)
            @PathVariable String hoscode,
            @ApiParam(name = "depcode", value = "科室code", required = true)
            @PathVariable String depcode) {
        return Result.ok(scheduleService.getBookingScheduleRule(page, limit, hoscode, depcode));
    }
    
    //获取排班具体数据
    @ApiOperation(value = "获取排班具体数据")
    @GetMapping("auth/findScheduleList/{hoscode}/{depcode}/{workDate}")
    public Result findScheduleList(
            @ApiParam(name = "hoscode", value = "医院code", required = true)
            @PathVariable String hoscode,
            @ApiParam(name = "depcode", value = "科室code", required = true)
            @PathVariable String depcode,
            @ApiParam(name = "workDate", value = "排班日期", required = true)
            @PathVariable String workDate) {
        return Result.ok(scheduleService.getDetailSchedule(hoscode, depcode, workDate));
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27

    Service

    //根据医院编号、科室编号、工作日期,查询排版详细信息
        @Override
        public List<Schedule> getScheduleDetail(String hoscode, String depcode, String workDate) {
            //根据参数,查询mongodb
            List<Schedule> scheduleList = scheduleRepository.findScheduleByHoscodeAndDepcodeAndWorkDate(hoscode, depcode, new DateTime(workDate).toDate());
    
            //遍历list集合,设置每个元素对应的属性
            //使用stream流遍历
            scheduleList.stream().forEach(item -> {
                this.packageSchedule(item);
            });
    
            return scheduleList;
        }
    
    @Override
        public Map<String, Object> getBookingScheduleRule(Integer page, Integer limit, String hoscode, String depcode) {
            Map<String, Object> result = new HashMap<>();
    
            //根据医院编号获取预约规则
            // 从 mongo 中取
            Hospital hospital = hospitalService.getByHoscode(hoscode);
            if (hospital == null) {
                throw new HospitalException(ResultCodeEnum.DATA_ERROR);
            }
            BookingRule bookingRule = hospital.getBookingRule();
    
            // 获取可预约日期的数据(分页)
            IPage iPage = this.getListDate(page, limit, bookingRule);
            // 当前可预约日期
            List<Date> dateList = iPage.getRecords();
    
            // 获取可预约日期里面科室的剩余预约数
            Criteria criteria = Criteria.where("hoscode").is(hoscode)
                    .and("depcode").is(depcode)
                    .and("workDate").in(dateList);
    
            Aggregation agg = Aggregation.newAggregation(
                    Aggregation.match(criteria),
                    Aggregation.group("workDate").first("workDate").as("workDate")
                            .count().as("docCount")
                            .sum("availableNumber").as("availableNumber")
                            .sum("reservedNumber").as("reservedNumber")
            );
    
            AggregationResults<BookingScheduleRuleVo> aggregateResult =
                    mongoTemplate.aggregate(agg, Schedule.class, BookingScheduleRuleVo.class);
    
            List<BookingScheduleRuleVo> scheduleVoList = aggregateResult.getMappedResults();
    
            //合并数据  map集合 key:日期  value:预约规则和剩余数量等
            Map<Date, BookingScheduleRuleVo> scheduleVoMap = new HashMap<>();
            if (!CollectionUtils.isEmpty(scheduleVoList)) {
                scheduleVoMap = scheduleVoList.stream().collect(Collectors.toMap(BookingScheduleRuleVo::getWorkDate, BookingScheduleRuleVo -> BookingScheduleRuleVo));
            }
    
            //获取可预约排版规则
            List<BookingScheduleRuleVo> bookingScheduleRuleVoList = new ArrayList<>();
            for (int i = 0, len = dateList.size(); i < len; i++) {
                Date date = dateList.get(i);
                //从map集合中根据key日期获取value值
                BookingScheduleRuleVo bookingScheduleRuleVo = scheduleVoMap.get(date);
                if (bookingScheduleRuleVo == null) {
                    bookingScheduleRuleVo = new BookingScheduleRuleVo();
                    //就诊医生人数
                    bookingScheduleRuleVo.setDocCount(0);
                    //科室剩余预约数  -1表示无号
                    bookingScheduleRuleVo.setAvailableNumber(-1);
                }
    
                bookingScheduleRuleVo.setWorkDate(date);
                bookingScheduleRuleVo.setWorkDateMd(date);
                //计算当前预约日期对应的星期
                String dayOfWeek = this.getDayOfWeek(new DateTime(date));
                bookingScheduleRuleVo.setDayOfWeek(dayOfWeek);
    
                //最后一页最后一条记录为即将预约   状态 0:正常 1:即将放号 -1:当天已停止挂号
                if (i == len - 1 && page == iPage.getPages()) {
                    bookingScheduleRuleVo.setStatus(1);
                } else {
                    bookingScheduleRuleVo.setStatus(0);
                }
                //当天预约如果过了停号时间, 不能预约
                if (i == 0 && page == 1) {
                    DateTime stopTime = this.getDateTime(new Date(), bookingRule.getStopTime());
                    if (stopTime.isBeforeNow()) {
                        //停止预约
                        bookingScheduleRuleVo.setStatus(-1);
                    }
                }
                bookingScheduleRuleVoList.add(bookingScheduleRuleVo);
            }
            //可预约日期规则数据
            result.put("bookingScheduleList", bookingScheduleRuleVoList);
            result.put("total", iPage.getTotal());
            //其他基础数据
            Map<String, String> baseMap = new HashMap<>();
            //医院名称
            baseMap.put("hosname", hospitalService.getHospName(hoscode));
            //科室
            Department department = departmentService.getDepartment(hoscode, depcode);
            //大科室名称
            baseMap.put("bigname", department.getBigname());
            //科室名称
            baseMap.put("depname", department.getDepname());
            //月
            baseMap.put("workDateString", new DateTime().toString("yyyy年MM月"));
            //放号时间
            baseMap.put("releaseTime", bookingRule.getReleaseTime());
            //停号时间
            baseMap.put("stopTime", bookingRule.getStopTime());
            result.put("baseMap", baseMap);
            return result;
        }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114

    前端

    跳转路径需要修改

    image-20221128150259510

    联调

    需要手动修改数据,我改的是 邵迎红 这位医生的排班信息,修改 work_date 为当前时间以后几天就可以看到数据了

    预约确认

    1、根据排班id获取排班信息,在页面展示

    2、选择就诊人

    3、预约下单

    image-20221128150753924

    后端

    有一个查询排版信息详情的接口

    //根据医院编号、科室编号、工作日期,查询排版详细信息
        @GetMapping("/getScheduleDetail/{hoscode}/{depcode}/{workDate}")
        public Result getScheduleDetail(@PathVariable String hoscode,
                                        @PathVariable String depcode,
                                        @PathVariable String workDate){
            List<Schedule> list = scheduleService.getScheduleDetail(hoscode,depcode,workDate);
            return Result.ok(list);
        }
    
    //根据医院编号、科室编号、工作日期,查询排版详细信息
        @Override
        public List<Schedule> getScheduleDetail(String hoscode, String depcode, String workDate) {
            //根据参数,查询mongodb
            List<Schedule> scheduleList = scheduleRepository.findScheduleByHoscodeAndDepcodeAndWorkDate(hoscode, depcode, new DateTime(workDate).toDate());
    
            //遍历list集合,设置每个元素对应的属性
            //使用stream流遍历
            scheduleList.stream().forEach(item -> {
                this.packageSchedule(item);
            });
    
            return scheduleList;
        }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23

    前端

    这块就是 booking 这个页面

    预约下单

    这块放到了后面

  • 相关阅读:
    Oracle 常用命令大全
    60 个前端 Web 开发流行语你都知道哪些?
    Pyecharts绘图教程(2)—— 绘制多种折线图(Line)参数说明+代码实战
    div内文字水平居中+垂直居中
    网站部署与上线(2)远程连接云服务器或虚拟机
    VUE快速入门-5
    医学大数据|R|竞争风险模型:可视化与图像优化
    基于PHP在线点餐外卖系统设计与实现 开题报告
    电机控制、运动控制、过程控制三者关系
    前端基础:协商缓存
  • 原文地址:https://blog.csdn.net/qq_39007838/article/details/128086151