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

194 lines
4.4 KiB
JavaScript

// API :
// search bank
// paramater : query , page , rowPerPage
const URL =
"/one-api/mockup/fo/registration_v27/";
export async function search(noreg, search, current_page) {
try {
var resp = await axios.post(URL + 'patient/search', {
search: search,
noreg: noreg,
current_page:current_page,
token:window.one_token()
});
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 searchnasional(noreg, search, current_page) {
try {
var resp = await axios.post(URL + 'patient/search_nasional', {
search: search,
noreg: noreg,
current_page:current_page,
token:window.one_token()
});
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 add_new(datas) {
try {
//sipe add token
datas["token"] = window.one_token();
var resp = await axios.post(URL + 'patient/add_new', datas);
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 edit(datas, id) {
try {
//sipe add token
datas["token"] = window.one_token();
datas["id"] = id
var resp = await axios.post(URL + 'patient/edit', datas);
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 search_idtype() {
try {
var resp = await axios.post(URL + 'patient/search_idtype', {token:window.one_token()});
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 check_connection_national() {
try {
var resp = await axios.post(URL + 'patient/check_connection_national', {token:window.one_token()});
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 getaddress(prm) {
try {
var resp = await axios.post(URL + 'patient/get_address', 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 download_data(datas) {
try {
//sipe add token
datas["token"] = window.one_token();
var resp = await axios.post(URL + 'patient/download_data', datas);
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 suspend(prm) {
try {
var resp = await axios.post(URL + 'patient/suspend', 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
};
}
}