This commit is contained in:
512song committed 2024-06-09 23:51:24 +08:00
1 parent 94984bf7a6
commit 76487f10e8
4 files changed
+3971 -253

No files matched your search

+63 -73
View File
@@ -10,15 +10,15 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 22,
"id": "ed6c774c-e91d-4f99-9a38-318fade9e937",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-01T08:38:50.009649Z",
"iopub.status.busy": "2024-06-01T08:38:50.009121Z",
"iopub.status.idle": "2024-06-01T08:38:50.151368Z",
"shell.execute_reply": "2024-06-01T08:38:50.150654Z",
"shell.execute_reply.started": "2024-06-01T08:38:50.009599Z"
"iopub.execute_input": "2024-06-06T02:03:52.715662Z",
"iopub.status.busy": "2024-06-06T02:03:52.714931Z",
"iopub.status.idle": "2024-06-06T02:03:52.870802Z",
"shell.execute_reply": "2024-06-06T02:03:52.870264Z",
"shell.execute_reply.started": "2024-06-06T02:03:52.715592Z"
}
},
"outputs": [
@@ -30,6 +30,49 @@
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
"import datetime\n",
"\n",
"wb = openpyxl.load_workbook('data/中安联合体测花名册.xlsx')\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"person = {}\n",
"for n in range(2, sheet.max_row+1):\n",
" if sheet.cell(n,2).value is None:\n",
" break\n",
" else: \n",
" code = int(sheet.cell(n, 4).value)\n",
" person.setdefault(code, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 6).value \n",
" xb = str(sheet.cell(n, 7).value)\n",
" if xb == '1':\n",
" sex = '男'\n",
" elif xb =='2':\n",
" sex = '女'\n",
" dict1['sex'] = sex\n",
" dict1['unit'] = sheet.cell(n, 3).value\n",
" rq = str(sheet.cell(n,8).value).split(' ')[0].replace('/','-')\n",
" dt = datetime.datetime.strptime(rq, '%Y-%m-%d')\n",
" dict1['birth'] = dt.strftime('%Y-%m-%d')\n",
" if sheet.cell(n,9).value is not None:\n",
" dict1['phone'] = str(sheet.cell(n,9).value)\n",
" \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": "code",
"execution_count": null,
"id": "3239aae7-bcdc-468a-aa68-6b5ca4ff0821",
"metadata": {},
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
@@ -53,12 +96,8 @@
" sex = '女'\n",
" dict1['sex'] = sex\n",
" dict1['unit'] = sheet.cell(n, 3).value\n",
" dict1['birth'] = str(sheet.cell(n,8).value).split(' ')[0]\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')"
" rq = str(sheet.cell(n,8).value).split(' ')[0].replace('/','-')\n",
" print(rq,type(rq))"
]
},
{
@@ -71,17 +110,9 @@
},
{
"cell_type": "code",
"execution_count": 44,
"execution_count": null,
"id": "c9430854-6f56-4854-bc6b-d22f812f6715",
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-31T12:41:21.160561Z",
"iopub.status.busy": "2024-05-31T12:41:21.159834Z",
"iopub.status.idle": "2024-05-31T12:41:21.433867Z",
"shell.execute_reply": "2024-05-31T12:41:21.433333Z",
"shell.execute_reply.started": "2024-05-31T12:41:21.160496Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"import openpyxl\n",
@@ -112,17 +143,9 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": null,
"id": "dbc5af3a-1a2a-4094-ac89-f8efded12245",
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-26T09:11:07.788399Z",
"iopub.status.busy": "2024-05-26T09:11:07.787797Z",
"iopub.status.idle": "2024-05-26T09:11:08.056837Z",
"shell.execute_reply": "2024-05-26T09:11:08.056306Z",
"shell.execute_reply.started": "2024-05-26T09:11:07.788344Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"import re\n",
@@ -164,27 +187,10 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"id": "1efe2b78-dd18-4d12-8bc9-058f6f0046c9",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-01T08:40:42.686238Z",
"iopub.status.busy": "2024-06-01T08:40:42.685496Z",
"iopub.status.idle": "2024-06-01T08:40:42.743042Z",
"shell.execute_reply": "2024-06-01T08:40:42.742507Z",
"shell.execute_reply.started": "2024-06-01T08:40:42.686153Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"709\n",
"709\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import time\n",
@@ -204,7 +210,7 @@
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"filename = 'data/places_result_20240601.csv'\n",
"filename = 'data/places_result_20240605.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -242,17 +248,9 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"id": "dd6379bf-6a79-48de-b3fb-35e84f192ce2",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-01T08:41:07.934988Z",
"iopub.status.busy": "2024-06-01T08:41:07.934276Z",
"iopub.status.idle": "2024-06-01T08:41:08.095312Z",
"shell.execute_reply": "2024-06-01T08:41:08.094771Z",
"shell.execute_reply.started": "2024-06-01T08:41:07.934919Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"import json\n",
@@ -305,17 +303,9 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"id": "314f9709-4c13-4f8b-bca6-fc2122a9054e",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-02T01:04:12.743929Z",
"iopub.status.busy": "2024-06-02T01:04:12.742863Z",
"iopub.status.idle": "2024-06-02T01:04:12.793583Z",
"shell.execute_reply": "2024-06-02T01:04:12.792951Z",
"shell.execute_reply.started": "2024-06-02T01:04:12.743871Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"import json\n",
+15 -118
View File
@@ -23,10 +23,10 @@
"mydb = myclient[\"baogao\"]\n",
"mycol = mydb[\"place\"]\n",
"\n",
"place_id = 571315\n",
"place_code = \"10\"\n",
"dw_name = \"中国石油青海油田勘探事业部\"\n",
"dw_jc = \"青海油田勘探事业部\"\n",
"place_id = 100615\n",
"place_code = \"11\"\n",
"dw_name = \"中安联合公司\"\n",
"dw_jc = \"中安联合公司\"\n",
"myquery = { \"id\": place_id }\n",
"num = mycol.count_documents(myquery)\n",
"if num>0:\n",
@@ -109,56 +109,12 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "5f665c0f-8d30-4759-b7f8-fb7e13b98efa",
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-21T07:50:22.591936Z",
"iopub.status.busy": "2024-05-21T07:50:22.591216Z",
"iopub.status.idle": "2024-05-21T07:50:22.615055Z",
"shell.execute_reply": "2024-05-21T07:50:22.614130Z",
"shell.execute_reply.started": "2024-05-21T07:50:22.591865Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1 18993713107 0040-李想.pdf\n",
"2 18993711277 0037-姜太亮.pdf\n",
"3 18909376963 0005-范朝峰.pdf\n",
"4 18993711151 0039-燕宇飞.pdf\n",
"5 18993729661 0003-于航.pdf\n",
"6 18997372608 0024-王永林.pdf\n",
"7 18997377335 0047-付艳双.pdf\n",
"8 18993710970 0042-张长好.pdf\n",
"9 18993710993 0011-黄叶秋.pdf\n",
"10 18993727823 0020-李伟.pdf\n",
"11 18997372109 0061-罗勇.pdf\n",
"12 18997374506 0044-王福国.pdf\n",
"13 18993710963 0071-李强.pdf\n",
"14 18093715987 0062-张伟.pdf\n",
"15 18997397669 0069-杨鹏.pdf\n",
"16 18993714097 0033-徐涛.pdf\n",
"17 18093715481 0036-刘雪娇.pdf\n",
"18 18993710973 0055-张庆尧.pdf\n",
"19 18997372106 0051-袁贵德.pdf\n",
"20 18993714936 0064-张狄杰.pdf\n",
"21 18993724221 0007-袁丽萍.pdf\n",
"22 18993710972 0035-许刚.pdf\n",
"23 18993710998 0009-彭晓群.pdf\n",
"24 18997375563 0046-张海宁.pdf\n",
"25 18993722556 0068-马丽娟.pdf\n",
"26 18993710256 0043-高雪峰.pdf\n",
"27 18993710971 0041-邢超.pdf\n",
"28 18993710985 0067-管斌.pdf\n",
"29 18993728737 0050-李文研.pdf\n",
"30 18909376562 0018-王海红.pdf\n"
]
}
],
"outputs": [],
"source": [
"from tencentcloud.common import credential\n",
"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n",
@@ -172,8 +128,8 @@
"mydb = myclient[\"baogao\"]\n",
"mycol = mydb[\"pdf\"]\n",
"\n",
"dw_jc = \"青海油田勘探事业部测试者\"\n",
"filename = 'data/青海2024.json'\n",
"dw_jc = \"中安联合测试者\"\n",
"filename = 'data/中安联合.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"dict2 = {}\n",
@@ -233,56 +189,12 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "4b2b5d76-665f-4dfe-bbd3-5c80abd8c3e3",
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-21T07:51:45.019283Z",
"iopub.status.busy": "2024-05-21T07:51:45.018719Z",
"iopub.status.idle": "2024-05-21T07:51:51.465933Z",
"shell.execute_reply": "2024-05-21T07:51:51.464380Z",
"shell.execute_reply.started": "2024-05-21T07:51:45.019227Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"18993713107 send success\n",
"18993711277 send success\n",
"18909376963 send success\n",
"18993711151 send success\n",
"18993729661 send success\n",
"18997372608 send success\n",
"18997377335 send success\n",
"18993710970 send success\n",
"18993710993 send success\n",
"18993727823 send success\n",
"18997372109 send success\n",
"18997374506 send success\n",
"18993710963 send success\n",
"18093715987 send success\n",
"18997397669 send success\n",
"18993714097 send success\n",
"18093715481 send success\n",
"18993710973 send success\n",
"18997372106 send success\n",
"18993714936 send success\n",
"18993724221 send success\n",
"18993710972 send success\n",
"18993710998 send success\n",
"18997375563 send success\n",
"18993722556 send success\n",
"18993710256 send success\n",
"18993710971 send success\n",
"18993710985 send success\n",
"18993728737 send success\n",
"18909376562 send success\n"
]
}
],
"outputs": [],
"source": [
"from tencentcloud.common import credential\n",
"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n",
@@ -296,7 +208,7 @@
"mydb = myclient[\"baogao\"]\n",
"mycol = mydb[\"pdf\"]\n",
"\n",
"filename = 'data/青海2024.json'\n",
"filename = 'data/中安联合.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"dict2 = {}\n",
@@ -309,7 +221,7 @@
" else:\n",
" print('no phone')\n",
"#print(dict2)\n",
"dw_jc = \"青海油田勘探事业部测试者\"\n",
"dw_jc = \"中安联合测试者\"\n",
"#dict2 = {375: {'phone': '13793180751', 'code': '0379208'}}\n",
"for k, v in dict2.items():\n",
" phone = '+86'+v['phone']\n",
@@ -365,27 +277,12 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "25a269c3-758f-4e79-ae6d-a6e6f161d64b",
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-21T07:49:49.553753Z",
"iopub.status.busy": "2024-05-21T07:49:49.553036Z",
"iopub.status.idle": "2024-05-21T07:49:49.771504Z",
"shell.execute_reply": "2024-05-21T07:49:49.769857Z",
"shell.execute_reply.started": "2024-05-21T07:49:49.553688Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"+8613793180751 send success\n"
]
}
],
"outputs": [],
"source": [
"from tencentcloud.common import credential\n",
"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n",
@@ -450,7 +347,7 @@
"mydb = myclient[\"baogao\"]\n",
"mycol = mydb[\"pdf\"]\n",
"\n",
"filename = 'data/世纪花园人员信息.json'\n",
"filename = 'data/中安联合.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"dict2 = {}\n",
+61 -39
View File
@@ -280,15 +280,15 @@
},
{
"cell_type": "code",
"execution_count": 103,
"execution_count": 7,
"id": "3e614f4a-a623-48e2-97f8-b31f62c9a983",
"metadata": {
"execution": {
"iopub.execute_input": "2024-03-21T07:32:21.775359Z",
"iopub.status.busy": "2024-03-21T07:32:21.774903Z",
"iopub.status.idle": "2024-03-21T07:32:21.809322Z",
"shell.execute_reply": "2024-03-21T07:32:21.808037Z",
"shell.execute_reply.started": "2024-03-21T07:32:21.775322Z"
"iopub.execute_input": "2024-06-05T08:38:54.344213Z",
"iopub.status.busy": "2024-06-05T08:38:54.343465Z",
"iopub.status.idle": "2024-06-05T08:38:54.410170Z",
"shell.execute_reply": "2024-06-05T08:38:54.409619Z",
"shell.execute_reply.started": "2024-06-05T08:38:54.344132Z"
},
"tags": []
},
@@ -297,8 +297,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"74\n",
"74\n"
"709\n",
"709\n"
]
}
],
@@ -331,11 +331,11 @@
"re_ta = {}\n",
"dict1 = {}\n",
"list1 = []\n",
"filename = 'data/东营老年大学.json'\n",
"filename = 'data/中安联合.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"filename = 'data/places_result_20240321.csv'\n",
"filename = 'data/places_result_20240605.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -376,7 +376,7 @@
" score = int(result[4])/item[m_item]['divisor'] \n",
" re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n",
"print(len(re_ta))\n",
"filename = 'data/result_东营老年大学.json'\n",
"filename = 'data/result_中安联合.json'\n",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl, ensure_ascii=False) \n",
@@ -393,15 +393,15 @@
},
{
"cell_type": "code",
"execution_count": 105,
"execution_count": 8,
"id": "141b30dc-5975-4dcb-9bc3-9b20d26a0917",
"metadata": {
"execution": {
"iopub.execute_input": "2024-03-21T08:42:07.845829Z",
"iopub.status.busy": "2024-03-21T08:42:07.845385Z",
"iopub.status.idle": "2024-03-21T08:42:07.884449Z",
"shell.execute_reply": "2024-03-21T08:42:07.883406Z",
"shell.execute_reply.started": "2024-03-21T08:42:07.845792Z"
"iopub.execute_input": "2024-06-05T08:39:59.079134Z",
"iopub.status.busy": "2024-06-05T08:39:59.078630Z",
"iopub.status.idle": "2024-06-05T08:39:59.141794Z",
"shell.execute_reply": "2024-06-05T08:39:59.141195Z",
"shell.execute_reply.started": "2024-06-05T08:39:59.079087Z"
},
"tags": []
},
@@ -511,7 +511,7 @@
"\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_东营老年大学.json'\n",
"filename = 'data/result_中安联合.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl) \n",
"for k, v in dict2.items():\n",
@@ -532,7 +532,7 @@
" dict2[k][item_en]['score'] = cal_score(data1)\n",
" #print(k,v[item_en]['成绩'],cal_score(data1))\n",
"\n",
"filename = f'data/result_东营老年大学.json'\n",
"filename = f'data/result_中安联合.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n",
"print('ok!') "
@@ -695,15 +695,15 @@
},
{
"cell_type": "code",
"execution_count": 108,
"execution_count": 10,
"id": "b123ee6b-85d2-4660-b226-321832a6b796",
"metadata": {
"execution": {
"iopub.execute_input": "2024-03-21T08:46:57.703552Z",
"iopub.status.busy": "2024-03-21T08:46:57.703093Z",
"iopub.status.idle": "2024-03-21T08:47:18.057243Z",
"shell.execute_reply": "2024-03-21T08:47:18.056037Z",
"shell.execute_reply.started": "2024-03-21T08:46:57.703496Z"
"iopub.execute_input": "2024-06-05T08:52:25.451985Z",
"iopub.status.busy": "2024-06-05T08:52:25.451119Z",
"iopub.status.idle": "2024-06-05T08:58:26.399739Z",
"shell.execute_reply": "2024-06-05T08:58:26.398553Z",
"shell.execute_reply.started": "2024-06-05T08:52:25.451918Z"
},
"tags": []
},
@@ -712,7 +712,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"62\n"
"709\n"
]
}
],
@@ -725,11 +725,11 @@
"headers = {\n",
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
" }\n",
"filename = 'data/result_东营老年大学1.json'\n",
"filename = 'data/result_中安联合.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"file_path ='./东营老年大学/'\n",
"file_path ='./中安联合/'\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
"i=0\n",
"list2 = []\n",
@@ -739,7 +739,7 @@
" \n",
" id = str(k).rjust(4,\"0\")\n",
" mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n",
" mydata['title'] = '体质监测报告样本'\n",
" mydata['title'] = '中安联合公司'\n",
" mydata['subtitle'] = v['unit']\n",
" mydata['id'] = id\n",
" mydata['name'] = v['name']\n",
@@ -788,9 +788,16 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"id": "d913a531-51b3-4795-adc3-f4fc858d7401",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-06T03:56:47.359615Z",
"iopub.status.busy": "2024-06-06T03:56:47.359270Z",
"iopub.status.idle": "2024-06-06T03:56:47.566463Z",
"shell.execute_reply": "2024-06-06T03:56:47.565918Z",
"shell.execute_reply.started": "2024-06-06T03:56:47.359581Z"
},
"tags": []
},
"outputs": [],
@@ -800,12 +807,12 @@
"import glob\n",
"from pathlib import Path\n",
"\n",
"fi_path = '/home/songyi/pdf-typescript/北海炼化2023'\n",
"new_path = 'file/北海炼化2023'\n",
"fi_path = '/home/songyi/pdf-typescript/中安联合'\n",
"new_path = 'file/中安联合'\n",
"old = []\n",
"dict2 = {}\n",
"\n",
"filename = 'data/北海炼化2023年.json'\n",
"filename = 'data/中安联合.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
@@ -829,12 +836,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 12,
"id": "02319955-7fb6-4791-ae45-55b03bdadd54",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-06T04:05:48.101908Z",
"iopub.status.busy": "2024-06-06T04:05:48.101136Z",
"iopub.status.idle": "2024-06-06T04:05:48.165587Z",
"shell.execute_reply": "2024-06-06T04:05:48.165042Z",
"shell.execute_reply.started": "2024-06-06T04:05:48.101837Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import os,sys,shutil\n",
"import json\n",
@@ -842,9 +864,9 @@
"from pathlib import Path\n",
"import openpyxl\n",
"\n",
"fi_path = '/home/songyi/pdf-typescript/北海炼化2023'\n",
"fi_path = '/home/songyi/pdf-typescript/中安联合'\n",
"\n",
"filename = 'data/北海炼化2023年.json'\n",
"filename = 'data/中安联合.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
@@ -860,7 +882,7 @@
" \n",
" list1.append(list2)\n",
"\n",
"filename = 'data/北海炼化体测报告打印明细表.xlsx'\n",
"filename = 'data/中安联合体测报告明细表.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
@@ -2047,7 +2069,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.12.3"
}
},
"nbformat": 4,