This commit is contained in:
512song committed 2021-11-12 00:14:23 +08:00
1 parent 5cfd8f1190
commit cc5ad90fd1
3 files changed
+211 -69

No files matched your search

+183 -61
View File
@@ -813,27 +813,12 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": null,
"id": "5e49d9c5-69cc-42dc-b872-738b6985f7a3",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-09T23:57:38.404084Z",
"iopub.status.busy": "2021-11-09T23:57:38.402865Z",
"iopub.status.idle": "2021-11-09T23:57:38.458541Z",
"shell.execute_reply": "2021-11-09T23:57:38.456244Z",
"shell.execute_reply.started": "2021-11-09T23:57:38.403976Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"\n",
@@ -875,28 +860,12 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": null,
"id": "61f92c63-d359-4c4b-ad64-9b8268a3e992",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-09T23:55:58.689535Z",
"iopub.status.busy": "2021-11-09T23:55:58.688298Z",
"iopub.status.idle": "2021-11-09T23:55:58.726710Z",
"shell.execute_reply": "2021-11-09T23:55:58.724689Z",
"shell.execute_reply.started": "2021-11-09T23:55:58.689426Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n",
"543\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"dict1 = {}\n",
@@ -937,20 +906,189 @@
"id": "bdc4673c-a0e2-4c8c-913a-47e39c7a366e",
"metadata": {},
"source": [
"### 脊椎症状自评数据统计(人数)"
"### 分部门、性别人数统计"
]
},
{
"cell_type": "code",
"execution_count": 45,
"execution_count": 38,
"id": "908302d5-252d-403e-80e5-fdc0694061b8",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-10T00:40:33.719985Z",
"iopub.status.busy": "2021-11-10T00:40:33.718720Z",
"iopub.status.idle": "2021-11-10T00:40:34.399895Z",
"shell.execute_reply": "2021-11-10T00:40:34.385355Z",
"shell.execute_reply.started": "2021-11-10T00:40:33.719864Z"
"iopub.execute_input": "2021-11-11T16:12:18.851377Z",
"iopub.status.busy": "2021-11-11T16:12:18.850161Z",
"iopub.status.idle": "2021-11-11T16:12:19.606841Z",
"shell.execute_reply": "2021-11-11T16:12:19.604194Z",
"shell.execute_reply.started": "2021-11-11T16:12:18.851271Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'0000': '0个症状', '1000': '仅有颈椎问题', '0100': '仅有胸椎问题', '0010': '仅有腰椎问题', '0001': '仅有骶尾椎问题', '1100': '颈椎问题+胸椎问题', '1010': '颈椎问题+腰椎问题', '1001': '颈椎问题+骶尾椎问题', '0110': '胸椎问题+腰椎问题', '0101': '胸椎问题+骶尾椎问题', '0011': '腰椎问题+骶尾椎问题', '1110': '颈椎问题+胸椎问题+腰椎问题', '1101': '颈椎问题+胸椎问题+骶尾椎问题', '0111': '胸椎问题+腰椎问题+骶尾椎问题', '1011': '颈椎问题+腰椎问题+骶尾椎问题', '1111': '颈椎问题+胸椎问题+腰椎问题+骶尾椎问题'}\n",
"管理部门\n",
"0个症状 男 16 女 3\n",
"仅有颈椎问题 男 15 女 1\n",
"仅有胸椎问题 男 1 女 1\n",
"仅有腰椎问题 男 5 女 2\n",
"仅有骶尾椎问题 男 0 女 2\n",
"颈椎问题+胸椎问题 男 6 女 2\n",
"颈椎问题+腰椎问题 男 6 女 7\n",
"颈椎问题+骶尾椎问题 男 1 女 1\n",
"胸椎问题+腰椎问题 男 1 女 1\n",
"胸椎问题+骶尾椎问题 男 0 女 0\n",
"腰椎问题+骶尾椎问题 男 1 女 0\n",
"颈椎问题+胸椎问题+腰椎问题 男 10 女 4\n",
"颈椎问题+胸椎问题+骶尾椎问题 男 1 女 0\n",
"胸椎问题+腰椎问题+骶尾椎问题 男 1 女 1\n",
"颈椎问题+腰椎问题+骶尾椎问题 男 2 女 3\n",
"颈椎问题+胸椎问题+腰椎问题+骶尾椎问题 男 5 女 6\n",
"一线部门\n",
"0个症状 男 71 女 13\n",
"仅有颈椎问题 男 68 女 8\n",
"仅有胸椎问题 男 7 女 6\n",
"仅有腰椎问题 男 11 女 6\n",
"仅有骶尾椎问题 男 3 女 1\n",
"颈椎问题+胸椎问题 男 30 女 4\n",
"颈椎问题+腰椎问题 男 34 女 13\n",
"颈椎问题+骶尾椎问题 男 3 女 4\n",
"胸椎问题+腰椎问题 男 11 女 4\n",
"胸椎问题+骶尾椎问题 男 2 女 1\n",
"腰椎问题+骶尾椎问题 男 2 女 3\n",
"颈椎问题+胸椎问题+腰椎问题 男 65 女 14\n",
"颈椎问题+胸椎问题+骶尾椎问题 男 5 女 2\n",
"胸椎问题+腰椎问题+骶尾椎问题 男 0 女 0\n",
"颈椎问题+腰椎问题+骶尾椎问题 男 4 女 3\n",
"颈椎问题+胸椎问题+腰椎问题+骶尾椎问题 男 28 女 12\n"
]
}
],
"source": [
"import json\n",
"import openpyxl\n",
"import pymysql\n",
"import json\n",
"\n",
"db = pymysql.connect(\"localhost\",\"root\",\"songyi\",\"ydyb\" )\n",
"cursor = db.cursor()\n",
"\n",
"fi_xls = 'data/北海炼化名单表(前后台).xlsx'\n",
"wb = openpyxl.load_workbook(fi_xls)\n",
"sheet = wb.active\n",
"depart = {}\n",
"m_xx ={}\n",
"for n in range(2,sheet.max_row+1): \n",
" m_dm = str(sheet.cell(n,1).value)\n",
" m_xb = sheet.cell(n,3).value\n",
" m_depart = sheet.cell(n,6).value\n",
" depart[m_dm] = m_depart\n",
" m_xx[m_dm] = [m_xb,m_depart] #人员信息\n",
" \n",
"filename = 'data/脊柱症状自评代码矩阵.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"dict2 = dict1.values()\n",
"dm = {}\n",
"for item in dict2:\n",
" dm[item['代码']] = item['问题']\n",
"print(dm)\n",
"list_dm = dm.keys()\n",
"filename = 'data/脊柱症状自评数据矩阵.json'\n",
"with open(filename,'r') as fl:\n",
" data = json.load(fl)\n",
"# 生成人员信息表,含性别、部门\n",
"list1 = []\n",
"for k, v in data.items():\n",
" list2 = []\n",
" list2.append(k)\n",
" list2.append(m_xx[k][0])\n",
" list2.append(m_xx[k][1])\n",
" list2.append(v)\n",
" list1.append(list2)\n",
"\n",
"'''sql = 'insert into tongji(ygdm,xb,bm,jzdm) values(%s,%s,%s,%s)'\n",
"#try:\n",
" # 执行sql语句\n",
"cursor.executemany(sql, list1)\n",
" # 提交到数据库执行\n",
"db.commit()\n",
"#except :\n",
" # 如果发生错误则回滚\n",
"# db.rollback()\n",
"# 关闭游标\n",
"cursor.close()\n",
"# 关闭数据库连接\n",
"db.close()'''\n",
"sql = 'SELECT bm,xb,jzdm,COUNT(jzdm) FROM tongji where bm=\"管理部门\" GROUP BY bm,jzdm,xb ORDER BY jzdm,xb'\n",
"cursor.execute(sql)\n",
"results = cursor.fetchall()\n",
"result = {}\n",
"print('管理部门')\n",
"for row in results:\n",
" result.setdefault(row[2],{})\n",
" result[row[2]][row[1]] = row[3]\n",
"#print(result) \n",
"for k, v in dm.items():\n",
" if k in result.keys():\n",
" if '男' in result[k].keys():\n",
" nan = result[k]['男']\n",
" else:\n",
" nan = 0\n",
" if '女' in result[k].keys():\n",
" nv = result[k]['女']\n",
" else:\n",
" nv = 0\n",
" print(v,'男',nan,'女',nv)\n",
" else:\n",
" print(v,'男',0,'女',0)\n",
"\n",
"sql = 'SELECT bm,xb,jzdm,COUNT(jzdm) FROM tongji where bm=\"一线部门\" GROUP BY bm,jzdm,xb ORDER BY jzdm,xb'\n",
"cursor.execute(sql)\n",
"results = cursor.fetchall()\n",
"result = {}\n",
"print('一线部门')\n",
"for row in results:\n",
" result.setdefault(row[2],{})\n",
" result[row[2]][row[1]] = row[3]\n",
"#print(result) \n",
"for k, v in dm.items():\n",
" if k in result.keys():\n",
" if '男' in result[k].keys():\n",
" nan = result[k]['男']\n",
" else:\n",
" nan = 0\n",
" if '女' in result[k].keys():\n",
" nv = result[k]['女']\n",
" else:\n",
" nv = 0\n",
" print(v,'男',nan,'女',nv)\n",
" else:\n",
" print(v,'男',0,'女',0)\n",
"\n"
]
},
{
"cell_type": "markdown",
"id": "3e3a3d27-7703-484e-ae47-add0e9367cfe",
"metadata": {},
"source": [
"### 脊椎症状自评数据统计(人数)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "664507fd-6f9c-44fd-8939-6d743e47cb81",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-11T14:56:40.750048Z",
"iopub.status.busy": "2021-11-11T14:56:40.748746Z",
"iopub.status.idle": "2021-11-11T14:56:41.415136Z",
"shell.execute_reply": "2021-11-11T14:56:41.413161Z",
"shell.execute_reply.started": "2021-11-11T14:56:40.749937Z"
},
"tags": []
},
@@ -960,7 +1098,6 @@
"output_type": "stream",
"text": [
"{'0000': '0个症状', '1000': '仅有颈椎问题', '0100': '仅有胸椎问题', '0010': '仅有腰椎问题', '0001': '仅有骶尾椎问题', '1100': '颈椎问题+胸椎问题', '1010': '颈椎问题+腰椎问题', '1001': '颈椎问题+骶尾椎问题', '0110': '胸椎问题+腰椎问题', '0101': '胸椎问题+骶尾椎问题', '0011': '腰椎问题+骶尾椎问题', '1110': '颈椎问题+胸椎问题+腰椎问题', '1101': '颈椎问题+胸椎问题+骶尾椎问题', '0111': '胸椎问题+腰椎问题+骶尾椎问题', '1011': '颈椎问题+腰椎问题+骶尾椎问题', '1111': '颈椎问题+胸椎问题+腰椎问题+骶尾椎问题'}\n",
"[('0000', 103), ('1110', 93), ('1000', 92), ('1010', 60), ('1111', 51), ('1100', 42), ('0010', 24), ('0110', 17), ('0100', 15), ('1011', 12), ('1001', 9), ('1101', 8), ('0011', 6), ('0001', 6), ('0101', 3), ('0111', 2)]\n",
"{'一线部门': {'1111': 40, '0110': 15, '1110': 79, '1010': 47, '1100': 34, '0000': 84, '0010': 17, '1011': 7, '1000': 76, '0001': 4, '1101': 7, '0100': 13, '1001': 7, '0011': 5, '0101': 3}, '管理部门': {'1000': 16, '1110': 14, '1011': 5, '0001': 2, '1111': 11, '1100': 8, '0110': 2, '0000': 19, '0010': 7, '1010': 13, '0011': 1, '1001': 2, '1101': 1, '0111': 2, '0100': 2}}\n",
"一线部门\n",
"0个症状 84\n",
@@ -1027,7 +1164,7 @@
" dict_tj.setdefault(v,0)\n",
" dict_tj[v] +=1\n",
"\n",
"print(new_dict) \n",
"\n",
"result = {}\n",
"for k, v in data.items():\n",
" result.setdefault(depart[k],{})\n",
@@ -1526,27 +1663,12 @@
},
{
"cell_type": "code",
"execution_count": 92,
"execution_count": null,
"id": "499a41ef-1b1f-4973-b733-8c322ac1ce09",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-09T15:22:44.612641Z",
"iopub.status.busy": "2021-11-09T15:22:44.611409Z",
"iopub.status.idle": "2021-11-09T15:22:44.631806Z",
"shell.execute_reply": "2021-11-09T15:22:44.628880Z",
"shell.execute_reply.started": "2021-11-09T15:22:44.612531Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"440\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"filename = '脊柱症状统计汇总表.json'\n",
+2 -2
View File
@@ -30,7 +30,7 @@
"import math\n",
"\n",
"fi_xls = os.getcwd() + '/北海炼化名单表(202110).xlsx'\n",
"fi_path = os.getcwd() + '/file/211028'\n",
"fi_path = os.getcwd() + '/file/211027'\n",
"old = []\n",
"dict1 = {}\n",
"\n",
@@ -45,7 +45,7 @@
" dict1[int(m_name.split('.')[0])] = [sheet.cell(n,2).value.strip(),sheet.cell(n,5).value.strip()]\n",
" \n",
"# 创建部门办公室 \n",
"m_path = os.getcwd()+'/file/211028/new'\n",
"m_path = os.getcwd()+'/file/211027/new'\n",
"for pn in depart:\n",
" if not os.path.exists(m_path + '/' + pn):\n",
" os.mkdir(m_path + '/' + pn)\n",
+26 -6
View File
@@ -9,7 +9,7 @@
"#gTTS语音\n",
"from gtts import gTTS\n",
"#engine = pyttsx3.init('espeak')\n",
"tts = gTTS(text=\"军士上前,将英玉兰架起,两个抓着脚踝,两个托住肩头,一起用力,英玉兰无奈分开两条大浪腿,露出骚屄,被举下\",lang='zh-cn')\n",
"tts = gTTS(text=\"军士上前,将英玉兰架起,英玉兰被举下\",lang='zh-cn')\n",
"#engine.save_to_file(\"欢迎使用百度语音合成,本次测试为Python接口\",'./test')\n",
"tts.save(\"./test.mp3\")\n",
"print('ok')"
@@ -17,9 +17,29 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 1,
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-09T07:21:49.711270Z",
"iopub.status.busy": "2021-11-09T07:21:49.709862Z",
"iopub.status.idle": "2021-11-09T07:21:50.010690Z",
"shell.execute_reply": "2021-11-09T07:21:50.007394Z",
"shell.execute_reply.started": "2021-11-09T07:21:49.711004Z"
}
},
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'aip'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-1-3dd6f47059b1>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m#百度语音在线\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0maip\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mAipSpeech\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;34m\"\"\" 你的 APPID AK SK \"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mAPP_ID\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'17553946'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'aip'"
]
}
],
"source": [
"#百度语音在线\n",
"from aip import AipSpeech\n",
@@ -31,7 +51,7 @@
"\n",
"client = AipSpeech(APP_ID, API_KEY, SECRET_KEY)\n",
"\n",
"result = client.synthesis('军士上前,将英玉兰架起,两个抓着脚踝,两个托住肩头,一起用力,英玉兰无奈分开两条大浪腿,露出骚屄,被举下。', 'zh', 5, {\n",
"result = client.synthesis('军士上前,将英玉兰架起,英玉兰被举下。', 'zh', 5, {\n",
" 'vol': 5,'per': 4,\n",
"})\n",
"\n",
@@ -66,7 +86,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.8.10"
}
},
"nbformat": 4,