You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.7 KiB
81 lines
2.7 KiB
#!/usr/bin/env python
|
|
# -*- encoding: utf-8 -*-
|
|
'''
|
|
@Date:2022/07/19 17:12:23
|
|
'''
|
|
from flask import jsonify, request
|
|
|
|
from common.utils import Utils
|
|
from db_logic.medicament_record import BllMedicamentRecord
|
|
from db_logic.medicament import BllMedicament
|
|
|
|
from flask import Blueprint
|
|
|
|
report_router = Blueprint("report", __name__)
|
|
|
|
# 获取报表统计页面展示
|
|
@report_router.route('/report_home', methods=["GET", "POST"])
|
|
def report_home_info():
|
|
# 试剂使用统计
|
|
base_data = BllMedicamentRecord().get_drug_record_count()
|
|
data = []
|
|
for i in base_data:
|
|
data.append(
|
|
{
|
|
"tp":i[0],
|
|
"number":i[1],
|
|
"date_time": i[2]
|
|
}
|
|
)
|
|
return jsonify(Utils.true_return(data=data))
|
|
|
|
|
|
|
|
# 库存信息总览
|
|
@report_router.route("/stock_data_info", methods=["GET", "POST"])
|
|
def get_stock_data_info():
|
|
name = request.values.get("name", None)
|
|
page = request.values.get('page', 1)
|
|
page_size = request.values.get('page_size', 15)
|
|
finds = ["name", "cas_number", "net_weight_unit",
|
|
"client_id", "count_surplus", "sum_remain"]
|
|
data_list = BllMedicament.get_stock_all_info(name=name, page=page, page_size=page_size)
|
|
if data_list:
|
|
data = []
|
|
for i in data_list:
|
|
data.append(dict(zip(finds, list(i))))
|
|
return jsonify(Utils.true_return(data=data))
|
|
else:
|
|
return jsonify(Utils.false_return(msg="无效数据"))
|
|
|
|
|
|
# 入库信息查询and 试剂信息查询
|
|
@report_router.route("/drug_details_info", methods=["GET", "POST"])
|
|
def drun_input_info():
|
|
seach_word = request.values.get('seach_word')
|
|
page = request.values.get('page', 1)
|
|
page_size = request.values.get('page_size', 10)
|
|
# manufacturer = request.values.get("manufacturer")
|
|
customer_id = request.values.get("customer_id")
|
|
client_id = request.values.get("client_id")
|
|
data = BllMedicament.getAllDrugList(search_word=seach_word, page=page, page_size=page_size, customer_id=customer_id, client_id=client_id)
|
|
return jsonify(Utils.true_return(data=data))
|
|
|
|
|
|
# 库存消耗
|
|
# 试剂名称、纯度、cas码 查询rms_medicament 分组后获取
|
|
# 入库数量 根据 medicament_id查询rms_medicament_record record_type == 1 count(id)
|
|
# 当前在库数量 查询 rms_medicament 分组后 status=1 count(id)
|
|
# 当前借出数量:查询 rms_medicament 分组后 status=2 count(id)
|
|
# 当前借出数量:查询 rms_medicament 分组后 status=3 count(id)
|
|
|
|
@report_router.route("/stock_loss_info", methods=["GET", "POST"])
|
|
def stock_loss_info():
|
|
seach_word = request.values.get('seach_word')
|
|
data = BllMedicamentRecord().durg_stock_loss(seach_word)
|
|
return jsonify(Utils.true_return(data=data))
|
|
|
|
|
|
|
|
# 试剂用量消耗
|