20230324
This commit is contained in:
1 parent
177370c8e1
commit
b73d2ec0ac
1 file changed
+271
-2
+271
-2
@@ -8,6 +8,242 @@
|
|||||||
"## 调查报告线下数据管理"
|
"## 调查报告线下数据管理"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "ced4bf30-e7ea-4c4c-ae46-8720ffc07a76",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 羊庙人员信息导入"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 33,
|
||||||
|
"id": "9b2b755e-049e-48c5-87d3-dd37dceb59fe",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-03-24T13:14:35.940432Z",
|
||||||
|
"iopub.status.busy": "2023-03-24T13:14:35.939897Z",
|
||||||
|
"iopub.status.idle": "2023-03-24T13:14:36.013683Z",
|
||||||
|
"shell.execute_reply": "2023-03-24T13:14:36.012420Z",
|
||||||
|
"shell.execute_reply.started": "2023-03-24T13:14:35.940384Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"ok\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"\n",
|
||||||
|
"filename = 'data/羊庙测试人员信息.json'\n",
|
||||||
|
"\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl) \n",
|
||||||
|
"dict2 = {}\n",
|
||||||
|
"for k,v in dict1.items():\n",
|
||||||
|
" for item in v:\n",
|
||||||
|
" bh = item['avatar_id']\n",
|
||||||
|
" del item['avatar_id']\n",
|
||||||
|
" dict2[bh] = item\n",
|
||||||
|
"filename = 'data/羊庙人员名单.json'\n",
|
||||||
|
"with open(filename, 'w') as fl:\n",
|
||||||
|
" json.dump(dict2, fl, ensure_ascii=False)\n",
|
||||||
|
"print('ok')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "00e9f538-c0f5-46a0-b768-51480ad3fbaf",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 获取参加体测人员编号"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 40,
|
||||||
|
"id": "d89e0e5e-0782-40a3-bba3-862cc9865d4e",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-03-24T13:43:39.136601Z",
|
||||||
|
"iopub.status.busy": "2023-03-24T13:43:39.136035Z",
|
||||||
|
"iopub.status.idle": "2023-03-24T13:43:39.168742Z",
|
||||||
|
"shell.execute_reply": "2023-03-24T13:43:39.167427Z",
|
||||||
|
"shell.execute_reply.started": "2023-03-24T13:43:39.136519Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"465\n",
|
||||||
|
"[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 177, 178, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 342, 343, 344, 345, 346, 347, 348, 349, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 555, 666, 777, 999, 1000, 1001, 2367, 3456, 6000, 6001, 6002, 6003, 6602, 8888, 8889, 9999, 10000, 11112, 66666, 77777, 88888, 98000, 98765, 98766, 98767, 98776, 99999, 111111, 888888, 999998, 999999, 9999999, 999999999]\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import time\n",
|
||||||
|
"import csv\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",
|
||||||
|
"re_ta = {}\n",
|
||||||
|
"dict1 = {}\n",
|
||||||
|
"list1 = []\n",
|
||||||
|
"#print(\"\\n运动项目信息:\")\n",
|
||||||
|
"filename = 'data/140.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",
|
||||||
|
"list2 = []\n",
|
||||||
|
"for result in list1:\n",
|
||||||
|
" user = int(result[2])\n",
|
||||||
|
" if user not in list2:\n",
|
||||||
|
" list2.append(user)\n",
|
||||||
|
"list2.sort()\n",
|
||||||
|
"print(list2)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "2c48f588-135a-4d1a-b01e-96222b70b987",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 根据风险筛选统计卡获取信息"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 63,
|
||||||
|
"id": "e76837e8-cdf4-41e0-9d51-6ae5223de813",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-03-24T14:43:32.834711Z",
|
||||||
|
"iopub.status.busy": "2023-03-24T14:43:32.834163Z",
|
||||||
|
"iopub.status.idle": "2023-03-24T14:43:32.955657Z",
|
||||||
|
"shell.execute_reply": "2023-03-24T14:43:32.954341Z",
|
||||||
|
"shell.execute_reply.started": "2023-03-24T14:43:32.834663Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"440\n",
|
||||||
|
"ok\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import openpyxl\n",
|
||||||
|
"import json\n",
|
||||||
|
"import time\n",
|
||||||
|
"\n",
|
||||||
|
"wb = openpyxl.load_workbook('data/杨庙运动风险筛查统计表.xlsx')\n",
|
||||||
|
"sheet = wb.active\n",
|
||||||
|
"person = {}\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",
|
||||||
|
" if sheet.cell(n, 8).value is not None:\n",
|
||||||
|
" name = sheet.cell(n, 8).value\n",
|
||||||
|
" else:\n",
|
||||||
|
" name ='不详'\n",
|
||||||
|
" dict1['name'] = name\n",
|
||||||
|
" if sheet.cell(n, 9).value is not None:\n",
|
||||||
|
" dict1['birth'] = str(sheet.cell(n, 9).value).split(' ')[0]\n",
|
||||||
|
" if sheet.cell(n, 10).value is not None:\n",
|
||||||
|
" dict1['phone'] = sheet.cell(n, 10).value\n",
|
||||||
|
" if sheet.cell(n,11).value is not None:\n",
|
||||||
|
" dict1['id_num'] = sheet.cell(n,11).value\n",
|
||||||
|
" person[code] = dict1\n",
|
||||||
|
"print(len(person))\n",
|
||||||
|
"filename = 'data/杨庙运动风险筛查统计表信息.json'\n",
|
||||||
|
"with open(filename, 'w') as fl:\n",
|
||||||
|
" json.dump(person, fl, ensure_ascii=False,default=str)\n",
|
||||||
|
"print('ok')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "6cc6b614-85e2-43fd-bc97-301fc776fe29",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 根据恢复版获取信息"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 60,
|
||||||
|
"id": "1293cdaa-1fdf-43a5-99ce-a031a76f6688",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-03-24T14:42:34.578240Z",
|
||||||
|
"iopub.status.busy": "2023-03-24T14:42:34.577707Z",
|
||||||
|
"iopub.status.idle": "2023-03-24T14:42:35.818413Z",
|
||||||
|
"shell.execute_reply": "2023-03-24T14:42:35.816872Z",
|
||||||
|
"shell.execute_reply.started": "2023-03-24T14:42:34.578193Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"350\n",
|
||||||
|
"ok\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import openpyxl\n",
|
||||||
|
"import json\n",
|
||||||
|
"import time\n",
|
||||||
|
"\n",
|
||||||
|
"wb = openpyxl.load_workbook('data/羊庙恢复版.xlsx')\n",
|
||||||
|
"sheet = wb.active\n",
|
||||||
|
"person = {}\n",
|
||||||
|
"for n in range(2, sheet.max_row+1):\n",
|
||||||
|
" if sheet.cell(n, 4).value is not None: \n",
|
||||||
|
" code = int(sheet.cell(n, 4).value)\n",
|
||||||
|
" person.setdefault(code, {})\n",
|
||||||
|
" dict1 = {}\n",
|
||||||
|
" name = sheet.cell(n, 5).value\n",
|
||||||
|
" dict1['name'] = name\n",
|
||||||
|
" dict1['bh'] = n - 1 \n",
|
||||||
|
" if sheet.cell(n, 9).value is not None:\n",
|
||||||
|
" dict1['phone'] = sheet.cell(n, 9).value\n",
|
||||||
|
" if sheet.cell(n,8).value is not None:\n",
|
||||||
|
" dict1['id_num'] = sheet.cell(n,8).value\n",
|
||||||
|
" person[code] = dict1\n",
|
||||||
|
"print(len(person))\n",
|
||||||
|
"filename = 'data/杨庙恢复版信息.json'\n",
|
||||||
|
"with open(filename, 'w') as fl:\n",
|
||||||
|
" json.dump(person, fl, ensure_ascii=False,default=str)\n",
|
||||||
|
"print('ok')"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "d31fa9b7-26d8-4101-94d1-f41723428aa9",
|
"id": "d31fa9b7-26d8-4101-94d1-f41723428aa9",
|
||||||
@@ -21,9 +257,28 @@
|
|||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"id": "dc20aabb-3942-49b9-8841-8e8a0823033a",
|
"id": "dc20aabb-3942-49b9-8841-8e8a0823033a",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-03-24T14:39:51.668924Z",
|
||||||
|
"iopub.status.busy": "2023-03-24T14:39:51.668395Z",
|
||||||
|
"iopub.status.idle": "2023-03-24T14:39:51.935114Z",
|
||||||
|
"shell.execute_reply": "2023-03-24T14:39:51.933808Z",
|
||||||
|
"shell.execute_reply.started": "2023-03-24T14:39:51.668877Z"
|
||||||
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"59\n",
|
||||||
|
"108\n",
|
||||||
|
"389\n",
|
||||||
|
"268\n",
|
||||||
|
"270\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import openpyxl\n",
|
"import openpyxl\n",
|
||||||
"import json\n",
|
"import json\n",
|
||||||
@@ -64,9 +319,23 @@
|
|||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"id": "09a354e6-a07a-40b8-9b8c-3499fb0b7c28",
|
"id": "09a354e6-a07a-40b8-9b8c-3499fb0b7c28",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-03-24T14:39:29.249485Z",
|
||||||
|
"iopub.status.busy": "2023-03-24T14:39:29.248954Z"
|
||||||
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"(192, 190, 194, 195, 196, 197, 198, 18, 17, 16, 15, 14, 13, 12, 11, 9, 8, 7, 6, 5, 4, 436, 120, 121, 122, 124, 123, 130, 126, 133, 136, 135, 137, 138, 139, 140, 141, 142, 143, 144, 151, 150, 157, 158, 159, 160, 166, 167, 118, 117, 116, 115, 114, 111, 110, 109, 106, 105, 103, 102, 101, 100, 98, 96, 95, 94, 93, 90, 89, 88, 87, 86, 85, 83, 82, 80, 79, 77, 76, 230, 231, 237, 235, 233, 234, 239, 236, 238, 241, 243, 244, 242, 249, 256, 257, 258, 164, 165, 168, 162, 163, 74, 75, 73, 67, 59, 57, 56, 55, 53, 52, 49, 48, 47, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 31, 30, 29, 26, 25, 24, 23, 170, 172, 169, 171, 175, 179, 183, 184, 186, 187, 188, 289, 290, 293, 294, 296, 305, 307, 308, 306, 310, 309, 311, 312, 316, 203, 199, 202, 207, 209, 210, 214, 212, 211, 216, 218, 219, 220, 221, 226, 227, 222, 223, 229, 232, 398, 401, 399, 403, 405, 406, 407, 415, 416, 6002, 424, 430, 346, 349, 348, 353, 357, 355, 351, 356, 362, 363, 364, 365, 369, 368, 371, 373, 377, 379, 376, 372, 378, 382, 386, 387, 393, 392, 396, 400, 314, 317, 318, 324, 323, 322, 326, 325, 328, 331, 329, 330, 332, 334, 335, 336, 337, 333, 338, 339, 340, 341, 297, 343, 344, 259, 262, 264, 260, 265, 267, 272, 271, 274, 2734, 275, 277, 276, 280, 281, 284, 283, 282, 286, 288, 228, 345)\n",
|
||||||
|
"264\n",
|
||||||
|
"264\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import openpyxl\n",
|
"import openpyxl\n",
|
||||||
"import json\n",
|
"import json\n",
|
||||||
|
|||||||
Reference in new issue
Block a user