Skip to content

Commit

Permalink
Merge branch 'main' of github.com:DIPSAS/hello-open-dips
Browse files Browse the repository at this point in the history
  • Loading branch information
hellefigen committed Jun 26, 2024
2 parents 332e2a5 + 5bc1818 commit 3aa2c10
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 13 deletions.
12 changes: 7 additions & 5 deletions src/pages/appointments/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ const Patient: React.FC = () => {
if (!extensions) return 'No details available';
for (let i = 0; i < extensions.length; i++) {
const extension = extensions?.[i];
// console.log(extension);
if (extension.valueCodeableConcept?.coding) {
for (let j = 0; j < extension.valueCodeableConcept.coding.length; j++) {
const coding = extension.valueCodeableConcept?.coding?.[j];
Expand Down Expand Up @@ -81,6 +80,7 @@ if (!patient) {
);
}


if(patient && appointments && encounters){

return (
Expand Down Expand Up @@ -112,7 +112,7 @@ if(patient && appointments && encounters){
<AppointmentsEncountersInfo title= "Appointments" onClose={handleCloseList}>
<ul className={styles.appointmentList}>
<div>
<ul className={styles.appointmentWrapper}>
{appointments?.total && <ul className={styles.appointmentWrapper}>
{appointments?.entry?.map((entry) => {
const resource = entry.resource as R4.IAppointment;
const display = getDisplayFromExtensions(resource.extension);
Expand All @@ -125,7 +125,8 @@ if(patient && appointments && encounters){
</li>
);
})}
</ul>
</ul>}
{!appointments?.total && <p className="conditions-error">The patient has no appointments.</p>}
</div>
</ul>
</AppointmentsEncountersInfo>
Expand All @@ -137,7 +138,7 @@ if(patient && appointments && encounters){
<AppointmentsEncountersInfo title="Encounters" onClose={handleCloseList}>
<ul className={styles.encounterList}>
<div>
<ul className={styles.appointmentWrapper}>
{encounters?.total && <ul className={styles.appointmentWrapper}>
{encounters?.entry?.map((entry) => {
const resource = entry.resource as R4.IEncounter;
return (
Expand All @@ -150,7 +151,8 @@ if(patient && appointments && encounters){
</li>
)
})}
</ul>
</ul>}
{!encounters?.total && <p className="conditions-error">The patient has no encounters.</p>}
</div>
</ul>
</AppointmentsEncountersInfo>
Expand Down
57 changes: 50 additions & 7 deletions src/pages/documents/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ const Documents: React.FC = () => {

if(documents){
if(documents.entry){
return (
<div className={styles.total}>
if(documents.total){

return (
<div className={styles.total}>
<div className={styles.goBack}>
<PatientOverview patientId={patientId as string}/></div>
<div className={styles.metaDataBox}>
Expand All @@ -125,20 +127,26 @@ const Documents: React.FC = () => {
</p>
</div>
</div>
{loading &&
{(loading || !document) && currentDocumentID && !documentLoadError &&
<span className={loadingstyles.loader}>
<Spinner />
</span>}
{loading == false && currentDocumentID && !documentLoadError && document &&
<div className={styles.documentViewer}>
<iframe src={`data:application/pdf;base64,${document}`}/>
</div>}
{!currentDocumentID && !loading && !documentLoadError &&
{!currentDocumentID && !loading && !documentLoadError && documents.total > 0 &&
<div className={styles.documentInfo}>
<p>
Please select a document
</p>
</div>}
{!currentDocumentID && !loading && !documentLoadError && documents.total == 0 &&
<div className={styles.documentInfo}>
<p>
There is no documents here
</p>
</div>}
{loading == false && currentDocumentID && documentLoadError &&
<div className={styles.documentError}>
<p>
Expand All @@ -155,16 +163,51 @@ const Documents: React.FC = () => {

</div>
}

</div>
)
}
else{
return (
<div className={styles.total}>
<div className={styles.goBack}>
<PatientOverview patientId={patientId as string}/>
</div>
<div className={styles.documentInfo}>
<p>
There is no documents here
</p>
</div>
</div>)
}
}
else{
return <></>
return (
<div className={styles.total}>
<div className={styles.goBack}>
<PatientOverview patientId={patientId as string}/>
</div>
<div className={styles.documentInfo}>
<p>
Could not get any documents assosiated with the patient
</p>
</div>
</div>)
}

}
else if (!loading){
return <h1> Could not find documents related to {patientId}</h1>
return(
<div className={styles.total}>
<div className={styles.goBack}>
<PatientOverview patientId={patientId as string}/>
</div>
<div className={styles.documentInfo}>
<p>
Could not find documents related to {patientId}
</p>
</div>
</div>)
}
else if (loading){
return (
Expand Down
2 changes: 1 addition & 1 deletion src/styles/appointment.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
.appointmentList, .encounterList {
list-style-type: none;
padding: 0;
height: calc(90vh - 100pt);
height: calc(80vh - 100pt);
overflow-y: auto;
}

Expand Down

0 comments on commit 3aa2c10

Please sign in to comment.