|
|
@ -5,9 +5,18 @@
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
from flask import Blueprint, jsonify, request
|
|
|
|
from flask import Blueprint, jsonify, request
|
|
|
|
from Common.Utils import Utils, PageParam
|
|
|
|
from Common.Utils import Utils, PageParam
|
|
|
|
from db_logic.client import BllClient
|
|
|
|
|
|
|
|
from Common.auth import token_auth
|
|
|
|
from Common.auth import token_auth
|
|
|
|
|
|
|
|
from db_logic.client import BllClient
|
|
|
|
|
|
|
|
from db_logic.medicament_record import BllMedicamentRecord
|
|
|
|
|
|
|
|
from db_logic.medicament_template import BllMedicamentTemplate
|
|
|
|
|
|
|
|
from db_logic.meidcament_variety import BllMedicamentVariety
|
|
|
|
|
|
|
|
from db_logic.humiture_record import BllHumitureRecord
|
|
|
|
|
|
|
|
from db_logic.medicament import BllMedicament
|
|
|
|
|
|
|
|
|
|
|
|
from models.client_models import EntityClient
|
|
|
|
from models.client_models import EntityClient
|
|
|
|
|
|
|
|
from models.medicament_models import EntityMedicament, EntityMedicamentRecord, EntityMedicamentTemplate, EntityMedicamentVariety
|
|
|
|
|
|
|
|
from models.humiture_models import EntityHumitureRecord
|
|
|
|
|
|
|
|
|
|
|
|
client_router = Blueprint("client", __name__)
|
|
|
|
client_router = Blueprint("client", __name__)
|
|
|
|
|
|
|
|
|
|
|
@ -23,7 +32,7 @@ def get_client_list():
|
|
|
|
|
|
|
|
|
|
|
|
# 查看列表
|
|
|
|
# 查看列表
|
|
|
|
@client_router.route("/get_list", methods=["GET","POST"])
|
|
|
|
@client_router.route("/get_list", methods=["GET","POST"])
|
|
|
|
@token_auth.login_required
|
|
|
|
# @token_auth.login_required
|
|
|
|
def getclient_list():
|
|
|
|
def getclient_list():
|
|
|
|
seach_word = request.values.get("seach_word")
|
|
|
|
seach_word = request.values.get("seach_word")
|
|
|
|
page = request.values.get("page", 1)
|
|
|
|
page = request.values.get("page", 1)
|
|
|
@ -83,3 +92,53 @@ def update_status():
|
|
|
|
return jsonify(Utils.true_return(msg="修改成功"))
|
|
|
|
return jsonify(Utils.true_return(msg="修改成功"))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return jsonify(Utils.false_return("柜体不存在"))
|
|
|
|
return jsonify(Utils.false_return("柜体不存在"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 删除柜体
|
|
|
|
|
|
|
|
@client_router.route("/del", methods=["GET", "POST"])
|
|
|
|
|
|
|
|
# @token_auth.login_required
|
|
|
|
|
|
|
|
def client_del():
|
|
|
|
|
|
|
|
client_id = request.values.get("client_id")
|
|
|
|
|
|
|
|
drug_obj = BllMedicament().findEntity(EntityMedicament.client_id == client_id)
|
|
|
|
|
|
|
|
if drug_obj:
|
|
|
|
|
|
|
|
return jsonify(Utils.false_return(msg="请先删除柜体内试剂数据"))
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
BllClient().delete(EntityClient.client_id==client_id)
|
|
|
|
|
|
|
|
BllMedicamentRecord().delete(EntityMedicamentRecord.client_id == client_id)
|
|
|
|
|
|
|
|
BllMedicamentTemplate().delete(EntityMedicamentTemplate.client_id == client_id)
|
|
|
|
|
|
|
|
BllHumitureRecord().delete(EntityHumitureRecord.client_id == client_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return jsonify(Utils.true_return(msg="删除成功"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 清空所有需删除表数据
|
|
|
|
|
|
|
|
# rms_user_medicament, rms_medicament_variety,
|
|
|
|
|
|
|
|
# rms_medicament_template,rms_medicament_record,
|
|
|
|
|
|
|
|
# rms_medicament_extend,rms_medicament, rms_humiture_record
|
|
|
|
|
|
|
|
# 清空指定柜体需删除
|
|
|
|
|
|
|
|
# rms_medicament_template,rms_medicament_record,rms_medicament, rms_humiture_record
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@client_router.route("/client_empty", methods=["GET", "POST"])
|
|
|
|
|
|
|
|
def client_empty():
|
|
|
|
|
|
|
|
client_id = request.values.get("client_id")
|
|
|
|
|
|
|
|
if client_id:
|
|
|
|
|
|
|
|
BllMedicament().delete(EntityMedicament.client_id == client_id)
|
|
|
|
|
|
|
|
BllMedicamentRecord().delete(EntityMedicamentRecord.client_id == client_id)
|
|
|
|
|
|
|
|
BllMedicamentTemplate().delete(EntityMedicamentTemplate.client_id == client_id)
|
|
|
|
|
|
|
|
BllHumitureRecord().delete(EntityHumitureRecord.client_id == client_id)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
BllClient().empty_table_info()
|
|
|
|
|
|
|
|
return jsonify(Utils.true_return())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 分配抽屉权限展示
|
|
|
|
|
|
|
|
@client_router.route("/get_drawer_power", methods=["GET", "POST"])
|
|
|
|
|
|
|
|
def get_client_drawer_power():
|
|
|
|
|
|
|
|
drawer_id = request.values.get("drawer_id")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 分配抽屉权限
|
|
|
|
|
|
|
|
@client_router.route("/set_drawer_power", methods=["GET", "POST"])
|
|
|
|
|
|
|
|
def set_client_drawer_power():
|
|
|
|
|
|
|
|
drawer_id = request.values.get("drawer_id")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|