Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Session search #164

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 35 additions & 160 deletions apps/frontend/doctor/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { PatientDetails, UpcomingDetails } from '@hospe/ui';
import { UpcomingDetails } from '@hospe/ui';
import { Api } from '@hospe/next';
import {
Paper,
SimpleGrid,
Expand All @@ -7,9 +8,39 @@ import {
Text,
Group,
} from '@mantine/core';
import { Users, Report } from 'tabler-icons-react';
import { Report } from 'tabler-icons-react';
import { useEffect, useState } from 'react';


interface Session {
__v: string;
docId: string;
_id: string;
date: string;
time: string;
maximumPatients: number;
doctorFee: number;
}

export interface Formdata {
_id: string;
}
export function Index() {
const [session, setSession] = useState<Session[]>([]);

useEffect(() => {
Api.Doctor.GetAll().then((res) => {
setSession(res);
});
}, []);

const onSubmit = async (values: Formdata) => {
await Api.Doctor.Delete(values._id);
Api.Doctor.GetAll().then((res) => {
setSession(res);
});
};

return (
<>
<SimpleGrid
Expand All @@ -20,121 +51,6 @@ export function Index() {
{ maxWidth: 'sm', cols: 1, spacing: 'sm' },
]}
>
{/* Patients Details */}
<div style={{ height: 450 }}>
<Paper
radius="md"
shadow="sm"
withBorder
p="lg"
m="md"
style={{ height: '100%' }}
sx={(theme) => ({
backgroundColor:
theme.colorScheme === 'dark'
? theme.colors.dark[8]
: theme.white,
})}
>
<Text size="md" pb={12}>
Today Appointments
</Text>
<Divider my="sm" />
<Group mb={'sm'}>
<Users size={18} />
<Text size="xs">10 Active Patients</Text>
</Group>

<ScrollArea
style={{ height: '80%', width: '100%', paddingBottom: 12 }}
type="hover"
>
<PatientDetails
patientdata={[
{
name: 'John Davis',
gender: 'Male',
age: 54,
appointmentNumber: 1,
},
{
name: 'John Harison',
gender: 'Male',
age: 22,
appointmentNumber: 2,
},
{
name: 'John Paker',
gender: 'Male',
age: 95,
appointmentNumber: 3,
},
{
name: 'John Hamilton',
gender: 'Female',
age: 22,
appointmentNumber: 4,
},
{
name: 'John',
gender: 'Female',
age: 30,
appointmentNumber: 5,
},
{
name: 'John Paker',
gender: 'Male',
age: 95,
appointmentNumber: 6,
},
{
name: 'John Hamilton',
gender: 'Female',
age: 22,
appointmentNumber: 7,
},
{
name: 'John',
gender: 'Female',
age: 30,
appointmentNumber: 5,
},
{
name: 'John Paker',
gender: 'Male',
age: 95,
appointmentNumber: 6,
},
{
name: 'John Hamilton',
gender: 'Female',
age: 22,
appointmentNumber: 7,
},
{
name: 'John',
gender: 'Female',
age: 30,
appointmentNumber: 5,
},
{
name: 'John Paker',
gender: 'Male',
age: 95,
appointmentNumber: 6,
},
{
name: 'John Hamilton',
gender: 'Female',
age: 22,
appointmentNumber: 7,
},
]}
/>
</ScrollArea>
</Paper>
</div>

{/* Upcoming Appointments */}
<div style={{ height: 450 }}>
<Paper
Expand Down Expand Up @@ -163,49 +79,8 @@ export function Index() {

<ScrollArea style={{ height: '80%', width: '100%' }}>
<UpcomingDetails
upcomingDetailsdata={[
{
time: '8.30 PM',
date: '2022-08-15',
patientsNumber: 12,
location: 'Room 06',
},

{
time: '10.30 PM',
date: '2022-08-16',
patientsNumber: 25,
location: 'Room 08',
},

{
time: '8.30 PM',
date: '2022-08-16',
patientsNumber: 32,
location: 'Room 10',
},

{
time: '8.30 PM',
date: '2022-08-15',
patientsNumber: 12,
location: 'Room 06',
},

{
time: '8.30 PM',
date: '2022-08-15',
patientsNumber: 12,
location: 'Room 06',
},

{
time: '8.30 PM',
date: '2022-08-15',
patientsNumber: 12,
location: 'Room 06',
},
]}
upcomingDetailsdata={session}
onSubmit={onSubmit}
/>
</ScrollArea>
</Paper>
Expand Down
3 changes: 1 addition & 2 deletions apps/frontend/management/pages/doctorRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ const doctorRegistration = () => {
];

const onSubmit = async (values: IDoctorCreate) => {
const res = await Api.Employee.CreateDoctor(values);
console.log(res);
await Api.Employee.CreateDoctor(values);
};

return (
Expand Down
75 changes: 37 additions & 38 deletions apps/frontend/user/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,56 +1,54 @@
import { useAuthStore } from '@hospe/next';
import { ResultCard, SearchBar } from '@hospe/ui';
import { SearchBar, SearchRes } from '@hospe/ui';
import { Center, SimpleGrid } from '@mantine/core';
import { Api } from '@hospe/next';
import { useEffect, useState } from 'react';

export interface Formdata {
Doctype: string;
}

interface SearchData {
_id: string;
docType: string;
docFee: number;
time: string;
maximumPatients: number;
date: string;
docName: string;
}

interface docFee {
docFee: number;
}

const IndexPage = () => {
const { displayName } = useAuthStore();
const [session, setSession] = useState<SearchData[]>([]);
const [fee, setFee] = useState<docFee[]>([]);

useEffect(() => {
setSession([]);
}, []);

const onSubmit = async (values: Formdata) => {
const data = await Api.Doctor.GetTypes(values.Doctype);
setSession(data);
setFee(data.docFee);
};

const mockDataSearch = {
searchData: [
{
specializations: ['General Physician', 'Dentist', 'Cardiologist'],
specializations: ['Surgeon', 'ENT', 'VOG'],
time: ['Any', 'Morning', 'Afternoon', 'Evening'],
gender: ['Any', 'Male', 'Female'],
},
],
};

const mockDataResult = {
data: [
{
name: 'John Doe',
specialization: 'General Physician',
patientCount: 10,
time: 10,
fee: 100,
},
{
name: 'John Doe',
specialization: 'General Physician',
patientCount: 10,
time: 10,
fee: 100,
},
{
name: 'John Doe',
specialization: 'General Physician',
patientCount: 10,
time: 10,
fee: 100,
},
],
};

const items = mockDataResult.data.map((item) => (
<div key={item.name}>
<ResultCard {...mockDataResult}></ResultCard>
</div>
));

return (
<>
<div>
<SearchBar {...mockDataSearch}></SearchBar>
<SearchBar {...mockDataSearch} onSubmit={onSubmit}></SearchBar>
<Center>
<SimpleGrid
cols={3}
Expand All @@ -61,9 +59,10 @@ const IndexPage = () => {
{ maxWidth: 755, cols: 1, spacing: 'sm' },
]}
>
{items}
{/* {items} */}
</SimpleGrid>
</Center>
<SearchRes searchData={session}></SearchRes>
</div>
</>
);
Expand Down
33 changes: 32 additions & 1 deletion apps/services/api/src/apps/channeling/channeling.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import {
FindOneChanneling,
UpdateChanneling,
FindAllChanneling,
FindAllChannelingByDocId,
FindAllChannelingByDocType,
} from './channeling.service';

import { FindOneEmployee } from '../employee/employee.service';

export const router = Router();

/* find channeling session by id */
Expand All @@ -30,6 +34,25 @@ router.get('/', async (req, res) => {
ExpressErrorResponseHandler(res, error);
}
});

router.get('/doctor/:docId', async (req, res) => {
try {
const data = await FindAllChannelingByDocId(req.params.docId);
res.status(200).json(data);
} catch (error) {
ExpressErrorResponseHandler(res, error);
}
});

router.get('/type/:docType', async (req, res) => {
try {
const data = await FindAllChannelingByDocType(req.params.docType);
res.status(200).json(data);
} catch (error) {
ExpressErrorResponseHandler(res, error);
}
});

/* delete channeling session by id */
router.delete('/:id', async (req, res) => {
try {
Expand All @@ -44,7 +67,15 @@ router.delete('/:id', async (req, res) => {
/* create channeling session */
router.post('/create-channeling', async (req, res) => {
try {
const data = await CreateChanneling(req.user.id, req.body);
const docData = await FindOneEmployee(req.user.id);
const docType = docData.specialization;
const docName = docData.name;
const data = await CreateChanneling(
req.user.id,
docType,
docName,
req.body
);
res.status(200).json(data);
} catch (error) {
ExpressErrorResponseHandler(res, error);
Expand Down
Loading