This commit is contained in:
Inshal
2024-06-04 03:43:35 +05:00
parent 9f094ad5b0
commit 6e41495bc3
8 changed files with 553 additions and 3 deletions

View File

@@ -2,9 +2,12 @@ import axios from 'axios';
import { createStore } from 'vuex';
import {
APPOINTMENT_DETAILS_API,
LABS_DELETE_API,
LABS_LIST_API,
LABS_UPDATE_API,
MEETING_NOTES_API,
MEETING_PRESCREPTIONS_API,
PATIENT_DELETE_API,
PATIENT_LIST_API,
PATIENT_MEETING_LIST_API,
@@ -22,7 +25,10 @@ export default createStore({
patientList:[],
patientMeetingList:[],
providersList:[],
labsList:[]
labsList:[],
singlePatientAppointment: null,
patientPrescription:null,
patientNotes: null,
},
mutations: {
setLoading(state, payload) {
@@ -40,7 +46,17 @@ export default createStore({
},
setLabsList(state, payload) {
state.labsList = payload
}
},
setPrescription(state, payload) {
state.patientPrescription = payload
},
setSinglePatientAppointment(state, payload) {
state.singlePatientAppointment = payload
},
setPatientNotes(state, payload) {
state.patientNotes = payload
},
},
actions: {
@@ -276,6 +292,85 @@ export default createStore({
console.error('Error:', error);
});
},
async getAppointmentByIdAgent ({commit,state},payload){
commit('setLoading', true)
await axios.post(APPOINTMENT_DETAILS_API+payload.patient_id + '/' + payload.appointment_id, {}, {
headers: {
'Authorization': `Bearer ${localStorage.getItem('admin_access_token')}`,
}
}) .then(response => {
commit('setLoading', false)
console.log('Response Notes:', response.data.data);
commit('setSinglePatientAppointment',response.data.data)
})
.catch(error => {
commit('setLoading', false)
console.error('Error:', error);
});
},
async getPrescriptions ({commit,state},payload){
commit('setLoading', true)
await axios.post(MEETING_PRESCREPTIONS_API+payload.patient_id + '/' + payload.appointment_id, {}, {
headers: {
'Authorization': `Bearer ${localStorage.getItem('admin_access_token')}`,
}
}) .then(response => {
commit('setLoading', false)
let doctor={}
let itemsPrescriptions=[]
for (let data of response.data) {
let dataObject = {}
dataObject.first_name = data.patient.first_name
dataObject.last_name = data.patient.last_name
dataObject.gender = data.patient.gender
dataObject.dob = data.patient.dob
dataObject.patient_address = data.patient.address+' '+ data.patient.city+' '+ data.patient.state +' ' +data.patient.country
dataObject.name = data.prescription.name
dataObject.brand = data.prescription.brand
dataObject.from = data.prescription.from
dataObject.direction_quantity = data.prescription.direction_quantity
dataObject.dosage = data.prescription.dosage
dataObject.quantity = data.prescription.quantity
dataObject.refill_quantity = data.prescription.refill_quantity
dataObject.actions = ''
dataObject.id = data.prescription.id
dataObject.comments = data.comments
dataObject.direction_one = data.direction_one
dataObject.direction_two = data.direction_two
dataObject.doctor = data.telemedPro
dataObject.status = data.status
dataObject.date = data.created_at
dataObject.agent_sign = data.telemedPro.name
dataObject.medical_license_number = data.telemedPro.medical_license_number
itemsPrescriptions.push(dataObject)
}
console.log('Response Notes:', response.data);
commit('setPrescription',itemsPrescriptions)
})
.catch(error => {
commit('setLoading', false)
commit('setPrescription',null)
console.error('Error:', error);
});
},
async getHistoryPatientNotes ({commit,state},payload){
commit('setLoading', true)
await axios.post(MEETING_NOTES_API+payload.patient_id + '/' + payload.appointment_id, {}, {
headers: {
'Authorization': `Bearer ${localStorage.getItem('admin_access_token')}`,
}
}) .then(response => {
commit('setLoading', false)
console.log('Response Notes:', response.data.data);
commit('setPatientNotes',response.data.data)
})
.catch(error => {
commit('setLoading', false)
console.error('Error:', error);
});
},
},
getters: {
getIsLoading(state){
@@ -294,5 +389,14 @@ export default createStore({
getLabsList(state){
return state.labsList
},
getSinglePatientAppointment(state){
return state.singlePatientAppointment
},
getPrescriptionList(state){
return state.patientPrescription
},
getPatientNotes(state){
return state.patientNotes
},
}
})