Consultation
Dealing With Consultation Class
In order to deal with the Consultations and the functionality related to consultations, we use the Consultation class
Here is the Consultation struct and the attributes related to it
class Consultation {
consultationId: Int?
userId: Int
question: String
medium: String
mediaIds: [String]?
parentConsultationId: Int?
status: String?
isFulfilled: Int?
doctorName: String?
doctorAvatar: String?
createdAt: String?
updatedAt: String?
closedAt: String?
user: User?
parentConsultation: Consultation?
consultations: [Consultation]?
socketChannel: String?
socketKey: String?
chatConfig: ChatConfig?
voipConfig: VoipConfig?
videoConfig: VoipConfig?
chatHistory: ChatHistory?
recommendation: Recommendation?
media: [Media]?
Double? doctorAverageRating
}
Consultation related types
Also, there are some pre-defined types included in the Consultation class
MediaType
The consultation data might include some media files related to the consultation represented as Media array and here is the Media struct
struct Media {
var id: String?
type: String?
name: String?
path: String?
ext: String?
size: Int?
createdAt: String?
url: String?
}
ChatConfig
The ChatConfig object contains the data related to chat consultations, here is the ChatConfig struct
struct ChatConfig {
id: Int?
consultationId: Int?
groupId: String?
chatUserId: String?
appId: String?
chatUserToken: String?
}
VoipConfig
The VoipConfig object contains the data related to Video or Voip consultations, here is the VoipConfig struct
struct VoipConfig {
id: Int?
consultationId: Int?
apiKey: String?
callId: String?
token: String?
}
ChatHistory
The ChatHistory object contains the data related to chat history of chat consultations, here is the ChatHistory struct
struct ChatHistory {
id: Int?
consultationId: Int?
createdAt: String?
updatedAt: String?
data: [ChatData]?
}
The data array of ChatHistory object is an array of ChatData type, and here is the ChatData struct
struct ChatData {
id: String?
message: String?
sentAt: String?
chatUserId: String?
}
Recommendation
The Recommendation object contains the recommendation data filled by the doctor, here is the Recommendation struct
struct Recommendation {
id: Int?
consultationId: Int?
createdAt: String?
updatedAt: String?
data: RecommendationData?
}
The data of the Recommendation object is an object of RecommendationData type and here is the RecommendationData struct
struct RecommendationData {
lab: RecommendationLab?
drug: RecommendationDrug?
icd10: RecommendationICD10?
doctorReferral: RecommendationDoctorReferral?
followUp: [RecommendationFollowUp]?
postCallAnswer: [RecommendationPostCallAnswer]?
}
Each field of the RecommendationData object is a pre-defined type and here are all the interfaces related to RecommendationData object
RecommendationLab
The RecommendationLab field contains an array of labs prescribed after the consultation
struct RecommendationLab {
lab: [RecommendationLabItem]?
panel: [RecommendationLabItem]?
}
And here is the RecommendationLabItem struct related to RecommendationLab
struct RecommendationLabItem {
name: String?
}
RecommendationDrug
The RecommendationDrug field contains an array of fdaDrugs prescribed after the consultation
struct RecommendationDrug {
fdaDrug: [RecommendationFdaDrug]?
}
And here is the RecommendationFdaDrug interface related to RecommendationDrug
struct RecommendationFdaDrug {
name: String?
dosage: String?
duration: Int?
howToUse: String?
frequency: String?
tradeName: String?
dosageForm: String?
dosageUnit: String?
packageSize: String?
packageType: String?
strengthValue: String?
relationWithFood: String?
specialInstructions: String?
routeOfAdministration: String?
}
RecommendationICD10
The RecommendationICD10 field contains an array of symptoms and array of diagnosis defined after the consultation
struct RecommendationICD10 {
symptom: [RecommendationSymptom]?
diagnosis: [RecommendationDiagnosis]?
}
And here are the RecommendationSymptom and RecommendationDiagnosis interfaces related to RecommendationICD10
struct RecommendationSymptom {
code: String?
name: String?
}
struct RecommendationDiagnosis {
code: String?
name: String?
}
RecommendationFollowUp
The RecommendationFollowUp field is an array of follow-ups related to the consultation
struct RecommendationFollowUp {
name: String?
}
RecommendationDoctorReferral
The RecommendationDoctorReferral field is an object contains the referral speciality recommended in the consultation
struct RecommendationDoctorReferral {
name: String?
}
RecommendationPostCallAnswer
The RecommendationPostCallAnswer field is an array of predefined questions answered in the recommendation
interface RecommendationPostCallAnswer {
answer: String?
question: String?
}
Consultation Functionalities
The following are the functionalities relate to consultations
| APi | Params |
|---|---|
| createConsultation | consultationData: Consultation |
| getConsultationInfo | id: Int |
| getLastConsultation | |
| getConsultationList | userId: Int (required), page: Int, perPage: Int |
| deleteConsultation | id: Int |
| cancelConsultation | id: Int |
| uploadMedia | jsonFile: Data, type: String |