def select_data(self, hosp_info, indexes, sql_where, reserved): try: ## 用共用程式取得指標資訊,首參數用來分辨資訊(v為指標值、d為就醫人數、l為指標值等級) value = SelectData().disease_data('v', indexes, sql_where, hosp_info) deno = SelectData().disease_data('d', indexes, sql_where, hosp_info) level = SelectData().disease_data('l', indexes, sql_where, hosp_info) ## 將醫療機構資訊、指標值、就醫人數、指標值等級包裝成zip z_data = zip(hosp_info, value, deno, level) return Result().get_column_name(indexes, z_data, sql_where, reserved) except BaseException as e: print('select_data Exception' + e) return render_template('search.html')
def search_subj(self, hospital_id, subjectives): try: ## 取得醫療機構資訊 hosp_info = SelectData().hosp_info(hospital_id) ## 取得主觀指標資訊 data = SelectData().hosp_subj_data(subjectives, hospital_id) return Result().get_subj_column_name(subjectives, hosp_info, data, hospital_id) except: alert = "抱歉,找不到您要的資料訊息。" hosp_info = SelectData().hosp_info(hospital_id) return render_template('hospSubjResult.html', hosp_info=hosp_info, alert=alert)
def hospSubjResult(): if request.method == 'POST': for id in range(8071): ## 按鈕【主觀指標】 if ('btnSubj'+str(id)) in request.form: hosp_info = SelectData().hosp_info(id) return render_template('hospSubjResult.html', hosp_info=hosp_info) ## 按鈕【客觀指標】 if ('btnObj'+str(id)) in request.form: hosp_info = SelectData().hosp_info(id) return render_template('hospObjResult.html', hosp_info=hosp_info) ## 按鈕【搜尋】 if ('btnSearch'+str(id)) in request.form: subjectives = request.values.getlist('subjective') return Hosp().search_subj(id, subjectives)
def search_obj(self, hospital_id, indexes): try: ## 取得醫療機構資訊 hosp_info = SelectData().hosp_info(hospital_id) ## 用共用程式取得客觀指標資訊,首參數用來分辨資訊(v為指標值、d為就醫人數、l為指標值等級) value = SelectData().hosp_obj_data('v', indexes, hospital_id) deno = SelectData().hosp_obj_data('d', indexes, hospital_id) level = SelectData().hosp_obj_data('l', indexes, hospital_id) ## 將指標值、就醫人數、指標值等級包裝成zip z_data = zip(value, deno, level) return Result().get_obj_column_name(indexes, hosp_info, z_data, hospital_id) except: alert = "抱歉,找不到您要的資料訊息。" hosp_info = Search().search_hosp(hospital_id) return render_template('hospObjResult.html', hosp_info=hosp_info, alert=alert)
def select_data(self, hosp_info, indexes, sql_where, reserved): try: ## 取得客觀指標值資訊 data = SelectData().depart_data(indexes, sql_where) ## 將醫療機構資訊、指標值包裝成zip z_data = zip(hosp_info, data) return Result().get_column_name(indexes, z_data, sql_where, reserved) except BaseException as e: print('select_data Exception' + e) return render_template('search.html')