Files
FE_CPONE/test/vuex/one-fo-registration-walk-in/api/order.js
2026-04-27 10:13:31 +07:00

206 lines
4.2 KiB
JavaScript

// API :
// search bank
// paramater : query , page , rowPerPage
const URL =
"/one-api/mockup/fo/walk_in_registration/";
let isSaving = false;
export async function save(prm) {
if (isSaving) {
return {
status: "ERR",
message: "Save operation is already in progress"
}
}
isSaving = true;
try {
var resp = await axios.post(URL + 'order/save', prm);
isSaving = false;
return resp
} catch (e) {
isSaving = false;
return {
status: "ERR",
message: e.message
}
}
}
export async function lookupbarcodes(prm) {
try {
var resp = await axios.post(URL + 'order/lookup_barcodes', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function load_from_clinic(queue) {
try {
var resp = await axios.post(URL + 'order/load_from_clinic', {
queue: queue
});
return resp
} catch (e) {
return {
status: "ERR",
message: e.message
}
}
}
export async function load_preregister(prm) {
try {
var resp = await axios.post(URL + 'order/load_preregister',prm);
return resp
} catch (e) {
return {
status: "ERR",
message: e.message
}
}
}
export async function load(id) {
try {
var resp = await axios.post(URL + 'order/load', {
id: id
});
return resp
} catch (e) {
return {
status: "ERR",
message: e.message
}
}
}
export async function patientSearch(noreg, search) {
try {
var resp = await axios.post(URL + 'patient/search', {
search: search,
noreg: noreg
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function doctorSearch(search) {
try {
var resp = await axios.post(URL + 'doctor/search', {
search: search
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function doctorSearchPj() {
try {
var resp = await axios.post(URL + 'doctor/search_pj', { });
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function languageSearch() {
try {
var resp = await axios.post(URL + 'language/search', { });
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function deliverySearch() {
try {
var resp = await axios.post(URL + 'delivery/search', { });
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function get_time_start(prm) {
try {
var resp = await axios.post(URL + 'order/get_time_start', prm);
return resp
} catch (e) {
return {
status: "ERR",
message: e.message
}
}
}