宣传网站建设背景免费咨询律师回答在线
- 作者: 五速梦信息网
- 时间: 2026年03月21日 07:03
当前位置: 首页 > news >正文
宣传网站建设背景,免费咨询律师回答在线,世界杯网站开发,北京地铁建设的官方网站目录一、就医提醒1、搭建定时任务模块二、后台管理系统-预约统计功能1、开发每天预约数据接口2、封装远程调用接口3、搭建统计分析模块4、整合统计功能前端一、就医提醒 我们通过定时任务#xff0c;每天8点执行#xff0c;提醒就诊 1、搭建定时任务模块 #xff08;1每天8点执行提醒就诊 1、搭建定时任务模块 1添加依赖 dependenciesdependencygroupIdcom.donglin/groupIdartifactIdrabbit_util/artifactIdversion0.0.1-SNAPSHOT/version/dependency/dependencies2添加配置文件
服务端口
server.port8208
服务名
spring.application.nameservice-task
环境设置dev、test、prod
spring.profiles.activedev# nacos服务地址
spring.cloud.nacos.discovery.server-addr127.0.0.1:8848#rabbitmq地址
spring.rabbitmq.host192.168.121.140
spring.rabbitmq.port5672
spring.rabbitmq.usernameadmin
spring.rabbitmq.passwordadmin3添加启动类
SpringBootApplication(exclude DataSourceAutoConfiguration.class)
EnableDiscoveryClient
ComponentScan(basePackages com.donglin)
public class ServiceTaskApplication {public static void main(String[] args) {SpringApplication.run(ServiceTaskApplication.class, args);}
}4添加常量配置 在rabbit-util模块MqConst类添加
//定时任务
public static final String EXCHANGE_DIRECT_TASK exchange.direct.task;
public static final String ROUTING_TASK_8 task.8;
//队列
public static final String QUEUE_TASK_8 queue.task.8;5添加定时任务 cron表达式
Component
EnableScheduling
public class PatientRemindJob {//Quartz://Quartz:cron表达式: 秒 分 时 dayofMonth Month dayOfWeek Year[最高到2099年]//:表示任意xxx//?:表示无所谓//-:连续的时间段// /n:表示每隔多长时间// ,可以使用,隔开没有规律的时间Autowiredprivate RabbitService rabbitService;Scheduled(cron/30 * * * * )public void printTime(){// System.out.println(new DateTime().toString(yyyy-MM-dd HH:mm:ss));System.out.println(new Date().toLocaleString());rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK,MqConst.ROUTING_TASK_8,);}//在springboot定时任务使用1.在类上加EnableScheduling 2.在定时任务Job的方法上加Scheduled并指定石英表达式//cron表达式写法七域表达式
}2、添加就医提醒处理 操作模块service-order
1添加OrderInfoService接口和实现 /** 就诊提醒/void patientTips();//实现方法Overridepublic void patientTips() {QueryWrapperOrderInfo queryWrapper new QueryWrapper();queryWrapper.eq(reserve_date,new DateTime().toString(yyyy-MM-dd));//这里应该加个条件订单状态不为-1的订单-1表示已退号queryWrapper.ne(order_status,-1);ListOrderInfo orderInfoList baseMapper.selectList(queryWrapper);for(OrderInfo orderInfo : orderInfoList) {//短信提示SmsVo smsVo new SmsVo();smsVo.setPhone(orderInfo.getPatientPhone());String reserveDate new DateTime(orderInfo.getReserveDate()).toString(yyyy-MM-dd) (orderInfo.getReserveTime()0 ? 上午: 下午);MapString,Object param new HashMapString,Object(){{put(title, orderInfo.getHosname()|orderInfo.getDepname()|orderInfo.getTitle());put(reserveDate, reserveDate);put(name, orderInfo.getPatientName());}};smsVo.setParam(param);rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_SMS, MqConst.ROUTING_SMS_ITEM, smsVo);}}2添加mq监听
Component
public class TaskListener {Autowiredprivate OrderInfoService orderService;RabbitListener(bindings QueueBinding(value Queue(value MqConst.QUEUE_TASK_8, durable true),exchange Exchange(value MqConst.EXCHANGE_DIRECT_TASK),key {MqConst.ROUTING_TASK_8}))public void patientTips(Message message, Channel channel) throws IOException {orderService.patientTips();}
}找到自己当天预约的 状态为-1为退款 不发短信 每隔30秒打印信息 测试成功
二、后台管理系统-预约统计功能
我们统计医院每天的预约情况通过图表的形式展示统计的数据都来自订单模块因此我们在该模块封装好数据在统计模块通过feign的形式获取数据。
我们为什么需要一个统计模块呢因为在实际的生产环境中有很多种各式统计数据来源于各个服务模块我们得有一个统计模块来专门管理
1、开发每天预约数据接口
操作模块service_orders 1在OrderInfoMapper添加方法
public interface OrderMapper extends BaseMapperOrderInfo {//统计每天平台预约数据ListOrderCountVo selectOrderCount(OrderCountQueryVo orderCountQueryVo);
}2在OrderInfoMapper.xml添加方法 创建OrderInfoMapper.xml文件
?xml version1.0 encodingUTF-8?
!DOCTYPE mapper PUBLIC -//mybatis.org//DTD Mapper 3.0//EN http://mybatis.org/dtd/mybatis-3-mapper.dtd
mapper namespacecom.donglin.yygh.order.mapper.OrderInfoMapperselect idselectOrderCount resultTypecom.donglin.yygh.vo.order.OrderCountVoselect reserve_date as reserveDate, count(reserve_date) as countfrom order_infowhereif testhosname ! null and hosname ! and hosname like CONCAT(%,#{hosname},%)/ifif testreserveDateBegin ! null and reserveDateBegin ! and reserve_date #{reserveDateBegin}/ifif testreserveDateEnd ! null and reserveDateEnd ! and reserve_date lt; #{reserveDateEnd}/ifand is_deleted 0/wheregroup by reserve_dateorder by reserve_date/select /mapper
3添加配置 application.properties添加
mybatis-plus.mapper-locationsclasspath:com/donglin/yygh/orders/mapper/xml/.xmlservice模块的pom.xml添加
buildpluginsplugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactId/plugin/pluginsresourcesresourcedirectorysrc/main/java/directoryincludesinclude/*.yml/includeinclude/.properties/includeinclude**/.xml/include/includesfilteringfalse/filtering/resourceresourcedirectorysrc/main/resources/directoryincludes include/*.yml/includeinclude/.properties/includeinclude**/.xml/include/includesfilteringfalse/filtering/resource/resources
/build4OrderService添加方法和实现 /*** 订单统计/MapString, Object getCountMap(OrderCountQueryVo orderCountQueryVo);//实现方法Overridepublic MapString, Object getCountMap(OrderCountQueryVo orderCountQueryVo) {MapString, Object map new HashMap();ListOrderCountVo orderCountVoList baseMapper.selectOrderCount(orderCountQueryVo);//日期列表ListString dateListorderCountVoList.stream().map(OrderCountVo::getReserveDate).collect(Collectors.toList());//统计列表ListInteger countListorderCountVoList.stream().map(OrderCountVo::getCount).collect(Collectors.toList());map.put(dateList, dateList);map.put(countList, countList);return map;}5在OrderInfoController添加方法 ApiOperation(value 获取订单统计数据)PostMapping(inner/getCountMap)public MapString, Object getCountMap(RequestBody OrderCountQueryVo orderCountQueryVo) {return orderInfoService.getCountMap(orderCountQueryVo);}2、封装远程调用接口
1创建模块service_order_client 2添加feign接口
FeignClient(value service-orders)
Repository
public interface OrderFeignClient {/** 获取订单统计数据*/PostMapping(/api/order/orderInfo/inner/getCountMap)MapString, Object getCountMap(RequestBody OrderCountQueryVo orderCountQueryVo);}3、搭建统计分析模块
1创建service_statistics模块 2引入依赖
dependenciesdependencygroupIdcom.donglin/groupIdartifactIdservice_order_client/artifactIdversion0.0.1-SNAPSHOT/version/dependency
/dependencies3添加配置文件
服务端口
server.port8209
服务名
spring.application.nameservice-sta
环境设置dev、test、prod
spring.profiles.activedev# nacos服务地址 spring.cloud.nacos.discovery.server-addr127.0.0.1:88484添加启动类 SpringBootApplication(exclude DataSourceAutoConfiguration.class) EnableDiscoveryClient EnableFeignClients(basePackages {com.donglin}) ComponentScan(basePackages {com.donglin}) public class ServiceStatisticsApplication {public static void main(String[] args) {SpringApplication.run(ServiceStatisticsApplication.class, args);}}5添加controller方法 Api(tags 统计管理接口) RestController RequestMapping(/admin/statistics) public class StatisticsController {Autowiredprivate OrderFeignClient orderFeignClient;ApiOperation(value 获取订单统计数据)GetMapping(getCountMap)public R getCountMap(ApiParam(name orderCountQueryVo, value 查询对象, required false) OrderCountQueryVo orderCountQueryVo) {MapString, Object map orderFeignClient.getCountMap(orderCountQueryVo);return R.ok().data(map);} }service-gateway下的resource下的application.yml加上网关 - id: service-stauri: lb://service-stapredicates:- Path/*/statistics/** # 路径匹配4、整合统计功能前端 ECharts是百度的一个项目后来百度把Echart捐给apache用于图表展示提供了常规的折线图、柱状图、散点图、饼图、K线图用于统计的盒形图用于地理数据可视化的地图、热力图、线图用于关系数据可视化的关系图、treemap、旭日图多维数据可视化的平行坐标还有用于 BI 的漏斗图仪表盘并且支持图与图之间的混搭。 官方网站https://echarts.apache.org/zh/index.html 1项目中安装 echarts组件 npm install –save echarts4.1.0 2添加路由 {path: /statistics,component: Layout,redirect: /statistics/order/index,name: BasesInfo,meta: { title: 统计管理, icon: table },alwaysShow: true,children: [{path: order/index,name: 预约统计,component: () import(/views/yygh/sta/index),meta: { title: 预约统计 }}]},3封装api请求 sta.js import request from /utils/requestconst api_name /admin/statisticsexport default {getCountMap(searchObj) {return request({url: ${api_name}/getCountMap,method: get,params: searchObj})} }4添加组件 创建/views/yygh/sta/index.vue组件 templatediv classapp-container!–表单–el-form :inlinetrue classdemo-form-inlineel-form-itemel-input v-modelsearchObj.hosname placeholder点击输入医院名称//el-form-itemel-form-itemel-date-pickerv-modelsearchObj.reserveDateBegintypedateplaceholder选择开始日期value-formatyyyy-MM-dd//el-form-itemel-form-itemel-date-pickerv-modelsearchObj.reserveDateEndtypedateplaceholder选择截止日期value-formatyyyy-MM-dd//el-form-itemel-button:disabledbtnDisabledtypeprimaryiconel-icon-searchclickshowChart()查询/el-button/el-formdiv classchart-containerdiv idchart refchart classchart styleheight:500px;width:100%//div/div /templatescript import echarts from echarts import statisticsApi from /api/staexport default {data() {return {searchObj: {hosname: ,reserveDateBegin: ,reserveDateEnd: },btnDisabled: false,chart: null,title: ,xData: [], // x轴数据yData: [] // y轴数据}},methods: {// 初始化图表数据showChart() {statisticsApi.getCountMap(this.searchObj).then(response {this.yData response.data.countListthis.xData response.data.dateListthis.setChartData()})},setChartData() {// 基于准备好的dom初始化echarts实例var myChart echarts.init(document.getElementById(chart))// 指定图表的配置项和数据var option {title: {text: this.title 挂号量统计},tooltip: {},legend: {data: [this.title]},xAxis: {data: this.xData},yAxis: {minInterval: 1},series: [{name: this.title,type: line,data: this.yData}]}// 使用刚指定的配置项和数据显示图表。myChart.setOption(option)},} } /script
相关文章
-
宣传旅游网站建设的重点是什么揭阳网站建设价格
宣传旅游网站建设的重点是什么揭阳网站建设价格
- 技术栈
- 2026年03月21日
-
宣传 网站建设方案驾校网站建设
宣传 网站建设方案驾校网站建设
- 技术栈
- 2026年03月21日
-
宣城网站制作wordpress支持md
宣城网站制作wordpress支持md
- 技术栈
- 2026年03月21日
-
宣传网站怎么做的wordpress yinhu
宣传网站怎么做的wordpress yinhu
- 技术栈
- 2026年03月21日
-
宣传网站站点最有效的方式是城阳区城市规划建设局网站
宣传网站站点最有效的方式是城阳区城市规划建设局网站
- 技术栈
- 2026年03月21日
-
宣传网站制作方案html网页设计毕业设计
宣传网站制作方案html网页设计毕业设计
- 技术栈
- 2026年03月21日
