20250922
This commit is contained in:
1 parent
689c26b967
commit
ba6f6b413a
2 files changed
+506
-6
No files matched your search
+229
-6
@@ -4,7 +4,6 @@
|
||||
"cell_type": "markdown",
|
||||
"id": "1c72f0cf-165b-4025-af9d-6771e4a0a5d1",
|
||||
"metadata": {
|
||||
"jp-MarkdownHeadingCollapsed": true,
|
||||
"tags": []
|
||||
},
|
||||
"source": [
|
||||
@@ -114,7 +113,96 @@
|
||||
" score = int(result[1])/item[m_item]['divisor'] \n",
|
||||
" re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n",
|
||||
" re_ta[user][item_name]['得分'] =result[2]\n",
|
||||
"filename = 'data/result_北海炼化2022.json'\n",
|
||||
"filename = 'data/result_北海炼化2022-1.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(re_ta, fl) \n",
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 33,
|
||||
"id": "d2598172-cede-4baa-920e-3d676c079b7b",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-09-17T01:50:24.312281Z",
|
||||
"iopub.status.busy": "2025-09-17T01:50:24.311666Z",
|
||||
"iopub.status.idle": "2025-09-17T01:50:24.427182Z",
|
||||
"shell.execute_reply": "2025-09-17T01:50:24.426684Z",
|
||||
"shell.execute_reply.started": "2025-09-17T01:50:24.312223Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import time\n",
|
||||
"import csv\n",
|
||||
"from datetime import date,datetime\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"filename = '../item.json'\n",
|
||||
"item = {}\n",
|
||||
"unit = {}\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"for k,v in dict1.items():\n",
|
||||
" item[k] = v\n",
|
||||
"\n",
|
||||
"filename = 'data/北海炼化人员_2022.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl) \n",
|
||||
"\n",
|
||||
"re_ta = {}\n",
|
||||
"dict1 = {}\n",
|
||||
"list1 = []\n",
|
||||
"#print(\"\\n运动项目信息:\")\n",
|
||||
"filename = 'data/138_2210.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",
|
||||
" user = str(result[4])\n",
|
||||
" m_item = str(result[0]) \n",
|
||||
" re_ta.setdefault(user,{}) \n",
|
||||
" re_ta[user]['name'] = str(result[6])\n",
|
||||
" re_ta[user]['unit'] = str(result[5]) \n",
|
||||
" \n",
|
||||
" #re_ta[user]['rq'] = str(result[3]).replace('/','-')\n",
|
||||
" date_obj = datetime.strptime(result[3], \"%Y/%m/%d\")\n",
|
||||
" re_ta[user]['rq'] = date_obj.strftime('%Y-%m-%d')\n",
|
||||
" \n",
|
||||
" \n",
|
||||
" \n",
|
||||
" #item_name = item[m_item]['name']\n",
|
||||
" re_ta[user].setdefault(m_item,{}) \n",
|
||||
" score = int(result[1])/item[m_item]['divisor'] \n",
|
||||
" re_ta[user][m_item]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n",
|
||||
" #re_ta[user][item_name]['得分'] =result[2]\n",
|
||||
"for k,v in re_ta.items():\n",
|
||||
" v['birth'] = dict2[k]['birth']\n",
|
||||
" birth = date.fromisoformat(dict2[k]['birth'].replace('/','-'))\n",
|
||||
" rq = date.fromisoformat(re_ta[user]['rq'].replace('/','-'))\n",
|
||||
" days = (rq-birth).days \n",
|
||||
" v['days'] = days\n",
|
||||
" v['age'] = int(days/365)\n",
|
||||
" v['sex'] = dict2[k]['sex']\n",
|
||||
" if 'height' in v.keys() and 'height' in v.keys():\n",
|
||||
" v.setdefault('bmi',{})\n",
|
||||
" v['bmi']['成绩'] = v['height']['成绩'].split()[0]+','+v['weight']['成绩'].split()[0]\n",
|
||||
" \n",
|
||||
"filename = 'data/result_北海炼化2022-1.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(re_ta, fl) \n",
|
||||
"print('ok')"
|
||||
@@ -636,6 +724,7 @@
|
||||
"cell_type": "markdown",
|
||||
"id": "c103301b-d540-4bf5-861a-0eb2e313e26e",
|
||||
"metadata": {
|
||||
"jp-MarkdownHeadingCollapsed": true,
|
||||
"tags": []
|
||||
},
|
||||
"source": [
|
||||
@@ -1982,7 +2071,9 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a51dadfb-30e7-40f3-a437-321aa986a10f",
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"jp-MarkdownHeadingCollapsed": true
|
||||
},
|
||||
"source": [
|
||||
"# 北海体检情况汇总"
|
||||
]
|
||||
@@ -2089,9 +2180,7 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "76c5c17a-462d-4a7b-95a5-6b895f5a25dc",
|
||||
"metadata": {
|
||||
"jp-MarkdownHeadingCollapsed": true
|
||||
},
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 2024年体质检测"
|
||||
]
|
||||
@@ -2353,6 +2442,64 @@
|
||||
"print('ok!') "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 34,
|
||||
"id": "c5846968-1f2e-46b5-a79c-e2f129e5c233",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-09-17T01:51:05.541822Z",
|
||||
"iopub.status.busy": "2025-09-17T01:51:05.541072Z",
|
||||
"iopub.status.idle": "2025-09-17T01:51:05.595736Z",
|
||||
"shell.execute_reply": "2025-09-17T01:51:05.595210Z",
|
||||
"shell.execute_reply.started": "2025-09-17T01:51:05.541754Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok!\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import time\n",
|
||||
"import my_module as My\n",
|
||||
"\n",
|
||||
"#list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','height','weight']\n",
|
||||
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n",
|
||||
"filename = 'data/result_北海炼化2022-1.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl) \n",
|
||||
"for k, v in dict2.items():\n",
|
||||
" #print(k)\n",
|
||||
" if v['sex'] == '男':\n",
|
||||
" sex = 'M'\n",
|
||||
" else:\n",
|
||||
" sex = 'F' \n",
|
||||
" if 'bmi' in v.keys():\n",
|
||||
" #bmi_data = v['height']['成绩'].split()[0]+','+ v['weight']['成绩'].split()[0]\n",
|
||||
" bmi_data = v['bmi']['成绩']\n",
|
||||
" data1 = {'code':k,'sex':sex,'age':v['age'],'item':'HeightWeight','result':bmi_data}\n",
|
||||
" dict2[k]['bmi'] = {}\n",
|
||||
" dict2[k]['bmi']['成绩'] = bmi_data\n",
|
||||
" dict2[k]['bmi']['score'] = My.cal_bmi(data1)\n",
|
||||
" for item_en in list_item:\n",
|
||||
" if item_en in v.keys(): \n",
|
||||
" data1 = {'code':k,'sex':sex,'age':v['age'],'item':item_en,'result':float(v[item_en]['成绩'].split()[0])}\n",
|
||||
" #print(k,v['name'])\n",
|
||||
" dict2[k][item_en]['score'] = My.cal_score(data1)\n",
|
||||
" #print(k,v[item_en]['成绩'],cal_score(data1))\n",
|
||||
"\n",
|
||||
"filename = f'data/result_北海炼化2022-1.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict2,fl , ensure_ascii=False) \n",
|
||||
"print('ok!') "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "5b9aef88-0341-4af0-8316-c7e2266f4b0c",
|
||||
@@ -2650,6 +2797,82 @@
|
||||
"print('ok') "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 37,
|
||||
"id": "98e43475-06ca-42bc-b352-5c92a554e2c2",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-09-17T02:01:52.580879Z",
|
||||
"iopub.status.busy": "2025-09-17T02:01:52.580448Z",
|
||||
"iopub.status.idle": "2025-09-17T02:01:52.867257Z",
|
||||
"shell.execute_reply": "2025-09-17T02:01:52.866600Z",
|
||||
"shell.execute_reply.started": "2025-09-17T02:01:52.580841Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n",
|
||||
"bmi = ['height','weight']\n",
|
||||
"title = ['编号','姓名','性别','单位/部门','身高','体重','bmi','肺活量','','握力','','坐位体前屈','','纵跳','','俯卧撑','','一分钟仰卧起坐','','单脚站立','','选择反应时','','台阶指数']\n",
|
||||
"\n",
|
||||
"filename = 'data/result_北海炼化2022-1.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"list1 = []\n",
|
||||
"for k, v in dict1.items(): #print(k,dict2[str(k)]['name'])\n",
|
||||
" list2 = []\n",
|
||||
" list2.append(str(k).rjust(5,'0'))\n",
|
||||
" list2.append(dict1[k]['name']) \n",
|
||||
" list2.append(dict1[k]['sex'])\n",
|
||||
" list2.append(dict1[k]['unit'])\n",
|
||||
" i = 0\n",
|
||||
" if 'bmi' in dict1[k].keys():\n",
|
||||
" list2.append(dict1[k]['bmi']['成绩'].split(',')[0])\n",
|
||||
" list2.append(dict1[k]['bmi']['成绩'].split(',')[1])\n",
|
||||
" list2.append(dict1[k]['bmi']['score'])\n",
|
||||
" i+=1\n",
|
||||
" else:\n",
|
||||
" list2.append('') \n",
|
||||
" list2.append('') \n",
|
||||
" list2.append('') \n",
|
||||
" \n",
|
||||
" \n",
|
||||
" for item in items:\n",
|
||||
" if item in dict1[k].keys():\n",
|
||||
" list2.append(dict1[k][item]['成绩'])\n",
|
||||
" list2.append(dict1[k][item]['score']) \n",
|
||||
" i+=1\n",
|
||||
" elif item =='name':\n",
|
||||
" list2.append(dict1[k][item])\n",
|
||||
" else:\n",
|
||||
" list2.append('') \n",
|
||||
" list2.append('') \n",
|
||||
" if i>2:\n",
|
||||
" list1.append(list2)\n",
|
||||
"filename = 'data/北海炼化体测情况明细表(2022年).xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"sheet.append(title)\n",
|
||||
"for row in list1:\n",
|
||||
" sheet.append(row)\n",
|
||||
" \n",
|
||||
"wb.save(filename)\n",
|
||||
"print('ok') "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "b46477dd-f9d0-40b8-ae25-62f3ffb5dc1e",
|
||||
|
||||
@@ -0,0 +1,277 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "1853a5ff-55c9-4c07-bc84-66e86b238fdc",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 人员基本信息导入"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "d6449ec6-54af-4f68-8c32-69372e390acf",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-09-22T03:30:37.564857Z",
|
||||
"iopub.status.busy": "2025-09-22T03:30:37.564250Z",
|
||||
"iopub.status.idle": "2025-09-22T03:30:37.781384Z",
|
||||
"shell.execute_reply": "2025-09-22T03:30:37.780531Z",
|
||||
"shell.execute_reply.started": "2025-09-22T03:30:37.564798Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"33 ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/通用技术中国医药人员信息.xlsx',data_only=True)\n",
|
||||
"sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"person = {}\n",
|
||||
"\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" code = int(sheet.cell(n, 1).value)\n",
|
||||
" person.setdefault(code, {})\n",
|
||||
" dict1 = {}\n",
|
||||
" dict1['name'] = sheet.cell(n, 2).value\n",
|
||||
" #dict1['sex'] = sheet.cell(n, 5).value\n",
|
||||
" dict1['unit'] = sheet.cell(n, 4).value \n",
|
||||
" dict1['birth'] = str(sheet.cell(n, 3).value).replace('/','-').split(' ')[0]\n",
|
||||
" dict1['phone'] = sheet.cell(n, 5).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(len(person),'ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "7b114094-afdc-4776-8fb7-19ac05162e68",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 导入手工数据"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "c24c957e-6cc5-4cab-81e2-cec86a7498c7",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-09-22T03:48:21.444109Z",
|
||||
"iopub.status.busy": "2025-09-22T03:48:21.443422Z",
|
||||
"iopub.status.idle": "2025-09-22T03:48:21.472961Z",
|
||||
"shell.execute_reply": "2025-09-22T03:48:21.472454Z",
|
||||
"shell.execute_reply.started": "2025-09-22T03:48:21.444045Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"33\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"import time\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/通用技术中国医药手工数据.xlsx',data_only=True)\n",
|
||||
"sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"\n",
|
||||
"filename = 'data/通用技术中国医药人员.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"dict2 = {}\n",
|
||||
"\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" code = str(sheet.cell(n, 1).value)\n",
|
||||
" rq = date.fromisoformat('2025-09-18')\n",
|
||||
" birth = date.fromisoformat(dict1[code]['birth'].replace('/','-'))\n",
|
||||
" dict2[code] = dict1[code]\n",
|
||||
" days = (rq-birth).days\n",
|
||||
" dict2[code]['age'] = int(days/365)\n",
|
||||
" dict2[code]['month'] = int(days/365*12)\n",
|
||||
" dict2[code]['rq'] = '2025-09-18'\n",
|
||||
" if sheet.cell(n,4).value:\n",
|
||||
" dict2[code].setdefault('reaction',{})\n",
|
||||
" dict2[code]['reaction']['成绩'] = sheet.cell(n, 4).value\n",
|
||||
" if sheet.cell(n,5).value:\n",
|
||||
" dict2[code].setdefault('grip',{})\n",
|
||||
" dict2[code]['grip']['成绩'] = sheet.cell(n, 5).value\n",
|
||||
" if sheet.cell(n,7).value:\n",
|
||||
" dict2[code].setdefault('lung',{})\n",
|
||||
" dict2[code]['lung']['成绩'] = sheet.cell(n, 7).value\n",
|
||||
" if sheet.cell(n,6).value:\n",
|
||||
" dict2[code].setdefault('balance',{})\n",
|
||||
" dict2[code]['balance']['成绩'] = sheet.cell(n, 6).value\n",
|
||||
" if sheet.cell(n,3).value:\n",
|
||||
" dict2[code].setdefault('bmi',{})\n",
|
||||
" dict2[code]['bmi']['成绩'] = sheet.cell(n, 3).value\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"filename = 'data/result_通用技术中国医药.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict2, fl, ensure_ascii=False) \n",
|
||||
"print(len(dict2))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "57aedeb8-02e6-47d2-a54a-e803d441104a",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 生成测试得分"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "a64ad6b7-b1dd-42ca-9619-3adcb8e0674e",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "84ad4891-f424-417c-8818-c9544bff67ef",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 导入问卷信息(新)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"id": "020be101-938b-427e-918d-faf2e74b5b7e",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-09-22T03:57:31.502714Z",
|
||||
"iopub.status.busy": "2025-09-22T03:57:31.501987Z",
|
||||
"iopub.status.idle": "2025-09-22T03:57:31.516781Z",
|
||||
"shell.execute_reply": "2025-09-22T03:57:31.515780Z",
|
||||
"shell.execute_reply.started": "2025-09-22T03:57:31.502649Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import csv\n",
|
||||
"import openpyxl\n",
|
||||
"import time\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"dict1 = {}\n",
|
||||
"\n",
|
||||
"filename = 'data/result_通用技术中国医药.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"filename = 'data/通用技术中国医药人员.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict3 = json.load(fl)\n",
|
||||
"\n",
|
||||
"phone = {}\n",
|
||||
"for k,v in dict3.items():\n",
|
||||
" if 'phone' in v.keys():\n",
|
||||
" phone[int(v['phone'])] = k\n",
|
||||
"\n",
|
||||
"list1 = []\n",
|
||||
"filename = 'data/survey_records_20250922.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",
|
||||
" list1.append(line)\n",
|
||||
"\n",
|
||||
"nn = 0\n",
|
||||
"for item in list1:\n",
|
||||
" if int(item[3]) in phone.keys(): \n",
|
||||
" tcm = []\n",
|
||||
" code = phone[int(item[3])]\n",
|
||||
" \n",
|
||||
" for i in range(0,60):\n",
|
||||
" tcm.append(0)\n",
|
||||
" \n",
|
||||
" \n",
|
||||
" content = json.loads(item[4])\n",
|
||||
" if code not in dict1.keys():\n",
|
||||
" dict1[code] = dict3[code]\n",
|
||||
" rq = date.fromisoformat(item[5].replace('/','-').split(' ')[0])\n",
|
||||
" dict1[code]['rq'] = str(date.fromisoformat(item[5].replace('/','-').split(' ')[0]))\n",
|
||||
" #dict1[code]['rq'] = item[5].replace('/','-').split(' ')[0]\n",
|
||||
" else:\n",
|
||||
" rq=date.fromisoformat('2025-09-18')\n",
|
||||
" dict1[code]['rq'] = '2025-09-18'\n",
|
||||
" for k, v in content.items():\n",
|
||||
" \n",
|
||||
" if 'tcm' in k:\n",
|
||||
" i = int(k[3:])\n",
|
||||
" tcm[i-1] = int(v) \n",
|
||||
" \n",
|
||||
" if 'tcm' in item[4]: \n",
|
||||
" dict1[code]['tcm'] = tcm\n",
|
||||
" \n",
|
||||
" birth = date.fromisoformat(dict3[code]['birth'].replace('/','-'))\n",
|
||||
" \n",
|
||||
" days = (rq-birth).days \n",
|
||||
" dict1[code]['age'] = int(days/365)\n",
|
||||
" dict1[code]['month'] = int(days/365*12)\n",
|
||||
" #print(phone[item[2]])\n",
|
||||
" nn+=1\n",
|
||||
"filename = 'data/result_通用技术中国医药-1.json'\n",
|
||||
"\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "9560d0ca-4d39-400b-b054-214e243ca4e5",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"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.12.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Reference in new issue
Block a user