1 Star 1 Fork 0

ManiacRaTT/HospitalFrontDesk

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
view_drug_list.py 12.17 KB
一键复制 编辑 原始数据 按行查看 历史
hrx 提交于 2023-12-08 09:08 . 1
import re
import smtplib
from email.header import Header
from email.mime.text import MIMEText
from email.utils import parseaddr, formataddr
from peewee import *
import ctrl_base
from werkzeug.security import generate_password_hash, check_password_hash
from database.xMySQL_1 import PatientPatient, DoctorDoctor, DrugDrugCategory, objects, DrugDrugs, DrugDrugsCategoryList, \
DrugDrugPrice, DrugDrugSupplier, DrugDrugLevel, DoctorDoctorDepartments, DoctorDoctorSections, DrugDrugIngredient, \
DrugDrugIngredientTableDrugIngredientTable, DrugDrugIngredientTable
from util.check_login import ban_check
from util.utils import GetInformation, emailisValid, generate_verification_code, GetDataSensitive, is_all_english
class drug_list_all(ctrl_base.BaseHandler):
@ban_check
async def get(self):
current_type, current_username, current_user_id, find_0, find_0_0, find_0_1 = await self.get_base_config()
find_6 = await objects.execute(DrugDrugLevel.select())
# each drug
find_1 = await objects.execute(DrugDrugs.select().where(DrugDrugs.status == 1))
for g in find_1:
s = ''
find_3 = await objects.execute(DrugDrugsCategoryList.select(DrugDrugsCategoryList.drug_category)
.where(DrugDrugsCategoryList.drugs == g.id))
for h in find_3:
_category = await objects.get(DrugDrugCategory, id=h.drug_category)
n = _category.category + ' '
s += n
find_4 = await objects.execute(DrugDrugPrice.select(DrugDrugPrice.price)
.where(DrugDrugPrice.drug_id == g.id))
g.price = "SECRET"
for v in find_4:
g.price = v.price
find_5 = await objects.execute(DrugDrugSupplier.select(DrugDrugSupplier.name)
.where(DrugDrugSupplier.id == g.supplier_id))
for c in find_5:
g.supplier = c.name
find_7 = await objects.execute(DrugDrugLevel.select(DrugDrugLevel.risk_factor)
.where(DrugDrugLevel.id == g.risk_factor))
for x in find_7:
g.risk_factor_name = x.risk_factor
g.category_list = s
await self.render("drug_list_all.html", find_0=find_0, find_1=find_1, find_6=find_6, current_type=current_type,
current_username=current_username, current_user_id=current_user_id,find_0_0=find_0_0,
find_0_1=find_0_1)
class drug_list_all_paginate(ctrl_base.BaseHandler):
@ban_check
async def get(self):
page_num = int(self.get_argument('page_num'))
find_1 = await objects.execute(DrugDrugs.select().where(DrugDrugs.status == 1).paginate(page_num, 4))
for g in find_1:
s = ''
find_3 = await objects.execute(DrugDrugsCategoryList.select(DrugDrugsCategoryList.drug_category)
.where(DrugDrugsCategoryList.drugs == g.id))
for h in find_3:
_category = await objects.get(DrugDrugCategory, id=h.drug_category)
n = _category.category + ' '
s += n
find_4 = await objects.execute(DrugDrugPrice.select(DrugDrugPrice.price)
.where(DrugDrugPrice.drug_id == g.id))
for v in find_4:
g.price = v.price
find_5 = await objects.execute(DrugDrugSupplier.select(DrugDrugSupplier.name)
.where(DrugDrugSupplier.id == g.supplier_id))
for c in find_5:
g.supplier = c.name
find_7 = await objects.execute(DrugDrugLevel.select(DrugDrugLevel.risk_factor)
.where(DrugDrugLevel.id == g.risk_factor))
for x in find_7:
g.risk_factor_name = x.risk_factor
g.category_list = s
msg = {'data':find_1}
await self.finish(msg)
return
class drug_list_second(ctrl_base.BaseHandler):
@ban_check
async def get(self):
current_type, current_username, current_user_id, find_0, find_0_0, find_0_1 = await self.get_base_config()
category_name = self.get_argument('category_name')
find_0_ = await objects.get(DrugDrugCategory, category=category_name)
category_id = find_0_.id
# each drug
find_1 = await objects.execute(DrugDrugsCategoryList.select(DrugDrugsCategoryList.drugs)
.join(DrugDrugs,on=(DrugDrugs.id==DrugDrugsCategoryList.drugs))
.where(DrugDrugsCategoryList.drug_category == category_id
,DrugDrugs.status == 1))
find_1_ = []
for g in find_1:
find_2 = await objects.get(DrugDrugs, id=g.drugs)
name = find_2.name
risk_factor_id = find_2.risk_factor
find_7 = await objects.execute(DrugDrugLevel.select(DrugDrugLevel.risk_factor)
.where(DrugDrugLevel.id == risk_factor_id))
for z in find_7:
g.risk_factor_name = z.risk_factor
if is_all_english(name[0]) is True:
g.name_label = name[0].upper()
else:
string = "·~!@#¥%……&*()——+-={}|【】、“”‘;:《》,。?、~!@#$%^&*()_+`-={}|\][:"';?/.,<>'""
if name[0] in string:
g.name_label = 'Special-Character'
else:
g.name_label = name[0]
find_1_.append(name[0])
s = 'g.name_label'
find_3 = await objects.execute(DrugDrugsCategoryList.select(DrugDrugsCategoryList.drug_category)
.where(DrugDrugsCategoryList.drugs == g.drugs))
for h in find_3:
_category = await objects.get(DrugDrugCategory, id=h.drug_category)
n = _category.category + ' '
s += n
find_4 = await objects.execute(DrugDrugPrice.select(DrugDrugPrice.price)
.where(DrugDrugPrice.drug_id == g.drugs))
for v in find_4:
g.price = v.price
find_5 = await objects.execute(DrugDrugSupplier.select(DrugDrugSupplier.name)
.where(DrugDrugSupplier.id == find_2.supplier_id))
for c in find_5:
g.supplier = c.name
g.category_list = s
g.img = find_2.img
g.name = find_2.name
g.id = find_2.id
g.detail = find_2.detail
list0 = [i for i in find_1_ if find_1_.count(i) == 1]
find_6 = await objects.execute(DrugDrugLevel.select())
await self.render("drug_list_second.html", find_0=find_0, find_1=find_1, list0=list0, find_6=find_6,
current_type=current_type,category_name=category_name,
current_username=current_username, current_user_id=current_user_id,find_0_0=find_0_0,
find_0_1=find_0_1)
class drug_item(ctrl_base.BaseHandler):
@ban_check
async def get(self):
current_type, current_username, current_user_id, find_0, find_0_0, find_0_1 = await self.get_base_config()
drug_name = self.get_argument('drug_name')
drug_id = self.get_argument('drug_id')
_find_1 = await objects.get(DrugDrugs, id=drug_id)
if _find_1.status == 0:
self.redirect('error_503')
find_1 = await objects.execute(DrugDrugs.select()
.where(DrugDrugs.id == drug_id))
for i in find_1:
i.description = str(i.description).replace('../../../../../media', 'http://localhost:8081/')
if i.specification != '':
i.specification = 'http://localhost:8081/' + str(i.specification)
print(i.specification)
i.file_name = str(i.specification).replace('Drug-Specification/','').replace('http://localhost:8081/','')
else:
i.specification = 'javascript:;'
i.file_name = 'Sorry, there are no relevant Specification File'
find_2 = await objects.execute(DrugDrugsCategoryList.select(DrugDrugsCategoryList.drug_category)
.where(DrugDrugsCategoryList.drugs == drug_id))
risk_factor_id = _find_1.risk_factor
for b in find_2:
find_3 = await objects.get(DrugDrugCategory, id=b.drug_category)
b.category_name = find_3.category
for a in find_1:
find_4 = await objects.get(DrugDrugLevel, id=risk_factor_id)
a.risk_factor_name = find_4.risk_factor
find_5 = await objects.get(DrugDrugPrice, drug_id=a.id)
a.price = find_5.price
find_6 = await objects.get(DrugDrugSupplier, id=a.supplier_id)
a.supplier_name = find_6.name
a.supplier_phonenumber = find_6.phonenumber
a.supplier_address = find_6.address
a.supplier_mark = find_6.mark
drug_id = _find_1.id
find_12 = await objects.execute(DrugDrugsCategoryList.select(DrugDrugsCategoryList.drug_category)
.where(fn.Substr(DrugDrugsCategoryList.drugs,1,1) == drug_id))
# find_12 = await objects.execute(DrugDrugsCategoryList.select(DrugDrugsCategoryList.drug_category)
# .where(DrugDrugsCategoryList.drugs == drug_id))
find_7 = None
for j in find_12:
i = j.drug_category
find_7 = await objects.execute(DrugDrugs.select()
.where(DrugDrugs.id != drug_id,DrugDrugsCategoryList.drug_category == i)
.join(DrugDrugsCategoryList,JOIN.LEFT_OUTER,
on=(DrugDrugsCategoryList.drugs == DrugDrugs.id)))
if len(find_7) != 0:
break
for g in find_7:
s = ''
find_8 = await objects.execute(DrugDrugsCategoryList.select(DrugDrugsCategoryList.drug_category)
.where(DrugDrugsCategoryList.drugs == g.id))
for h in find_8:
_category = await objects.get(DrugDrugCategory, id=h.drug_category)
n = _category.category + ' '
s += n
find_9 = await objects.execute(DrugDrugPrice.select(DrugDrugPrice.price)
.where(DrugDrugPrice.drug_id == g.id))
for v in find_9:
g.price = v.price
find_10 = await objects.execute(DrugDrugSupplier.select(DrugDrugSupplier.name)
.where(DrugDrugSupplier.id == g.supplier_id))
for c in find_10:
g.supplier = c.name
find_11 = await objects.execute(DrugDrugLevel.select(DrugDrugLevel.risk_factor)
.where(DrugDrugLevel.id == g.risk_factor))
for x in find_11:
g.risk_factor_name = x.risk_factor
g.category_list = s
relative_length = len(find_7)
find_8 = await objects.execute(DrugDrugIngredient.select()
.join(DrugDrugIngredientTableDrugIngredientTable,JOIN.RIGHT_OUTER
,on=(DrugDrugIngredientTableDrugIngredientTable.drug_ingredient == DrugDrugIngredient.id))
.join(DrugDrugIngredientTable
,on=(DrugDrugIngredientTable.id == DrugDrugIngredientTableDrugIngredientTable.drug_ingredient_table))
.where(DrugDrugIngredientTable.to_drug == drug_id))
await self.render('drug_item.html', find_0=find_0, current_type=current_type,
current_username=current_username, current_user_id=current_user_id,
drug_name=_find_1.name, find_1=find_1,find_2=find_2,find_7=find_7,relative_length=relative_length,find_0_0=find_0_0,
find_0_1=find_0_1,find_8=find_8)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/maniacratt/HospitalFrontDesk.git
git@gitee.com:maniacratt/HospitalFrontDesk.git
maniacratt
HospitalFrontDesk
HospitalFrontDesk
master

搜索帮助