This commit is contained in:
512song committed 2023-04-02 12:46:21 +00:00
1 parent 84e02a4dad
commit 1a3c492710
1 file changed
+267 -152
+267 -152
View File
@@ -819,27 +819,12 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 28, "execution_count": null,
"id": "78109eb9-9c40-4289-b358-a68e64bb3361", "id": "78109eb9-9c40-4289-b358-a68e64bb3361",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2023-03-31T02:43:16.189320Z",
"iopub.status.busy": "2023-03-31T02:43:16.188583Z",
"iopub.status.idle": "2023-03-31T02:43:16.366939Z",
"shell.execute_reply": "2023-03-31T02:43:16.366217Z",
"shell.execute_reply.started": "2023-03-31T02:43:16.189279Z"
},
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"source": [ "source": [
"import json\n", "import json\n",
"import pymysql\n", "import pymysql\n",
@@ -938,27 +923,12 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 39, "execution_count": null,
"id": "ce028da4-2cb1-4ee2-b7f3-6f3cfcda1851", "id": "ce028da4-2cb1-4ee2-b7f3-6f3cfcda1851",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2023-04-01T06:57:41.564443Z",
"iopub.status.busy": "2023-04-01T06:57:41.563561Z",
"iopub.status.idle": "2023-04-01T06:57:41.638569Z",
"shell.execute_reply": "2023-04-01T06:57:41.637601Z",
"shell.execute_reply.started": "2023-04-01T06:57:41.564398Z"
},
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"source": [ "source": [
"import json\n", "import json\n",
"import pymysql\n", "import pymysql\n",
@@ -1022,127 +992,12 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 43, "execution_count": null,
"id": "e24a046e-77cd-4df2-af89-733d718ce543", "id": "e24a046e-77cd-4df2-af89-733d718ce543",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2023-04-01T08:19:19.843498Z",
"iopub.status.busy": "2023-04-01T08:19:19.842647Z",
"iopub.status.idle": "2023-04-01T08:19:20.066358Z",
"shell.execute_reply": "2023-04-01T08:19:20.065345Z",
"shell.execute_reply.started": "2023-04-01T08:19:19.843458Z"
},
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"file/140wenjuan/罗盖村/00010-盖会存.pdf\n",
"file/140wenjuan/北范村/00022-李同艳.pdf\n",
"file/140wenjuan/南范村/00027-张霞.pdf\n",
"file/140wenjuan/小街村/00028-盖玉娥.pdf\n",
"file/140wenjuan/小街村/00032-李梅.pdf\n",
"file/140wenjuan/罗盖村/00044-盖明月.pdf\n",
"file/140wenjuan/西韩村/00045-韩健康.pdf\n",
"file/140wenjuan/杨庙村/00046-蒋梅.pdf\n",
"file/140wenjuan/小街村/00051-王荣华.pdf\n",
"file/140wenjuan/东范村/00054-孙汉章.pdf\n",
"file/140wenjuan/南范村/00058-程大英.pdf\n",
"file/140wenjuan/未明确/00060-盖景华.pdf\n",
"file/140wenjuan/小街村/00061-薄遵兰.pdf\n",
"file/140wenjuan/未明确/00062-吕吉刚.pdf\n",
"file/140wenjuan/南范村/00063-王长征.pdf\n",
"file/140wenjuan/未明确/00064-刘小凤.pdf\n",
"file/140wenjuan/未明确/00065-许秀风.pdf\n",
"file/140wenjuan/杨庙村/00066-刘小玉.pdf\n",
"file/140wenjuan/杨庙村/00068-杨恩.pdf\n",
"file/140wenjuan/罗盖村/00069-臧小麦.pdf\n",
"file/140wenjuan/罗盖村/00070-陈秀玙.pdf\n",
"file/140wenjuan/南范村/00071-李爱花.pdf\n",
"file/140wenjuan/东范村/00072-张芳.pdf\n",
"file/140wenjuan/北范村/00078-赵收良.pdf\n",
"file/140wenjuan/东范村/00084-刘忠华.pdf\n",
"file/140wenjuan/西韩村/00091-刘学云.pdf\n",
"file/140wenjuan/杨庙村/00092-王六好.pdf\n",
"file/140wenjuan/北范村/00097-黄爱勇.pdf\n",
"file/140wenjuan/未明确/00099-周洪新.pdf\n",
"file/140wenjuan/西韩村/00104-刘云翠.pdf\n",
"file/140wenjuan/杨庙村/00107-程国利.pdf\n",
"file/140wenjuan/罗盖村/00113-程汝枝.pdf\n",
"file/140wenjuan/东范村/00127-孙小芹.pdf\n",
"file/140wenjuan/北范村/00132-崔新军.pdf\n",
"file/140wenjuan/未明确/00134-张荣俊.pdf\n",
"file/140wenjuan/未明确/00145-裴建美.pdf\n",
"file/140wenjuan/东范村/00146-张淑平.pdf\n",
"file/140wenjuan/未明确/00147-王海方.pdf\n",
"file/140wenjuan/未明确/00148-冯静静.pdf\n",
"file/140wenjuan/未明确/00149-盖梦娜.pdf\n",
"file/140wenjuan/新李村/00155-程好.pdf\n",
"file/140wenjuan/杨庙村/00156-李志娟.pdf\n",
"file/140wenjuan/前许村/00173-程兰兰.pdf\n",
"file/140wenjuan/宋王村/00174-程芳斌.pdf\n",
"file/140wenjuan/东范村/00177-胡环环.pdf\n",
"file/140wenjuan/南范村/00178-马翠苹.pdf\n",
"file/140wenjuan/新李村/00180-程秀芹.pdf\n",
"file/140wenjuan/杨庙村/00181-程云.pdf\n",
"file/140wenjuan/宋王村/00185-李新美.pdf\n",
"file/140wenjuan/后许村/00191-李建栋.pdf\n",
"file/140wenjuan/小街村/00193-樊风贤.pdf\n",
"file/140wenjuan/未明确/00200-李勇军.pdf\n",
"file/140wenjuan/罗盖村/00201-崔云花.pdf\n",
"file/140wenjuan/未明确/00208-王小冬.pdf\n",
"file/140wenjuan/未明确/00213-张金宗.pdf\n",
"file/140wenjuan/罗盖村/00217-刘学荣.pdf\n",
"file/140wenjuan/北范村/00240-赵小华.pdf\n",
"file/140wenjuan/小街村/00245-刘维康.pdf\n",
"file/140wenjuan/宋王村/00248-王联军.pdf\n",
"file/140wenjuan/小街村/00250-裴双双.pdf\n",
"file/140wenjuan/罗盖村/00251-高继梅.pdf\n",
"file/140wenjuan/罗盖村/00253-盖秀香.pdf\n",
"file/140wenjuan/罗盖村/00263-罗增海.pdf\n",
"file/140wenjuan/宋王村/00266-程友海.pdf\n",
"file/140wenjuan/罗盖村/00278-盖玉海.pdf\n",
"file/140wenjuan/小街村/00279-周立美.pdf\n",
"file/140wenjuan/杨庙村/00287-程新利.pdf\n",
"file/140wenjuan/罗盖村/00292-盖树强.pdf\n",
"file/140wenjuan/罗盖村/00295-程建美.pdf\n",
"file/140wenjuan/南范村/00303-王玉枝.pdf\n",
"file/140wenjuan/未明确/00313-王祝娥.pdf\n",
"file/140wenjuan/新李村/00315-盖学忠.pdf\n",
"file/140wenjuan/罗盖村/00319-张学敏.pdf\n",
"file/140wenjuan/罗盖村/00320-盖引.pdf\n",
"file/140wenjuan/前许村/00342-许建峰.pdf\n",
"file/140wenjuan/未明确/00347-刘慧丽.pdf\n",
"file/140wenjuan/南范村/00358-史景霞.pdf\n",
"file/140wenjuan/小街村/00360-刘德收.pdf\n",
"file/140wenjuan/宋王村/00361-张玉环.pdf\n",
"file/140wenjuan/宋王村/00370-张英.pdf\n",
"file/140wenjuan/前许村/00374-李其珍.pdf\n",
"file/140wenjuan/新李村/00381-张玉香.pdf\n",
"file/140wenjuan/未明确/00383-张向明.pdf\n",
"file/140wenjuan/东范村/00402-张立业.pdf\n",
"file/140wenjuan/北范村/00404-何大英.pdf\n",
"file/140wenjuan/前许村/00411-许广新.pdf\n",
"file/140wenjuan/宋王村/00412-程海峰.pdf\n",
"file/140wenjuan/罗盖村/00414-李梅.pdf\n",
"file/140wenjuan/南范村/00417-张玉娟.pdf\n",
"file/140wenjuan/东范村/00420-马燕辉.pdf\n",
"file/140wenjuan/小街村/00421-刘云霄.pdf\n",
"file/140wenjuan/东范村/00423-崔云卿.pdf\n",
"file/140wenjuan/南范村/00427-高俊臣.pdf\n",
"file/140wenjuan/宋王村/00429-董丽娜.pdf\n",
"file/140wenjuan/宋王村/00433-程军花.pdf\n",
"file/140wenjuan/北范村/00434-王保芹.pdf\n",
"file/140wenjuan/小街村/00435-崔娟.pdf\n",
"file/140wenjuan/小街村/00437-刘华训.pdf\n",
"file/140wenjuan/未明确/06000-车呈淼.pdf\n",
"file/140wenjuan/未明确/06001-苏莎莎.pdf\n",
"file/140wenjuan/未明确/98765-张红霞.pdf\n"
]
}
],
"source": [ "source": [
"import os,sys,shutil\n", "import os,sys,shutil\n",
"import json\n", "import json\n",
@@ -1191,10 +1046,270 @@
" print(n_name)" " print(n_name)"
] ]
}, },
{
"cell_type": "markdown",
"id": "387b5c35-886a-41dc-b787-f67154efa758",
"metadata": {},
"source": [
"# 杨庙社区处方分组"
]
},
{
"cell_type": "markdown",
"id": "b8dafd4a-2bd4-4626-b8a8-45ae9cbe7177",
"metadata": {},
"source": [
"## 人员分组"
]
},
{
"cell_type": "markdown",
"id": "bc731911-3390-4c5e-bccf-fc7c367e1172",
"metadata": {},
"source": [
"### 高血压人员"
]
},
{
"cell_type": "code",
"execution_count": 60,
"id": "5d24953d-4ded-4e1c-911c-a0baab222399",
"metadata": {
"execution": {
"iopub.execute_input": "2023-04-01T09:44:43.894749Z",
"iopub.status.busy": "2023-04-01T09:44:43.893902Z",
"iopub.status.idle": "2023-04-01T09:44:44.014089Z",
"shell.execute_reply": "2023-04-01T09:44:44.013281Z",
"shell.execute_reply.started": "2023-04-01T09:44:43.894709Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['437', '422', '417', '416', '415', '403', '399', '397', '393', '392', '389', '387', '382', '377', '376', '371', '365', '364', '362', '361', '357', '355', '353', '351', '349', '346', '345', '344', '340', '335', '333', '332', '330', '329', '328', '326', '323', '322', '317', '315', '314', '309', '306', '305', '294', '293', '291', '282', '281', '279', '278', '277', '276', '274', '273', '272', '271', '270', '265', '264', '262', '261', '259', '258', '256', '239', '236', '223', '221', '219', '214', '213', '212', '209', '208', '191', '188', '187', '186', '183', '179', '174', '172', '168', '167', '166', '164', '162', '160', '157', '156', '140', '139', '138', '137', '136', '135', '127', '124', '123', '122', '121', '116', '115', '111', '110', '106', '103', '100', '98', '97', '96', '95', '94', '89', '76', '74', '73', '58', '53', '52', '46', '42', '41', '40', '39', '35', '34', '30', '28', '26', '25', '23', '16', '13', '12', '11', '8', '6', '5']\n"
]
}
],
"source": [
"import os,sys,shutil\n",
"import json\n",
"import math\n",
"\n",
"filename = 'data/杨庙体测明确人员信息(20230328).json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"wb = openpyxl.load_workbook('data/杨庙运动风险筛查统计表.xlsx')\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"\n",
"list_gxy = []\n",
"\n",
"for n in range(2,sheet.max_row+1):\n",
" code = sheet.cell(n, 1).value\n",
" if sheet.cell(n, 3).value is not None:\n",
" code = sheet.cell(n, 1).value\n",
" gxy = sheet.cell(n, 3).value\n",
" if str(code) in dict1.keys() and int(gxy) ==1:\n",
" list_gxy.append(str(code))\n",
"print(list_gxy)\n"
]
},
{
"cell_type": "markdown",
"id": "a1f4ee17-4a47-4b46-a139-92e25c363a82",
"metadata": {
"execution": {
"iopub.execute_input": "2023-04-01T09:22:21.145580Z",
"iopub.status.busy": "2023-04-01T09:22:21.145166Z",
"iopub.status.idle": "2023-04-01T09:22:21.150015Z",
"shell.execute_reply": "2023-04-01T09:22:21.148725Z",
"shell.execute_reply.started": "2023-04-01T09:22:21.145552Z"
},
"tags": []
},
"source": [
"### 失眠人员"
]
},
{
"cell_type": "code",
"execution_count": 55,
"id": "efa10ba4-0a27-41e6-beb7-27de8f3109a1",
"metadata": {
"execution": {
"iopub.execute_input": "2023-04-01T09:40:25.949400Z",
"iopub.status.busy": "2023-04-01T09:40:25.948559Z",
"iopub.status.idle": "2023-04-01T09:40:26.009374Z",
"shell.execute_reply": "2023-04-01T09:40:26.008325Z",
"shell.execute_reply.started": "2023-04-01T09:40:25.949359Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['134', '147', '177', '181', '185', '193', '200', '201', '208', '213', '251', '263', '292', '320', '347', '358', '374', '383', '410', '435', '434', '437', '433', '155', '113', '108', '97', '92', '245', '71', '70', '69', '65', '64', '60', '58', '54', '32', '180', '217', '411', '414', '370', '381', '389', '270', '278', '192', '190', '196', '17', '13', '12', '11', '5', '4', '436', '121', '122', '124', '133', '137', '138', '141', '142', '143', '150', '157', '158', '160', '167', '115', '114', '111', '103', '96', '94', '93', '89', '87', '85', '83', '79', '77', '233', '234', '236', '74', '73', '59', '55', '53', '52', '49', '48', '47', '43', '42', '35', '34', '26', '23', '172', '171', '175', '186', '289', '290', '294', '310', '309', '316', '199', '202', '207', '209', '210', '211', '219', '222', '223', '229', '415', '6002', '346', '349', '357', '362', '363', '365', '369', '371', '373', '379', '376', '372', '378', '393', '400', '314', '324', '323', '328', '330', '332', '334', '343', '259', '267', '271', '273', '277', '276', '282', '345']\n"
]
}
],
"source": [
"import json\n",
"import pymysql\n",
"\n",
"filename = 'data/杨庙体测明确人员信息(20230328).json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"#print(dict1)\n",
"\n",
"db = pymysql.connect(host = \"localhost\",user = \"songyi\",password = \"yylzs\",database = \"ydyb\" )\n",
"cursor = db.cursor()\n",
"sql = 'SELECT a.phone ,a.name,a.code,a.data FROM Survey as a WHERE a.surveyId =\"merge1\"'\n",
"cursor.execute(sql)\n",
"results = cursor.fetchall()\n",
"list_sm =[]\n",
"for result in results:\n",
" c=json.loads(result[3])\n",
" if 'qv7' in c.keys() and c['qv7'] ==1:\n",
" if result[2] is None:\n",
" phone = result[0]\n",
" for k,v in dict1.items():\n",
" if 'phone' in v.keys() and phone ==v['phone']:\n",
" list_sm.append(k) \n",
" else:\n",
" list_sm.append(result[2])\n",
"print(list_sm)"
]
},
{
"cell_type": "markdown",
"id": "0830d7d4-958d-4166-a439-9a6bfca2cf18",
"metadata": {},
"source": [
"### 脊柱调理人员"
]
},
{
"cell_type": "code",
"execution_count": 69,
"id": "e5bd9e8c-00f5-48b7-8cc7-810316e0423b",
"metadata": {
"execution": {
"iopub.execute_input": "2023-04-01T11:11:09.553748Z",
"iopub.status.busy": "2023-04-01T11:11:09.553341Z",
"iopub.status.idle": "2023-04-01T11:11:09.598656Z",
"shell.execute_reply": "2023-04-01T11:11:09.597753Z",
"shell.execute_reply.started": "2023-04-01T11:11:09.553720Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['107', '127', '134', '147', '146', '161', '177', '181', '185', '193', '200', '201', '208', '213', '251', '263', '292', '295', '313', '319', '320', '98765', '342', '360', '358', '359', '374', '6000', '6003', '423', '435', '434', '155', '156', '113', '108', '104', '245', '253', '71', '70', '69', '66', '65', '64', '63', '61', '58', '54', '46', '45', '32', '174', '180', '404', '411', '414', '427', '361', '381', '268', '266', '270', '417', '303', '192', '190', '194', '195', '196', '17', '16', '13', '12', '11', '9', '8', '7', '6', '5', '4', '436', '121', '122', '124', '123', '130', '126', '133', '136', '135', '137', '139', '140', '142', '143', '144', '151', '150', '157', '158', '159', '160', '166', '118', '117', '116', '115', '111', '110', '109', '103', '101', '98', '96', '95', '94', '89', '88', '87', '86', '83', '82', '80', '79', '77', '231', '237', '233', '234', '239', '236', '243', '244', '242', '256', '257', '258', '164', '163', '74', '75', '67', '59', '57', '56', '53', '52', '49', '48', '47', '43', '41', '40', '37', '36', '35', '34', '33', '31', '30', '26', '25', '24', '23', '172', '171', '175', '179', '183', '186', '187', '188', '289', '290', '293', '294', '296', '305', '308', '310', '309', '316', '203', '199', '202', '207', '214', '211', '219', '221', '222', '223', '229', '401', '399', '403', '406', '415', '6002', '430', '346', '349', '348', '353', '357', '355', '351', '362', '364', '365', '369', '368', '371', '373', '377', '379', '376', '372', '378', '382', '386', '393', '392', '396', '400', '314', '318', '323', '322', '326', '325', '328', '331', '330', '332', '334', '335', '337', '333', '344', '259', '262', '264', '260', '265', '267', '272', '271', '273', '275', '277', '276', '281', '283', '282', '286', '345']\n"
]
}
],
"source": [
"import json\n",
"import pymysql\n",
"\n",
"filename = 'data/杨庙体测明确人员信息(20230328).json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"#print(dict1)\n",
"\n",
"db = pymysql.connect(host = \"localhost\",user = \"songyi\",password = \"yylzs\",database = \"ydyb\" )\n",
"cursor = db.cursor()\n",
"sql = 'SELECT a.phone ,a.name,a.code,a.data FROM Survey as a WHERE a.surveyId =\"merge1\"'\n",
"cursor.execute(sql)\n",
"results = cursor.fetchall()\n",
"list_jz =[]\n",
"for result in results:\n",
" c=json.loads(result[3])\n",
" if ('qv1' in c.keys() and c['qv1'] ==1) or ('qv18' in c.keys() and c['qv18'] ==1):\n",
" if result[2] is None:\n",
" phone = result[0]\n",
" for k,v in dict1.items():\n",
" if 'phone' in v.keys() and phone ==v['phone']:\n",
" list_jz.append(k) \n",
" else:\n",
" list_jz.append(result[2])\n",
"print(list_jz)"
]
},
{
"cell_type": "code",
"execution_count": 70,
"id": "4c02f3b9-6677-4114-9fd9-f9d8bccaefe0",
"metadata": {
"execution": {
"iopub.execute_input": "2023-04-01T11:11:18.106136Z",
"iopub.status.busy": "2023-04-01T11:11:18.105295Z",
"iopub.status.idle": "2023-04-01T11:11:18.196768Z",
"shell.execute_reply": "2023-04-01T11:11:18.195822Z",
"shell.execute_reply.started": "2023-04-01T11:11:18.106095Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'高血压': ['437', '422', '417', '416', '415', '403', '399', '397', '393', '392', '389', '387', '382', '377', '376', '371', '365', '364', '362', '361', '357', '355', '353', '351', '349', '346', '345', '344', '340', '335', '333', '332', '330', '329', '328', '326', '323', '322', '317', '315', '314', '309', '306', '305', '294', '293', '291', '282', '281', '279', '278', '277', '276', '274', '273', '272', '271', '270', '265', '264', '262', '261', '259', '258', '256', '239', '236', '223', '221', '219', '214', '213', '212', '209', '208', '191', '188', '187', '186', '183', '179', '174', '172', '168', '167', '166', '164', '162', '160', '157', '156', '140', '139', '138', '137', '136', '135', '127', '124', '123', '122', '121', '116', '115', '111', '110', '106', '103', '100', '98', '97', '96', '95', '94', '89', '76', '74', '73', '58', '53', '52', '46', '42', '41', '40', '39', '35', '34', '30', '28', '26', '25', '23', '16', '13', '12', '11', '8', '6', '5'], '失眠': ['134', '147', '177', '181', '185', '193', '200', '201', '251', '263', '292', '320', '347', '358', '374', '383', '410', '435', '434', '433', '155', '113', '108', '92', '245', '71', '70', '69', '65', '64', '60', '54', '32', '180', '217', '411', '414', '370', '381', '192', '190', '196', '17', '4', '436', '133', '141', '142', '143', '150', '158', '114', '93', '87', '85', '83', '79', '77', '233', '234', '59', '55', '49', '48', '47', '43', '171', '175', '289', '290', '310', '316', '199', '202', '207', '210', '211', '222', '229', '6002', '363', '369', '373', '379', '372', '378', '400', '324', '334', '343', '267'], '脊柱调理': ['107', '146', '161', '295', '313', '319', '98765', '342', '360', '359', '6000', '6003', '423', '104', '253', '66', '63', '61', '45', '404', '427', '268', '266', '303', '194', '195', '9', '7', '130', '126', '144', '151', '159', '118', '117', '109', '101', '88', '86', '82', '80', '231', '237', '243', '244', '242', '257', '163', '75', '67', '57', '56', '37', '36', '33', '31', '24', '296', '308', '203', '401', '406', '430', '348', '368', '386', '396', '318', '325', '331', '337', '260', '275', '283', '286'], '整体调理': ['2', '3', '10', '15', '18', '22', '27', '29', '38', '44', '51', '62', '68', '72', '78', '81', '84', '90', '91', '99', '105', '112', '119', '120', '128', '129', '132', '145', '148', '149', '152', '153', '154', '165', '169', '170', '173', '176', '178', '184', '189', '197', '198', '204', '205', '206', '215', '216', '218', '220', '224', '225', '227', '228', '235', '238', '240', '241', '248', '249', '250', '255', '269', '284', '285', '287', '297', '301', '302', '307', '321', '327', '336', '352', '354', '356', '375', '391', '394', '395', '402', '405', '407', '408', '412', '418', '419', '420', '421', '424', '429', '431', '432', '6001', '98776']}\n",
"ok!\n"
]
}
],
"source": [
"dict2 = {}\n",
"dict2.setdefault('高血压',[])\n",
"dict2['高血压'] = list_gxy\n",
"dict2.setdefault('失眠',[])\n",
"for item in list_sm:\n",
" if item not in list_gxy:\n",
" dict2['失眠'].append(item)\n",
"\n",
"dict2.setdefault('脊柱调理',[])\n",
"for item in list_jz:\n",
" if item not in list_gxy and item not in list_sm:\n",
" dict2['脊柱调理'].append(item)\n",
"\n",
"list_other = []\n",
"for item in dict1.keys():\n",
" if item not in list_gxy and item not in list_sm and item not in list_jz:\n",
" list_other.append(item)\n",
"dict2['整体调理'] = list_other\n",
"print(dict2)\n",
"list1 = []\n",
"for k, v in dict2.items():\n",
" for item in v:\n",
" list2 = [k,item,dict1[item]['name'],dict1[item]['sex'],dict1[item]['birth'],dict1[item]['unit']]\n",
" list1.append(list2)\n",
"filename = 'data/杨庙社区分组情况表.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!') \n",
" "
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "5c6d5e6c-a8a6-457d-979c-3e990bdecc54", "id": "0077bd98-5a26-4543-a262-c66f419b6db3",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []