110 lines
2.2 KiB
Plaintext
110 lines
2.2 KiB
Plaintext
import { request } from "@utils";
|
|
|
|
const API_PATH = "/bre/treatment";
|
|
|
|
const TreatmentAPI = {
|
|
getTreatmentList(query: TreatmentPageQuery) {
|
|
return request<ApiResponse<PageResult<TreatmentTable>>>({
|
|
url: `${API_PATH}/list`,
|
|
method: "get",
|
|
params: query,
|
|
});
|
|
},
|
|
|
|
getTreatmentDetail(query: number) {
|
|
return request<ApiResponse<TreatmentTable>>({
|
|
url: `${API_PATH}/detail/${query}`,
|
|
method: "get",
|
|
});
|
|
},
|
|
|
|
getTreatmentOptions() {
|
|
return request<ApiResponse<TreatmentOption[]>>({
|
|
url: `${API_PATH}/options`,
|
|
method: "get",
|
|
});
|
|
},
|
|
|
|
createTreatment(body: TreatmentForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/create`,
|
|
method: "post",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
updateTreatment(id: number, body: TreatmentForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/update/${id}`,
|
|
method: "put",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
deleteTreatment(body: number[]) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/delete`,
|
|
method: "delete",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
exportTreatment(body: TreatmentPageQuery) {
|
|
return request<Blob>({
|
|
url: `${API_PATH}/export`,
|
|
method: "post",
|
|
data: body,
|
|
responseType: "blob",
|
|
});
|
|
},
|
|
|
|
downloadTemplateTreatment() {
|
|
return request<Blob>({
|
|
url: `${API_PATH}/download/template`,
|
|
method: "post",
|
|
responseType: "blob",
|
|
});
|
|
},
|
|
|
|
importTreatment(body: FormData) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/import`,
|
|
method: "post",
|
|
data: body,
|
|
headers: {
|
|
"Content-Type": "multipart/form-data",
|
|
},
|
|
});
|
|
},
|
|
};
|
|
|
|
export default TreatmentAPI;
|
|
|
|
export interface TreatmentPageQuery extends PageQuery, UserByQueryParams {
|
|
trial_study_id?: number;
|
|
factor?: string;
|
|
level?: string;
|
|
}
|
|
|
|
export interface TreatmentOption {
|
|
value: number;
|
|
label: string;
|
|
}
|
|
|
|
export interface TreatmentTable extends BaseType {
|
|
trial_study_id?: number;
|
|
trial_study_name?: string;
|
|
factor?: string;
|
|
level?: string;
|
|
description?: string;
|
|
remark?: string;
|
|
}
|
|
|
|
export interface TreatmentForm extends BaseFormType {
|
|
trial_study_id?: number;
|
|
factor?: string;
|
|
level?: string;
|
|
description?: string;
|
|
remark?: string;
|
|
}
|