110 lines
2.3 KiB
TypeScript
110 lines
2.3 KiB
TypeScript
import axiosClient from ".";
|
|
|
|
export interface GetPrescriptionParams {
|
|
Page?: number;
|
|
PageSize?: number;
|
|
Search?: string;
|
|
SortBy?: string;
|
|
Desc?: boolean;
|
|
}
|
|
|
|
export interface PrescriptionItem {
|
|
id: string;
|
|
examinationSessionId: string;
|
|
prescriptionCode: string;
|
|
prescriptionImg: string | null;
|
|
notes: string;
|
|
createdBy: string;
|
|
items: {
|
|
id: string;
|
|
prescriptionId: string;
|
|
medicineName: string;
|
|
dosage: string;
|
|
frequency: string;
|
|
duration: string;
|
|
instructions: string;
|
|
}[];
|
|
}
|
|
|
|
export interface PrescriptionDetail {
|
|
id: string;
|
|
examinationSessionId: string;
|
|
prescriptionCode: string;
|
|
prescriptionImg: string | null;
|
|
notes: string;
|
|
createdBy: string;
|
|
items: {
|
|
id: string;
|
|
prescriptionId: string;
|
|
medicineName: string;
|
|
dosage: string;
|
|
frequency: string;
|
|
duration: string;
|
|
instructions: string;
|
|
}[];
|
|
}
|
|
|
|
export interface PrescriptionResponse {
|
|
items: PrescriptionItem[];
|
|
page: number;
|
|
pageSize: number;
|
|
total: number;
|
|
totalPages: number;
|
|
}
|
|
|
|
const prescriptionServices = {
|
|
createPrescription: (
|
|
data: {
|
|
examinationSessionId: string;
|
|
notes: string;
|
|
prescriptionImg: string;
|
|
items: {
|
|
medicineName: string;
|
|
dosage: string;
|
|
frequency: string;
|
|
duration: string;
|
|
instructions: string;
|
|
}[];
|
|
},
|
|
tokenAxios?: any,
|
|
) => {
|
|
return axiosClient.post(`/Prescription`, data, {
|
|
cancelToken: tokenAxios,
|
|
});
|
|
},
|
|
getPrescription: (params?: GetPrescriptionParams, tokenAxios?: any) => {
|
|
return axiosClient.get<PrescriptionResponse>(`/Prescription`, {
|
|
params,
|
|
cancelToken: tokenAxios,
|
|
});
|
|
},
|
|
|
|
putPrescription: (
|
|
id: string,
|
|
data: {
|
|
notes: string;
|
|
prescriptionImg: string;
|
|
items: {
|
|
medicineName: string;
|
|
dosage: string;
|
|
frequency: string;
|
|
duration: string;
|
|
instructions: string;
|
|
}[];
|
|
},
|
|
tokenAxios?: any,
|
|
) => {
|
|
return axiosClient.put(`/Prescription/${id}`, data, {
|
|
cancelToken: tokenAxios,
|
|
});
|
|
},
|
|
|
|
detailPrescription: (id: string, tokenAxios?: any) => {
|
|
return axiosClient.get<PrescriptionDetail>(`/Prescription/${id}`, {
|
|
cancelToken: tokenAxios,
|
|
});
|
|
},
|
|
};
|
|
|
|
export default prescriptionServices;
|