-
{{ conflict.date }} {{ conflict.conflictShift }}
+
{{ conflict.date }} {{ conflict.dayOfWeek ? `(${conflict.dayOfWeek})` : '' }}{{ conflict.conflictShift }}
-
冲突
+
{{!is_allow_coincide ?'冲突':'重叠' }}
{{ conflict.hospital }}({{ conflict.type === 'fixed' ?
'固定排班' :
'临时出诊' }})
@@ -716,7 +715,7 @@
-
@@ -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;