|
|
|
@ -154,8 +154,8 @@
@@ -154,8 +154,8 @@
|
|
|
|
|
const origin = state.formData.takeSpecimenId; |
|
|
|
|
// 抽离计算属性 |
|
|
|
|
const taskDataSource = getDataSource(); |
|
|
|
|
const smallHospitalPositions = Array<any>(); |
|
|
|
|
const largeHospitalPositions = Array<any>(); |
|
|
|
|
const smallHospitalPositions:any[] = []; |
|
|
|
|
const largeHospitalPositions:any[] = []; |
|
|
|
|
taskDataSource.forEach(item => { |
|
|
|
|
// 任务上下级医院唯一匹配ID |
|
|
|
|
const key = buildUUID(); |
|
|
|
@ -165,11 +165,13 @@
@@ -165,11 +165,13 @@
|
|
|
|
|
if(largeHospital) largeHospitalPositions.push([key, new AMap.LngLat(largeHospital.lng, largeHospital.lat)]); |
|
|
|
|
}); |
|
|
|
|
// 途径点 |
|
|
|
|
const waypoints = Array<any>(); |
|
|
|
|
const waypoints:any[] = []; |
|
|
|
|
// 目的地 |
|
|
|
|
let destination; |
|
|
|
|
|
|
|
|
|
// 下级医院规划方案二维数组,默认填充0数据 |
|
|
|
|
/** 1.计算预测大致的智能规划方案可行性数量 */ |
|
|
|
|
|
|
|
|
|
// 下级医院规划方案二维数组 |
|
|
|
|
const smallHospitalScheme = Array.from({ length: smallHospitalPositions.length }, () => Array(smallHospitalPositions.length).fill(0)); |
|
|
|
|
for(let i = 0; i < smallHospitalPositions.length; ++i) { |
|
|
|
|
// 提取一维数组,方案索引 |
|
|
|
@ -187,39 +189,45 @@
@@ -187,39 +189,45 @@
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 计算不重复插入匹配上级医院 |
|
|
|
|
for (let i = 0; i < smallHospitalScheme.length; ++i) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 计算下级医院组合次数 |
|
|
|
|
for(let i = 0; i < smallHospitals.length; ++i) { |
|
|
|
|
const composeCycle = add(i,1); |
|
|
|
|
const hospitalCycle = Math.ceil(divide(smallHospitals.length, composeCycle)); |
|
|
|
|
for(let j = 0; j < hospitalCycle; ++j) { |
|
|
|
|
for(let k = 0; k < composeCycle; ++k) { |
|
|
|
|
const index = add(j, k); |
|
|
|
|
const small = smallHospitals[index]; |
|
|
|
|
const smallHospital = smallHospitalMapList.find(index => index.id == small.smallHospitalId); |
|
|
|
|
if(smallHospital) waypoints.push([small.key, new AMap.LngLat(smallHospital.lng, smallHospital.lat)]); |
|
|
|
|
} |
|
|
|
|
for (let k = 0; k < ; ++k) { |
|
|
|
|
// 计算组合规范方案 |
|
|
|
|
const composeScheme = mapSchemePermuteUnique([]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
largeHospitals.forEach(large => { |
|
|
|
|
// 匹配下级医院,当存在时才能存放上级医院途径点,需求必须要在下级医院取完标本才能送往上级医院 |
|
|
|
|
if(waypoints.find(waypoint => waypoint[0] == large.key)){ |
|
|
|
|
const largeHospital = largeHospitalMapList.find(index => index.id == large.largeHospitalId); |
|
|
|
|
if(largeHospital) waypoints.push([large.key, new AMap.LngLat(largeHospital.lng, largeHospital.lat)]); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
/** 地图方案组合排列算法,可确保二叉树当存在数组内容相同排列不重复 */ |
|
|
|
|
function mapSchemePermuteUnique(composeQueue: number[]) { |
|
|
|
|
const ans: number[][] = []; |
|
|
|
|
const arr: number[] = []; |
|
|
|
|
const used: boolean[] = []; |
|
|
|
|
function helper() { |
|
|
|
|
// 找到一组排列直接退出 |
|
|
|
|
if (arr.length === composeQueue.length) { |
|
|
|
|
ans.push(arr.slice(0)); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 在同一层递归里,相同的数只能枚举一次,避免重复 |
|
|
|
|
let last: unknown = undefined; |
|
|
|
|
for (let i = 0; i < composeQueue.length; i++){ |
|
|
|
|
// 如果这个位置已经用过了跳过 |
|
|
|
|
if (used[i]) continue; |
|
|
|
|
// 在同一层递归里,如果这个数重复了跳过 |
|
|
|
|
if (last == composeQueue[i]) continue; |
|
|
|
|
// 标记已使用 |
|
|
|
|
last = composeQueue[i]; |
|
|
|
|
used[i] = true; |
|
|
|
|
// 取用这个数 |
|
|
|
|
arr.push(composeQueue[i]); |
|
|
|
|
// 进到下一层 |
|
|
|
|
helper(); |
|
|
|
|
// 恢复现场 |
|
|
|
|
arr.pop(); |
|
|
|
|
used[i] = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
helper(); |
|
|
|
|
return ans; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 处理路线预览 */ |
|
|
|
|
function handlePathPreview() { |
|
|
|
|
|
|
|
|
|