This commit is contained in:
Muhammad Shahzad
2024-06-08 05:42:42 +05:00
parent cfcd4e1e98
commit 55a289e729
8 changed files with 328 additions and 13 deletions

View File

@@ -21,16 +21,19 @@ import {
MEETING_NOTES_API,
MEETING_PRESCREPTIONS_API,
PATIENT_DELETE_API,
PATIENT_FILTER_LIST_API,
PATIENT_LABKIT_LIST_API,
PATIENT_LABKIT_STATUS_UPDATE_API,
PATIENT_LIST_API,
PATIENT_MEETING_LIST_API,
PATIENT_PRESCRIPTION_STATUS_UPDATE_API,
PATIENT_UPDATE_API,
PROFILE_UPDATE_API,
PROVIDER_DELETE_API,
PROVIDER_LIST_API,
PROVIDER_MEETING_LIST_API,
PROVIDER_UPDATE_API
PROVIDER_UPDATE_API,
SUBCRIPTIONS_LIST_API
} from './constants.js';
@@ -45,7 +48,9 @@ export default createStore({
providerMeetingList:[],
providersList:[],
labsList:[],
subcriptions:[],
patientLabKitStatus:'',
patientPrescriptionStatus:'',
singlePatientAppointment: null,
patientPrescription:null,
patientNotes: null,
@@ -88,6 +93,9 @@ export default createStore({
state.showMessage = payload
},
setSubcriptions(state, payload) {
state.subcriptions = payload
},
setPtientList(state, payload) {
state.patientList = payload
},
@@ -132,7 +140,12 @@ export default createStore({
},
setPatientLabKitStatus(state, payload) {
state.patientLabKitStatus = payload
}
},
setPatientPrescriptionStatus(state, payload) {
state.patientPrescriptionStatus = payload
},
},
@@ -147,7 +160,11 @@ export default createStore({
async patientList({ commit }, payload) {
commit('setLoading', true)
console.log(localStorage.getItem('admin_access_token'))
await axios.post(PATIENT_LIST_API, {}, {
await axios.post(PATIENT_LIST_API, {
plan: 'all' ,
gender: 'all',
state: 'all',
}, {
headers: {
'Authorization': `Bearer ${localStorage.getItem('admin_access_token')}`,
}
@@ -176,6 +193,58 @@ export default createStore({
console.error('Error:', error);
});
},
async PatientFilter({ commit,state }, payload) {
commit('setLoading', true)
await axios.post(PATIENT_FILTER_LIST_API, {
plan: payload.plan ? payload.plan: 'all' ,
gender: payload.gender ? payload.gender: 'all',
state: payload.state? payload.state :'all',
}, {
headers: {
'Authorization': `Bearer ${localStorage.getItem('admin_access_token')}`,
}
}) .then(response => {
commit('setLoading', false)
console.log('Response Patient:', response.data.patients);
let dataArray =[]
for (let data of response.data.patients) {
let dataObject = {}
dataObject.name = data.first_name + ' ' + data.last_name
dataObject.first_name = data.first_name
dataObject.last_name = data.last_name
dataObject.email = data.email
dataObject.dob = data.dob
dataObject.phone_no = data.phone_no
dataObject.avatar = '',
dataObject.id = data.id,
dataArray.push(dataObject)
}
console.log(dataArray)
commit('setPtientList',dataArray)
})
.catch(error => {
commit('setLoading', false)
console.error('Error:', error);
});
},
async getSubcriptions ({commit,state},payload){
commit('setLoading', true)
await axios.post(SUBCRIPTIONS_LIST_API, {}, {
headers: {
'Authorization': `Bearer ${localStorage.getItem('admin_access_token')}`,
}
}) .then(response => {
commit('setLoading', false)
console.log('Response Subcriptions:', response.data);
commit('setSubcriptions',response.data);
})
.catch(error => {
commit('setLoading', false)
commit('setPrescription',null)
console.error('Error:', error);
});
},
async patientMeetingList({ commit }, payload) {
commit('setLoading', true)
console.log(localStorage.getItem('admin_access_token'))
@@ -428,6 +497,23 @@ export default createStore({
console.error('Error:', error);
});
},
async updatePrescriptionStatus ({commit,state},payload){
commit('setLoading', true)
await axios.post(PATIENT_PRESCRIPTION_STATUS_UPDATE_API+payload.prescription_id ,{
status:payload.status
}, {
headers: {
'Authorization': `Bearer ${localStorage.getItem('admin_access_token')}`,
}
}) .then(response => {
commit('setLoading', false)
commit('setPatientPrescriptionStatus',response.data);
})
.catch(error => {
commit('setLoading', false)
console.error('Error:', error);
});
},
async getAppointmentByIdAgent ({commit,state},payload){
commit('setLoading', true)
await axios.post(APPOINTMENT_DETAILS_API+payload.patient_id + '/' + payload.appointment_id, {}, {
@@ -890,6 +976,10 @@ export default createStore({
console.log('payload');
return state.showMessage
},
getSubcriptions(state){
return state.subcriptions
},
getPatientList(state){
return state.patientList
},
@@ -905,6 +995,9 @@ export default createStore({
getPatientLabKitStatus(state){
return state.patientLabKitStatus
},
getPatientPrescriptionStatus(state){
return state.patientPrescriptionStatus
},
getProvidersList(state){
return state.providersList
},