20231018
This commit is contained in:
1 parent
3e97205f17
commit
61fd173804
4 files changed
+744
-121
No files matched your search
+234
-5
@@ -3,7 +3,9 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "bfa33ac5-8fe9-4845-8b1d-56c509afcb83",
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"source": [
|
||||
"## 体质检测管理"
|
||||
]
|
||||
@@ -786,7 +788,9 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "f623d291-8d66-4246-a34f-a051115596ef",
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"source": [
|
||||
"## 体检报告数据管理"
|
||||
]
|
||||
@@ -1171,10 +1175,235 @@
|
||||
"print(len(dict1))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "fbb13d70-6601-4421-8deb-26e717c37a8c",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 体质问卷管理"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "7e0fe102-69d4-425c-bc1f-9a26cc974d9d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 问卷人员导入"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"id": "714d4a20-9ca0-4439-880b-f68de8c0e2fb",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-10-18T04:28:34.758506Z",
|
||||
"iopub.status.busy": "2023-10-18T04:28:34.757933Z",
|
||||
"iopub.status.idle": "2023-10-18T04:28:34.828585Z",
|
||||
"shell.execute_reply": "2023-10-18T04:28:34.827501Z",
|
||||
"shell.execute_reply.started": "2023-10-18T04:28:34.758452Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/职工健康提升项目志愿者报名表(汇总).xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"person = {}\n",
|
||||
"\n",
|
||||
"for n in range(3, sheet.max_row+1):\n",
|
||||
" code = int(sheet.cell(n, 1).value)\n",
|
||||
" person.setdefault(code, {})\n",
|
||||
" dict1 = {}\n",
|
||||
" dict1['name'] = sheet.cell(n, 4).value\n",
|
||||
" dict1['sex'] = sheet.cell(n, 5).value\n",
|
||||
" dict1['unit'] = sheet.cell(n, 2).value\n",
|
||||
" dict1['job'] = sheet.cell(n, 3).value\n",
|
||||
" dict1['age'] = int(sheet.cell(n, 6).value)\n",
|
||||
" dict1['phone'] = str(sheet.cell(n,7).value)\n",
|
||||
" dict1['note'] = sheet.cell(n,8).value\n",
|
||||
" person[code] = dict1\n",
|
||||
"filename = 'data/安庆职工健康提升志愿者.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(person, fl, ensure_ascii=False)\n",
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "e8774dfb-d9f5-44af-a118-4a106ceac9fc",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 导入问卷信息"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"id": "dcdd18b3-d7b7-49b1-b148-c2ea9a7799ff",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-10-18T04:52:32.821254Z",
|
||||
"iopub.status.busy": "2023-10-18T04:52:32.820749Z",
|
||||
"iopub.status.idle": "2023-10-18T04:52:32.885978Z",
|
||||
"shell.execute_reply": "2023-10-18T04:52:32.885231Z",
|
||||
"shell.execute_reply.started": "2023-10-18T04:52:32.821208Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"3\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import csv\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"filename = 'data/安庆职工健康提升志愿者.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"wj = {'psy_0556_sh':'心理问卷','tcm_0556_sh':'中医问卷','spine_0556_sh':'脊柱问卷'}\n",
|
||||
"wj_dm = {'psy_0556_sh':0,'tcm_0556_sh':1,'spine_0556_sh':2}\n",
|
||||
"list1 = []\n",
|
||||
"re_ta = {}\n",
|
||||
"filename = 'data/Survey_20231018.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
" for line in fl:\n",
|
||||
" #line = re.sub('[\\r\\n\\f ]{1,}', '', line)\n",
|
||||
" list1.append(line)\n",
|
||||
"#print(list1)\n",
|
||||
"for result in list1:\n",
|
||||
" item = str(result[1])\n",
|
||||
" re_ta.setdefault(item,[])\n",
|
||||
" re_ta[item].append(result[2])\n",
|
||||
"print(len(re_ta))\n",
|
||||
"\n",
|
||||
"tj = {}\n",
|
||||
"for k ,v in dict1.items():\n",
|
||||
" phone = v['phone']\n",
|
||||
" tj.setdefault(k, [0,0,0])\n",
|
||||
" for k1,v1 in re_ta.items():\n",
|
||||
" if phone in v1:\n",
|
||||
" tj[k][wj_dm[k1]] = 1\n",
|
||||
"list1 = []\n",
|
||||
"for k, v in tj.items():\n",
|
||||
" list2 = []\n",
|
||||
" list2.append(k)\n",
|
||||
" list2.append(dict1[k]['name'])\n",
|
||||
" list2.append(dict1[k]['phone'])\n",
|
||||
" for item in v:\n",
|
||||
" list2.append(item)\n",
|
||||
" list1.append(list2)\n",
|
||||
" \n",
|
||||
"filename = 'data/安庆职工健康提升问卷情况表.xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"title = ['编号','员工姓名','手机号码','心理','中医','脊柱']\n",
|
||||
"sheet.append(title)\n",
|
||||
"for row in list1:\n",
|
||||
" sheet.append(row)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"wb.save(filename) \n",
|
||||
" "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "8bc929e2-38f1-4dbd-820e-65d92b59ab26",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 导统计问卷新增手机号码"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"id": "ea4fffc4-3c6e-4f85-819f-52f969e04dd7",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-10-18T05:02:18.718756Z",
|
||||
"iopub.status.busy": "2023-10-18T05:02:18.717923Z",
|
||||
"iopub.status.idle": "2023-10-18T05:02:18.745164Z",
|
||||
"shell.execute_reply": "2023-10-18T05:02:18.743072Z",
|
||||
"shell.execute_reply.started": "2023-10-18T05:02:18.718679Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"13865166211\n",
|
||||
"15905566828\n",
|
||||
"18055691637\n",
|
||||
"13855602427\n",
|
||||
"13966613066\n",
|
||||
"18755696791\n",
|
||||
"18055696268\n",
|
||||
"15856585658\n",
|
||||
"13966607917\n",
|
||||
"13855640093\n",
|
||||
"18155688687\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import csv\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"filename = 'data/安庆职工健康提升志愿者.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"phone = set()\n",
|
||||
"phone1 = set()\n",
|
||||
"for k,v in dict1.items():\n",
|
||||
" phone.add(v['phone'])\n",
|
||||
"\n",
|
||||
"filename = 'data/Survey_20231018.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
" for line in fl:\n",
|
||||
" #line = re.sub('[\\r\\n\\f ]{1,}', '', line)\n",
|
||||
" list1.append(line)\n",
|
||||
"#print(list1)\n",
|
||||
"for result in list1:\n",
|
||||
" if result[2] not in phone:\n",
|
||||
" phone1.add(result[2])\n",
|
||||
"for item in phone1:\n",
|
||||
" print(item)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "a7219084-9d0a-4027-9d51-5b6cc2f2ec9b",
|
||||
"id": "37bf232e-7db1-40a8-b8d6-4a182f839848",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
@@ -1182,7 +1411,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
@@ -1196,7 +1425,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.10"
|
||||
"version": "3.10.12"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in new issue
Block a user