当前位置:网站首页>Yygh-11-timing statistics
Yygh-11-timing statistics
2022-07-06 05:40:00 【What about Xiao Zhao】
Medical advice
We pass the scheduled task , Every day 8 Point to perform , Reminder visit
build service-task service
pom The configuration file
<dependencies>
<dependency>
<groupId>com.atguigu</groupId>
<artifactId>rabbit_util</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
application.properties
# Service port
server.port=8207
# service name
spring.application.name=service-task
# Environment settings :dev、test、prod
spring.profiles.active=dev
# nacos Service address
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
#rabbitmq Address
spring.rabbitmq.host=192.168.44.165
spring.rabbitmq.port=5672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
stay rabbit-util modular com.atguigu.yygh.common.constant.MqConst Class add
public static final String EXCHANGE_DIRECT_TASK = "exchange.direct.task";
public static final String ROUTING_TASK_8 = "task.8";
// queue
public static final String QUEUE_TASK_8 = "queue.task.8";
Start class
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)// Cancel data source auto configuration
@EnableDiscoveryClient
public class ServiceTaskApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceTaskApplication.class, args);
}
}
establish service
@Component
@EnableScheduling
@Slf4j
public class ScheduledTask {
@Autowired
private RabbitService rabbitService;
// Execute the method at 8 o'clock every day , Medical advice
//0 0 8 * * ?
// Every first 30s Start execution
@Scheduled(cron = "0 0 8 * * ?")
public void taskPatient() {
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm");
log.info(" Scheduled task start execution " + sdf.format(date));
rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK, MqConst.ROUTING_TASK_8, "start");
}
}
order Establish a monitoring module
@Component
@Slf4j
public class OrderReceiver {
@Autowired
private OrderService 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(String str) {
log.info(" Receive the message " + str);
orderService.patientTips();
}
}
orderService
@Override
public void patientTips() {
QueryWrapper<OrderInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("reserve_date", new DateTime().toString("yyyy-MM-dd"));
queryWrapper.ne("order_status", OrderStatusEnum.CANCLE.getStatus());
List<OrderInfo> orderInfos = baseMapper.selectList(queryWrapper);
for (OrderInfo orderInfo : orderInfos) {
// Text message prompt
MsmVo msmVo = new MsmVo();
msmVo.setPhone(orderInfo.getPatientPhone());
String reserveDate = new DateTime(orderInfo.getReserveDate()).toString("yyyy-MM-dd") + (orderInfo.getReserveTime() == 0 ? " In the morning " : " Afternoon ");
Map<String, Object> param = new HashMap<String, Object>() {
{
put("title", orderInfo.getHosname() + "|" + orderInfo.getDepname() + "|" + orderInfo.getTitle());
put("reserveDate", reserveDate);
put("name", orderInfo.getPatientName());
}};
msmVo.setParam(param);
rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_MSM, MqConst.ROUTING_MSM_ITEM, msmVo);
}
}
Appointment Statistics
We need to add a line chart showing the number of appointments per day to the management page .
Here we use ECharts To do it
Thought analysis
1. The front end sends a request with query data , To sta modular
2.sta call feign request order modular ,
3.order The module gets the number of appointments per day
Echarts
ECharts It's a Baidu project , Later Baidu put Echart Donated to apache, For chart display , Provides a regular Broken line diagram 、 Histogram 、 Scatter plot 、 The pie chart 、K Line graph , For statistics Box diagram , For geographic data visualization Map 、 Heat map 、 Line graph , For relational data visualization The diagram 、treemap、 Sunrise chart , Multidimensional data visualization Parallel coordinates , Also used BI Of Funnel diagram , The dashboard , And support the mix and match between graphs .
Official website :https://echarts.apache.org/zh/index.html
(1) introduce ECharts
<!-- introduce ECharts file -->
<script src="echarts.min.js"></script>
(2) Define the chart area
<!-- by ECharts Prepare one with size ( Wide and high ) Of Dom -->
<div id="main" style="width: 600px;height:400px;"></div>
(3) Rendering the chart ( Broken line diagram )
<script>
var myChart = echarts.init(document.getElementById('main'));
var option = {
//x The axis is the category axis ( Discrete data ), Must pass data Set category data
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
//y The axis is the data axis ( Continuous data )
yAxis: {
type: 'value'
},
// List of series . Each series passes through type Decide your chart type
series: [{
// Array of data contents in the series
data: [820, 932, 901, 934, 1290, 1330, 1320],
// Broken line diagram
type: 'line'
}]
};
myChart.setOption(option);
Project integration EChart
npm install --save [email protected]
Order modular
Add interface Mapper
@Mapper
public interface OrderMapper extends BaseMapper<OrderInfo> {
List<OrderCountVo> selectOrderCount(@Param("vo") OrderCountQueryVo orderCountQueryVo);
List<OrderAmountVo> selectOrderAmount(@Param("vo") OrderCountQueryVo orderCountQueryVo);
}
add to mapper.xml
<?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="com.example.yygh.order.mapper.OrderMapper">
<!-- Check the number of appointments per day -->
<select id="selectOrderCount" resultType="com.example.yygh.vo.order.OrderCountVo">
select reserve_date as reserveDate, count(reserve_date) as count
from order_info
<where>
<if test="vo.hosname != null and vo.hosname != ''">
and hosname like CONCAT('%',#{vo.hosname},'%')
</if>
<if test="vo.reserveDateBegin != null and vo.reserveDateBegin != ''">
and reserve_date >= #{vo.reserveDateBegin}
</if>
<if test="vo.reserveDateEnd != null and vo.reserveDateEnd != ''">
and reserve_date <= #{vo.reserveDateEnd}
</if>
and is_deleted = 0
</where>
group by reserve_date
order by reserve_date
</select>
<!-- Check the number of appointments per day -->
<select id="selectOrderAmount" resultType="com.example.yygh.vo.order.OrderAmountVo">
select reserve_date as reserveDate, sum(amount) as amount
from order_info
<where>
<if test="vo.hosname != null and vo.hosname != ''">
and hosname like CONCAT('%',#{vo.hosname},'%')
</if>
<if test="vo.reserveDateBegin != null and vo.reserveDateBegin != ''">
and reserve_date >= #{vo.reserveDateBegin}
</if>
<if test="vo.reserveDateEnd != null and vo.reserveDateEnd != ''">
and reserve_date <= #{vo.reserveDateEnd}
</if>
and is_deleted = 0
</where>
group by reserve_date
order by reserve_date
</select>
</mapper>
establish FeignClient
@FeignClient("service-order")
public interface OrderFeignClient {
/** * Count the number of appointments per day * @param orderCountQueryVo * @return */
@PostMapping("/api/order/orderInfo/inner/getCountMap")
public Map<String, Object> getCountMap(@RequestBody OrderCountQueryVo orderCountQueryVo);
/** * Count the daily registration amount * @param orderCountQueryVo * @return */
@PostMapping("/api/order/orderInfo/inner/getAmount")
public Map<String, Object> getAmunt(@RequestBody OrderCountQueryVo orderCountQueryVo);
}
sta modular

controller
@RestController
@RequestMapping("/admin/sta")
public class StaController {
@Autowired
private OrderFeignClient orderFeignClient;
@ApiOperation(value = " Get order statistics ")
@GetMapping("getCountMap")
public Result getCountMap(@ApiParam(name = "orderCountQueryVo", value = " Query object ", required = false) OrderCountQueryVo orderCountQueryVo) {
return Result.ok(orderFeignClient.getCountMap(orderCountQueryVo));
}
@ApiOperation(value = " Get amount statistics ")
@GetMapping("getAmount")
public Result getAmount(@ApiParam(name = "orderCountQueryVo", value = " Query object ", required = false) OrderCountQueryVo orderCountQueryVo) {
return Result.ok(orderFeignClient.getAmunt(orderCountQueryVo));
}
}
front end
modify src/router/index.js
{
path: '/statistics',
component: Layout,
redirect: '/statistics/order/index',
name: 'BasesInfo',
meta: {
title: ' Statistics management ', icon: 'table' },
alwaysShow: true,
children: [
{
path: 'order/index',
name: ' Appointment Statistics ',
component: () => import('@/views/statistics/order/index'),
meta: {
title: ' Appointment Statistics ' }
},
{
path: 'order/pay',
name: ' Payment statistics ',
component: () => import('@/views/statistics/order/amount'),
meta: {
title: ' Payment statistics ' }
}
]
},
add to src/api/orderStatistics.js
export default {
getCountMap(searchObj) {
return request({
url: `${
api_name}/getCountMap`,
method: 'get',
params: searchObj
})
},
getAmount(searchObj) {
return request({
url: `${
api_name}/getAmount`,
method: 'get',
params: searchObj
})
}
}
add to src/views/statistics/order/index.vue
<template>
<div class="app-container">
<!-- Forms -->
<el-form :inline="true" class="demo-form-inline">
<el-form-item>
<el-input v-model="searchObj.hosname" placeholder=" Click to enter the name of the hospital "/>
</el-form-item>
<el-form-item>
<el-date-picker v-model="searchObj.reserveDateBegin" type="date" placeholder=" Choose a start date " value-format="yyyy-MM-dd"/>
</el-form-item>
<el-form-item>
<el-date-picker v-model="searchObj.reserveDateEnd" type="date" placeholder=" Choose a deadline " value-format="yyyy-MM-dd"/>
</el-form-item>
<el-button :disabled="btnDisabled" type="primary" icon="el-icon-search" @click="showChart()"> Inquire about </el-button>
</el-form>
<div class="chart-container">
<div id="chart" ref="chart" class="chart" style="height:500px;width:100%"/>
</div>
</div>
</template>
<script> import echarts from 'echarts' import statisticsApi from '@/api/orderStatistics' export default {
data() {
return {
searchObj: {
hosname: '', reserveDateBegin: '', reserveDateEnd: '' }, btnDisabled: false, chart: null, title: '', xData: [], // x Axis data yData: [] // y Axis data } }, methods: {
// Initialize chart data showChart() {
statisticsApi.getCountMap(this.searchObj).then(response => {
this.yData = response.data.countList this.xData = response.data.dateList this.setChartData() }) }, setChartData() {
// Based on the prepared dom, initialization echarts example var myChart = echarts.init(document.getElementById('chart')) // Specify configuration items and data for the chart var option = {
title: {
text: this.title + ' Registration statistics ' }, tooltip: {
}, legend: {
data: [this.title] }, xAxis: {
data: this.xData }, yAxis: {
minInterval: 1 }, series: [{
name: this.title, type: 'line', data: this.yData }] } // Use the configuration item and data display chart just specified . myChart.setOption(option) }, } } </script>
design sketch


边栏推荐
- [SQL Server Express Way] - authentification et création et gestion de comptes utilisateurs
- Text classification still stays at Bert? The dual contrast learning framework is too strong
- Force buckle 1189 Maximum number of "balloons"
- Pix2pix: image to image conversion using conditional countermeasure networks
- 大型网站如何选择比较好的云主机服务商?
- Vulhub vulnerability recurrence 67_ Supervisor
- Notes, continuation, escape and other symbols
- 移植InfoNES到STM32
- First acquaintance with CDN
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
猜你喜欢

Vulhub vulnerability recurrence 72_ uWSGI

【云原生】3.1 Kubernetes平台安装KubeSpher

Deep learning -yolov5 introduction to actual combat click data set training

Safe mode on Windows

29io stream, byte output stream continue write line feed

The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower

Codeforces Round #804 (Div. 2) Editorial(A-B)

Game push image / table /cv/nlp, multi-threaded start

Fluent implements a loadingbutton with loading animation

28io stream, byte output stream writes multiple bytes
随机推荐
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Huawei od computer test question 2
Text classification still stays at Bert? The dual contrast learning framework is too strong
ARTS Week 25
剑指 Offer II 039. 直方图最大矩形面积
Pytorch代码注意的细节,容易敲错的地方
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
应用安全系列之三十七:日志注入
01. 开发博客项目之项目介绍
Node 之 nvm 下载、安装、使用,以及node 、nrm 的相关使用
LeetCode_ String inversion_ Simple_ 557. Reverse word III in string
Installation de la Bibliothèque de processus PDK - csmc
UCF (2022 summer team competition I)
Sword finger offer II 039 Maximum rectangular area of histogram
Web Security (VI) the use of session and the difference between session and cookie
Zoom and pan image in Photoshop 2022
js Array 列表 实战使用总结
B站刘二大人-多元逻辑回归 Lecture 7
Steady, 35K, byte business data analysis post
数字经济破浪而来 ,LTD是权益独立的Web3.0网站?