增加统计

main
yanzai 10 months ago
parent c24c563858
commit 065abec30d

@ -0,0 +1,36 @@
<?php
namespace App\Http\Controllers\API\Admin\YeWu;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class AppointmentTypeController extends Controller
{
//各种预约方式数量统计
public function countAppointmentType(){
$searchInfo = request('searchInfo');
$list = DB::table('s_list');
if(isset($searchInfo['dateRange'])){
$list=$list->whereBetween('s_list.reservation_date', $searchInfo['dateRange']);
}
$list=$list
->where(['s_list.list_status' => 2, 's_list.is_del' => 0, 's_list.is_nullify' => 0])
->select('appointment_type_id', 's_appointment_type.name', DB::raw('count(*) as count'))
->leftJoin('s_appointment_type', 's_list.appointment_type_id', '=', 's_appointment_type.id')
->groupBy('appointment_type_id', 's_appointment_type.name') // 添加 s_appointment_type.name 到 groupBy
->get();
//按月统计
$monthList = DB::table('s_list');
if(isset($searchInfo['dateRange'])){
$monthList=$monthList->whereBetween('s_list.reservation_date', $searchInfo['dateRange']);
}
$monthList=$monthList
->where(['s_list.list_status' => 2,'s_list.is_del' => 0,'s_list.is_nullify' => 0])
->select(DB::raw('DATE_FORMAT(s_list.reservation_date, "%Y-%m") as month'), DB::raw('count(*) as count'))
->groupBy('month')->get();
return \Yz::Return(true, '操作成功', ['list'=>$list,'monthList'=>$monthList]);
}
}

@ -330,4 +330,26 @@ class WorkMainController extends Controller
return \Yz::Return(true,'查询完成',['list'=>$list,'count'=>$count]);
}
//开单统计
public function CountMakeList(){
$searchInfo = request('searchInfo');
$list = DB::table('s_list')
->where(['s_list.is_del' => 0, 's_list.is_nullify' => 0]);
if(isset($searchInfo['dateRange'])){
$list=$list->whereBetween('s_list.created_at', $searchInfo['dateRange']);
}
//开单总量
$count=$list;
$count=$count->count();
//按月开单量统计
$MonthCountList=$list;
$MonthCountList=$MonthCountList
->select(DB::raw('DATE_FORMAT(s_list.reservation_date, "%Y-%m") as month'), DB::raw('count(*) as count'))
->groupBy(DB::raw('DATE_FORMAT(s_list.reservation_date, "%Y-%m")'))->get();
//预约总量
$appointmentCount=$list;
$appointmentCount=$appointmentCount->where(['s_list.list_status'=>2])->count();
return \Yz::Return(true, '操作成功', ['MonthCountList'=>$MonthCountList,'Count'=>$count,'AppointmentCount'=>$appointmentCount]);
}
}

@ -99,6 +99,8 @@ Route::group(['middleware'=>['checktoken','log'],'prefix'=>'v1'],function () {
Route::post('admin/InpatientWardDel','App\Http\Controllers\API\Admin\YeWu\InpatientWardController@Del');//删除病区
Route::post('admin/SignIn','App\Http\Controllers\API\Admin\YeWu\SignInController@SignIn');//签到
Route::post('admin/CancelSign','App\Http\Controllers\API\Admin\YeWu\SignInController@CancelSign');//取消签到
Route::post('admin/countAppointmentType','App\Http\Controllers\API\Admin\YeWu\AppointmentTypeController@countAppointmentType');//预约渠道统计
Route::post('admin/CountMakeList','App\Http\Controllers\API\Admin\YeWu\WorkMainController@CountMakeList');//开单统计
});
//暂时不加权限

@ -349,4 +349,12 @@ export const CheckIsDaiJian = (data = {}) => {
//医生端取消预约
export const DoctorCancelYuYue = (data = {}) => {
return axios({ url: import.meta.env.VITE_APP_API + 'admin/DoctorCancelYuYue', data: data })
}
//预约渠道统计
export const countAppointmentType = (data = {}) => {
return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/countAppointmentType', data: data })
}
//开单统计
export const CountMakeList = (data = {}) => {
return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/CountMakeList', data: data })
}

@ -184,6 +184,20 @@ const router = createRouter({
meta: {
title: '资源信息列表'
}
},{
path: '/info/AppointmentTj',
name: 'InfoAppointmentTj',
component: () => import('../views/Info/AppointmentTj.vue'),
meta: {
title: '预约统计'
}
},{
path: '/info/MakeListTj',
name: 'InfoMakeListTj',
component: () => import('../views/Info/MakeListTj.vue'),
meta: {
title: '开单统计'
}
}]
},

@ -0,0 +1,132 @@
<template>
<div class="head">
<el-row>
<el-form-item>
<el-date-picker style="margin-left: 8px; width: 300px" v-model="searchInfo.dateRange"
type="daterange" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间"
value-format="YYYY-MM-DD" />
</el-form-item>
<el-button @click="countAppointmentTypeFunc()" style="margin-left: 10px;">搜索</el-button>
</el-row>
</div>
<div v-if="monthNameList.length>0" id="MonthCount" class="MonthCount"></div>
<el-table :data="tableData" style="width: 100%;" row-key="id" v-loading="loading">
<el-table-column prop="name" label="方式" />
<el-table-column prop="count" label="数量" />
</el-table>
</template>
<script setup>
import {
ref,
onMounted,computed, nextTick
} from 'vue'
import * as echarts from 'echarts';
import {
countAppointmentType,GetServiceDateTime,
} from '@/api/api.js'
import { ElMessage, ElMessageBox } from 'element-plus'
const groupList_new = computed(() => {
return groupList.value.filter(item => (item.id ==2));
});
let loading=ref(false);
let searchInfo=ref({
name:''
})
let Info=ref({
id:null,
name:'',
status:1
})
let dialogVisible=ref(false);
//list
let tableData = ref([])
let monthData=ref();
let currentPage = ref(1) //
let pageSize = ref(15) //
let total = 0 //
//
const GetServiceDate = () => {
GetServiceDateTime().then(res => {
if (res.status) {
let datetime = res.data.datetime.substr(0, 10)
searchInfo.value.dateRange = [datetime, datetime]
countAppointmentTypeFunc()
}
})
}
let monthNameList=ref([]);
let monthCountList=ref([]);
const countAppointmentTypeFunc=()=>{
loading.value = true
countAppointmentType({searchInfo:searchInfo.value}).then(res => {
loading.value = false
if (res.status) {
tableData.value=res.data.list
monthData.value=res.data.monthList
monthNameList.value=[];
monthCountList.value=[];
monthData.value.forEach((v,i)=>{
monthNameList.value.push(v.month)
monthCountList.value.push(v.count)
})
if(monthNameList.value.length>0){
nextTick(()=>{
DrawMonth()
})
}
} else {
ElMessage.error(res.msg)
}
})
}
const DrawMonth=()=>{
var ChartMonthCount = echarts.init(document.getElementById('MonthCount'));
//
ChartMonthCount.setOption({
title: {
text: searchInfo.value.dateRange[0]+'~'+searchInfo.value.dateRange[1]+'预约量统计(月)'
},
tooltip: {},
xAxis: {
data: monthNameList.value
},
yAxis: {},
series: [
{
name: '数量',
type: 'bar',
data:monthCountList.value
}
]
});
}
onMounted(()=>{
GetServiceDate()
})
</script>
<style scoped>
.page {
display: flex;
justify-content: flex-end;
margin-top: 10px;
}
.MonthCount{
height: 400px;
width: 100%;
}
</style>

@ -0,0 +1,144 @@
<template>
<div class="head">
<el-row>
<el-form-item>
<el-date-picker style="margin-left: 8px; width: 300px" v-model="searchInfo.dateRange"
type="daterange" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间"
value-format="YYYY-MM-DD" />
</el-form-item>
<el-button @click="CountMakeListFunc()" style="margin-left: 10px;">搜索</el-button>
</el-row>
</div>
<div v-if="KaiDanCount>0" id="MonthCount" class="MonthCount"></div>
<el-table :data="tableData" style="width: 100%;" row-key="id" v-loading="loading">
<el-table-column prop="month" label="月份" />
<el-table-column prop="count" label="开单数量" />
</el-table>
</template>
<script setup>
import {
ref,
onMounted,computed, nextTick
} from 'vue'
import * as echarts from 'echarts';
import {
CountMakeList,GetServiceDateTime,
} from '@/api/api.js'
import { ElMessage, ElMessageBox } from 'element-plus'
const groupList_new = computed(() => {
return groupList.value.filter(item => (item.id ==2));
});
let loading=ref(false);
let searchInfo=ref({
name:''
})
let Info=ref({
id:null,
name:'',
status:1
})
let dialogVisible=ref(false);
//list
let tableData = ref([])
let monthData=ref();
let currentPage = ref(1) //
let pageSize = ref(15) //
let total = 0 //
//
const GetServiceDate = () => {
GetServiceDateTime().then(res => {
if (res.status) {
let datetime = res.data.datetime.substr(0, 10)
searchInfo.value.dateRange = [datetime, datetime]
CountMakeListFunc()
}
})
}
let AppointmentCount=ref(0);
let KaiDanCount=ref(0);
const CountMakeListFunc=()=>{
loading.value = true
CountMakeList({searchInfo:searchInfo.value}).then(res => {
loading.value = false
if (res.status) {
tableData.value=res.data.MonthCountList
KaiDanCount.value=res.data.Count
AppointmentCount.value=res.data.AppointmentCount
if(KaiDanCount.value>0){
nextTick(()=>{
DrawMonth()
})
}
} else {
ElMessage.error(res.msg)
}
})
}
const DrawMonth=()=>{
var ChartMonthCount = echarts.init(document.getElementById('MonthCount'));
//
ChartMonthCount.setOption({
title: {
text: searchInfo.value.dateRange[0]+'~'+searchInfo.value.dateRange[1]+'开单检查量比',
subtext: '开单总量 '+ KaiDanCount.value,
left: 'center'
},
tooltip: {
trigger: 'item'
},
legend: {
orient: 'vertical',
left: 'left'
},
series: [
{
name: 'Access From',
type: 'pie',
radius: '50%',
data: [
{ value: KaiDanCount.value-AppointmentCount.value, name: '未预约' },
{ value: AppointmentCount.value, name: '已预约' },
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
});
}
onMounted(()=>{
GetServiceDate()
})
</script>
<style scoped>
.page {
display: flex;
justify-content: flex-end;
margin-top: 10px;
}
.MonthCount{
height: 400px;
width: 100%;
}
</style>
Loading…
Cancel
Save