Skip to content

Commit

Permalink
Merge branch 'master' into FE_GET_PATIENTS
Browse files Browse the repository at this point in the history
  • Loading branch information
alchemist006 authored Oct 7, 2022
2 parents 73203a5 + 315d45d commit 84b287f
Show file tree
Hide file tree
Showing 21 changed files with 862 additions and 204 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@
"@types/escape-string-regexp": "~2.0.1",
"@types/json2csv": "~5.0.1",
"@types/pouchdb-find": "~6.3.4",
"axios": "~0.27.2",
"bootstrap": "~5.1.0",
"cors": "~2.8.5",
"date-fns": "~2.28.0",
"dotenv": "~16.0.2",
"escape-string-regexp": "~4.0.0",
"i18next": "~21.6.0",
"i18next-browser-languagedetector": "~6.1.0",
"i18next-xhr-backend": "~3.2.2",
"json2csv": "~5.0.1",
"lodash": "^4.17.15",
"moment": "~2.29.4",
"node-sass": "~7.0.0",
"pouchdb": "~7.2.1",
"pouchdb-adapter-memory": "~7.2.1",
Expand Down
2 changes: 1 addition & 1 deletion src/patients/ContactInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const ContactInfo = (props: Props): ReactElement => {
<Column xs={12} sm={4}>
{/* <span className="">{t('patient.contactInfoType.label')}</span>
<span className="d-sm-none"> &amp; {t(label)}</span> */}
<Label text={`${name} Type`} />
<Label text={`${name}Type`} />
</Column>
<Column className="d-none d-sm-block" sm={8}>
{t(label)}
Expand Down
25 changes: 25 additions & 0 deletions src/patients/GeneralInformation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,31 @@ const GeneralInformation = (props: Props): ReactElement => {
</Panel>
</div>
</Panel>
<br />
<Panel title="Emergency Contact" color="primary" collapsible>
<div className="row">
<div className="col-md-4">
<TextInputWithLabelFormGroup
label="Name"
name="emergencyContactName"
value={patient.emergencyContactName}
isEditable={isEditable}
onChange={(event) => onFieldChange('emergencyContactName', event.currentTarget.value)}
/>
</div>
<div className="col-md-4">
<TextInputWithLabelFormGroup
label="Phone Number"
name="emergencyContactNumber"
value={patient.emergencyContactNumber}
isEditable={isEditable}
onChange={(event) =>
onFieldChange('emergencyContactNumber', event.currentTarget.value)
}
/>
</div>
</div>
</Panel>
</div>
)
}
Expand Down
15 changes: 11 additions & 4 deletions src/patients/appointments/AppointmentsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,22 @@ const AppointmentsList = ({ patient }: Props) => {
label: t('scheduling.appointment.startDate'),
key: 'startDateTime',
formatter: (row) =>
row.startDateTime
? format(new Date(row.startDateTime), 'yyyy-MM-dd, hh:mm a')
: '',
row.start ? format(new Date(row.start), 'yyyy-MM-dd, hh:mm a') : '',
},
{
label: t('scheduling.appointment.endDate'),
key: 'endDateTime',
formatter: (row) =>
row.endDateTime ? format(new Date(row.endDateTime), 'yyyy-MM-dd, hh:mm a') : '',
row.start
? format(
new Date(
new Date(row.start).setMinutes(
new Date(row.start).getMinutes() + row.minutesDuration,
),
),
'yyyy-MM-dd, hh:mm a',
)
: '',
},
{ label: t('scheduling.appointment.location'), key: 'location' },
{ label: t('scheduling.appointment.type'), key: 'type' },
Expand Down
14 changes: 8 additions & 6 deletions src/patients/history/mappers/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,22 @@ export const convertLab = (lab: Lab): PatientHistoryRecord[] => {

export const convertAppointment = (appt: Appointment): PatientHistoryRecord[] => {
const apptEvents = []
if (appt.startDateTime) {
if (appt.start) {
apptEvents.push({
date: new Date(appt.startDateTime),
date: new Date(appt.start),
type: HistoryRecordType.APPOINTMENT,
info: `Started - ${appt.type}`,
info: `Started - ${appt.appointmentType.text}`,
recordId: appt.id,
id: `startedAppt${appt.id}`,
})
}
if (appt.endDateTime) {
if (new Date(appt.start).setMinutes(new Date(appt.start).getMinutes() + appt.minutesDuration)) {
apptEvents.push({
date: new Date(appt.endDateTime),
date: new Date(
new Date(appt.start).setMinutes(new Date(appt.start).getMinutes() + appt.minutesDuration),
),
type: HistoryRecordType.APPOINTMENT,
info: `Ended - ${appt.type}`,
info: `Ended - ${appt.appointmentType.text}`,
recordId: appt.id,
id: `endedAppt${appt.id}`,
})
Expand Down
13 changes: 11 additions & 2 deletions src/patients/search/ViewPatientsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Table } from '@hospitalrun/components'
import React from 'react'
//import { AnyIfEmpty } from 'react-redux'
import { useHistory } from 'react-router-dom'

import Loading from '../../shared/components/Loading'
import useTranslator from '../../shared/hooks/useTranslator'
import Patient from '../../shared/model/Patient'
Expand All @@ -23,6 +22,8 @@ const ViewPatientsTable = (props: Props) => {
const history = useHistory()
const { data, status } = usePatients(searchRequest)

console.log(data)

if (data === undefined || status === 'loading') {
return <Loading />
}
Expand All @@ -49,7 +50,15 @@ const ViewPatientsTable = (props: Props) => {
},
]}
actionsHeaderText={t('actions.label')}
actions={[{ label: t('actions.view'), action: (row) => history.push(`/patients/${row.id}`) }]}
actions={[
{
label: t('actions.view'),
action: (row) => {
console.log(`/patients/${row.id}`)
history.push(`/patients/${row.id}`)
},
},
]}
/>
{console.log('patientdata: ',props.patientData)}
</>
Expand Down
73 changes: 73 additions & 0 deletions src/patients/visits/FilterPatientModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import React, { useState } from 'react'
import { Label, Modal, Select } from '@hospitalrun/components'
import useTranslator from '../../shared/hooks/useTranslator'
import { Button } from 'react-bootstrap'
import {
appointmentStatus,
appointmentTypes,
} from '../../scheduling/appointments/constants/Appointment'
// import { getAllPatients } from '../../scheduling/appointments/service/Patients'

interface Props {
show: boolean
onCloseButtonClick: () => void
onFieldChange?: (patientId: any, type: any) => void
}

const FilterPatientModal = ({ show, onCloseButtonClick, onFieldChange }: Props) => {
// const func = () => {
// console.log('ALL PATIENTS DATA', getAllPatients())
// }

// useEffect(() => {
// func()
// }, [])

const { t } = useTranslator()

const [patientStatus, setPatientStatus] = useState('')
const [appointmentType, setappointmentType] = useState('')

const clearValues = () => {
setPatientStatus('')
setappointmentType('')
}

const body = (
<div className="row">
<div className="col">
<div className="form-group">
<Label text={t('scheduling.appointment.type')} title="type" />
<Select
id="type"
defaultSelected={appointmentTypes.filter(({ value }) => value === appointmentType)}
options={appointmentTypes}
onChange={(values) => setappointmentType(values[0])}
/>
</div>
<div className="form-group">
<Label text="Status" title="Status" />
<Select
defaultSelected={appointmentStatus.filter(({ value }) => value == patientStatus)}
id="status"
options={appointmentStatus}
onChange={(values) => setPatientStatus(values[0])}
/>
</div>
<Button
onClick={() => {
onFieldChange && onFieldChange(patientStatus, appointmentType)
clearValues()
onCloseButtonClick()
}}
>
Apply
</Button>
</div>
</div>
)

return <Modal show={show} toggle={onCloseButtonClick} body={body} />
}

export default FilterPatientModal
Loading

0 comments on commit 84b287f

Please sign in to comment.