2 Star 1 Fork 0

vForce/extract-39net-disease-sympton-department

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
exportResult.php 2.18 KB
一键复制 编辑 原始数据 按行查看 历史
<?php
include_once "util.php";
include_once "result/alias.php";
include_once "result/department.php";
include_once "result/symptons.php";
include_once "result/totalSympton.php";
/**
* @var array $alias
* @var array $department
* @var array $symptons
* @var array $totalSympton
*/
//科室
$result = [];
foreach ($department as $diseaseName => $departments) {
foreach ($departments as $name) {
if (array_search($name, $result) === false) $result[] = $name;
}
}
$fp = fopen("exported/科室.txt", "w");
fwrite($fp, "名称\n");
foreach ($result as $name) {
fwrite($fp, $name . "\n");
}
fclose($fp);
//疾病
$fp = fopen("exported/疾病.txt", "w");
fwrite($fp, "名称\n");
foreach (array_keys($alias) as $diseaseName) {
fwrite($fp, $diseaseName . "\n");
}
fclose($fp);
//症状
$fp = fopen("exported/症状.txt", "w");
fwrite($fp, "名称\n");
foreach ($totalSympton as $sympton) {
fwrite($fp, $sympton . "\n");
}
fclose($fp);
//症状到疾病
$fp = fopen("exported/疾病相关症状.csv", "w");
fwrite($fp, "名称1,关系,名称2\n");
foreach ($symptons as $disease => $targets) {
foreach ($targets as $sympton) {
fwrite($fp, "{$disease},疾病相关症状,{$sympton}" . "\n");
}
}
fclose($fp);
//疾病到科室
$fp = fopen("exported/疾病相关科室.csv", "w");
fwrite($fp, "名称1,关系,名称2\n");
foreach ($department as $disease => $targets) {
foreach ($targets as $target) {
fwrite($fp, "{$disease},疾病相关科室,{$target}" . "\n");
}
}
fclose($fp);
//同义词
$fp = fopen("exported/同义词.csv", "w");
fwrite($fp, "名称1,关系,名称2\n");
foreach ($alias as $disease => $targets) {
foreach ($targets as $target) {
if ($target) fwrite($fp, "{$disease},同义词,{$target}" . "\n");
}
}
fclose($fp);
//Web Data
//疾病
dumpVariableToFile(array_keys($alias), "webData/diseases.php", "diseases");
//症状
dumpVariableToFile($totalSympton, "webData/symptons.php", "symptons");
//同义词
$webAlias = [];
foreach ($alias as $diseaseName => $aliases) {
foreach ($aliases as $aliasName) {
if ($aliasName) $webAlias[$aliasName] = $diseaseName;
}
}
dumpVariableToFile($webAlias, "webData/aliases.php", "aliases");
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/vforce/extract-39net-disease-sympton-department.git
git@gitee.com:vforce/extract-39net-disease-sympton-department.git
vforce
extract-39net-disease-sympton-department
extract-39net-disease-sympton-department
master

搜索帮助