218 lines
6.1 KiB
Plaintext
218 lines
6.1 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "86c59eaa-b1fd-47f3-aa0d-3ad3626df3bf",
|
|
"metadata": {},
|
|
"source": [
|
|
"# 中医体质管理"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "e791846d-699f-4803-b898-bda8f1a30dd2",
|
|
"metadata": {},
|
|
"source": [
|
|
"## 中医体质数据管理"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "19cd094e-8228-4f21-9897-9e8bef990d4e",
|
|
"metadata": {},
|
|
"source": [
|
|
"### 体质监测数据生成"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "1f58bd08-d20b-4a76-a841-ac7e132a54b7",
|
|
"metadata": {
|
|
"tags": []
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"import re\n",
|
|
"import json\n",
|
|
"\n",
|
|
"file_name = 'data/130.txt'\n",
|
|
"list1 =[]\n",
|
|
"dict1 = {}\n",
|
|
"with open(file_name,'r') as fl:\n",
|
|
" for l in fl:\n",
|
|
" list2 = []\n",
|
|
" l = re.sub('[\\r\\n\\f ]{1,}', '', l)\n",
|
|
" list2 = l.split(',')\n",
|
|
" if list2[0] != '' and list2[5] != '':\n",
|
|
" dict1[list2[0]] = [list2[1],list2[2],list2[3],list2[4],list2[5]+list2[6]]\n",
|
|
"filename = 'data/130中医体质.json'\n",
|
|
"with open(filename,'w') as fl:\n",
|
|
" json.dump(dict1, fl) \n",
|
|
"print('ok')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "a0f172a9-a0f3-4d53-90f0-39dda318c59b",
|
|
"metadata": {},
|
|
"source": [
|
|
"### 测试人员分类"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "e83b31a6-4fae-40be-8159-fd509999c6d5",
|
|
"metadata": {
|
|
"tags": []
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"import openpyxl\n",
|
|
"import json\n",
|
|
"\n",
|
|
"dict1 = {}\n",
|
|
"filename = 'data/交警支队完成情况.xlsx'\n",
|
|
"wb = openpyxl.load_workbook(filename)\n",
|
|
"sheet = wb.active\n",
|
|
"for n in range(2, sheet.max_row+1):\n",
|
|
" bh = sheet.cell(n, 1).value\n",
|
|
" xm = sheet.cell(n, 3).value\n",
|
|
" if sheet.cell(n,8).value is not None:\n",
|
|
" dict1.setdefault('1', [])\n",
|
|
" dict1['1'].append(bh) \n",
|
|
" elif sheet.cell(n,8).value is None and sheet.cell(n,6).value is not None:\n",
|
|
" dict1.setdefault('2', [])\n",
|
|
" dict1['2'].append(bh)\n",
|
|
" elif sheet.cell(n,8).value is None and sheet.cell(n,6).value is None and sheet.cell(n,7).value is not None:\n",
|
|
" dict1.setdefault('3', [])\n",
|
|
" dict1['3'].append(bh)\n",
|
|
"filename = 'data/交警支队完成人员分类.json'\n",
|
|
"with open(filename,'w') as fl:\n",
|
|
" json.dump(dict1, fl) \n",
|
|
"print('ok')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "566b134f-03ac-4f79-994e-f4a512d9e5f1",
|
|
"metadata": {},
|
|
"source": [
|
|
"### 生成测试人员分类表"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 30,
|
|
"id": "1d0c8452-c3ac-4901-83cf-cefdeebee956",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2022-08-12T01:54:03.835733Z",
|
|
"iopub.status.busy": "2022-08-12T01:54:03.835180Z",
|
|
"iopub.status.idle": "2022-08-12T01:54:04.266745Z",
|
|
"shell.execute_reply": "2022-08-12T01:54:04.265693Z",
|
|
"shell.execute_reply.started": "2022-08-12T01:54:03.835686Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"import json\n",
|
|
"import csv\n",
|
|
"import openpyxl\n",
|
|
"\n",
|
|
"dict1 = {}\n",
|
|
"filename = 'data/交警支队成绩.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",
|
|
" dict1[line[0]] = line\n",
|
|
"filename = 'data/交警支队分组.xlsx'\n",
|
|
"wb = openpyxl.load_workbook(filename)\n",
|
|
"\n",
|
|
"fl_name = 'data/交警支队完成人员分类.json'\n",
|
|
"with open(fl_name,'r') as fl:\n",
|
|
" m_xx = json.load(fl)\n",
|
|
"for k, v in m_xx.items():\n",
|
|
" if k == '1':\n",
|
|
" sheet = wb['参加中医体质人员']\n",
|
|
" i = 2\n",
|
|
" for item in v:\n",
|
|
" bh = str(item) \n",
|
|
" sheet[f'A{i}'] = dict1[bh][4]\n",
|
|
" sheet[f'B{i}'] = dict1[bh][1]\n",
|
|
" sheet[f'C{i}'] = dict1[bh][2]\n",
|
|
" sheet[f'D{i}'] = dict1[bh][3]\n",
|
|
" sheet[f'E{i}'] = dict1[bh][26]\n",
|
|
" sheet[f'F{i}'] = dict1[bh][27]\n",
|
|
" i+=1\n",
|
|
" elif k == '2':\n",
|
|
" sheet = wb['参加体测未参加中医体测']\n",
|
|
" i = 2\n",
|
|
" for item in v:\n",
|
|
" bh = str(item)\n",
|
|
" list1 = dict1[bh]\n",
|
|
" for n in range(26):\n",
|
|
" sheet.cell(column = n+1, row=i, value=list1[n])\n",
|
|
" i+=1\n",
|
|
" else:\n",
|
|
" sheet = wb['只参加心理未参加中医']\n",
|
|
" i = 2\n",
|
|
" for item in v:\n",
|
|
" bh = str(item)\n",
|
|
" sheet[f'A{i}'] = bh\n",
|
|
" sheet[f'B{i}'] = dict1[bh][4]\n",
|
|
" sheet[f'C{i}'] = dict1[bh][1]\n",
|
|
" sheet[f'D{i}'] = dict1[bh][2]\n",
|
|
" sheet[f'E{i}'] = dict1[bh][3]\n",
|
|
" list1 = dict1[bh]\n",
|
|
" for n in range(6,16):\n",
|
|
" sheet.cell(column = n, row=i, value=list1[31+n])\n",
|
|
" i+=1 \n",
|
|
" \n",
|
|
"wb.save('data/交警支队分组1.xlsx') "
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "56998dde-2263-46f1-b315-75be8488ece1",
|
|
"metadata": {},
|
|
"source": [
|
|
"### 人员手机号码核对"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "c897d05b-6e6a-46f0-897f-7ec670aba0a0",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.8.10"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|