Browse Source

增加当前冲突对应的周时间展示

pull/15/head
zq 4 weeks ago
parent
commit
afd59b5662
  1. 565
      src/views/HosInformation.vue

565
src/views/HosInformation.vue

@ -332,7 +332,6 @@
<GroupFormBtns cancelText="还原" @cancel="restoreCancel" @confirm="setDepartWorkTime" />
</el-form>
</div>
<div class="siteMessage flex-common mt12" id="siteMessage9">
@ -698,17 +697,17 @@
</el-form>
</GuipDialog>
<GuipDialog :dialogVisible="visitDialogVisible" :title="visitDialogTitle" :show-close-button="true" width="599"
<GuipDialog :dialogVisible="visitDialogVisible" :title="visitDialogTitle" :show-close-button="true" width="699px"
:show-cancel-button="visitShowCancelBtn" @confirm="handleVisitConfirm" :confirmText="visitConfirmText"
@cancel="handleVisitCancel" @close="handleVisitClose">
<div class="flex conflictTitle mb24">
您设置的 <span>{{ form.h_realname }} </span>每周排班与以下现有出诊安排冲突请调整后再保存
您设置的 <b>{{ form.h_realname }} </b>每周排班与以下现有出诊安排冲突请调整后再保存
</div>
<div class="visitContent">
<div class="hosPlanItem mb24" v-for="(conflict, index) in hasConflictresult" :key="index">
<p>{{ conflict.date }} {{ conflict.conflictShift }}</p>
<p>{{ conflict.date }} {{ conflict.dayOfWeek ? `${conflict.dayOfWeek}` : '' }}{{ conflict.conflictShift }}</p>
<div class="flex">
<span class="conflictTip">冲突</span>
<span class="conflictTip">{{!is_allow_coincide ?'冲突':'重叠' }}</span>
<div>{{ conflict.hospital }}({{ conflict.type === 'fixed' ?
'固定排班' :
'临时出诊' }})</div>
@ -716,7 +715,7 @@
</div>
</div>
</GuipDialog>
<GuipDialog :dialogVisible="dialogVisible" :title="dialogTitle" :show-close-button="true" width="762"
<GuipDialog :dialogVisible="dialogVisible" :title="dialogTitle" :show-close-button="true" width="762px"
:show-cancel-button="true" @confirm="handleConfirm" @cancel="handleCancel" @close="handleClose"
@dialogVisibleChange="dialogVisibleChange">
<BatchProject ref="channelProject" v-if="dialogType == '1'" :projectTagData="projectTagData" />
@ -752,13 +751,11 @@ import GuipSelect from '@/components/GuipSelect.vue';
import GuipSwitch from '@/components/GuipSwitch.vue';
import GuipTable from '@/components/GuipTable.vue';
import GuipDialog from '@/components/GuipDialog.vue';
//import GuipSelectFilter from '@/components/GuipSelectFilter.vue';
import CustomDropdown from '@/components/CustomDropdown.vue';
import SetAliPay from '@/components/SetAliPay.vue';
import { mapState } from 'vuex';
import { Object } from 'core-js';
// const cityOptions = ['', '', '广', ''];
const PAY_TYPE_WEIXIN = 2; //
const PAY_TYPE_ALIPAY = 3; //
@ -1163,10 +1160,7 @@ export default {
},
async saveWorkTimeDirect() {
const { display_work_days, planDays, worktime_no_fixed, worktimes } = this.houseCallSettingForm;
var worktimesArray = Object.entries(worktimes).map(([key, value]) => ({
type: parseInt(key),
plan: value.plan
}));
var worktimesArray = this.formatWorktimesArray(worktimes)
const params = {
doctor_id: this.doctor_id,
@ -2524,66 +2518,8 @@ export default {
// setDepartWorkTime
async setDepartWorkTime() {
// const { display_work_days, planDays, worktime_no_fixed,worktimes } = this.houseCallSettingForm;
const { display_work_days, planDays, worktime_no_fixed } = this.houseCallSettingForm;
const worktimes = {
"1": {
"id": "92",
"doctor_id": "3",
"depart_id": "4",
"week_day": "1",
"plan": "1",
"work_paln_desc": "上午可约"
},
"2": {
"id": "93",
"doctor_id": "3",
"depart_id": "4",
"week_day": "2",
"plan": "3",
"work_paln_desc": "全天可约"
},
"3": {
"id": "94",
"doctor_id": "3",
"depart_id": "4",
"week_day": "3",
"plan": "0",
"work_paln_desc": "休息"
},
"4": {
"id": "95",
"doctor_id": "3",
"depart_id": "4",
"week_day": "4",
"plan": "3",
"work_paln_desc": "全天可约"
},
"5": {
"id": "96",
"doctor_id": "3",
"depart_id": "4",
"week_day": "5",
"plan": "3",
"work_paln_desc": "全天可约"
},
"6": {
"id": "97",
"doctor_id": "3",
"depart_id": "4",
"week_day": "6",
"plan": "3",
"work_paln_desc": "全天可约"
},
"7": {
"id": "98",
"doctor_id": "3",
"depart_id": "4",
"week_day": "7",
"plan": "3",
"work_paln_desc": "全天可约"
}
};
const { display_work_days, planDays, worktime_no_fixed,worktimes } = this.houseCallSettingForm;
const params = {
doctor_id: this.doctor_id,
depart_id: this.depart_id,
@ -2673,70 +2609,70 @@ export default {
},
//
checkVsNonFixedHospital(newWorktimes, hospital) {
const conflicts = [];
console.log('检查非固定排班医院冲突:', hospital.h_depart_name, hospital.worktime_list);
if (!hospital.worktime_list) return conflicts;
//
Object.keys(hospital.worktime_list).forEach(dateStr => {
const hospitalPlan = hospital.worktime_list[dateStr];
if (!hospitalPlan || hospitalPlan.plan === '0') return;
//
const date = new Date(dateStr);
const dayOfWeek = date.getDay() === 0 ? 7 : date.getDay();
const weekDayKey = dayOfWeek.toString();
//
const newSchedule = newWorktimes[weekDayKey];
if (!newSchedule || newSchedule.plan === '0') return;
console.log(`日期${dateStr}(周${dayOfWeek}): 新排班=${newSchedule.plan}, 医院排班=${hospitalPlan.plan}`);
//
const conflictShift = this.getConflictShift(newSchedule.plan, hospitalPlan.plan);
if (conflictShift) {
console.log(`发现冲突: ${dateStr}${newSchedule.plan} vs 医院${hospitalPlan.plan}, 冲突时段: ${conflictShift}`);
conflicts.push(this.createConflictInfo(
dateStr,
hospital.h_depart_name,
newSchedule.plan,
conflictShift, //
'非固定排班',
hospitalPlan.work_paln_desc,
// this.weekPlan[dayOfWeek],//
));
}
});
return conflicts;
},
getConflictShift(newPlan, existingPlan) {
const planMap = {
'0': '休息',
'1': '上午',
'2': '下午',
'3': '全天班'
};
//
if (newPlan === '3') {
return planMap[existingPlan]; //
}
if (existingPlan === '3') {
return planMap[newPlan]; //
}
//
if (newPlan === existingPlan) {
return planMap[newPlan];
}
return null; //
},
const conflicts = [];
console.log('检查非固定排班医院冲突:', hospital.h_depart_name, hospital.worktime_list);
if (!hospital.worktime_list) return conflicts;
//
Object.keys(hospital.worktime_list).forEach(dateStr => {
const hospitalPlan = hospital.worktime_list[dateStr];
if (!hospitalPlan || hospitalPlan.plan === '0') return;
//
const date = new Date(dateStr);
const dayOfWeek = date.getDay() === 0 ? 7 : date.getDay();
const weekDayKey = dayOfWeek.toString();
//
const newSchedule = newWorktimes[weekDayKey];
if (!newSchedule || newSchedule.plan === '0') return;
console.log(`日期${dateStr}(周${dayOfWeek}): 新排班=${newSchedule.plan}, 医院排班=${hospitalPlan.plan}`);
//
const conflictShift = this.getConflictShift(newSchedule.plan, hospitalPlan.plan);
if (conflictShift) {
console.log(`发现冲突: ${dateStr}${newSchedule.plan} vs 医院${hospitalPlan.plan}, 冲突时段: ${conflictShift}`);
conflicts.push(this.createConflictInfo(
dateStr,
hospital.h_depart_name,
newSchedule.plan,
conflictShift, //
'非固定排班',
hospitalPlan.work_paln_desc,
this.weekPlan[dayOfWeek],//
));
}
});
return conflicts;
},
getConflictShift(newPlan, existingPlan) {
const planMap = {
'0': '休息',
'1': '上午',
'2': '下午',
'3': '全天班'
};
//
if (newPlan === '3') {
return planMap[existingPlan]; //
}
if (existingPlan === '3') {
return planMap[newPlan]; //
}
//
if (newPlan === existingPlan) {
return planMap[newPlan];
}
return null; //
},
//
checkVsFixedHospital(newWorktimes, hospital) {
const conflicts = [];
@ -2765,33 +2701,7 @@ getConflictShift(newPlan, existingPlan) {
newPlan,
conflictShift, //
'固定排班',
hospitalPlan.work_paln_desc
));
}
}
});
return conflicts;
},
checkFixedVsAll(newWorktimes, hospital) {
const conflicts = [];
//
Object.keys(newWorktimes).forEach(weekDay => {
const newPlan = newWorktimes[weekDay].plan;
if (newPlan === '0') return; //
//
const hospitalPlan = this.getHospitalPlanForWeekDay(hospital, parseInt(weekDay));
if (hospitalPlan && hospitalPlan.plan !== '0') {
if (this.isPlanConflict(newPlan, hospitalPlan.plan)) {
conflicts.push(this.createConflictInfo(
`${this.getWeekDayName(parseInt(weekDay))}`,
hospital.h_depart_name,
newPlan,
hospitalPlan.plan,
hospital.worktime_no_fixed === 0 ? '固定排班' : '非固定排班',
hospitalPlan.work_paln_desc
hospitalPlan.work_paln_desc,
));
}
}
@ -2811,170 +2721,36 @@ getConflictShift(newPlan, existingPlan) {
}
return null;
},
checkNonFixedVsAll(newWorktimes, hospital) {
const conflicts = [];
const futureDates = this.generateFutureDates(30); // 30
futureDates.forEach(dateInfo => {
const { dateStr, dayOfWeek } = dateInfo;
//
const newSchedule = newWorktimes[dayOfWeek.toString()];
if (!newSchedule || newSchedule.plan === '0') return;
//
const hospitalSchedule = this.getHospitalScheduleForDate(hospital, dateStr, dayOfWeek);
if (hospitalSchedule && hospitalSchedule.plan !== '0') {
if (this.isPlanConflict(newSchedule.plan, hospitalSchedule.plan)) {
conflicts.push(this.createConflictInfo(
dateStr,
hospital.h_depart_name,
newSchedule.plan,
hospitalSchedule.plan,
hospital.worktime_no_fixed === 0 ? '固定排班' : '非固定排班',
hospitalSchedule.work_paln_desc
));
}
}
});
return conflicts;
},
//
createConflictInfo(date, hospitalName, newPlan, conflictShift, scheduleType, workDesc) {
const planMap = {
'0': '休息',
'1': '上午班',
'2': '下午班',
'3': '全天班'
};
const conflict = {
date: date,
hospital: hospitalName,
newPlan: planMap[newPlan],
conflictShift: conflictShift, //
scheduleType: scheduleType,
workDesc: workDesc,
// displayText: `${date} ${planMap[newPlan]} ${hospitalName} ${conflictShift} `
};
console.log('创建冲突信息:', conflict);
return conflict;
},
//
checkNonFixedConflict(newWorktimes, hospital, conflicts) {
let hasConflict = false;
const futureDates = this.generateFutureDates(30); // 30
futureDates.forEach(dateInfo => {
const { dateStr, dayOfWeek } = dateInfo;
//
const newSchedule = newWorktimes.find(schedule => schedule.type === dayOfWeek);
if (!newSchedule || newSchedule.plan === '0') return;
//
const hospitalSchedule = this.getHospitalScheduleForDate(hospital, dateStr, dayOfWeek);
if (hospitalSchedule && hospitalSchedule.plan !== '0') {
if (this.isPlanConflict(newSchedule.plan, hospitalSchedule.plan)) {
conflicts.push({
date: dateStr,
hospital: hospital.h_depart_name,
newPlan: this.getPlanDesc(newSchedule.plan),
existingPlan: this.getPlanDesc(hospitalSchedule.plan),
type: hospital.worktime_no_fixed === 0 ? 'fixed' : 'non_fixed'
});
hasConflict = true;
}
}
});
return hasConflict;
},
getHospitalScheduleForDate(hospital, dateStr, dayOfWeek) {
//
if (hospital.temp_change_worktime && hospital.temp_change_worktime[dateStr]) {
return hospital.temp_change_worktime[dateStr];
}
//
if (hospital.worktime_no_fixed === 0 && hospital.worktime_list) {
return hospital.worktime_list[dayOfWeek];
}
//
if (hospital.worktime_no_fixed === 1 && hospital.worktime_list) {
return hospital.worktime_list[dateStr];
}
return null;
},
getWeekDayName(weekDay) {
const weekDays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
return weekDays[weekDay - 1] || `${weekDay}`;
},
getPlanDesc(plan) {
createConflictInfo(date, hospitalName, newPlan, conflictShift, scheduleType, workDesc, dayOfWeek) {
console.log(dayOfWeek,this.getWeekDayName(1),'createConflictInfo:dayOfWeek');
const planMap = {
'0': '休息',
'1': '上午班',
'2': '下午班',
'3': '全天班'
};
return planMap[plan] || '未知';
},
//
//
isPlanConflict(plan1, plan2) {
console.log(`检查冲突: ${plan1} vs ${plan2}`);
if (plan1 === '0' || plan2 === '0') {
console.log('一方休息,无冲突');
return false;
}
if (plan1 === '3' || plan2 === '3') {
console.log('一方是全天班,有冲突');
return true; //
}
if (plan1 === plan2) {
console.log('相同班次,有冲突');
return true; //
}
console.log('不同班次,无冲突');
return false;
},
// isPlanConflict(plan1, plan2) {
// if (plan1 === '0' || plan2 === '0') return false;
// if (plan1 === '3' || plan2 === '3') return true;
// if (plan1 === plan2) return true;
// return false;
// },
generateFutureDates(days) {
const dates = [];
const today = new Date();
for (let i = 0; i < days; i++) {
const date = new Date(today);
date.setDate(today.getDate() + i);
const dateStr = this.formatDate(date);
const dayOfWeek = date.getDay() === 0 ? 7 : date.getDay();
dates.push({ date, dateStr, dayOfWeek });
}
const conflict = {
date: date,
hospital: hospitalName,
newPlan: planMap[newPlan],
conflictShift: conflictShift, //
scheduleType: scheduleType,
workDesc: workDesc,
dayOfWeek
// displayText: `${date} ${planMap[newPlan]} ${hospitalName} ${conflictShift} `
};
return dates;
console.log('创建冲突信息:', conflict);
return conflict;
},
// ==========
checkRangeConflict() {
getWeekDayName(weekDay) {
const weekDays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
return weekDays[weekDay - 1] || `${weekDay}`;
},
restoreCancel() {
//
},
//
singleTempConfirm() {
@ -3015,8 +2791,6 @@ getConflictShift(newPlan, existingPlan) {
this.morningSelectedHospitals = [];
this.afternoonSelectedHospitals = [];
});
// this.afternoonSelectedHospitals = [];
// this.morningSelectedHospitals = [];
},
//
isCurrentMonth(date) {
@ -3096,128 +2870,14 @@ getConflictShift(newPlan, existingPlan) {
hasScheduleData(dateString) {
return !!this.getDateSchedule(dateString);
},
formatCalendarData(responseData) {
const calendarData = {};
const today = new Date();
//
Object.keys(responseData).forEach(hospitalId => {
const hospital = responseData[hospitalId];
const { worktime_no_fixed, worktime_list, temp_change_worktime } = hospital;
//
if (temp_change_worktime && Object.keys(temp_change_worktime).length > 0) {
Object.keys(temp_change_worktime).forEach(dateStr => {
const schedule = temp_change_worktime[dateStr];
if (!calendarData[dateStr]) {
calendarData[dateStr] = {};
}
// plan
const shiftType = schedule.plan.toString();
if (!calendarData[dateStr][shiftType]) {
calendarData[dateStr][shiftType] = [];
}
calendarData[dateStr][shiftType].push({
hid: hospitalId,
hospital_name: hospital.h_depart_name,
workTime: schedule.work_paln_desc || this.getWorkTimeDesc(schedule.plan)
});
});
}
//
if (worktime_no_fixed === 0 && worktime_list && Object.keys(worktime_list).length > 0) {
// 60
for (let i = 0; i < 60; i++) {
const date = new Date(today);
date.setDate(today.getDate() + i);
const dateStr = this.formatDate(date);
const dayOfWeek = date.getDay() === 0 ? 7 : date.getDay(); // 7
//
if (temp_change_worktime && temp_change_worktime[dateStr]) {
continue;
}
//
const weeklySchedule = worktime_list[dayOfWeek.toString()];
if (weeklySchedule && weeklySchedule.plan !== "0") {
if (!calendarData[dateStr]) {
calendarData[dateStr] = {};
}
const shiftType = weeklySchedule.plan.toString();
if (!calendarData[dateStr][shiftType]) {
calendarData[dateStr][shiftType] = [];
}
//
const exists = calendarData[dateStr][shiftType].some(
item => item.hid === hospitalId
);
if (!exists) {
calendarData[dateStr][shiftType].push({
hid: hospitalId,
hospital_name: hospital.h_depart_name,
workTime: weeklySchedule.work_paln_desc || this.getWorkTimeDesc(weeklySchedule.plan)
});
}
}
}
}
//
if (worktime_no_fixed === 1 && worktime_list && Object.keys(worktime_list).length > 0) {
//
//
}
});
return calendarData;
},
showConflictDetails() {
if (this.conflictCount === 0) return;
const conflictList = this.conflictDates.map(dateStr => {
const date = new Date(dateStr);
const schedule = this.getDateSchedule(dateStr);
const conflicts = [];
//
for (const shiftType in schedule) {
if (shiftType === '_isTempAdjust' || shiftType === '0') continue;
const hospitals = schedule[shiftType];
if (hospitals && hospitals.length > 1) {
const hospitalNames = hospitals.map(h => h.hospital_name).join('、');
conflicts.push({
shift: this.plantype[shiftType],
hospitals: hospitalNames,
count: hospitals.length
});
}
}
return {
date: dateStr,
dayOfWeek: this.weekDaysDesc[date.getDay()],
conflicts: conflicts
};
});
return conflictList
},
//
getWorkTimeDesc(plan) {
const planMap = {
'0': '不可预约',
'1': '8:00-12:00 (上午班)',
'2': '14:00-17:00 (下午班)',
'3': '8:00-17:00 (全天班)'
'1': '(上午班)',
'2': '(下午班)',
'3': '(全天班)'
};
return planMap[plan.toString()] || '不可预约';
},
@ -3520,7 +3180,6 @@ getConflictShift(newPlan, existingPlan) {
}
this.houseCallSettingForm.worktimes = this.form.worktimes;
console.log(this.form.worktimes, '=form.worktimes====');
this.departType = (response.data.type || response.data.type === 0 || response.data.type === "0") ? [Number(response.data.type)] : []
this.departIsFixed = response.data.is_fixed == "1" ? true : false
this.onLinePay = response.data.pay_switch
@ -3577,8 +3236,6 @@ getConflictShift(newPlan, existingPlan) {
}
this.tableKey = Date.now(); //
}
// this.$set('projectList',Object.values(response.data.list))
// this.$set('projectTagData',response.data.classify)
})
}
}).catch(error => {
@ -3914,15 +3571,9 @@ getConflictShift(newPlan, existingPlan) {
let props = {}
switch (form) {
case 'siteForm1':
// var worktimesArray = Object.entries(this.form.worktimes).map(([key, value]) => ({
// type: parseInt(key),
// plan: value.plan
// }));
props = {
morning_worktime: this.form.morning_worktime ? this.form.morning_worktime.join('-') : '',
afternoon_worktime: this.form.afternoon_worktime ? this.form.afternoon_worktime.join('-') : '',
// week_visit_plan: JSON.stringify(worktimesArray),
}
rqurl = "/api/admin/set_morning_afternoon_worktime";
@ -3998,20 +3649,24 @@ getConflictShift(newPlan, existingPlan) {
max-height: 300px;
overflow-y: auto;
}
.conflictTitle {
color: #626573;
line-height: 23px;
color: #626573;
span {
display: inline-block;
margin: 0 4px;
white-space: nowrap;
color: #1E2226;
}
display: flex;
margin-bottom: 24px;
font-size: 14px;
color: #333;
line-height: 1.5;
flex-wrap: wrap;
word-wrap: break-word;
word-break: break-word;
white-space: normal;
}
.conflictTitle b {
color: #1890ff;
font-weight: 600;
margin: 0 4px;
word-break: break-all;
}
.hosPlanItem {
p {
color: #1E2226;

Loading…
Cancel
Save