35 lines
915 B
JavaScript
35 lines
915 B
JavaScript
|
|
import { get, post, patch, del } from './client.js';
|
||
|
|
|
||
|
|
export async function fetchVisits(params = {}) {
|
||
|
|
const query = new URLSearchParams(params).toString();
|
||
|
|
return get(query ? `/api/patvisit?${query}` : '/api/patvisit');
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function fetchVisit(id) {
|
||
|
|
return get(`/api/patvisit/${encodeURIComponent(id)}`);
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function fetchVisitsByPatient(patientId) {
|
||
|
|
return get(`/api/patvisit/patient/${encodeURIComponent(patientId)}`);
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function createVisit(data) {
|
||
|
|
return post('/api/patvisit', data);
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function updateVisit(data) {
|
||
|
|
return patch('/api/patvisit', data);
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function deleteVisit(id) {
|
||
|
|
return del('/api/patvisit', { body: JSON.stringify({ InternalPVID: id }) });
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function createADT(data) {
|
||
|
|
return post('/api/patvisitadt', data);
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function updateADT(data) {
|
||
|
|
return patch('/api/patvisitadt', data);
|
||
|
|
}
|