# 基于python的医患路线规划程序
**Repository Path**: xiaoliang-11/patients_to_hospital_path
## Basic Information
- **Project Name**: 基于python的医患路线规划程序
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MulanPSL-2.0
- **Default Branch**: xiaoliang
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2025-06-15
- **Last Updated**: 2025-06-16
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
#使用前记得看这个
需要安装的插件:
为了避免证书错误,需要额外安装openssl
[安装命令:pip install openssl]
##项目文件说明:
ptsaddress_hosaddress
├─ hospitaladdress.py 患者地址和医院结构化地址转换
├─ route_count.py 路径计算
└─ lib
├─ hospitals.xlsx 医院地址
├─ hospitals_with_coord.xlsx 医院地址转换坐标后文件
├─ optimal_route_results.xlsx 患者去往医院的最优路线
├─ patients.xlsx 患者地址
└─ patients_with_coord.xlsx 患者地址转换坐标后文件
##文件必要必要的说明
hospitaladdress.py文件中会将医院地址和患者信息一起转换,如您不需要同时转换,可以将以下段落注释掉在运行:
#从Excel读取地址(43-45行)
df_patients = pd.read_excel("input/patients.xlsx") #患者信息表
df_hospitals = pd.read_excel("input/hospitals.xlsx") #医院地址
77-78行
process_geocoding(df_patients, "input/patients_with_coord.xlsx") #导出到patients_with_coord.xlsx
process_geocoding(df_hospitals, "input/hospitals_with_coord.xlsx") #导出到hospitals_with_coord.xlsx
print("已将结果存储在 input/patients_with_coord.xlsx")
print("已将结果存储在 input/hospitals_with_coord.xlsx")
##更新日志
2025-05-22
借助ai对主体进行编写,并写入少量数据进行测试
对测试结果进行调试
2025-05-23
1.调试完主体代码,对报错内容进行更改
2.对输出到optimal_route_results文件的秒和米添加了换算,换算成分钟和公里
3.~~添加了tpdm进度条~~(后续调试因输出内容太麻烦,已删除)
4.增加了进度条,例如
进度: |██████████████████████████████| 100%
跟之前相比,输出会更简洁
2025-06-13
修复已知问题~~(瞎扯淡)~~
创建了plan_the_patients_path.html,excel-json.py文件
使用了百度地图JavaScript API GL实现了网页驾车步行导航的规划,主要借助于以下代码:
```javascript
let routePlan;
switch (routeMode) {
case 'driving':
routePlan = new BMapGL.DrivingRoute(map, {
renderOptions: { map: map, autoViewport: true, enableDragging: true},
onSearchComplete: (result) => {
if (routePlan.getStatus() === 0) {
const plan = result.getPlan(0);
displayRouteInfo(plan, routeMode);
} else {
alert('路线规划失败');
}
}
});
routePlan.search(startPoint, endPoint,);
break;
case 'walking':
routePlan = new BMapGL.WalkingRoute(map, {
renderOptions: { map: map, panel: "r-result", autoViewport: true},
onSearchComplete: (result) => {
if (routePlan.getStatus() === 0) {
const plan = result.getPlan(0);
displayRouteInfo(plan, routeMode);
document.getElementById('r-result').classList.remove('hidden');
} else {
alert('路线规划失败');
}
}
});
routePlan.search(startPoint, endPoint);
break;
}
```
2025-06-14
更新目录结构,删除了不必要的文件
ptsaddress_to_hosaddress
├─ gui_query.py
├─ hospital_address.py 患者地址和医院结构化地址转换
├─ route_count.py 路径计算
├─ output
│ ├─ excel-json.py excel转json,主要是用来对optimal_route_results.xlsx进行
│ ├─ optimal_route_results.json
│ ├─ optimal_route_results.xlsx
│ └─ plan_the_patients_path.html 用来规划患者到医院的步行和驾车路线
└─ input
├─ hospitals.xlsx
├─ hospitals_with_coord.xlsx
├─ patients.xlsx
└─ patients_with_coord.xlsx