20241014
This commit is contained in:
1 parent
4455c45565
commit
1473d61c69
2 files changed
+268
-81
No files matched your search
+29
-5
@@ -853,10 +853,26 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 46,
|
||||||
"id": "096e2b97-b83c-46bb-a070-c816e47da331",
|
"id": "096e2b97-b83c-46bb-a070-c816e47da331",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
"outputs": [],
|
"execution": {
|
||||||
|
"iopub.execute_input": "2024-10-12T07:01:48.471770Z",
|
||||||
|
"iopub.status.busy": "2024-10-12T07:01:48.471014Z",
|
||||||
|
"iopub.status.idle": "2024-10-12T07:01:48.503168Z",
|
||||||
|
"shell.execute_reply": "2024-10-12T07:01:48.502646Z",
|
||||||
|
"shell.execute_reply.started": "2024-10-12T07:01:48.471700Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"ok\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import openpyxl\n",
|
"import openpyxl\n",
|
||||||
"import json\n",
|
"import json\n",
|
||||||
@@ -964,9 +980,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 47,
|
||||||
"id": "808e65e9-a9e3-44ea-9c0b-359375dceb3d",
|
"id": "808e65e9-a9e3-44ea-9c0b-359375dceb3d",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2024-10-12T07:02:11.291002Z",
|
||||||
|
"iopub.status.busy": "2024-10-12T07:02:11.290225Z",
|
||||||
|
"iopub.status.idle": "2024-10-12T07:02:11.324427Z",
|
||||||
|
"shell.execute_reply": "2024-10-12T07:02:11.323742Z",
|
||||||
|
"shell.execute_reply.started": "2024-10-12T07:02:11.290926Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
|
|||||||
+239
-76
@@ -431,15 +431,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 23,
|
"execution_count": 27,
|
||||||
"id": "3e614f4a-a623-48e2-97f8-b31f62c9a983",
|
"id": "3e614f4a-a623-48e2-97f8-b31f62c9a983",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2024-10-11T07:48:39.710342Z",
|
"iopub.execute_input": "2024-10-12T07:02:02.593487Z",
|
||||||
"iopub.status.busy": "2024-10-11T07:48:39.709657Z",
|
"iopub.status.busy": "2024-10-12T07:02:02.592731Z",
|
||||||
"iopub.status.idle": "2024-10-11T07:48:39.737255Z",
|
"iopub.status.idle": "2024-10-12T07:02:02.619016Z",
|
||||||
"shell.execute_reply": "2024-10-11T07:48:39.736634Z",
|
"shell.execute_reply": "2024-10-12T07:02:02.618495Z",
|
||||||
"shell.execute_reply.started": "2024-10-11T07:48:39.710281Z"
|
"shell.execute_reply.started": "2024-10-12T07:02:02.593410Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -544,15 +544,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 24,
|
"execution_count": 28,
|
||||||
"id": "141b30dc-5975-4dcb-9bc3-9b20d26a0917",
|
"id": "141b30dc-5975-4dcb-9bc3-9b20d26a0917",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2024-10-11T07:48:42.774725Z",
|
"iopub.execute_input": "2024-10-12T07:02:05.510384Z",
|
||||||
"iopub.status.busy": "2024-10-11T07:48:42.773914Z",
|
"iopub.status.busy": "2024-10-12T07:02:05.509618Z",
|
||||||
"iopub.status.idle": "2024-10-11T07:48:42.795168Z",
|
"iopub.status.idle": "2024-10-12T07:02:05.530837Z",
|
||||||
"shell.execute_reply": "2024-10-11T07:48:42.794010Z",
|
"shell.execute_reply": "2024-10-12T07:02:05.530388Z",
|
||||||
"shell.execute_reply.started": "2024-10-11T07:48:42.774652Z"
|
"shell.execute_reply.started": "2024-10-12T07:02:05.510309Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -699,15 +699,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 19,
|
"execution_count": 29,
|
||||||
"id": "b123ee6b-85d2-4660-b226-321832a6b796",
|
"id": "b123ee6b-85d2-4660-b226-321832a6b796",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2024-10-11T07:25:22.814095Z",
|
"iopub.execute_input": "2024-10-12T07:02:48.877755Z",
|
||||||
"iopub.status.busy": "2024-10-11T07:25:22.812877Z",
|
"iopub.status.busy": "2024-10-12T07:02:48.876986Z",
|
||||||
"iopub.status.idle": "2024-10-11T07:26:04.375164Z",
|
"iopub.status.idle": "2024-10-12T07:03:30.738007Z",
|
||||||
"shell.execute_reply": "2024-10-11T07:26:04.373942Z",
|
"shell.execute_reply": "2024-10-12T07:03:30.736951Z",
|
||||||
"shell.execute_reply.started": "2024-10-11T07:25:22.814016Z"
|
"shell.execute_reply.started": "2024-10-12T07:02:48.877680Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -876,15 +876,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 26,
|
"execution_count": 30,
|
||||||
"id": "d913a531-51b3-4795-adc3-f4fc858d7401",
|
"id": "d913a531-51b3-4795-adc3-f4fc858d7401",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2024-10-11T07:54:08.868059Z",
|
"iopub.execute_input": "2024-10-12T07:07:42.539946Z",
|
||||||
"iopub.status.busy": "2024-10-11T07:54:08.867441Z",
|
"iopub.status.busy": "2024-10-12T07:07:42.539191Z",
|
||||||
"iopub.status.idle": "2024-10-11T07:54:08.898253Z",
|
"iopub.status.idle": "2024-10-12T07:07:42.573754Z",
|
||||||
"shell.execute_reply": "2024-10-11T07:54:08.897678Z",
|
"shell.execute_reply": "2024-10-12T07:07:42.573156Z",
|
||||||
"shell.execute_reply.started": "2024-10-11T07:54:08.867998Z"
|
"shell.execute_reply.started": "2024-10-12T07:07:42.539874Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -895,8 +895,8 @@
|
|||||||
"import glob\n",
|
"import glob\n",
|
||||||
"from pathlib import Path\n",
|
"from pathlib import Path\n",
|
||||||
"\n",
|
"\n",
|
||||||
"fi_path = '/home/songyi/pdf-typescript/中石化石油工程设计有限公司'\n",
|
"fi_path = '/home/songyi/pdf-typescript/中石化石油工程设计有限公司1'\n",
|
||||||
"new_path = 'file/中石化石油工程设计有限公司'\n",
|
"new_path = 'file/中石化石油工程设计有限公司1'\n",
|
||||||
"old = []\n",
|
"old = []\n",
|
||||||
"dict2 = {}\n",
|
"dict2 = {}\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -1596,15 +1596,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 3,
|
"execution_count": 31,
|
||||||
"id": "46aa847d-e1fe-45bd-85b6-e2d792ec8842",
|
"id": "46aa847d-e1fe-45bd-85b6-e2d792ec8842",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2024-07-22T10:43:23.301125Z",
|
"iopub.execute_input": "2024-10-14T04:27:15.625845Z",
|
||||||
"iopub.status.busy": "2024-07-22T10:43:23.300375Z",
|
"iopub.status.busy": "2024-10-14T04:27:15.625079Z",
|
||||||
"iopub.status.idle": "2024-07-22T10:43:23.317400Z",
|
"iopub.status.idle": "2024-10-14T04:27:15.648163Z",
|
||||||
"shell.execute_reply": "2024-07-22T10:43:23.316420Z",
|
"shell.execute_reply": "2024-10-14T04:27:15.647247Z",
|
||||||
"shell.execute_reply.started": "2024-07-22T10:43:23.301053Z"
|
"shell.execute_reply.started": "2024-10-14T04:27:15.625772Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -1621,7 +1621,7 @@
|
|||||||
"import openpyxl\n",
|
"import openpyxl\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"filename = 'data/result_青海all.json'\n",
|
"filename = 'data/result_东营工程设计院2024.json'\n",
|
||||||
"with open(filename,'r') as fl:\n",
|
"with open(filename,'r') as fl:\n",
|
||||||
" dict1 = json.load(fl)\n",
|
" dict1 = json.load(fl)\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -1674,7 +1674,7 @@
|
|||||||
" mydata['score'] = round(score/len(mydata['fits']),2)\n",
|
" mydata['score'] = round(score/len(mydata['fits']),2)\n",
|
||||||
" if len(mydata['fits']) >2:\n",
|
" if len(mydata['fits']) >2:\n",
|
||||||
" dict2[str(k)] = mydata\n",
|
" dict2[str(k)] = mydata\n",
|
||||||
"filename = f'data/data_青海.json'\n",
|
"filename = f'data/data_东营工程设计院2024.json'\n",
|
||||||
"with open(filename,'w') as fl:\n",
|
"with open(filename,'w') as fl:\n",
|
||||||
" json.dump(dict2,fl , ensure_ascii=False) \n",
|
" json.dump(dict2,fl , ensure_ascii=False) \n",
|
||||||
"print('ok!') "
|
"print('ok!') "
|
||||||
@@ -1690,15 +1690,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 4,
|
"execution_count": 32,
|
||||||
"id": "63edd636-f034-4aa6-8575-63d5cdb84adb",
|
"id": "63edd636-f034-4aa6-8575-63d5cdb84adb",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2024-07-22T10:43:52.390906Z",
|
"iopub.execute_input": "2024-10-14T04:27:43.990332Z",
|
||||||
"iopub.status.busy": "2024-07-22T10:43:52.390136Z",
|
"iopub.status.busy": "2024-10-14T04:27:43.989558Z",
|
||||||
"iopub.status.idle": "2024-07-22T10:43:52.398533Z",
|
"iopub.status.idle": "2024-10-14T04:27:44.001359Z",
|
||||||
"shell.execute_reply": "2024-07-22T10:43:52.398018Z",
|
"shell.execute_reply": "2024-10-14T04:27:44.000019Z",
|
||||||
"shell.execute_reply.started": "2024-07-22T10:43:52.390839Z"
|
"shell.execute_reply.started": "2024-10-14T04:27:43.990257Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -1707,15 +1707,15 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"平均成绩:2.9632分,男性:22人\n",
|
"平均成绩:2.7852分,男性:44人\n",
|
||||||
"平均成绩:3.272分,女性:5人\n",
|
"平均成绩:3.1184分,女性:32人\n",
|
||||||
"平均成绩:3.0204分,总体:27人\n"
|
"平均成绩:2.9255分,总体:76人\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
|
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
|
||||||
"filename = 'data/data_青海.json'\n",
|
"filename = 'data/data_东营工程设计院2024.json'\n",
|
||||||
"with open(filename,'r') as fl:\n",
|
"with open(filename,'r') as fl:\n",
|
||||||
" dict1 = json.load(fl) \n",
|
" dict1 = json.load(fl) \n",
|
||||||
"i = 1\n",
|
"i = 1\n",
|
||||||
@@ -2262,7 +2262,7 @@
|
|||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"# 体质报告在线管理"
|
"# 问卷数据处理分析"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2270,27 +2270,130 @@
|
|||||||
"id": "1485fc89-4fc2-437d-a29e-b4a0aab12aa0",
|
"id": "1485fc89-4fc2-437d-a29e-b4a0aab12aa0",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"## 新增体测单位"
|
"## 常用参数及自定义函数"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"id": "cf345bf0-f11b-459e-9b69-b2843836f6f3",
|
"id": "6f9768ce-2ef5-4253-9fc6-49dbdcf00a19",
|
||||||
"metadata": {
|
"metadata": {},
|
||||||
"tags": []
|
|
||||||
},
|
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"import pymongo\n",
|
"import json\n",
|
||||||
"\n",
|
"\n",
|
||||||
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
"questions = [\n",
|
||||||
"mydb = myclient[\"baogao\"]\n",
|
" [1],\n",
|
||||||
"mycol = mydb[\"place\"]\n",
|
" [-1, 2],\n",
|
||||||
|
" [-1, 2],\n",
|
||||||
|
" [-1, 8],\n",
|
||||||
|
" [-1, 3],\n",
|
||||||
|
" [1],\n",
|
||||||
|
" [-1],\n",
|
||||||
|
" [-1, 7],\n",
|
||||||
|
" [2],\n",
|
||||||
|
" [2],\n",
|
||||||
|
" [2],\n",
|
||||||
|
" [2, 3],\n",
|
||||||
|
" [2],\n",
|
||||||
|
" [2],\n",
|
||||||
|
" [3],\n",
|
||||||
|
" [3],\n",
|
||||||
|
" [3],\n",
|
||||||
|
" [3],\n",
|
||||||
|
" [3],\n",
|
||||||
|
" [4],\n",
|
||||||
|
" [4],\n",
|
||||||
|
" [4],\n",
|
||||||
|
" [4],\n",
|
||||||
|
" [4],\n",
|
||||||
|
" [4],\n",
|
||||||
|
" [4],\n",
|
||||||
|
" [4],\n",
|
||||||
|
" [5],\n",
|
||||||
|
" [5],\n",
|
||||||
|
" [5],\n",
|
||||||
|
" [5],\n",
|
||||||
|
" [5],\n",
|
||||||
|
" [5],\n",
|
||||||
|
" [5],\n",
|
||||||
|
" [5],\n",
|
||||||
|
" [6],\n",
|
||||||
|
" [6],\n",
|
||||||
|
" [6],\n",
|
||||||
|
" [6],\n",
|
||||||
|
" [6],\n",
|
||||||
|
" [6],\n",
|
||||||
|
" [7],\n",
|
||||||
|
" [7],\n",
|
||||||
|
" [7],\n",
|
||||||
|
" [7],\n",
|
||||||
|
" [7],\n",
|
||||||
|
" [7],\n",
|
||||||
|
" [8],\n",
|
||||||
|
" [8],\n",
|
||||||
|
" [8],\n",
|
||||||
|
" [8],\n",
|
||||||
|
" [8],\n",
|
||||||
|
" [8],\n",
|
||||||
|
" [9],\n",
|
||||||
|
" [9],\n",
|
||||||
|
" [9],\n",
|
||||||
|
" [9],\n",
|
||||||
|
" [9],\n",
|
||||||
|
" [9],\n",
|
||||||
|
" [9]\n",
|
||||||
|
"]\n",
|
||||||
"\n",
|
"\n",
|
||||||
"mydict = { \"id\": \"469849\",\"name\": \"长炼医院\", }\n",
|
"kinds = [\n",
|
||||||
" \n",
|
" '平和',\n",
|
||||||
"x = mycol.insert_one(mydict) "
|
" '气虚',\n",
|
||||||
|
" '阳虚',\n",
|
||||||
|
" '阴虚',\n",
|
||||||
|
" '痰湿',\n",
|
||||||
|
" '湿热',\n",
|
||||||
|
" '血瘀',\n",
|
||||||
|
" '气郁',\n",
|
||||||
|
" '特禀'\n",
|
||||||
|
"]\n",
|
||||||
|
"\n",
|
||||||
|
"def tcm_calc(arr):\n",
|
||||||
|
" qa = [8, 8, 7, 8, 8, 6, 7, 7, 7]\n",
|
||||||
|
" # 成绩数组\n",
|
||||||
|
" s = [0] * 9\n",
|
||||||
|
" # 遍历五进制\n",
|
||||||
|
" for i in range(len(questions)):\n",
|
||||||
|
" m = arr[i] - 1\n",
|
||||||
|
" for v in questions[i]:\n",
|
||||||
|
" if v < 0:\n",
|
||||||
|
" s[-v - 1] += 4 - m\n",
|
||||||
|
" else:\n",
|
||||||
|
" s[v - 1] += m\n",
|
||||||
|
" return [int((v / qa[i]) * 25) for i, v in enumerate(s)]\n",
|
||||||
|
"\n",
|
||||||
|
"def tcm_kind(score):\n",
|
||||||
|
" kind = 0\n",
|
||||||
|
" near = False\n",
|
||||||
|
" max_kind = 0\n",
|
||||||
|
" max_score = 0\n",
|
||||||
|
" for i in range(1, 9):\n",
|
||||||
|
" if score[i] > max_score:\n",
|
||||||
|
" max_kind = i\n",
|
||||||
|
" max_score = score[i]\n",
|
||||||
|
" if score[0] >= 60 and max_score < 40:\n",
|
||||||
|
" if max_score >= 30:\n",
|
||||||
|
" near = True\n",
|
||||||
|
" kind = max_kind\n",
|
||||||
|
" else:\n",
|
||||||
|
" kind = max_kind\n",
|
||||||
|
" return {\n",
|
||||||
|
" \"kind\": kind,\n",
|
||||||
|
" \"near\": near\n",
|
||||||
|
" }\n",
|
||||||
|
"list2 = ['成就感','愉快心境','放松程度','压力应对','体力充沛','情感充沛度']\n",
|
||||||
|
"list3 = [[5,7],[7,4],[7,4],[7,4],[8,1],[6,1]] \n",
|
||||||
|
"list4 = ['颈椎','胸椎','腰椎','骶尾椎']\n",
|
||||||
|
"list5 = [[0,10,10],[10,17,7],[17,24,6],[24,26,2]]"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2298,7 +2401,7 @@
|
|||||||
"id": "df2d18e2-d2e4-499e-876a-59d8550a8201",
|
"id": "df2d18e2-d2e4-499e-876a-59d8550a8201",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"## 新增报告信息"
|
"## 计算中医体质"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2310,15 +2413,32 @@
|
|||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"import pymongo\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
"filename = 'data/result_东营工程设计院2024_all.json'\n",
|
||||||
"mydb = myclient[\"baogao\"]\n",
|
"with open(filename,'r') as fl:\n",
|
||||||
"mycol = mydb[\"pdf\"]\n",
|
" dict1 = json.load(fl) \n",
|
||||||
|
"i = 1\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" if 'tcm' in v.keys():\n",
|
||||||
|
" list1 = []\n",
|
||||||
|
" tcm =v['tcm']\n",
|
||||||
|
" for item in tcm:\n",
|
||||||
|
" list1.append(item)\n",
|
||||||
|
" score = tcm_calc(list1)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"mydict = { \"place\": \"714309\",\"code\":\"4\",\"name\": \"朱维\", }\n",
|
" result = tcm_kind(score)\n",
|
||||||
" \n",
|
" kind = result['kind']\n",
|
||||||
"x = mycol.insert_one(mydict) "
|
" near = result['near']\n",
|
||||||
|
" print(i,k,kinds[kind], near, score)\n",
|
||||||
|
" i+=1"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "cfb5661f-fd37-4372-9d22-3708d61680f9",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 计算心理"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2330,25 +2450,68 @@
|
|||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"import pymongo\n",
|
"list2 = ['成就感','愉快心境','放松程度','压力应对','体力充沛','情感充沛度']\n",
|
||||||
"\n",
|
"list3 = [[5,7],[7,4],[7,4],[7,4],[8,1],[6,1]]\n",
|
||||||
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
"qb = [\n",
|
||||||
"mydb = myclient[\"baogao\"]\n",
|
" 1, 1, 1, 1, 1,\n",
|
||||||
"mycol = mydb[\"pdf\"]\n",
|
" 4, 3, 2, 3, 2, 4, 3,\n",
|
||||||
"\n",
|
" 4, 3, 2, 4, 4, 2, 4,\n",
|
||||||
"mydict = { \"place\": \"714309\",\"code\":\"4\",\"name\": \"朱维\", }\n",
|
" 3, 2, 2, 4, 3, 3, 2,\n",
|
||||||
|
" 5, 5, 5, 5, 5, 5, 5, 5,\n",
|
||||||
|
" 6, 6, 6, 6, 6, 6\n",
|
||||||
|
" ]\n",
|
||||||
|
"filename = 'data/result_青海all_2.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl) \n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" if 'psy' in v.keys():\n",
|
||||||
|
" psy=v['psy']\n",
|
||||||
|
" for i in range(26,40):\n",
|
||||||
|
" new_valve = psy[i]-1\n",
|
||||||
|
" psy[i] = new_valve\n",
|
||||||
|
" dict3 = {}\n",
|
||||||
" \n",
|
" \n",
|
||||||
"x = mycol.find_one(mydict) \n",
|
" i = 0\n",
|
||||||
"print(x)"
|
" for item in qb:\n",
|
||||||
|
" dict3.setdefault(item,0)\n",
|
||||||
|
" dict3[item] +=psy[i]\n",
|
||||||
|
" i+=1\n",
|
||||||
|
" print(dict3)\n",
|
||||||
|
" print(k)\n",
|
||||||
|
" for i in range(0,6):\n",
|
||||||
|
" score = int(dict3[i+1]/list3[i][0]/list3[i][1]*100)\n",
|
||||||
|
" print(list2[i],score)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "20ef0e26-0f7b-4ee8-8b52-005e2d5ad0d4",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 计算脊柱"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"id": "cc0571b6-1da5-4bcc-96ad-5613cd1198e3",
|
"id": "122f19fb-3531-4074-94e4-e2afdb8af51a",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": []
|
"source": [
|
||||||
|
"list4 = ['颈椎','胸椎','腰椎','骶尾椎']\n",
|
||||||
|
"list5 = [[0,10,10],[10,17,7],[17,24,6],[24,26,2]]\n",
|
||||||
|
"filename = 'data/result_青海all_2.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl) \n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" if 'spine' in v.keys():\n",
|
||||||
|
" spine = v['spine']\n",
|
||||||
|
" for i in range(0,4):\n",
|
||||||
|
" score = 0\n",
|
||||||
|
" for ii in range(list5[i][0],list5[i][1]):\n",
|
||||||
|
" score+= spine[ii]\n",
|
||||||
|
" print(k,list4[i],int(score/list5[i][2]*100)-100)"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
|||||||
Reference in new issue
Block a user