ConsultationType
Dealing With ConsultationType
In order to deal with the Consultations and the functionality related to consultations, we use the ConsultationType interface:
interface ConsultationType {
id?: number;
user_id?: number;
question?: string;
doctor_name?: string;
doctor_avatar?: string;
medium?: string;
status?: string;
is_fulfilled?: number;
parent_consultation_id?: number;
consultation_category_id?: number;
created_at?: string;
updated_at?: string;
closed_at?: string;
accepted_at?: string;
user?: UserType;
parentConsultation?: ConsultationType;
media?: MediaType[];
consultations?: ConsultationType[];
pusherChannel?: string;
pusherAppKey?: string;
chatConfig?: ChatConfig;
voipConfig?: VoipConfig;
videoConfig?: VoipConfig;
chatHistory?: ChatHistory;
recommendation?: Recommendation;
socketParams?: SocketParams;
doctor_average_rating?: number;
}
Consultation Related Types
Also, there are some pre-defined types included in the ConsultationType interface.
MediaType
The consultation data might include some media files related to the consultation represented as a MediaType array. Here is the MediaType interface:
interface MediaType {
id?: string;
type?: string;
name?: string;
path?: string;
extension?: string;
url?: string;
size?: number;
}
ChatConfig
The ChatConfig object contains the data related to chat consultations. Here is the ChatConfig interface:
interface ChatConfig {
id?: number;
consultation_id?: number;
group_id?: string;
chat_user_id?: string;
app_id?: string;
chat_user_token?: string;
}
VoipConfig
The VoipConfig object contains the data related to Video or VOIP consultations. Here is the VoipConfig interface:
// Used for both voipConfig and videoConfig
interface VoipConfig {
id?: number;
consultation_id?: number;
api_key?: string;
call_id?: string;
token?: string;
created_at?: string;
updated_at?: string;
}
ChatHistory
The ChatHistory object contains the data related to chat history of chat consultations. Here is the ChatHistory interface:
interface ChatHistory {
id?: number;
consultation_id?: number;
data?: ChatData[];
created_at?: string;
updated_at?: string;
}
The data array of ChatHistory object is an array of ChatData type. Here is the ChatData interface:
interface ChatData {
id?: string;
message?: string;
sent_at?: string;
chat_user_id?: string;
}
Recommendation
The Recommendation object contains the recommendation data filled by the doctor. Here is the Recommendation interface:
interface Recommendation {
id?: number;
consultation_id?: number;
data?: RecommendationData;
created_at?: string;
updated_at?: string;
}
The data of the Recommendation object is an object of RecommendationData type. Here is the RecommendationData interface:
interface RecommendationData {
lab?: RecommendationLab;
drug?: RecommendationDrug;
icd10?: RecommendationICD10;
followUp?: RecommendationFollowUp[] | null;
doctorReferral?: RecommendationDoctorReferral;
postCallAnswer?: RecommendationPostCallAnswer[] | null;
}
Each field of the RecommendationData object is a pre-defined type. Here are all the interfaces related to RecommendationData:
RecommendationLab
The RecommendationLab field contains an array of labs prescribed after the consultation:
interface RecommendationLab {
lab?: RecommendationLabItem[] | null;
panel?: RecommendationLabItem[] | null;
}
And here is the RecommendationLabItem interface:
interface RecommendationLabItem {
name?: string;
}
RecommendationDrug
The RecommendationDrug field contains an array of FDA drugs prescribed after the consultation:
interface RecommendationDrug {
fdaDrug?: RecommendationFdaDrug[] | null;
}
And here is the RecommendationFdaDrug interface:
interface RecommendationFdaDrug {
name?: string;
dosage?: string;
duration?: number;
howToUse?: string;
frequency?: string;
tradeName?: string;
dosageForm?: string;
dosageUnit?: string;
packageSize?: string;
packageType?: string;
strengthValue?: string;
relationWithFood?: string;
specialInstructions?: string;
routeOfAdministration?: string;
registrationNumber?: string;
}
RecommendationICD10
The RecommendationICD10 field contains an array of symptoms and an array of diagnoses defined after the consultation:
interface RecommendationICD10 {
symptom?: RecommendationSymptom[] | null;
diagnosis?: RecommendationDiagnosis[] | null;
}
And here are the RecommendationSymptom and RecommendationDiagnosis interfaces:
interface RecommendationSymptom {
code?: string;
name?: string;
}
interface RecommendationDiagnosis {
code?: string;
name?: string;
}
RecommendationFollowUp
The RecommendationFollowUp field is an array of follow-ups related to the consultation:
interface RecommendationFollowUp {
name?: string;
}
RecommendationDoctorReferral
The RecommendationDoctorReferral field is an object containing the referral specialty recommended in the consultation:
interface RecommendationDoctorReferral {
name?: string;
}
RecommendationPostCallAnswer
The RecommendationPostCallAnswer field is an array of predefined questions answered in the recommendation:
interface RecommendationPostCallAnswer {
answer?: string;
question?: string;
}
ShiftType
The ShiftType object contains information about available consultation time slots.
interface ShiftType {
from?: string;
to?: string;
booked?: boolean;
full_date?: string;
}
Consultation Functionalities
The following are the functionalities related to consultations:
| API | Params |
|---|---|
| createConsultation | consultationData: ConsultationObject |
| getConsultationInfo | consultation_id: number |
| getLastConsultation | |
| getConsultationList | user_id?: number, page: number, perPage: number |
| deleteConsultation | consultation_id: number |
| cancelConsultation | consultation_id: number |
| rateConsultation | consultation_id: number, score: number |
| getPrescription | consultation_id: number |
| uploadMedia | path: string, type: string, fileName: string |
| getConsultationAvailableShifts | parent_consultation_id: string, date: string |
| shiftValue | shift: ShiftType |