|
|
|
@ -98,7 +98,7 @@ class BllMedicament(Repository):
|
|
|
|
|
# 选择药剂入库--试剂详情
|
|
|
|
|
def get_drug_info_distinct_list(self, seach_word, page_param, client_id=None):
|
|
|
|
|
sql_all = """
|
|
|
|
|
select %s from rms_medicament %s
|
|
|
|
|
select * from rms_medicament %s
|
|
|
|
|
"""
|
|
|
|
|
# 分组查询
|
|
|
|
|
group_base = " group by `name`, cas_number, net_weight_unit"
|
|
|
|
@ -107,17 +107,22 @@ class BllMedicament(Repository):
|
|
|
|
|
if client_id:
|
|
|
|
|
where_base += f"client_id='{client_id}'"
|
|
|
|
|
if seach_word:
|
|
|
|
|
seach_word = f"%{seach_word}%"
|
|
|
|
|
if where_base:
|
|
|
|
|
where_base += " and"
|
|
|
|
|
where_base += f" `name` like '{seach_word}' or english_name like '{seach_word}'"
|
|
|
|
|
if where_base:
|
|
|
|
|
where_base = "where" + where_base
|
|
|
|
|
# 组装最终sql
|
|
|
|
|
run_sql = sql_all % ("*", where_base+group_base)
|
|
|
|
|
run_sql = sql_all % where_base+group_base
|
|
|
|
|
try:
|
|
|
|
|
count_number = len(self.execute(run_sql).fetchall())
|
|
|
|
|
except Exception:
|
|
|
|
|
count_number = 0
|
|
|
|
|
page_param.totalRecords = count_number
|
|
|
|
|
# 分页sql
|
|
|
|
|
run_sql = Utils.sql_paging_assemble(run_sql, page_param)
|
|
|
|
|
run_sql_data = self.execute(run_sql).fetchall()
|
|
|
|
|
page_param.totalRecords = self.execute(
|
|
|
|
|
sql_all % ("count(*)", where_base + group_base)).fetchone()[0]
|
|
|
|
|
|
|
|
|
|
return run_sql_data
|
|
|
|
|
# 药剂入库
|
|
|
|
|