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

Search tool connexion with FHIR API #22

Merged
merged 28 commits into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8ce62f4
patients are charged using fhir.js
nriss Feb 14, 2020
0a20720
isolating API call
nriss Feb 14, 2020
ae6c931
creating type file to isolate interfaces, improving api.tsx
nriss Feb 19, 2020
b837f1d
patient card id, name and age is loaded from the server
nriss Feb 19, 2020
77ef159
rebase with connectToFHIRAPI/PatientTable branch
nriss Feb 20, 2020
1634233
renaming patient to patientPage, centralising Patient interface in ty…
nriss Feb 21, 2020
6867e96
adding id search on toolsearch and adding number of allergies, observ…
nriss Feb 21, 2020
5abf07e
cleaning
nriss Feb 21, 2020
664962a
correcting bug when Patient is not found
nriss Feb 21, 2020
64f95f9
commenting and cleaning
nriss Feb 21, 2020
5679b5d
moving api calls from patientTable to patients, first working version…
nriss Feb 24, 2020
ce1aa48
replacing fhir.js by custom get requests
nriss Feb 25, 2020
5f0ed13
working search by age and nameé
nriss Mar 3, 2020
e8c81ae
adding div
nriss Mar 3, 2020
93d5a1d
rebase on PatientCard branch
nriss Feb 24, 2020
4943905
modifying search tool, adding an unique input text to search by name …
nriss Mar 5, 2020
1b23b23
adapting header to Arkhn colors
nriss Mar 6, 2020
8b9bca1
fhir.js removed
nriss Mar 9, 2020
f40a7d1
adding pagination function and modifying patient list manipulation us…
nriss Mar 9, 2020
f56f3d5
disabling précédent button if it is the first page, API cleaning
nriss Mar 10, 2020
c293e16
Merge branch 'master' into nr/connectToFHIRAPI/SearchTool
nriss Mar 10, 2020
c33a58b
resolving conflict issues
nriss Mar 10, 2020
48faaec
taking jason comments into account for PR#22
nriss Mar 13, 2020
fee0d13
bug correction: PatientTable component wasn't updated when new patien…
nriss Mar 13, 2020
e8c2e3b
bug correction on diabete patient search
nriss Mar 15, 2020
2476f41
adding some comments and removing nextlink bug
nriss Mar 16, 2020
cb574ac
applying Jason comments for PR #22
nriss Mar 18, 2020
548e377
adding toaster and renaming api.tsx to api.ts
nriss Mar 19, 2020
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
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"@types/react-dom": "^16.9.0",
"@types/react-router": "^5.1.4",
"@types/react-router-dom": "^5.1.3",
"fhir.js": "^0.0.22",
"interact.js": "^1.2.8",
"interactjs": "^1.8.2",
"moment": "^2.24.0",
Expand Down Expand Up @@ -46,4 +45,4 @@
"last 1 safari version"
]
}
}
}
6 changes: 3 additions & 3 deletions src/components/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface Props {

const Header = ({ patient }: Props) => {
return (
<BPNavbar id="navbar" className="bp3-dark">
<BPNavbar id="navbar">
<BPNavbar.Group align={Alignment.LEFT}>
<BPNavbar.Heading>
<Link className="linkNavbar" to={ROUTE_HOME}>
Expand All @@ -32,8 +32,8 @@ const Header = ({ patient }: Props) => {
<Icon icon="user" />
<div>Nom médecin</div>
<BPNavbar.Divider />
<Button icon="more" minimal />
<Button icon="log-out" minimal />
<Button icon="more" minimal className="headerButtons" />
<Button icon="log-out" minimal className="headerButtons" />
</BPNavbar.Group>
</BPNavbar>
);
Expand Down
12 changes: 9 additions & 3 deletions src/components/header/style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@import "~@blueprintjs/core/lib/css/blueprint.css";

#navbar {
background-color: black;
background-color: #6ad4a9;
color: white;
}

.bp3-icon {
Expand All @@ -14,11 +15,16 @@
}

#titleNavbar {
margin: 0px 0px 0px 9px;
color: white;
margin: 2px 0px 0px 9px;
cursor: pointer;
text-decoration: none;
color: white;
}

.linkNavbar:hover {
text-decoration: none;
}

.headerButtons svg {
fill: white !important;
}
29 changes: 13 additions & 16 deletions src/components/patientPage/hospitSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,20 @@ import "./style.css";

const HospitSummary = () => {
return (
<>
<div className="fullHeight">
<H3>
<Icon icon={"pulse"} /> Hospitalisation
</H3>
<div className="centeredName">
<H5 className="marginRight">{"Chirurgie cardiaque".toUpperCase()}</H5>
<span className="bp3-text-muted">15/05/2019 - 19/05/2019</span>
</div>
Les informations sur l'hospitalisation sélectionnée seront indiquées
ici.
<br />
<br />
Par défaut, cette carte affichera les infos de la dernière
hospitalisation.
<div className="fullHeight">
<H3>
<Icon icon={"pulse"} /> Hospitalisation
</H3>
<div className="centeredName">
<H5 className="marginRight">{"Chirurgie cardiaque".toUpperCase()}</H5>
<span className="bp3-text-muted">15/05/2019 - 19/05/2019</span>
</div>
</>
Les informations sur l'hospitalisation sélectionnée seront indiquées ici.
<br />
<br />
Par défaut, cette carte affichera les infos de la dernière
hospitalisation.
</div>
);
};

Expand Down
3 changes: 2 additions & 1 deletion src/components/patientPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const PatientPage = ({ patientId }: Props) => {

React.useEffect(() => {
const fetchPatientData = async () => {
const patient: any = await getPatientData(patientId);
const patient: any = await getPatientData(patientId, true);

setPatientData(patient);
};
fetchPatientData();
Expand Down
48 changes: 13 additions & 35 deletions src/components/patientPage/patientCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,20 @@ const PatientCard = ({ patient }: Props) => {
getPatientNumberCard and getSubjectNumberCard are now rendering PatientInfo elements with click option which print the results on the console.
*/
const getPatientNumberCard = (
object: "observations" | "conditions",
object:
| "observations"
| "conditions"
| "allergyIntolerances"
| "episodesOfCare",
writtenName: string
) => {
if (patient[object]) {
return (
<div
onClick={() => {
console.log(writtenName + " : ", patient[object].entry);
}}
>
<PatientGeneralInfo
type={writtenName}
content={patient[object].total.toString()}
/>
</div>
);
}
};
const resourceNumber = patient[object] ? patient[object].length : 0;

const getSubjectNumberCard = (
object: "allergyIntolerances" | "episodesOfCare",
writtenName: string
) => {
if (patient[object])
return (
<div
onClick={() => {
console.log(writtenName + " : ", patient[object].entry);
}}
>
<PatientGeneralInfo
type={writtenName}
content={patient[object].total.toString()}
/>
</div>
);
return (
<div>
<PatientGeneralInfo type={writtenName} content={resourceNumber} />
</div>
);
};

const getSubjectNameDiv = () => {
Expand Down Expand Up @@ -98,13 +76,13 @@ const PatientCard = ({ patient }: Props) => {
/>
}

{getSubjectNumberCard("allergyIntolerances", "Allergies")}
{getPatientNumberCard("allergyIntolerances", "Allergies")}

{getPatientNumberCard("observations", "Observations")}

{getPatientNumberCard("conditions", "Conditions")}

{getSubjectNumberCard("episodesOfCare", "Hospitalisations")}
{getPatientNumberCard("episodesOfCare", "Hospitalisations")}
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const PatientAgeInfo = ({ type, birthDate, age }: Props) => {
<Tag round={true}>{type}</Tag>
</div>
<div className="patientInfoContent">
{birthDate}{" "}
{birthDate}
<div className="secondContent"> ({age?.toString()} ans) </div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ interface Props {
}

const PatientGeneralInfo = ({ type, content }: Props) => {
if (content)
if (content !== undefined)
//Avoid to write "Inconnu" instead of 0
return (
<div className="patientInfo">
<div className="patientTag">
Expand Down
44 changes: 40 additions & 4 deletions src/components/patients/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,55 @@ import React from "react";
import Header from "components/header";
import PatientTable from "components/patients/patientTable";
import SearchTool from "components/patients/searchTool";
import {
getPatients,
getPatientsPerQuery,
requestNextPatients
} from "services/api";
import { PatientBundle } from "types";
import { Card, Elevation } from "@blueprintjs/core";

import "./style.css";

interface Props {
onSearch: Function;
searchItem: any;
}

const Patients = () => {
const [patientBundle, setPatientBundle] = React.useState({} as PatientBundle);
const getNextPatients = async () => {
const patBundle = await requestNextPatients(patientBundle);
if (patBundle) setPatientBundle(patBundle);
};
const handleSearch = async (searchName: String, searchParams: any) => {
const bundle: PatientBundle = await getPatientsPerQuery(
searchName,
searchParams
);
setPatientBundle(bundle);
};

React.useEffect(() => {
const fetchPatients = async () => {
const bundle: PatientBundle = await getPatients();
Jasopaum marked this conversation as resolved.
Show resolved Hide resolved
setPatientBundle(bundle);
};
fetchPatients();
}, []);

return (
<>
<Header />
<div className="homeSearch">
<Card elevation={Elevation.THREE} className="searchTool">
<SearchTool />
<Card elevation={Elevation.ZERO} className="searchTool">
<SearchTool onSearch={handleSearch} />
</Card>
<Card elevation={Elevation.THREE} className="patientTable">
<PatientTable />
<Card elevation={Elevation.ZERO} className="patientTable">
<PatientTable
bundle={patientBundle}
updateNextPatients={getNextPatients}
/>
</Card>
</div>
</>
Expand Down
Loading