|
|
|
@ -30,16 +30,26 @@ class BllMedicamentRecord(Repository):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 获取流转记录
|
|
|
|
|
def get_drug_flow_log(self, page_param):
|
|
|
|
|
sql_all = """
|
|
|
|
|
|
|
|
|
|
def get_drug_flow_log(self, medicament_id, page_param):
|
|
|
|
|
filter_base = ""
|
|
|
|
|
if medicament_id:
|
|
|
|
|
filter_base += f" medicament_id='{medicament_id}' "
|
|
|
|
|
if filter_base:
|
|
|
|
|
filter_base = f" where {filter_base}"
|
|
|
|
|
sql_all = f"""
|
|
|
|
|
select a.`name`, a.speci, a.bar_code, a.cas_number, a.purity, a.client_id, a.`status`, b.create_date, b.create_user_name from(
|
|
|
|
|
select medicament_id, `name`, speci, bar_code, cas_number, purity, client_id, `status` from rms_medicament
|
|
|
|
|
select medicament_id, `name`, speci, bar_code, cas_number, purity, client_id, `status` from rms_medicament
|
|
|
|
|
) a RIGHT JOIN(
|
|
|
|
|
select medicament_id, create_date, create_user_id, create_user_name from rms_medicament_record order by create_date desc
|
|
|
|
|
select medicament_id, create_date, create_user_id, create_user_name from rms_medicament_record {filter_base} order by create_date desc
|
|
|
|
|
) b on b.medicament_id=a.medicament_id
|
|
|
|
|
"""
|
|
|
|
|
count_sql = "select count(*) from rms_medicament_record"
|
|
|
|
|
page_param.totalRecords = self.execute(count_sql).fetchone()[0]
|
|
|
|
|
# count_sql = "select count(*) from rms_medicament_record"
|
|
|
|
|
try:
|
|
|
|
|
count_number = len(self.execute(sql_all).fetchall())
|
|
|
|
|
except Exception:
|
|
|
|
|
count_number = 0
|
|
|
|
|
page_param.totalRecords = count_number
|
|
|
|
|
sql_all = Utils.sql_paging_assemble(sql_all, page_param)
|
|
|
|
|
return self.execute(sql_all).fetchall()
|
|
|
|
|
|
|
|
|
|