尚医通10:科室排班日期+科室排班详细数据+搭建平台用户系统前端环境

news2024/11/5 8:43:16
内容介绍

1、查看科室排班日期统计数据

2、查看科室排班详细数据

3、搭建平台用户系统前端环境

4、首页静态数据整合

5、首页数据显示接口

6、首页数据显示前端

查看科室排班日期统计数据

1确认需求

2、实现接口

1)分析接口

*参数:pagelimithoscodedepcode

*返回值:RMaptotalList<BookingScheduleRuleVo>。。。))

2)创建controller

@Api(tags = "排班管理")

  @RestController

@RequestMapping("/admin/hosp/schedule")

  public class ScheduleController {

    @Autowired

    private ScheduleService scheduleService;

    

    //根据医院编号  科室编号 ,查询排班规则数据

    @ApiOperation(value ="查询排班规则统计数据")

    @GetMapping("getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")

    public R getScheduleRule(@PathVariable long page,

                             @PathVariable long limit,

                             @PathVariable String hoscode,

                             @PathVariable String depcode) {

        Map<String,Object> map = scheduleService.getScheduleRule(page,limit,hoscode,depcode);

        return R.ok().data(map);

    }

  }

3)如果是mysql如何实现

#根据医院编号 科室编号 ,查询排班规则统计数据,带分页带排序

SELECT s.workDate,COUNT(id) AS docCount,

SUM(s.reservedNumber) AS reservedNumber,

SUM(s.availableNumber) AS availableNumber

 FROM SCHEDULE s

WHERE  s.hoscode = '医院编号' AND s.depcode = '科室编号'

GROUP BY s.workDate

ORDER BY s.workDate

LIMIT XXXX;

4)梳理service实现步骤

//查询排班规则统计数据

  @Override

  public Map<String, Object> getScheduleRule(long page, long limit,

                                           String hoscode, String depcode) {

    //1创建返回对象

    //2根据医院编码、科室编码筛选,根据排班日期、带排序带分页聚合查询(List)

    //3根据医院编码、科室编码筛选,根据排班日期、聚合查询(total)

    //4遍历集合根据排班日期推算出周几

    //5把查询数据存入返回对象

    //6补全数据

    return null;

  }
(5)导入日期工具依赖

<dependency>

    <groupId>joda-time</groupId>

    <artifactId>joda-time</artifactId>

  </dependency>
(6)实现接口方法

@Autowired

  private MongoTemplate mongoTemplate;

  @Autowired

  private HospitalService hospitalService;


//查询排班规则统计数据

  @Override

  public Map<String, Object> getScheduleRule(long page, long limit,

                                           String hoscode, String depcode) {

    //1创建返回对象

    Map<String, Object> result = new HashMap<>();

    //2根据医院编码、科室编码筛选,根据排班日期、带排序带分页聚合查询(List)

    //2.1封装筛选条件

    Criteria criteria = Criteria.where("hoscode").is(hoscode)

            .and("depcode").is(depcode);

    //2.2创建聚合查询对象

    Aggregation agg =Aggregation.newAggregation(

            //2.2.1设置筛选条件

            Aggregation.match(criteria),

            //2.2.2设置聚合字段,查询收集字段

            Aggregation.group("workDate")

                    .first("workDate").as("workDate")

                    .count().as("docCount")

                    .sum("reservedNumber").as("reservedNumber")

                    .sum("availableNumber").as("availableNumber"),

            //2.2.3设置排序

            Aggregation.sort(Sort.Direction.ASC,"workDate"),

            //2.2.4设置分页

            Aggregation.skip((page-1)*limit),

            Aggregation.limit(limit)

    );

    //2.3进行聚合查询(list)

    AggregationResults<BookingScheduleRuleVo> aggregate = mongoTemplate.aggregate(agg, Schedule.class, BookingScheduleRuleVo.class);

    List<BookingScheduleRuleVo> bookingScheduleRuleVoList = aggregate.getMappedResults();

    //3根据医院编码、科室编码筛选,根据排班日期、聚合查询(total)

    //3.1创建聚合查询对象

    Aggregation aggTotal =Aggregation.newAggregation(

            //2.2.1设置筛选条件

            Aggregation.match(criteria),

            //2.2.2设置聚合字段,查询收集字段

            Aggregation.group("workDate")

    );

    //3.2进行聚合查询(total)

    AggregationResults<BookingScheduleRuleVo> aggregateTotal = mongoTemplate.aggregate(aggTotal, Schedule.class, BookingScheduleRuleVo.class);

    List<BookingScheduleRuleVo> totalResults = aggregateTotal.getMappedResults();

    int total = totalResults.size();

    //4遍历集合根据排班日期推算出周几

    for (BookingScheduleRuleVo bookingScheduleRuleVo : bookingScheduleRuleVoList) {

        Date workDate = bookingScheduleRuleVo.getWorkDate();

        String dayOfWeek =this.getDayOfWeek(new DateTime(workDate));

        bookingScheduleRuleVo.setDayOfWeek(dayOfWeek);

    }

    //5把查询数据存入返回对象

    result.put("bookingScheduleRuleList",bookingScheduleRuleVoList);

    result.put("total",total);

    //6补全数据

    //获取医院名称

    String hosName = hospitalService.getHospName(hoscode);

    //其他基础数据

    Map<String, String> baseMap = new HashMap<>();

    baseMap.put("hosname",hosName);

    result.put("baseMap",baseMap);

    return result;

  }


*相关工具

//换算周几

  private String getDayOfWeek(DateTime dateTime) {

    String dayOfWeek = "";

    switch (dateTime.getDayOfWeek()) {

        case DateTimeConstants.SUNDAY:

            dayOfWeek = "周日";

            break;

        case DateTimeConstants.MONDAY:

            dayOfWeek = "周一";

            break;

        case DateTimeConstants.TUESDAY:

            dayOfWeek = "周二";

            break;

        case DateTimeConstants.WEDNESDAY:

            dayOfWeek = "周三";

            break;

        case DateTimeConstants.THURSDAY:

            dayOfWeek = "周四";

            break;

        case DateTimeConstants.FRIDAY:

            dayOfWeek = "周五";

            break;

        case DateTimeConstants.SATURDAY:

            dayOfWeek = "周六";

        default:

            break;

    }

    return dayOfWeek;

  }


*相关接口

//根据hoscode获取医院名称

  @Override

  public String getHospName(String hoscode) {

    Hospital hospital = hospitalRepository.getByHoscode(hoscode);

    return hospital.getHosname();

  }

7)测试

3、对接前端

1)创建api接口文件

api/yygh创建schedule.js

import request from '@/utils/request'



const api_name = '/admin/hosp/schedule'



export default {

    //查询排班规则统计数据

    getScheduleRule(page,limit,hoscode,depcode) {

        return request({

            url: `${api_name}/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`,

            method: 'get'

        })

    }

}

(2)改造页面

<!-- 排班日期 分页 -->

          <el-tag

            v-for="(item,index) in bookingScheduleList"

            :key="item.id"

            @click="selectDate(item.workDate, index)"

            :type="index == activeIndex ? '' : 'info'"

            style="height: 60px;margin-right: 5px;margin-right:15px;cursor:pointer;"

          >

            {{ item.workDate }} {{ item.dayOfWeek }}

            <br>

            {{ item.availableNumber }} / {{ item.reservedNumber }}

          </el-tag>



          <!-- 分页 -->

          <el-pagination

            :current-page="page"

            :total="total"

            :page-size="limit"

            class="pagination"

            layout="prev, pager, next"

            @current-change="getPage"

          ></el-pagination>

(3)改造js

<script>

import hospApi from "@/api/yygh/hosp";

import scheduleApi from "@/api/yygh/schedule";



export default {

  data() {

    return {

      data: [], //科室集合

      defaultProps: {

        //默认支柱属性

        children: "children",

        label: "depname"

      },

      hoscode: "", //医院编码

      activeIndex: 0, //选中索引号

      depcode: null, //选中科室编码

      depname: null, //选中科室名称

      workDate: null, //选中排班日期



      bookingScheduleList: [], //排班日期统计集合

      baseMap: {}, //基础展示对象



      page: 1, // 当前页

      limit: 7, // 每页个数

      total: 0 // 总页码

    };

  },

  created() {

    this.hoscode = this.$route.params.hoscode;

    this.fetchData();

  },

  methods: {

    //查询科室数据

    fetchData() {

      hospApi.getDeptByHoscode(this.hoscode).then(response => {

        this.data = response.data.list;

        //默认选中第一个小科室信息

        this.depcode = this.data[0].children[0].depcode;

        this.depname = this.data[0].children[0].depname;

        //排班日期统计分页方法

        this.getPage();

      });

    },

    //点击一个科室触发

    handleNodeClick(node) {

      //如果大科室返回

      if (node.children) {

        return;

      }

      //设置选中科室信息

      this.depcode = node.depcode;

      this.depname = node.depname;

      //排班日期统计分页方法

      this.getPage();

    },

    //排班日期统计分页方法

    getPage(page = 1) {

      //设置参数

      this.page = page;

      this.workDate = null;

      this.activeIndex = 0;

      //调用排班日期统计方法

      this.getBookingScheduleList();

    },

    //调用排班日期统计方法

    getBookingScheduleList() {

      scheduleApi

        .getScheduleRule(this.page, this.limit, this.hoscode, this.depcode)

        .then(response => {

          this.bookingScheduleList = response.data.bookingScheduleRuleList

          this.total = response.data.total

          this.baseMap = response.data.baseMap



          if(this.workDate == null){

              this.workDate  = this.bookingScheduleList[0].workDate

          }

          //......



        });

    },

    //点选某一天

    selectDate(workDate, index){

        this.workDate  = workDate

        this.activeIndex = index

        //......

    }



  }

};

</script>

4)测试

查看科室排班详细数据

1、需求分析

  1. 根据医院、科室、排班日期查询排班列表
  2. 翻译字段

2、实现接口

1)分析接口

*参数:hoscodedepcodeworkDate

*返回值:RList<Schedule>

2)实现controller

//根据医院编号 、科室编号和工作日期,查询排班详细信息

  @ApiOperation(value = "查询排班详细信息")

  @GetMapping("getScheduleDetail/{hoscode}/{depcode}/{workDate}")

  public R getScheduleDetail( @PathVariable String hoscode,

                            @PathVariable String depcode,

                            @PathVariable String workDate) {

    List<Schedule> list = scheduleService

            .getScheduleDetail(hoscode,depcode,workDate);

    return R.ok().data("list",list);

  }

3)实现service

//查询排班详细信息集合

  @Override

  public List<Schedule> getScheduleDetail(String hoscode, String depcode, String workDate) {

    //1调用方法查询数据

    List<SchedulescheduleList =

            scheduleRepository.getByHoscodeAndDepcodeAndWorkDate(

                    hoscode,depcode,new DateTime(workDate).toDate()

            );

    //2遍历集合翻译字段

    scheduleList.forEach(item->{

        this.packSchedule(item);

    });

  

    return scheduleList;

  }

4)查询接口



  @Repository

  public interface ScheduleRepository extends MongoRepository<Schedule,String> {

    //根据hoscodehosScheduleId查询排班信息

    Schedule getByHoscodeAndHosScheduleId(String hoscode, String hosScheduleId);

    //根据医院编号 、科室编号和工作日期,查询排班详细信息

    List<Schedule> getByHoscodeAndDepcodeAndWorkDate(String hoscode, String depcode, Date workDate);

  }

5)测试

3、对接前端

(1)创建api

//查询排班详情

    getScheduleDetail(hoscode, depcode, workDate) {

        return request({

            url: `${api_name}/getScheduleDetail/${hoscode}/${depcode}/${workDate}`,

            method: 'get'

        })

    }

(2)添加页面元素

<el-table v-loading="listLoading" :data="scheduleList" border fit highlight-current-row>

            <el-table-column label="序号" width="60" align="center">

              <template slot-scope="scope">{{ scope.$index + 1 }}</template>

            </el-table-column>

            <el-table-column label="职称" width="150">

              <template slot-scope="scope">{{ scope.row.title }} | {{ scope.row.docname }}</template>

            </el-table-column>

            <el-table-column label="号源时间" width="80">

              <template slot-scope="scope">{{ scope.row.workTime == 0 ? "上午" : "下午" }}</template>

            </el-table-column>

            <el-table-column prop="reservedNumber" label="可预约数" width="80"/>

            <el-table-column prop="availableNumber" label="剩余预约数" width="100"/>

            <el-table-column prop="amount" label="挂号费(元)" width="90"/>

            <el-table-column prop="skill" label="擅长技能"/>

          </el-table>

(3)改造js

data() {

    return {

      data: [], //科室集合

      defaultProps: {

        //默认支柱属性

        children: "children",

        label: "depname"

      },

      hoscode: "", //医院编码

      activeIndex: 0, //选中索引号

      depcode: null, //选中科室编码

      depname: null, //选中科室名称

      workDate: null, //选中排班日期



      bookingScheduleList: [], //排班日期统计集合

      baseMap: {}, //基础展示对象



      page: 1, // 当前页

      limit: 7, // 每页个数

      total: 0, // 总页码

      listLoading: true,

      scheduleList: []

    };

  },

  created() {

    this.hoscode = this.$route.params.hoscode;

    this.fetchData();

  },

  methods: {

    //查询科室数据

    fetchData() {

      hospApi.getDeptByHoscode(this.hoscode).then(response => {

        this.data = response.data.list;

        //默认选中第一个小科室信息

        this.depcode = this.data[0].children[0].depcode;

        this.depname = this.data[0].children[0].depname;

        //排班日期统计分页方法

        this.getPage();

      });

    },

    //点击一个科室触发

    handleNodeClick(node) {

      //如果大科室返回

      if (node.children) {

        return;

      }

      //设置选中科室信息

      this.depcode = node.depcode;

      this.depname = node.depname;

      //排班日期统计分页方法

      this.getPage();

    },

    //排班日期统计分页方法

    getPage(page = 1) {

      //设置参数

      this.page = page;

      this.workDate = null;

      this.activeIndex = 0;

      this.scheduleList = [];

      //调用排班日期统计方法

      this.getBookingScheduleList();

    },

    //调用排班日期统计方法

    getBookingScheduleList() {

      scheduleApi

        .getScheduleRule(this.page, this.limit, this.hoscode, this.depcode)

        .then(response => {

          this.bookingScheduleList = response.data.bookingScheduleRuleList;

          this.total = response.data.total;

          this.baseMap = response.data.baseMap;



          if (this.workDate == null) {

            this.workDate = this.bookingScheduleList[0].workDate;

          }

          //获取排班明细集合

          this.getScheduleList();

        });

    },

    //点选某一天

    selectDate(workDate, index) {

      this.workDate = workDate;

      this.activeIndex = index;

      //获取排班明细集合

      this.getScheduleList();

    },

    //获取排班明细集合

    getScheduleList() {

      scheduleApi

        .getScheduleDetail(this.hoscode, this.depcode, this.workDate)

        .then(response => {

          console.log(response)

          this.scheduleList = response.data.list;

          this.listLoading = false;

        });

    }

  }

4)测试

搭建平台用户系统前端环境

1、相关概念

1)服务端渲染

服务端渲染又称SSR (Server Side Render)是在服务端完成页面的内容,而不是在客户端通过AJAX获取数据。

2SEO

服务器端渲染(SSR)的优势主要在于:更好的 SEO,由于搜索引擎爬虫抓取工具可以直接查看完全渲染的页面。

2、什么是NUXT

Nuxt.js 是一个基于 Vue.js 的轻量级应用框架,可用来创建服务端渲染 (SSR) 应用,也可充当静态站点引擎生成静态站点应用,具有优雅的代码结构分层和热加载等特性。

2、创建前端工程(标准步骤)

1)获取工程包

2)解压后,找到目录,修改工程名,复制到开发目录

yygh_site

3)修改配置文件,插值表达式改成字符串

4)下载依赖

5)启动工程

npm run dev

3、创建前端工程(快捷步骤)

1)获取工程包

2)解压后,复制到开发目录

3)启动工程

npm run dev

4、工程目录介绍

1)资源目录 assets

 用于组织未编译的静态资源如 LESSSASS JavaScript

2布局目录 layouts

用于组织应用的布局组件。

3页面目录 pages

存放前台系统所有页面内容,和layouts下组件整合完整页面

5、封装axios

1)安装

npm install axios

2)创建utils文件夹,创建request.js

import axios from 'axios'

import { MessageBox, Message } from 'element-ui'

// 创建axios实例

const service = axios.create({

    baseURL: 'http://localhost:8200/',

    timeout: 15000 // 请求超时时间

})

// http request 拦截器

service.interceptors.request.use(

    config => {

    // token 先不处理,后续使用时在完善

    return config

},

  err => {

    return Promise.reject(err)

})

// http response 拦截器

service.interceptors.response.use(

    response => {

        if (response.data.code !== 20000) {

            Message({

                message: response.data.message,

                type: 'error',

                duration: 5 * 1000

            })

            return Promise.reject(response.data)

        } else {

            return response.data

        }

    },

    error => {

        return Promise.reject(error.response)

})

export default service

首页静态数据整合

1、页面组成

 

2、添加静态资源

 

3、整合布局页面

(1)提取头文件

创建layouts/myheader.vue文件

<template>

  <div class="header-container">

    <div class="wrapper">

      <!-- logo -->

      <div class="left-wrapper v-link selected">

        <img style="width: 50px" width="50" height="50" src="~assets/images/logo.png">

        <span class="text">尚医通 预约挂号统一平台</span>

      </div>

      <!-- 右侧 -->

      <div class="right-wrapper">

        <span class="v-link clickable">帮助中心</span>

        <span class="v-link clickable" @click="dialogUserFormVisible = true">登录/注册</span>

      </div>

    </div>

  </div>

</template>

<script>

export default {};

</script>

(2)提取尾文件

创建layouts/myfooter.vue文件

<template>

  <div class="footer-container">

    <div class="wrapper">

      <div><span class="record">京ICP备atguigu号</span><span

        class="phone">www.atguigu.com</span></div>

      <div class="right"><span

        class="v-link clickable"> 联系我们 </span><span

        class="v-link clickable"> 合作伙伴 </span><span

        class="v-link clickable"> 用户协议 </span><span

        class="v-link clickable"> 隐私协议 </span></div>

    </div>

  </div>

</template>



<script>

export default {



}

</script>



(3)整合到默认布局

修改layouts/default.vue文件

<template>

  <div class="app-container">

    <div id="main">

      <!-- 公共头 -->

      <myheader/>

      <div class="main-container">

        <el-scrollbar class='page-component__scroll'>

          <!-- 内容区域 -->

          <nuxt/>

        </el-scrollbar>

      </div>

      <!-- 公共底 -->

      <myfooter/>

    </div>

  </div>

</template>

<script>

import '~/assets/css/app.css'

import '~/assets/css/chunk.css'

import '~/assets/css/iconfont.css'

import '~/assets/css/main.css'



import myheader from './myheader'

import myfooter from './myfooter'



export default {



  components: {

    myheader,myfooter

  },



  mounted() {

    window.document.getElementById("__nuxt").classList.add("app-container")

    window.document.getElementById("__layout").classList.add("app-container")

  }

}

</script>



4、修改首页面

修改pages/index.vue文件

<template>

  <div class="home page-component">

    <el-carousel indicator-position="outside">

      <el-carousel-item v-for="item in 2" :key="item">

        <img src="~assets/images/web-banner1.png" alt>

      </el-carousel-item>

    </el-carousel>

    <!-- 搜索 -->

    <div class="search-container">

      <div class="search-wrapper">

        <div class="hospital-search">

          <el-autocomplete

            class="search-input"

            prefix-icon="el-icon-search"

            v-model="state"

            :fetch-suggestions="querySearchAsync"

            placeholder="点击输入医院名称"

            @select="handleSelect"

          >

            <span slot="suffix" class="search-btn v-link highlight clickable selected">搜索</span>

          </el-autocomplete>

        </div>

      </div>

    </div>

    <!-- bottom -->

    <div class="bottom">

      <div class="left">

        <div class="home-filter-wrapper">

          <div class="title">医院</div>

          <div>

            <div class="filter-wrapper">

              <span class="label">等级:</span>

              <div class="condition-wrapper">

                <span class="item v-link highlight clickable selected">全部</span>

                <span class="item v-link clickable">三级医院</span>

                <span class="item v-link clickable">二级医院</span>

                <span class="item v-link clickable">一级医院</span>

              </div>

            </div>

            <div class="filter-wrapper">

              <span class="label">地区:</span>

              <div class="condition-wrapper">

                <span class="item v-link highlight clickable selected">全部</span>

                <span class="item v-link clickable">东城区</span>

                <span class="item v-link clickable">西城区</span>

                <span class="item v-link clickable">朝阳区</span>

                <span class="item v-link clickable">丰台区</span>

                <span class="item v-link clickable">石景山区</span>

                <span class="item v-link clickable">海淀区</span>

                <span class="item v-link clickable">门头沟区</span>

                <span class="item v-link clickable">房山区</span>

                <span class="item v-link clickable">通州区</span>

                <span class="item v-link clickable">顺义区</span>

                <span class="item v-link clickable">昌平区</span>

                <span class="item v-link clickable">大兴区</span>

                <span class="item v-link clickable">怀柔区</span>

                <span class="item v-link clickable">平谷区</span>

                <span class="item v-link clickable">密云区</span>

                <span class="item v-link clickable">延庆区</span>

              </div>

            </div>

          </div>

        </div>

        <div class="v-scroll-list hospital-list">

          <div class="v-card clickable list-item">

            <div class>

              <div class="hospital-list-item hos-item" index="0">

                <div class="wrapper">

                  <div class="hospital-title">北京协和医院</div>

                  <div class="bottom-container">

                    <div class="icon-wrapper">

                      <span class="iconfont"></span>

                      三级甲等

                    </div>

                    <div class="icon-wrapper">

                      <span class="iconfont"></span>

                      每天8:30放号

                    </div>

                  </div>

                </div>

                <img src="images/23176337663806575.png" alt="北京协和医院" class="hospital-img">

              </div>

            </div>

          </div>

          <div class="v-card clickable list-item space">

            <div class>

              <div class="hospital-list-item hos-item" index="0">

                <div class="wrapper">

                  <div class="hospital-title">北京协和医院</div>

                  <div class="bottom-container">

                    <div class="icon-wrapper">

                      <span class="iconfont"></span>

                      三级甲等

                    </div>

                    <div class="icon-wrapper">

                      <span class="iconfont"></span>

                      每天8:30放号

                    </div>

                  </div>

                </div>

                <img src="images/23176337663806575.png" alt="北京协和医院" class="hospital-img">

              </div>

            </div>

          </div>

          <div class="v-card clickable list-item">

            <div class>

              <div class="hospital-list-item hos-item" index="0">

                <div class="wrapper">

                  <div class="hospital-title">北京协和医院</div>

                  <div class="bottom-container">

                    <div class="icon-wrapper">

                      <span class="iconfont"></span>

                      三级甲等

                    </div>

                    <div class="icon-wrapper">

                      <span class="iconfont"></span>

                      每天8:30放号

                    </div>

                  </div>

                </div>

                <img src="images/23176337663806575.png" alt="北京协和医院" class="hospital-img">

              </div>

            </div>

          </div>

        </div>

      </div>

      <div class="right">

        <div class="common-dept">

          <div class="header-wrapper">

            <div class="title">常见科室</div>

            <div class="all-wrapper">

              <span>全部</span>

              <span class="iconfont icon"></span>

            </div>

          </div>

          <div class="content-wrapper">

            <span class="item v-link clickable dark">神经内科</span>

            <span class="item v-link clickable dark">消化内科</span>

            <span class="item v-link clickable dark">呼吸内科</span>

            <span class="item v-link clickable dark">内科</span>

            <span class="item v-link clickable dark">神经外科</span>

            <span class="item v-link clickable dark">妇科</span>

            <span class="item v-link clickable dark">产科</span>

            <span class="item v-link clickable dark">儿科</span>

          </div>

        </div>

        <div class="space">

          <div class="header-wrapper">

            <div class="title-wrapper">

              <div class="icon-wrapper">

                <span class="iconfont title-icon"></span>

              </div>

              <span class="title">平台公告</span>

            </div>

            <div class="all-wrapper">

              <span>全部</span>

              <span class="iconfont icon"></span>

            </div>

          </div>

          <div class="content-wrapper">

            <div class="notice-wrapper">

              <div class="point"></div>

              <span class="notice v-link clickable dark">关于延长北京大学国际医院放假的通知</span>

            </div>

            <div class="notice-wrapper">

              <div class="point"></div>

              <span class="notice v-link clickable dark">北京中医药大学东方医院部分科室医生门诊医</span>

            </div>

            <div class="notice-wrapper">

              <div class="point"></div>

              <span class="notice v-link clickable dark">武警总医院号源暂停更新通知</span>

            </div>

          </div>

        </div>

        <div class="suspend-notice-list space">

          <div class="header-wrapper">

            <div class="title-wrapper">

              <div class="icon-wrapper">

                <span class="iconfont title-icon"></span>

              </div>

              <span class="title">停诊公告</span>

            </div>

            <div class="all-wrapper">

              <span>全部</span>

              <span class="iconfont icon"></span>

            </div>

          </div>

          <div class="content-wrapper">

            <div class="notice-wrapper">

              <div class="point"></div>

              <span class="notice v-link clickable dark">中国人民解放军总医院第六医学中心(原海军总医院)呼吸内科门诊停诊公告</span>

            </div>

            <div class="notice-wrapper">

              <div class="point"></div>

              <span class="notice v-link clickable dark">首都医科大学附属北京潞河医院老年医学科门诊停诊公告</span>

            </div>

            <div class="notice-wrapper">

              <div class="point"></div>

              <span class="notice v-link clickable dark">中日友好医院中西医结合心内科门诊停诊公告</span>

            </div>

          </div>

        </div>

      </div>

    </div>

  </div>

</template>

<script>

export default {};

</script>

5、页面

 

 

首页数据显示接口

1、准备工作

2、分析接口

1)带条件、带分页查询医院信息,翻译字段

*参数:page,limit, HospitalQueryVo

*返回值:R(Page)

2)根据医院名称模糊查询医院列表

*参数:hosname

*返回值:RList<Hospital>

3、创建controller

@Api(tags = "医院显示接口")

  @RestController

@RequestMapping("/api/hosp/hospital")

  public class HospitalApiController {

  

    @Autowired

    private HospitalService hospitalService;

  

    @ApiOperation(value = "带条件带分页医院列表查询")

    @GetMapping("{page}/{limit}")

    public R index(

            @PathVariable Integer page,

            @PathVariable Integer limit,

            HospitalQueryVo hospitalQueryVo) {

        Page<Hospital> pageModel = hospitalService

                .selectPage(page, limit, hospitalQueryVo);

        return R.ok().data("pageModel",pageModel);

    }

  

    @ApiOperation(value = "根据医院名称获取医院列表")

    @GetMapping("findByHosname/{hosname}")

    public R findByHosname(

            @PathVariable String hosname) {

        List<Hospital> list = hospitalService.findByHosnameLike(hosname);

        return R.ok().data("list",list);

    }

  

  }

4、实现service

//根据医院名称获取医院列表

  @Override

  public List<Hospital> findByHosnameLike(String hosname) {

    List<Hospital> list = hospitalRepository.getByHosnameLike(hosname);

    return list;

  }

*创建接口

@Repository

  public interface HospitalRepository extends MongoRepository<Hospital,String> {

    //根据hoscode查询mongo,获取医院信息

    Hospital getByHoscode(String hoscode);

    //根据医院名称获取医院列表

    List<Hospital> getByHosnameLike(String hosname);

  }

5、测试

首页数据显示前端

1、创建api

(1)创建api文件夹,创建/api/hospital.js

import request from '@/utils/request'



const api_name = '/api/hosp/hospital'



export default {

    //带条件带分页查询医院列表

    getHospPage(page, limit, searchObj) {

        return request({

            url: `${api_name}/${page}/${limit}`,

            method: 'get',

            params: searchObj

        })

    }

}

(2)复制后台前端dict.js

import request from '@/utils/request'



const api_name = '/admin/cmn/dict'



export default {

    dictList(id) {//数据字典列表

      return request ({

        url: `${api_name}/findChildData/${id}`,

        method: 'get'

      })

    },

    //根据dictCode获取下级节点

    findByDictCode(dictCode) {

      return request ({

        url: `${api_name}/findByDictCode/${dictCode}`,

        method: 'get'

      })

    }

}



2、修改页面

pages/index.vue组件

<template>

  <div class="home page-component">

    <el-carousel indicator-position="outside">

      <el-carousel-item v-for="item in 2" :key="item">

        <img src="~assets/images/web-banner1.png" alt>

      </el-carousel-item>

    </el-carousel>

    <!-- 搜索 -->

    <div class="search-container">

      <div class="search-wrapper">

        <div class="hospital-search">

          <el-autocomplete

            class="search-input"

            prefix-icon="el-icon-search"

            v-model="hosname"

            :fetch-suggestions="querySearchAsync"

            placeholder="点击输入医院名称"

            @select="handleSelect"

          >

            <span slot="suffix" class="search-btn v-link highlight clickable selected">搜索</span>

          </el-autocomplete>

        </div>

      </div>

    </div>

    <!-- bottom -->

    <div class="bottom">

      <div class="left">

        <div class="home-filter-wrapper">

          <div class="title">医院</div>

          <div>

            <div class="filter-wrapper">

              <span class="label">等级:</span>

              <div class="condition-wrapper">

                <span

                  class="item v-link clickable"

                  :class="hostypeActiveIndex == index ? 'selected' : ''"

                  v-for="(item,index) in hostypeList"

                  :key="item.id"

                  @click="hostypeSelect(item.value, index)"

                >{{ item.name }}</span>

              </div>

            </div>

            <div class="filter-wrapper">

              <span class="label">地区:</span>

              <div class="condition-wrapper">

                <span

                  class="item v-link clickable"

                  :class="provinceActiveIndex == index ? 'selected' : ''"

                  v-for="(item,index) in districtList"

                  :key="item.id"

                  @click="districtSelect(item.value, index)"

                >{{ item.name }}</span>

              </div>

            </div>

          </div>

        </div>

        <div class="v-scroll-list hospital-list">

          <div class="v-card clickable list-item" v-for="item in list" :key="item.id">

            <div class>

              <div class="hospital-list-item hos-item" index="0" @click="show(item.hoscode)">

                <div class="wrapper">

                  <div class="hospital-title">{{ item.hosname }}</div>

                  <div class="bottom-container">

                    <div class="icon-wrapper">

                      <span class="iconfont"></span>

                      {{ item.param.hostypeString }}

                    </div>

                    <div class="icon-wrapper">

                      <span class="iconfont"></span>

                      每天{{ item.bookingRule.releaseTime }}放号

                    </div>

                  </div>

                </div>

                <img

                  :src="'data:image/jpeg;base64,'+item.logoData"

                  :alt="item.hosname"

                  class="hospital-img"

                >

              </div>

            </div>

          </div>

        </div>

      </div>

      <div class="right">

        <div class="common-dept">

          <div class="header-wrapper">

            <div class="title">常见科室</div>

            <div class="all-wrapper">

              <span>全部</span>

              <span class="iconfont icon"></span>

            </div>

          </div>

          <div class="content-wrapper">

            <span class="item v-link clickable dark">神经内科</span>

            <span class="item v-link clickable dark">消化内科</span>

            <span class="item v-link clickable dark">呼吸内科</span>

            <span class="item v-link clickable dark">内科</span>

            <span class="item v-link clickable dark">神经外科</span>

            <span class="item v-link clickable dark">妇科</span>

            <span class="item v-link clickable dark">产科</span>

            <span class="item v-link clickable dark">儿科</span>

          </div>

        </div>

        <div class="space">

          <div class="header-wrapper">

            <div class="title-wrapper">

              <div class="icon-wrapper">

                <span class="iconfont title-icon"></span>

              </div>

              <span class="title">平台公告</span>

            </div>

            <div class="all-wrapper">

              <span>全部</span>

              <span class="iconfont icon"></span>

            </div>

          </div>

          <div class="content-wrapper">

            <div class="notice-wrapper">

              <div class="point"></div>

              <span class="notice v-link clickable dark">关于延长北京大学国际医院放假的通知</span>

            </div>

            <div class="notice-wrapper">

              <div class="point"></div>

              <span class="notice v-link clickable dark">北京中医药大学东方医院部分科室医生门诊医</span>

            </div>

            <div class="notice-wrapper">

              <div class="point"></div>

              <span class="notice v-link clickable dark">武警总医院号源暂停更新通知</span>

            </div>

          </div>

        </div>

        <div class="suspend-notice-list space">

          <div class="header-wrapper">

            <div class="title-wrapper">

              <div class="icon-wrapper">

                <span class="iconfont title-icon"></span>

              </div>

              <span class="title">停诊公告</span>

            </div>

            <div class="all-wrapper">

              <span>全部</span>

              <span class="iconfont icon"></span>

            </div>

          </div>

          <div class="content-wrapper">

            <div class="notice-wrapper">

              <div class="point"></div>

              <span class="notice v-link clickable dark">中国人民解放军总医院第六医学中心(原海军总医院)呼吸内科门诊停诊公告</span>

            </div>

            <div class="notice-wrapper">

              <div class="point"></div>

              <span class="notice v-link clickable dark">首都医科大学附属北京潞河医院老年医学科门诊停诊公告</span>

            </div>

            <div class="notice-wrapper">

              <div class="point"></div>

              <span class="notice v-link clickable dark">中日友好医院中西医结合心内科门诊停诊公告</span>

            </div>

          </div>

        </div>

      </div>

    </div>

  </div>

</template>

3、js初步实现

<script>

import hospApi from '@/api/hospital'

import dictApi from '@/api/dict'



export default {

   //服务端渲染异步,显示医院列表

   asyncData({params,error}){

     return hospApi.getHospPage(1, 10, null).then(response=>{

       return{

         list:response.data.pageModel.content,

         pages: response.data.pageModel.totalPages

       }

     })

   }



};

</script>

 

4、实现js功能

1)需求

 

2)实现js

<script>

import hospApi from "@/api/hospital";

import dictApi from "@/api/dict";



export default {

  //服务端渲染异步,显示医院列表

  asyncData({ params, error }) {

    return hospApi.getHospPage(1, 10, null).then(response => {

      return {

        list: response.data.pageModel.content,

        pages: response.data.pageModel.totalPages

      };

    });

  },

  data() {

    return {

      searchObj: {}, //查询条件

      page: 1,

      limit: 10,



      hosname: "", //医院名称

      hostypeList: [], //医院等级集合

      districtList: [], //地区集合



      hostypeActiveIndex: 0, //选中等级索引号

      provinceActiveIndex: 0 //选中地区索引号

    };

  },

  created() {

    this.init();

  },

  methods: {

    //初始化方法

    init() {

      //初始化医院等级集合

      dictApi.findByDictCode("Hostype").then(response => {

        //1初始化医院等级集合

        this.hostypeList = [];

        //2向集合存入“全部”选项

        this.hostypeList.push({ name: "全部", value: "" });

        //3遍历查询结果,存入集合

        for (let i = 0; i < response.data.list.length; i++) {

          this.hostypeList.push(response.data.list[i]);

        }

      });



      //初始化地区集合

      dictApi.findByDictCode("Beijing").then(response => {

        //1初始化地区集合

        this.districtList = [];

        //2向集合存入“全部”选项

        this.districtList.push({ name: "全部", value: "" });

        //3遍历查询结果,存入集合

        for (let i in response.data.list) {

          this.districtList.push(response.data.list[i]);

        }

      });

    }

  }

};

</script>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/807306.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

C语言基础入门详解一

前些天发现了一个蛮有意思的人工智能学习网站,8个字形容一下"通俗易懂&#xff0c;风趣幽默"&#xff0c;感觉非常有意思,忍不住分享一下给大家。 &#x1f449;点击跳转到教程 前言&#xff1a; 初识C语言 //#include 相当于java的import,stdio全称&#xff1a;st…

秒级体验本地调试远程 k8s 中的服务

点击上方蓝色字体&#xff0c;选择“设为星标” 回复”云原生“获取基础架构实践 背景 在这个以k8s为云os的时代&#xff0c;程序员在日常的开发过程中&#xff0c;肯定会遇到各种问题&#xff0c;比如&#xff1a;本地开发完&#xff0c;需要部署到远程k8s集群&#xff0c;本地…

【雕爷学编程】Arduino动手做(175)---机智云ESP8266开发板模块5

37款传感器与执行器的提法&#xff0c;在网络上广泛流传&#xff0c;其实Arduino能够兼容的传感器模块肯定是不止这37种的。鉴于本人手头积累了一些传感器和执行器模块&#xff0c;依照实践出真知&#xff08;一定要动手做&#xff09;的理念&#xff0c;以学习和交流为目的&am…

区间预测 | MATLAB实现VAR向量自回归时间序列区间预测

区间预测 | MATLAB实现VAR向量自回归时间序列区间预测 目录 区间预测 | MATLAB实现VAR向量自回归时间序列区间预测预测效果基本介绍程序设计参考资料预测效果 基本介绍 区间预测 | MATLAB实现VAR向量自回归时间序列区间预测 VAR(Vector Autoregression)模型是一种广泛应用于时…

pytest 自定义HOOK函数

除了系统提过的HOOK函数外&#xff0c;也可以通过自定义HOOK的方式实现想要的功能。 首先创建一个py文件&#xff0c;里面定义自己的HOOK函数&#xff0c;主要pytest里面的hook函数必须以pytest开头。 #myhook.pydef pytest_myhook(user):"""自定义HOOK函数&q…

SpringBoot项目部署(前后端分离、Linux部署项目)

一、架构 部署环境说明&#xff1a; 192.168.122.100(服务器A)&#xff1a; Nginx&#xff1a;部署前端项目、配置反向代理 Mysql&#xff1a;主从复制结构中的主库 192.168.122.131 (服务器B)&#xff1a; jdk: 运行Java项目 git:版本控制工具 (从gitee中拉取源码) maven:…

No104.精选前端面试题,享受每天的挑战和学习(小米)

文章目录 聊一下vue和react的区别react生命周期有哪些hooks解决了什么问题小程序跳转传参怎么传附录&#xff1a;「简历必备」前后端实战项目&#xff08;推荐&#xff1a;⭐️⭐️⭐️⭐️⭐️&#xff09; &#x1f4c8;「作者简介」&#xff1a;前端开发工程师 | 蓝桥云课签…

CenOS设置启动级别

背景知识 init一共分为7个级别&#xff0c;这7个级别的所代表的含义如下 0&#xff1a;停机或者关机&#xff08;千万不能将initdefault设置为0&#xff09;1&#xff1a;单用户模式&#xff0c;只root用户进行维护2&#xff1a;多用户模式&#xff0c;不能使用NFS(Net File S…

Banana Pi BPI-CM4 评测(计算模块 4),更快性能,旨在替换树莓派CM4

如果您正在寻找可靠的单板计算机来提升您的下一个项目&#xff0c;但无法找到满足您需求的 Raspberry Pi&#xff0c;请看看我是否可以提供帮助。在这篇详细的评论中&#xff0c;我将向您介绍 Banana Pi CM4&#xff0c;这是一款适用于各种任务的多功能且强大的解决方案。从经验…

Blazor前后端框架Known-V1.2.8

V1.2.8 Known是基于C#和Blazor开发的前后端分离快速开发框架&#xff0c;开箱即用&#xff0c;跨平台&#xff0c;一处代码&#xff0c;多处运行。 Gitee&#xff1a; https://gitee.com/known/KnownGithub&#xff1a;https://github.com/known/Known 概述 基于C#和Blazor…

太强了~ 这份《23 种设计模式加强版》宝典,阿里 P8 都得细细研究

说在前面的话 Java 作为老牌纯正的编程语言&#xff0c;在规范性上有着天然优势。因此本版的设计模式讲解全部用 Java 语言来描述&#xff0c;并针对 Java 语言的特性对讲解内容做了相当大的改动。 不知道大家是否听过编程界的一段话&#xff1a;掌握设计模式相当于华山派的&…

信号和槽函数的扩展

信号和槽函数的扩展 一个信号连接多个槽函数一个槽函数连接多个信号信号连接信号 一个信号可以连接多个槽函数, 发送一个信号有多个处理动作 需要写多个connect&#xff08;&#xff09;连接槽函数的执行顺序和信号的发射顺序相同&#xff08;QT5中&#xff09;信号的接收者可…

C#实现读写CSV文件的方法详解

目录 CSV文件标准 文件示例RFC 4180简化标准读写CSV文件 使用CsvHelper使用自定义方法总结 项目中经常遇到CSV文件的读写需求&#xff0c;其中的难点主要是CSV文件的解析。本文会介绍CsvHelper、TextFieldParser、正则表达式三种解析CSV文件的方法&#xff0c;顺带也会介绍一…

SpringBoot中MongoDB的使用

SpringBoot中MongoDB的使用 MongoDB 是最早热门非关系数据库的之一&#xff0c;使用也比较普遍&#xff0c;一般会用做离线数据分析来使用&#xff0c;放到内网的居 多。由于很多公司使用了云服务&#xff0c;服务器默认都开放了外网地址&#xff0c;导致前一阵子大批 MongoD…

骨传导耳机是什么?为什么不用塞到耳朵里?

骨传导耳机其实就跟它的名字一样&#xff0c;用骨传导声音的耳机&#xff0c;整个声音传导过程都是开放双耳的&#xff0c;不接触耳膜&#xff0c;佩戴非常舒适的耳机。 为什么不需要塞进耳朵里&#xff0c;首先咱们要先知道骨传导的原理&#xff1a; 如上图所示&#xff0c;骨…

【Linux命令200例】less强大的文件内容查看工具

&#x1f3c6;作者简介&#xff0c;黑夜开发者&#xff0c;全栈领域新星创作者✌&#xff0c;2023年6月csdn上海赛道top4。 &#x1f3c6;本文已收录于专栏&#xff1a;Linux命令大全。 &#x1f3c6;本专栏我们会通过具体的系统的命令讲解加上鲜活的实操案例对各个命令进行深入…

项目实战 — 消息队列(1) {需求分析}

一、什么是消息队列 消息队列&#xff08;Message Queue ,MQ&#xff09;&#xff0c;就是将阻塞队列的数据结构&#xff0c;提取成了一个程序&#xff0c;独立进行部署。也就是实现一个生产者消费模型。 有关生产者消费者模型&#xff0c;参考多线程 — 阻塞队列_多线程阻塞…

redis基本架构:一个键值数据库包含什么?(这篇文章主要是一个引导的作用)

我们设计一个简单的smpliekv数据库&#xff0c;来体验简直数据库包含什么 体来说&#xff0c;一个键值数据库包括了访问框架、索引模块、操作模块和存储模块四部分&#xff08;见 下图&#xff09;。接下来&#xff0c;我们就从这四个部分入手&#xff0c;继续构建我们的 Simpl…

【MyBatis】MyBatis 3.5+版本报错合集(持续更新)

报错&#xff1a;BindingException 1. org.apache.ibatis.binding.BindingException: Type interface xxx is not known to the MapperRegistry. 2. org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): xxx 解决方案 在pom.xml中添加如下代码…

NetApp FAS控制器的启动过程详解

了解NetApp FAS存储系统的控制器启动过程对于控制器故障的诊断分析非常重要&#xff0c;最近在给几个小朋友培训NetApp&#xff0c;顺便把这个启动过程总结了一下&#xff0c;分享给大家&#xff0c;遇到控制器故障&#xff0c;就可以照方抓药了&#xff0c;如果还是搞不懂&…