|
|
@ -6,14 +6,12 @@
|
|
|
|
import datetime
|
|
|
|
import datetime
|
|
|
|
from flask import jsonify, request, g
|
|
|
|
from flask import jsonify, request, g
|
|
|
|
from flask import Blueprint
|
|
|
|
from flask import Blueprint
|
|
|
|
from sqlalchemy import and_
|
|
|
|
|
|
|
|
from db_logic.client import BllClient
|
|
|
|
from db_logic.client import BllClient
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from db_logic.medicament import BllMedicament
|
|
|
|
from db_logic.medicament import BllMedicament
|
|
|
|
|
|
|
|
from db_logic.medicament_record import BllMedicamentRecord
|
|
|
|
from models.medicament_models import EntityMedicament
|
|
|
|
from models.medicament_models import EntityMedicament
|
|
|
|
from db_logic.user import BllUser
|
|
|
|
|
|
|
|
from models.user_models import EntityUser
|
|
|
|
|
|
|
|
from models.client_models import EntityClient
|
|
|
|
from models.client_models import EntityClient
|
|
|
|
from Common.Utils import DrugStatus, PageParam, Utils
|
|
|
|
from Common.Utils import DrugStatus, PageParam, Utils
|
|
|
|
from Common.auth import token_auth
|
|
|
|
from Common.auth import token_auth
|
|
|
@ -134,18 +132,23 @@ def get_drug_info():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 试剂管理
|
|
|
|
# 试剂管理
|
|
|
|
@drug_router.route("/drug_manage", methods=["GET", "POST"])
|
|
|
|
@drug_router.route("/drug_list", methods=["GET", "POST"])
|
|
|
|
@token_auth.login_required
|
|
|
|
@token_auth.login_required
|
|
|
|
def get_drug_manage():
|
|
|
|
def get_drug_manage():
|
|
|
|
seach_word = request.values.get("seach_word")
|
|
|
|
seach_word = request.values.get("seach_word")
|
|
|
|
client_id = request.values.get("client_id")
|
|
|
|
client_id = request.values.get("client_id")
|
|
|
|
data_list = BllMedicament().get_drug_info_distinct_list(seach_word=seach_word, client_id=client_id)
|
|
|
|
page = int(request.values.get("page", 1))
|
|
|
|
|
|
|
|
page_size = int(request.values.get("page_size", 10))
|
|
|
|
|
|
|
|
page_param = PageParam(page, page_size)
|
|
|
|
|
|
|
|
data_list = BllMedicament().get_drug_list(
|
|
|
|
|
|
|
|
seach_word=seach_word, client_id=client_id, page_param=page_param
|
|
|
|
|
|
|
|
)
|
|
|
|
return jsonify(Utils.true_return(data=Utils.msyql_table_model(data_list)))
|
|
|
|
return jsonify(Utils.true_return(data=Utils.msyql_table_model(data_list)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 编辑/新增数据
|
|
|
|
# 编辑数据
|
|
|
|
@drug_router.route("/add_update", methods=["GET", "POST"])
|
|
|
|
@drug_router.route("/add_update", methods=["GET", "POST"])
|
|
|
|
@token_auth.login_required
|
|
|
|
@token_auth.login_required
|
|
|
|
def drug_add_update():
|
|
|
|
def drug_add_update():
|
|
|
@ -161,13 +164,24 @@ def drug_add_update():
|
|
|
|
bar_code = request.values.get("bar_code")
|
|
|
|
bar_code = request.values.get("bar_code")
|
|
|
|
medicament_obj = BllMedicament().findEntity(medicament_id)
|
|
|
|
medicament_obj = BllMedicament().findEntity(medicament_id)
|
|
|
|
if medicament_id:
|
|
|
|
if medicament_id:
|
|
|
|
obj = BllMedicament().findEntity(
|
|
|
|
obj = BllMedicament().findEntity(EntityMedicament.bar_code == bar_code)
|
|
|
|
and_(
|
|
|
|
if obj.medicament_id == medicament_obj.medicament_id:
|
|
|
|
EntityMedicament.bar_code == bar_code)
|
|
|
|
for i in finds_list:
|
|
|
|
)
|
|
|
|
setattr(medicament_obj, i, request.values.get(i))
|
|
|
|
return Utils.true_return()
|
|
|
|
BllMedicament().update(medicament_obj)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
return jsonify(Utils.true_return(msg="条码不能重复"))
|
|
|
|
|
|
|
|
return jsonify(Utils.true_return(msg="试剂id不能为空"))
|
|
|
|
|
|
|
|
|
|
|
|
# 流转记录
|
|
|
|
# 流转记录
|
|
|
|
|
|
|
|
@drug_router.route("/get_durg_record", methods=["GET", "POST"])
|
|
|
|
|
|
|
|
@token_auth.login_required
|
|
|
|
|
|
|
|
def get_durg_record():
|
|
|
|
|
|
|
|
page = int(request.values.get("page", 1))
|
|
|
|
|
|
|
|
page_size = int(request.values.get("page_size", 10))
|
|
|
|
|
|
|
|
page_param = PageParam(page, page_size)
|
|
|
|
|
|
|
|
data_list = BllMedicamentRecord().get_drug_flow_log(page_param=page_param)
|
|
|
|
|
|
|
|
return jsonify(Utils.true_return(data={"data_list": Utils.msyql_table_model(data_list), "total_count":page_param.totalRecords}))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|