From 9ca8de0a693b964925b1301180aec8c9e28467f4 Mon Sep 17 00:00:00 2001 From: Wendy Date: Fri, 4 Oct 2024 12:13:53 -0700 Subject: [PATCH 01/22] include hospital data for each physician --- server/routes/api/v1/physicians/list.js | 32 ++++++++++++++++++------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/server/routes/api/v1/physicians/list.js b/server/routes/api/v1/physicians/list.js index edb268e3..d1e7c138 100644 --- a/server/routes/api/v1/physicians/list.js +++ b/server/routes/api/v1/physicians/list.js @@ -23,6 +23,16 @@ export default async function (fastify) { phone: { type: 'string' }, firstName: { type: 'string' }, lastName: { type: 'string' }, + hospitals: { + type: 'array', + items: { + type: 'object', + properties: { + id: { type: 'string' }, + name: { type: 'string'} + } + } + } }, }, }, @@ -72,16 +82,20 @@ export default async function (fastify) { }; } - const options = { - page, - perPage, - orderBy: [{ firstName: 'asc' }, { lastName: 'asc' }], - where: whereClase, - }; + const options = await fastify.prisma.$transaction(async (tx) => { + const exists = await tx.physician.findMany({ + skip: (Number(page) - 1) * Number(perPage), + take: Number(perPage), + orderBy: [{ firstName: 'asc' }, { lastName: 'asc' }], + where: whereClase, + include: { + hospitals: true + } + }) + return exists + }) - const { records, total } = - await fastify.prisma.physician.paginate(options); - reply.setPaginationHeaders(page, perPage, total).send(records); + reply.setPaginationHeaders(page, perPage, options.length).send(options); }, ); } From 24f1a4e0be311e6c55c9ad55729c9ba63af2a0f3 Mon Sep 17 00:00:00 2001 From: Wendy Date: Fri, 4 Oct 2024 12:15:40 -0700 Subject: [PATCH 02/22] display name of hospital with each physician in form dropdrown --- client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx b/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx index 0e8069d8..87b46550 100644 --- a/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx +++ b/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx @@ -91,7 +91,7 @@ export default function HealthcareChoicesSearch({ form, choice, initialData }) { const options = (data || []).map((item) => ( - {item.name} + {item.name} - {item.hospitals[0]?.name} )); From a03668831ef5836395f46031873d29ff7dbe4e96 Mon Sep 17 00:00:00 2001 From: Wendy Date: Fri, 4 Oct 2024 12:48:46 -0700 Subject: [PATCH 03/22] Displays physician followed by hospital name only if it exists --- client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx b/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx index 87b46550..575c55b1 100644 --- a/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx +++ b/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx @@ -91,7 +91,7 @@ export default function HealthcareChoicesSearch({ form, choice, initialData }) { const options = (data || []).map((item) => ( - {item.name} - {item.hospitals[0]?.name} + {item.name} {item.hospitals?.length && `- ${item.hospitals[0].name}`} )); From 4849cef859c2e03be5b1db489776baf01af7cafe Mon Sep 17 00:00:00 2001 From: Wendy Date: Fri, 4 Oct 2024 14:23:09 -0700 Subject: [PATCH 04/22] Format selected value --- client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx b/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx index 575c55b1..b7355595 100644 --- a/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx +++ b/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx @@ -72,7 +72,7 @@ export default function HealthcareChoicesSearch({ form, choice, initialData }) { }; const handleSelectValue = (id, key) => { - const name = key.children; + const name = key.children.filter( el => el !== undefined).join('').trim(); setValue({ id, name }); setSearch(name); form.setFieldValue(`healthcareChoices.${choice}Id`, id); From c6ada313381877255390eb61c7fbf07b11cf4e51 Mon Sep 17 00:00:00 2001 From: Wendy Date: Fri, 4 Oct 2024 14:40:33 -0700 Subject: [PATCH 05/22] Fixed format issues with Prettier --- .../inputs/HealthcareChoicesSearch.jsx | 5 ++++- server/routes/api/v1/physicians/list.js | 18 +++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx b/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx index b7355595..e6d5699f 100644 --- a/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx +++ b/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx @@ -72,7 +72,10 @@ export default function HealthcareChoicesSearch({ form, choice, initialData }) { }; const handleSelectValue = (id, key) => { - const name = key.children.filter( el => el !== undefined).join('').trim(); + const name = key.children + .filter((el) => el !== undefined) + .join('') + .trim(); setValue({ id, name }); setSearch(name); form.setFieldValue(`healthcareChoices.${choice}Id`, id); diff --git a/server/routes/api/v1/physicians/list.js b/server/routes/api/v1/physicians/list.js index d1e7c138..0b0c513d 100644 --- a/server/routes/api/v1/physicians/list.js +++ b/server/routes/api/v1/physicians/list.js @@ -29,10 +29,10 @@ export default async function (fastify) { type: 'object', properties: { id: { type: 'string' }, - name: { type: 'string'} - } - } - } + name: { type: 'string' }, + }, + }, + }, }, }, }, @@ -89,11 +89,11 @@ export default async function (fastify) { orderBy: [{ firstName: 'asc' }, { lastName: 'asc' }], where: whereClase, include: { - hospitals: true - } - }) - return exists - }) + hospitals: true, + }, + }); + return exists; + }); reply.setPaginationHeaders(page, perPage, options.length).send(options); }, From 1ddac19cd0a134bb83f6c82f88c99448773e0b6d Mon Sep 17 00:00:00 2001 From: Wendy Date: Mon, 7 Oct 2024 23:34:30 -0700 Subject: [PATCH 06/22] Fixed bug related to pagination headers --- server/routes/api/v1/physicians/list.js | 30 ++++++++++++++----------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/server/routes/api/v1/physicians/list.js b/server/routes/api/v1/physicians/list.js index 0b0c513d..a3957dcd 100644 --- a/server/routes/api/v1/physicians/list.js +++ b/server/routes/api/v1/physicians/list.js @@ -82,20 +82,24 @@ export default async function (fastify) { }; } - const options = await fastify.prisma.$transaction(async (tx) => { - const exists = await tx.physician.findMany({ - skip: (Number(page) - 1) * Number(perPage), - take: Number(perPage), - orderBy: [{ firstName: 'asc' }, { lastName: 'asc' }], - where: whereClase, - include: { - hospitals: true, - }, - }); - return exists; - }); + const options = { + page, + perPage, + orderBy: [{ firstName: 'asc' }, { lastName: 'asc' }], + where: whereClase, + include: { hospitals: true }, + }; + + const { page: currentPage, perPage: currentPerPage, include, ...paginationOptions } = options; - reply.setPaginationHeaders(page, perPage, options.length).send(options); + const total = await fastify.prisma.physician.count(paginationOptions) + const records = await fastify.prisma.physician.findMany({ + ...paginationOptions, + include, + skip: Number((currentPage - 1) * currentPerPage), + take: Number(currentPerPage), + }) + reply.setPaginationHeaders(currentPage, currentPerPage, total).send(records); }, ); } From 9679edd7676379c1bdd89fd576a051565db51df1 Mon Sep 17 00:00:00 2001 From: Wendy Date: Mon, 7 Oct 2024 23:50:20 -0700 Subject: [PATCH 07/22] Formatted with Prettier --- server/routes/api/v1/physicians/list.js | 31 +++++++++++++++---------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/server/routes/api/v1/physicians/list.js b/server/routes/api/v1/physicians/list.js index a3957dcd..fbddd9f6 100644 --- a/server/routes/api/v1/physicians/list.js +++ b/server/routes/api/v1/physicians/list.js @@ -87,19 +87,26 @@ export default async function (fastify) { perPage, orderBy: [{ firstName: 'asc' }, { lastName: 'asc' }], where: whereClase, - include: { hospitals: true }, - }; - - const { page: currentPage, perPage: currentPerPage, include, ...paginationOptions } = options; + include: { hospitals: true }, + }; - const total = await fastify.prisma.physician.count(paginationOptions) - const records = await fastify.prisma.physician.findMany({ - ...paginationOptions, - include, - skip: Number((currentPage - 1) * currentPerPage), - take: Number(currentPerPage), - }) - reply.setPaginationHeaders(currentPage, currentPerPage, total).send(records); + const { + page: currentPage, + perPage: currentPerPage, + include, + ...paginationOptions + } = options; + + const total = await fastify.prisma.physician.count(paginationOptions); + const records = await fastify.prisma.physician.findMany({ + ...paginationOptions, + include, + skip: Number((currentPage - 1) * currentPerPage), + take: Number(currentPerPage), + }); + reply + .setPaginationHeaders(currentPage, currentPerPage, total) + .send(records); }, ); } From d1e4e4c8b6add3e225ec41e5b115b8e2662803c4 Mon Sep 17 00:00:00 2001 From: Wendy Date: Mon, 21 Oct 2024 01:47:25 -0700 Subject: [PATCH 08/22] Modify pagination parameters to avoid conflicts --- client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx b/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx index e6d5699f..520e6c0e 100644 --- a/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx +++ b/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx @@ -73,7 +73,7 @@ export default function HealthcareChoicesSearch({ form, choice, initialData }) { const handleSelectValue = (id, key) => { const name = key.children - .filter((el) => el !== undefined) + .filter((el) => el !== undefined && el) .join('') .trim(); setValue({ id, name }); @@ -94,7 +94,8 @@ export default function HealthcareChoicesSearch({ form, choice, initialData }) { const options = (data || []).map((item) => ( - {item.name} {item.hospitals?.length && `- ${item.hospitals[0].name}`} + {item.name} {item.phone}{' '} + {item.hospitals?.length && `- ${item.hospitals[0].name}`} )); From bd4a12a5064574bafd2d8794a9adfdf8e675dedb Mon Sep 17 00:00:00 2001 From: Wendy Date: Mon, 21 Oct 2024 01:48:27 -0700 Subject: [PATCH 09/22] Update display of dropdown values --- server/prisma/client.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/prisma/client.js b/server/prisma/client.js index 642b1e49..b5b335bc 100644 --- a/server/prisma/client.js +++ b/server/prisma/client.js @@ -6,12 +6,17 @@ const prisma = new PrismaClient({ name: 'paginate', model: { $allModels: { - async paginate({ page, perPage, ...options }) { + async paginate({ page, perPage, include, ...options }) { const take = parseInt(perPage, 10); const skip = (parseInt(page, 10) - 1) * take; const context = Prisma.getExtensionContext(this); const total = await context.count(options); - const records = await context.findMany({ ...options, skip, take }); + const records = await context.findMany({ + ...options, + include, + skip, + take, + }); return { records, total }; }, }, From bd63ad8f764fda5f406d75165eb6c91ade1a5662 Mon Sep 17 00:00:00 2001 From: Wendy Date: Mon, 21 Oct 2024 01:53:38 -0700 Subject: [PATCH 10/22] Include hospitals in physician query --- server/routes/api/v1/patients/get.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/server/routes/api/v1/patients/get.js b/server/routes/api/v1/patients/get.js index 822352f6..b2f2a3d3 100644 --- a/server/routes/api/v1/patients/get.js +++ b/server/routes/api/v1/patients/get.js @@ -58,6 +58,19 @@ export default async function (fastify, _opts) { lastName: { type: 'string' }, phone: { type: 'string' }, email: { type: 'string' }, + hospitals: { + type: 'array', + items: { + type: 'object', + properties: { + id: { type: 'string' }, + name: { type: 'string' }, + address: { type: 'string' }, + phone: { type: 'string' }, + email: { type: 'string' }, + }, + }, + }, }, }, updatedById: { type: 'string' }, @@ -98,7 +111,11 @@ export default async function (fastify, _opts) { orderBy: { sortOrder: 'asc' }, }, hospital: true, - physician: true, + physician: { + include: { + hospitals: true, + }, + }, }, }); if (!patient) throw new Error('Patient not found'); From e9b2490831959e2392f5f88ac3623a5bc43e7204 Mon Sep 17 00:00:00 2001 From: Wendy Date: Mon, 21 Oct 2024 01:55:06 -0700 Subject: [PATCH 11/22] Restore to previous approach of paginating results --- server/routes/api/v1/physicians/list.js | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/server/routes/api/v1/physicians/list.js b/server/routes/api/v1/physicians/list.js index fbddd9f6..af99c186 100644 --- a/server/routes/api/v1/physicians/list.js +++ b/server/routes/api/v1/physicians/list.js @@ -81,7 +81,6 @@ export default async function (fastify) { ], }; } - const options = { page, perPage, @@ -90,23 +89,9 @@ export default async function (fastify) { include: { hospitals: true }, }; - const { - page: currentPage, - perPage: currentPerPage, - include, - ...paginationOptions - } = options; - - const total = await fastify.prisma.physician.count(paginationOptions); - const records = await fastify.prisma.physician.findMany({ - ...paginationOptions, - include, - skip: Number((currentPage - 1) * currentPerPage), - take: Number(currentPerPage), - }); - reply - .setPaginationHeaders(currentPage, currentPerPage, total) - .send(records); + const { records, total } = + await fastify.prisma.physician.paginate(options); + reply.setPaginationHeaders(page, perPage, total).send(records); }, ); } From 98c96aaaab3e965db323efb2b6f1a4ab26fc9d0a Mon Sep 17 00:00:00 2001 From: Wendy Date: Mon, 21 Oct 2024 01:57:23 -0700 Subject: [PATCH 12/22] Refactored data mapping to hospital name --- client/src/pages/patients/LifelineAPI.js | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/pages/patients/LifelineAPI.js b/client/src/pages/patients/LifelineAPI.js index 60711f44..7ab0b555 100644 --- a/client/src/pages/patients/LifelineAPI.js +++ b/client/src/pages/patients/LifelineAPI.js @@ -18,6 +18,7 @@ export default class LifelineAPI { return { ...item, name: `${item.firstName} ${item.lastName}`, + hospital: item.hospitals[0].name, }; }); } From 5ff8584156509b48da006adf4febc63e3c9e1d93 Mon Sep 17 00:00:00 2001 From: Wendy Date: Mon, 21 Oct 2024 01:58:14 -0700 Subject: [PATCH 13/22] Update initial physician input --- client/src/pages/patients/PatientRegistration.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/pages/patients/PatientRegistration.jsx b/client/src/pages/patients/PatientRegistration.jsx index 46225133..a528fa66 100644 --- a/client/src/pages/patients/PatientRegistration.jsx +++ b/client/src/pages/patients/PatientRegistration.jsx @@ -47,7 +47,6 @@ export default function PatientRegistration() { codeStatus: false, }); const [unvisitedSections, setUnvisitedSections] = useState([]); - const { patientId } = useParams(); const navigate = useNavigate(); const location = useLocation(); @@ -175,7 +174,9 @@ export default function PatientRegistration() { setInitialPhysicianData({ id: physician ? physician.id : '', - name: physician ? `${physician.firstName} ${physician.lastName}` : '', + name: physician + ? `${physician.firstName} ${physician.lastName} ${physician.phone ? `${physician.phone} ` : ''}- ${physician.hospitals[0]?.name || ''}` + : '', }); const patientData = { From 02e8d16e75360e82401a8ce68db29a88f578724e Mon Sep 17 00:00:00 2001 From: Wendy Date: Mon, 21 Oct 2024 02:03:10 -0700 Subject: [PATCH 14/22] Modified component with hospital data --- client/src/pages/patients/PatientRegistrationAccordion.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/pages/patients/PatientRegistrationAccordion.jsx b/client/src/pages/patients/PatientRegistrationAccordion.jsx index 1f3f50af..0b581f24 100644 --- a/client/src/pages/patients/PatientRegistrationAccordion.jsx +++ b/client/src/pages/patients/PatientRegistrationAccordion.jsx @@ -186,6 +186,7 @@ export default function PatientRegistrationAccordion({ form={form} choice="physician" initialData={initialPhysicianData} + initialHospitalData={initialHospitalData} /> From 57ae77fd9d8b1f0048ed441921e7c8fbcb75c39e Mon Sep 17 00:00:00 2001 From: Wendy Date: Mon, 21 Oct 2024 02:13:09 -0700 Subject: [PATCH 15/22] Reformatted physician input value --- client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx b/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx index 520e6c0e..e96371ee 100644 --- a/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx +++ b/client/src/pages/patients/inputs/HealthcareChoicesSearch.jsx @@ -72,10 +72,7 @@ export default function HealthcareChoicesSearch({ form, choice, initialData }) { }; const handleSelectValue = (id, key) => { - const name = key.children - .filter((el) => el !== undefined && el) - .join('') - .trim(); + const name = key.children.filter((el) => el.trim() !== '').join(' '); setValue({ id, name }); setSearch(name); form.setFieldValue(`healthcareChoices.${choice}Id`, id); From a5713459d90cdacf0de4bd058796ae2460bbd742 Mon Sep 17 00:00:00 2001 From: samau3 Date: Mon, 21 Oct 2024 13:52:30 -0700 Subject: [PATCH 16/22] Add nullish operator to prevent accessing undefined properties Without the use of the nullish operator here, the app would crash when a search for physicians is made where some of the fields are null. --- client/src/pages/patients/LifelineAPI.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/pages/patients/LifelineAPI.js b/client/src/pages/patients/LifelineAPI.js index 7ab0b555..6366a97f 100644 --- a/client/src/pages/patients/LifelineAPI.js +++ b/client/src/pages/patients/LifelineAPI.js @@ -18,7 +18,7 @@ export default class LifelineAPI { return { ...item, name: `${item.firstName} ${item.lastName}`, - hospital: item.hospitals[0].name, + hospital: item.hospitals[0]?.name, }; }); } From 09401f1ecdd8a0379f51ccc691e3c45468186f64 Mon Sep 17 00:00:00 2001 From: samau3 Date: Mon, 21 Oct 2024 14:01:42 -0700 Subject: [PATCH 17/22] Modify string creation logic to remove extra characters --- .../patients/register/inputs/HealthcareChoicesSearch.jsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/client/src/pages/patients/register/inputs/HealthcareChoicesSearch.jsx b/client/src/pages/patients/register/inputs/HealthcareChoicesSearch.jsx index 4523de8c..9c4ec8f2 100644 --- a/client/src/pages/patients/register/inputs/HealthcareChoicesSearch.jsx +++ b/client/src/pages/patients/register/inputs/HealthcareChoicesSearch.jsx @@ -71,15 +71,14 @@ export default function HealthcareChoicesSearch({ form, choice, initialData }) { const handleSelectValue = (id, key) => { const name = key.children; - // setValue({ id, name }); - setSearch(name); + setSearch(name.join("")); form.setFieldValue(`healthcareChoices.${choice}Id`, id); combobox.closeDropdown(); }; const options = (data || []).map((item) => ( - {item.name} + {item.name}{item.hospital ? ` - ${item.hospital}` : ''} )); From 385885ac6e10d79ea50088640fd6358d60acfcc2 Mon Sep 17 00:00:00 2001 From: samau3 Date: Mon, 21 Oct 2024 14:11:56 -0700 Subject: [PATCH 18/22] Remove passing initial hospital data prop as it is unused --- .../src/pages/patients/register/PatientRegistrationAccordion.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/client/src/pages/patients/register/PatientRegistrationAccordion.jsx b/client/src/pages/patients/register/PatientRegistrationAccordion.jsx index a7ccc989..34cd913f 100644 --- a/client/src/pages/patients/register/PatientRegistrationAccordion.jsx +++ b/client/src/pages/patients/register/PatientRegistrationAccordion.jsx @@ -213,7 +213,6 @@ export default function PatientRegistrationAccordion({ form={form} choice="physician" initialData={initialPhysicianData} - initialHospitalData={initialHospitalData} /> From c7255d05ce3af01aebd8c26cb772c7a3ce73b13f Mon Sep 17 00:00:00 2001 From: samau3 Date: Mon, 21 Oct 2024 14:12:41 -0700 Subject: [PATCH 19/22] Display physician name and their hospital if patient has that information stored already --- .../src/pages/patients/register/PatientRegistration.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/src/pages/patients/register/PatientRegistration.jsx b/client/src/pages/patients/register/PatientRegistration.jsx index 9a031423..dc2ea9b0 100644 --- a/client/src/pages/patients/register/PatientRegistration.jsx +++ b/client/src/pages/patients/register/PatientRegistration.jsx @@ -172,9 +172,11 @@ export default function PatientRegistration() { setInitialHospitalData(hospital ? hospital.name : ''); - setInitialPhysicianData( - physician ? `${physician.firstName} ${physician.lastName}` : '', - ); + if (physician) { + const fullName = `${physician.firstName}${physician.middleName ? ` ${physician.middleName}` : ''} ${physician.lastName}`; + const hospital = physician.hospitals[0] ? physician.hospitals[0].name : ''; + setInitialPhysicianData(`${fullName}${hospital ? ` - ${hospital}` : ''}`); + } const patientData = { firstName, From 179ce4b49d7ba27f9247e9d69813409b4eb25bfb Mon Sep 17 00:00:00 2001 From: samau3 Date: Mon, 21 Oct 2024 14:40:26 -0700 Subject: [PATCH 20/22] Separate out the pieces for string construction of physician details --- client/src/pages/patients/register/PatientRegistration.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/pages/patients/register/PatientRegistration.jsx b/client/src/pages/patients/register/PatientRegistration.jsx index dc2ea9b0..c449dad5 100644 --- a/client/src/pages/patients/register/PatientRegistration.jsx +++ b/client/src/pages/patients/register/PatientRegistration.jsx @@ -175,7 +175,9 @@ export default function PatientRegistration() { if (physician) { const fullName = `${physician.firstName}${physician.middleName ? ` ${physician.middleName}` : ''} ${physician.lastName}`; const hospital = physician.hospitals[0] ? physician.hospitals[0].name : ''; - setInitialPhysicianData(`${fullName}${hospital ? ` - ${hospital}` : ''}`); + const phone = physician.phone ? `${physician.phone} ` : ''; + const physicianDetails = `${fullName}${hospital ? ` (${hospital})` : ''}${phone ? ` - ${phone}` : ''}`; + setInitialPhysicianData(physicianDetails); } const patientData = { From 2cf217dbfec2a9cc2f92db6c28ce45b77598bb76 Mon Sep 17 00:00:00 2001 From: samau3 Date: Mon, 21 Oct 2024 14:40:59 -0700 Subject: [PATCH 21/22] Display physician name, hospital, and phone number in combobox drop down --- .../pages/patients/register/inputs/HealthcareChoicesSearch.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/pages/patients/register/inputs/HealthcareChoicesSearch.jsx b/client/src/pages/patients/register/inputs/HealthcareChoicesSearch.jsx index 9c4ec8f2..c6253c9d 100644 --- a/client/src/pages/patients/register/inputs/HealthcareChoicesSearch.jsx +++ b/client/src/pages/patients/register/inputs/HealthcareChoicesSearch.jsx @@ -78,7 +78,7 @@ export default function HealthcareChoicesSearch({ form, choice, initialData }) { const options = (data || []).map((item) => ( - {item.name}{item.hospital ? ` - ${item.hospital}` : ''} + {item.name}{item.hospital ? ` (${item.hospital})` : ''}{item.phone ? ` - ${item.phone}` : ''} )); From 7861aa6e0a1bdc7ad28f62f13c62752a5b33995d Mon Sep 17 00:00:00 2001 From: samau3 Date: Mon, 21 Oct 2024 14:42:15 -0700 Subject: [PATCH 22/22] Format files --- client/src/pages/patients/register/PatientRegistration.jsx | 4 +++- .../patients/register/inputs/HealthcareChoicesSearch.jsx | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/src/pages/patients/register/PatientRegistration.jsx b/client/src/pages/patients/register/PatientRegistration.jsx index c449dad5..d4b9dcfd 100644 --- a/client/src/pages/patients/register/PatientRegistration.jsx +++ b/client/src/pages/patients/register/PatientRegistration.jsx @@ -174,7 +174,9 @@ export default function PatientRegistration() { if (physician) { const fullName = `${physician.firstName}${physician.middleName ? ` ${physician.middleName}` : ''} ${physician.lastName}`; - const hospital = physician.hospitals[0] ? physician.hospitals[0].name : ''; + const hospital = physician.hospitals[0] + ? physician.hospitals[0].name + : ''; const phone = physician.phone ? `${physician.phone} ` : ''; const physicianDetails = `${fullName}${hospital ? ` (${hospital})` : ''}${phone ? ` - ${phone}` : ''}`; setInitialPhysicianData(physicianDetails); diff --git a/client/src/pages/patients/register/inputs/HealthcareChoicesSearch.jsx b/client/src/pages/patients/register/inputs/HealthcareChoicesSearch.jsx index c6253c9d..6ab80bcc 100644 --- a/client/src/pages/patients/register/inputs/HealthcareChoicesSearch.jsx +++ b/client/src/pages/patients/register/inputs/HealthcareChoicesSearch.jsx @@ -71,14 +71,16 @@ export default function HealthcareChoicesSearch({ form, choice, initialData }) { const handleSelectValue = (id, key) => { const name = key.children; - setSearch(name.join("")); + setSearch(name.join('')); form.setFieldValue(`healthcareChoices.${choice}Id`, id); combobox.closeDropdown(); }; const options = (data || []).map((item) => ( - {item.name}{item.hospital ? ` (${item.hospital})` : ''}{item.phone ? ` - ${item.phone}` : ''} + {item.name} + {item.hospital ? ` (${item.hospital})` : ''} + {item.phone ? ` - ${item.phone}` : ''} ));