This commit is contained in:
nasir@endelospay.com 2024-06-05 22:52:34 +05:00
parent 7e451af7a2
commit 83459a1ea8
8 changed files with 321 additions and 7 deletions

View File

@ -1,6 +1,6 @@
export const GET_BASE_PATH = ""
// let MAIN_DOMAIN = "http://127.0.0.1:8000";
let MAIN_DOMAIN = "http://telemedpro.test";
let MAIN_DOMAIN = "http://127.0.0.1:8000";
//let MAIN_DOMAIN = "http://telemedpro.test";
export const ADMIN_LOGIN_API = MAIN_DOMAIN + "/api/admin/login"
export const PATIENT_LIST_API = MAIN_DOMAIN + "/api/admin/patient-list"
@ -30,4 +30,4 @@ export const MEDICINE_ADD_QUESTIONERIES_EXCEL_API = MAIN_DOMAIN + "/api/admin/qu
export const MEDICINE_SAVE_API = MAIN_DOMAIN + "/api/admin/save-med"
export const MEDICINE_UPDATE_API = MAIN_DOMAIN + "/api/admin/update-med/"
export const MEDICINE_DELETE_API = MAIN_DOMAIN + "/api/admin/delete-med/"
export const PROVIDER_MEETING_LIST_API = MAIN_DOMAIN + "/api/admin/get-meeting-history-with-agent/"

View File

@ -176,7 +176,7 @@ const options = [
</v-list-item>
</v-list>
</VMenu>
</div>
</div>
<!-- <div class="d-flex gap-1">
<VBtn class="text-capitalize text-white" @click="historyDetail(item)"> Detail
</VBtn>

View File

@ -0,0 +1,79 @@
<script setup>
import Notes from '@/pages/pages/patient-meetings/notes.vue';
import Prescription from '@/pages/pages/patient-meetings/prescription.vue';
import moment from 'moment';
import { onMounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useStore } from 'vuex';
const store = useStore();
const router = useRouter();
const route = useRoute();
const patientId = route.params.patient_id;
const appointmentId = route.params.id;
const currentTab = ref(0);
const appointmentID = ref();
const doctorName = ref();
const startTime = ref();
const endTime = ref();
const duration = ref();
const appointmentData = ref(null);
onMounted(async () => {
store.dispatch('updateIsLoading', true);
await store.dispatch('getAppointmentByIdAgent', {
patient_id: patientId,
appointment_id: appointmentId,
});
appointmentData.value = store.getters.getSinglePatientAppointment;
appointmentID.value = appointmentId;
doctorName.value = appointmentData.value.agent_name;
startTime.value = appointmentData.value.start_time;
endTime.value = appointmentData.value.end_time;
duration.value = totalCallDuration(startTime.value, endTime.value);
localStorage.setItem('meetingPatientAppointmentId', appointmentID.value);
store.dispatch('updateIsLoading', false);
});
const totalCallDuration = (start_time, end_time) => {
const startMoment = moment(start_time);
const endMoment = moment(end_time);
const duration = moment.duration(endMoment.diff(startMoment));
const hours = duration.hours();
const minutes = duration.minutes();
const seconds = duration.seconds();
return `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
};
</script>
<template>
<VCard>
<VCardText>
<h3 v-if="appointmentID"> #{{ appointmentID }} By {{ doctorName }} </h3>
<span> Meeting duration: <b>{{ duration }}</b></span>
</VCardText>
<div class="d-flex">
<div>
<VTabs v-model="currentTab" direction="vertical">
<VTab>
<VIcon start icon="tabler-edit" />
Notes
</VTab>
<VTab>
<VIcon start icon="tabler-lock" />
Prescriptions
</VTab>
</VTabs>
</div>
<VCardText>
<VWindow v-model="currentTab" class="ms-3">
<VWindowItem>
<Notes />
</VWindowItem>
<VWindowItem>
<Prescription />
</VWindowItem>
</VWindow>
</VCardText>
</div>
</VCard>
</template>

View File

@ -0,0 +1,189 @@
<script setup>
import moment from 'moment';
import { onBeforeMount, onMounted, onUnmounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useStore } from 'vuex';
const store = useStore();
const router = useRouter();
const route = useRoute();
const editDialog = ref(false);
const deleteDialog = ref(false);
const search = ref('');
const appointmentId = ref('');
const defaultItem = ref({
id: -1,
avatar: '',
name: '',
email: '',
dob: '',
phone_no: '',
});
const editedItem = ref({ ...defaultItem.value });
const editedIndex = ref(-1);
const providerMeetingList = ref([]);
const isLoading = ref(false);
// Status options
const selectedOptions = [
{ text: 'Active', value: 1 },
{ text: 'InActive', value: 2 },
];
const refVForm = ref(null);
// Headers
const headers = [
// { title: 'Appointment Id', key: 'id' },
{ title: 'Patient', key: 'patient_name' },
// { key: 'appointment_date', sortable: false, title: 'Date' },
{ key: 'start_time', title: 'Start Time' },
{ key: 'end_time', title: 'End Time' },
{ key: 'duration', title: 'Duration' },
{ title: 'ACTIONS', key: 'actions' },
];
// Utility functions
function changeDateFormat(dateFormat) {
if (dateFormat) {
const [datePart, timePart] = dateFormat.split(' ');
const [year, month, day] = datePart.split('-');
const formattedDate = `${parseInt(month)}-${parseInt(day)}-${year}`;
return `${formattedDate} ${timePart}`;
}
return dateFormat;
}
function changeFormat(dateFormat) {
const [year, month, day] = dateFormat.split('-');
return `${parseInt(month)}-${parseInt(day)}-${year}`;
}
function totalCallDuration(start_time, end_time) {
const startMoment = moment(start_time);
const endMoment = moment(end_time);
const duration = moment.duration(endMoment.diff(startMoment));
const hours = String(duration.hours()).padStart(2, '0');
const minutes = String(duration.minutes()).padStart(2, '0');
const seconds = String(duration.seconds()).padStart(2, '0');
if (hours === '00' && minutes === '00') {
return `00:00:${seconds}`;
} else if (hours === '00') {
return `00:${minutes}:${seconds}`;
} else {
return `${hours}:${minutes}:${seconds}`;
}
}
// Fetch and process the patient meeting list
const getPatientMeetingList = async () => {
store.dispatch('updateIsLoading', true);
await store.dispatch('providerMeetingList', { id: route.params.id });
store.dispatch('updateIsLoading', false);
let list = store.getters.getProviderMeetingList;
providerMeetingList.value = list.map(history => ({
...history,
appointment_date: changeFormat(history.appointment_date),
start_time: changeDateFormat(history.start_time),
end_time: changeDateFormat(history.end_time),
duration: totalCallDuration(history.start_time, history.end_time),
}));
console.log(list);
};
// Lifecycle hooks
onBeforeMount(() => {});
onMounted(async () => {
await getPatientMeetingList();
});
onUnmounted(() => {});
const historyDetail = (item, value) => {
console.log('item',item.id ,value)
if(value == 'notes')
router.push('/admin/patient/meeting/notes/' + item.patient_id + '/' + item.id);
if(value == 'prescription')
router.push('/admin/patient/meeting/prescription/' + item.patient_id + '/' + item.id);
}
const menusVariant = [
'primary'
];
const options = [
{
title: 'Notes',
key: 'notes',
},
{
title: 'Prescription',
key: 'prescription',
},
]
</script>
<template>
<v-row>
<v-col cols="12" md="12">
<v-card title="Meetings">
<v-card-text>
<v-row>
<v-col cols="12" offset-md="8" md="4">
<v-text-field
v-model="search"
label="Search"
placeholder="Search ..."
append-inner-icon="ri-search-line"
single-line
hide-details
dense
outlined
/>
</v-col>
</v-row>
</v-card-text>
<v-data-table
:headers="headers"
:items="providerMeetingList"
:search="search"
:items-per-page="5"
class="text-no-wrap"
>
<template #item.id="{ item }">{{ item.id }}</template>
<template #item.duration="{ item }">{{ item.duration }}</template>
<!-- Actions -->
<template #item.actions="{ item }">
<div class="demo-space-x">
<VMenu
v-for="menu in menusVariant"
:key="menu"
>
<template #activator="{ props }">
<i class="ri-more-2-line cursor-pointer" v-bind="props"></i>
</template>
<v-list>
<v-list-item
v-for="opt in options"
:key="opt.value"
@click="historyDetail(item, opt.key)"
>
{{ opt.title }}
</v-list-item>
</v-list>
</VMenu>
</div>
<!-- <div class="d-flex gap-1">
<VBtn class="text-capitalize text-white" @click="historyDetail(item)"> Detail
</VBtn>
</div> -->
</template>
</v-data-table>
</v-card>
</v-col>
</v-row>
</template>

View File

@ -16,7 +16,7 @@ const defaultItem = ref({
phone_no: '',
})
const router = useRouter()
const editedItem = ref(defaultItem.value)
const editedIndex = ref(-1)
const providersList = ref([])
@ -152,7 +152,9 @@ const save = async () => {
}
const getMettings = (Item) => {
router.push('/admin/provider/meetings/'+Item.id);
}
const deleteItemConfirm = async() => {
console.log('editedIndex.value',editedIndex.value,editedItem.value.id)
await store.dispatch('providerDelete',{
@ -260,6 +262,12 @@ onMounted(() => {
>
<VIcon icon="ri-delete-bin-line" />
</IconBtn>
<IconBtn
size="small"
@click="getMettings(item)"
>
<VIcon icon="ri-time-line" />
</IconBtn>
</div>
</template>
</VDataTable>

View File

@ -53,6 +53,16 @@ export const routes = [
name: 'admin-patient-meeitng-details',
component: () => import('@/pages/patients/meeting-details.vue'),
},
{
path: '/admin/provider/meetings/:id',
name: 'admin-provider-meeitngs',
component: () => import('@/pages/providers/meetings.vue'),
},
{
path: '/admin/provider/meeting-details/:provider_id/:id',
name: 'admin-provider-meeitng-details',
component: () => import('@/pages/providers/meeting-details.vue'),
},
{
path: '/admin/patient/meeting/prescription/:patient_id/:id',
name: 'admin-patient-meeitng-prescription',

View File

@ -18,6 +18,7 @@ import {
PATIENT_UPDATE_API,
PROVIDER_DELETE_API,
PROVIDER_LIST_API,
PROVIDER_MEETING_LIST_API,
PROVIDER_UPDATE_API
} from './constants.js';
@ -27,7 +28,8 @@ export default createStore({
state: {
isLoading: false,
patientList:[],
patientMeetingList:[],
patientMeetingList: [],
providerMeetingList:[],
providersList:[],
labsList:[],
singlePatientAppointment: null,
@ -47,6 +49,9 @@ export default createStore({
setPtientMeetingList(state, payload) {
state.patientMeetingList = payload
},
setProviderMeetingList(state, payload) {
state.providerMeetingList = payload
},
setProvidersList(state, payload) {
state.providersList = payload
},
@ -124,6 +129,24 @@ export default createStore({
console.error('Error:', error);
});
},
async providerMeetingList({ commit }, payload) {
commit('setLoading', true)
console.log(localStorage.getItem('admin_access_token'))
await axios.post(PROVIDER_MEETING_LIST_API+payload.id, {}, {
headers: {
'Authorization': `Bearer ${localStorage.getItem('admin_access_token')}`,
}
}) .then(response => {
commit('setLoading', false)
console.log('Meeting Response:', response.data.patients);
commit('setProviderMeetingList',response.data.patients);
})
.catch(error => {
commit('setLoading', false)
console.error('Error:', error);
});
},
async patientUpdate({ commit }, payload) {
commit('setLoading', true)
await axios.post(PATIENT_UPDATE_API+payload.id, {
@ -525,6 +548,9 @@ export default createStore({
getPatientMeetingList(state){
return state.patientMeetingList
},
getProviderMeetingList(state){
return state.providerMeetingList
},
getProvidersList(state){
return state.providersList

2
typed-router.d.ts vendored
View File

@ -155,6 +155,8 @@ declare module 'vue-router/auto/routes' {
'patients-meeting-details': RouteRecordInfo<'patients-meeting-details', '/patients/meeting-details', Record<never, never>, Record<never, never>>,
'patients-meetings': RouteRecordInfo<'patients-meetings', '/patients/meetings', Record<never, never>, Record<never, never>>,
'patients-patients': RouteRecordInfo<'patients-patients', '/patients/patients', Record<never, never>, Record<never, never>>,
'providers-meeting-details': RouteRecordInfo<'providers-meeting-details', '/providers/meeting-details', Record<never, never>, Record<never, never>>,
'providers-meetings': RouteRecordInfo<'providers-meetings', '/providers/meetings', Record<never, never>, Record<never, never>>,
'providers-providers': RouteRecordInfo<'providers-providers', '/providers/providers', Record<never, never>, Record<never, never>>,
'register': RouteRecordInfo<'register', '/register', Record<never, never>, Record<never, never>>,
'tables-data-table': RouteRecordInfo<'tables-data-table', '/tables/data-table', Record<never, never>, Record<never, never>>,