from django.contrib import messages
from consult.models import observation,nutritional_value,blood_Pressure,History_examination,vitals,scheduling,treatment_details
from django.contrib.auth.decorators import login_required
from  consult.forms import form_observation,form_nutritional_value,form_blood_Pressure,form_History_examination,form_vitals,form_observation_search,form_nutritional_value_search,form_blood_Pressure_search,form_History_examination_search,form_vitals_search,form_treatment_details,form_treatment_details_search,form_scheduling,form_scheduling_search
from baseapp.views import formview_base,view_base,formview_base_patient, view_base_patient
# Create your views here.




def formview_observation(request, pid =1,id = 0):  
    return formview_base_patient(request,form_observation,observation, 'Observations',pid,id,'add_observation')

def view_observation(request,pid, viewtype ='tbl',*args, **kwargs):
    return view_base_patient(request,observation,form_observation_search,pid, form_observation.Meta.fields ,form_observation.Meta.fields, 'Observations',viewtype,'view_observation','report_name')





def formview_nutritional_value(request, pid,  id = 0):    return formview_base_patient(request,form_nutritional_value,nutritional_value, ' Anthropometric Measurements',pid,id,'add_nutritional_value')

def view_nutritional_value(request,pid,viewtype ='tbl',*args, **kwargs):
    return view_base_patient(request,nutritional_value,form_nutritional_value_search,pid,['height','weight' , 'BMI','Waistratio'] ,['height','weight' , 'BMI','Waistratio'] , 'Anthropometric Measurements',viewtype,'view_nutritional_value','BMI')



def formview_blood_Pressure(request, pid =1, id = 0):    return formview_base_patient(request,form_blood_Pressure,blood_Pressure, ' Blood Pressure',pid,id,'add_blood_pressure')

def view_blood_Pressure(request,pid,viewtype ='tbl',*args, **kwargs):
    return view_base_patient(request,blood_Pressure,form_blood_Pressure_search,pid,form_blood_Pressure.Meta.fields ,form_blood_Pressure.Meta.fields, ' Blood Pressure',viewtype,'view_blood_presssure','sys_bld_pressure')







# def formview_fees_information(request,pid=1, id = 0):    return formview_base_patient(request,form_fees_information,fees_information, 'Fees Information',pid,id,'add_fees_information')

# def view_fees_information(request,pid,viewtype ='tbl',*args, **kwargs):
#     return view_base_patient(request,fees_information,fees_information_search,pid,form_fees_information.Meta.fields ,form_fees_information.Meta.fields, 'Fees Information',viewtype,'view_fees_information')





def formview_History_examination(request,pid=1, id = 0):    return formview_base_patient(request,form_History_examination,History_examination, 'History Examination',pid,id,'add_examination')

def view_History_examination(request,pid,viewtype ='tbl',*args, **kwargs):
    return view_base_patient(request,History_examination,form_History_examination_search,pid,form_History_examination.Meta.fields ,form_History_examination.Meta.fields,'History Examination',viewtype,'view_examination','symptom_duration')





def formview_vitals(request,pid=1, id = 0):    return formview_base_patient(request,form_vitals,vitals, 'Vitals',pid,id,'add_vitals')

def view_vitals(request,pid,viewtype ='tbl',*args, **kwargs):
    return view_base_patient(request,vitals,form_vitals_search,pid,form_vitals.Meta.fields ,form_vitals.Meta.fields, 'Vitals',viewtype,'view_vitals','temperature')




def formview_treatment_details(request, pid =1,id = 0):  
    return formview_base_patient(request,form_treatment_details,treatment_details, 'Treatment Details',pid,id,'add_tret_details')

def view_treatment_details(request,pid, viewtype ='tbl',*args, **kwargs):
    return view_base_patient(request,treatment_details,form_treatment_details_search,pid, form_treatment_details.Meta.fields ,form_treatment_details.Meta.fields,'Treatment Details',viewtype,'view_treat_details','treatment_notes')




def formview_scheduling(request, pid =1,id = 0):  
    return formview_base_patient(request,form_scheduling,scheduling,'Scheduling',pid,id,'add_scheduling')

def view_scheduling(request,pid, viewtype ='tbl',*args, **kwargs):
    return view_base_patient(request,scheduling,form_scheduling_search,pid, form_scheduling.Meta.fields ,form_scheduling.Meta.fields, 'Scheduling',viewtype,'view_scheduling','date_scheduled')

