class MedicalRecordListSerializer(serializers.ModelSerializer): doctor = doctors_infoSerializer() class Meta: model = patient_medical_records fields = ('id', 'patient_name', 'patient', 'record_type', 'description', 'record_files', 'is_prescription', 'doctor', 'consultation_id', 'Last_modied', 'format_last_modified', 'follow_up_date')
class getAllConsultationsSerializer(serializers.ModelSerializer): doctor_id = doctors_infoSerializer() patient = UserAuthSerializer() patient_pic = serializers.SerializerMethodField('get_patient_pic') def get_patient_pic(self, obj): pat_details = patient_info.objects.get(user__id=obj.patient.id) if pat_details.profile_pic: return self.context['request'].build_absolute_uri(pat_details.profile_pic.url) return "" class Meta: model = consultations fields = ('id','doctor_id','patient','patient_name','patient_age','patient_gender','patient_pic','consultation_date_time','message')
class appointmentsListSerializer(serializers.ModelSerializer): doctor = doctors_infoSerializer() patient = UserAuthSerializer() patient_pic = serializers.SerializerMethodField('get_patient_pic') def get_patient_pic(self, obj): pat_details = patient_info.objects.get(user__id=obj.patient.id) if pat_details.profile_pic: return self.context['request'].build_absolute_uri( pat_details.profile_pic.url) return "" class Meta: model = appointment fields = ('id', 'doctor', 'patient', 'patient_name', 'patient_age', 'patient_gender', 'patient_pic', 'appointment_date', 'appointment_time', 'Description')
class appointmentsListSerializer(serializers.ModelSerializer): doctor = doctors_infoSerializer() patient = UserAuthSerializer() # patient_pic = serializers.SerializerMethodField('get_patient_pic') # def get_patient_pic(self, obj): # pat_details = patient_info.objects.get(user=obj.patient) # if pat_details.profile_pic: # return self.context['request'].build_absolute_uri(pat_details.profile_pic.url) # return "" class Meta: model = appointment fields = ('id', 'doctor', 'patient', 'paid_amount', 'patient_name', 'patient_age', 'patient_gender', 'appointment_date', 'appointment_time', 'Description', 'pat_id', 'patient_login_status', "video_flag")