@photonhealth/react 2.0.0-rc.2 → 2.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/dist/analytics/PhotonAnalyticsProvider.d.ts +5 -2
- package/dist/analytics/PhotonAnalyticsProvider.d.ts.map +1 -1
- package/dist/analytics/PhotonAnalyticsProvider.js +34 -15
- package/dist/analytics/PhotonAnalyticsProvider.js.map +1 -1
- package/dist/analytics/cardLifecycle.d.ts +10 -0
- package/dist/analytics/cardLifecycle.d.ts.map +1 -0
- package/dist/analytics/cardLifecycle.js +43 -0
- package/dist/analytics/cardLifecycle.js.map +1 -0
- package/dist/analytics/lifecycleOutcomes.d.ts +8 -0
- package/dist/analytics/lifecycleOutcomes.d.ts.map +1 -0
- package/dist/analytics/lifecycleOutcomes.js +16 -0
- package/dist/analytics/lifecycleOutcomes.js.map +1 -0
- package/dist/analytics/tracker.d.ts +5 -3
- package/dist/analytics/tracker.d.ts.map +1 -1
- package/dist/analytics/tracker.js +10 -5
- package/dist/analytics/tracker.js.map +1 -1
- package/dist/components/PhotonOrder.d.ts +18 -18
- package/dist/components/PhotonOrder.d.ts.map +1 -1
- package/dist/components/PhotonOrder.js +17 -6
- package/dist/components/PhotonOrder.js.map +1 -1
- package/dist/components/PhotonPatient.d.ts +7 -35
- package/dist/components/PhotonPatient.d.ts.map +1 -1
- package/dist/components/PhotonPatient.js +3 -77
- package/dist/components/PhotonPatient.js.map +1 -1
- package/dist/components/PhotonPrescription.d.ts +14 -14
- package/dist/components/PhotonPrescription.d.ts.map +1 -1
- package/dist/components/PhotonPrescription.js +0 -1
- package/dist/components/PhotonPrescription.js.map +1 -1
- package/dist/components/open.d.ts +11 -13
- package/dist/components/open.d.ts.map +1 -1
- package/dist/components/open.js +7 -2
- package/dist/components/open.js.map +1 -1
- package/dist/components/patient/PatientCard/PatientCard.d.ts +30 -0
- package/dist/components/patient/PatientCard/PatientCard.d.ts.map +1 -0
- package/dist/components/patient/PatientCard/PatientCard.js +101 -0
- package/dist/components/patient/PatientCard/PatientCard.js.map +1 -0
- package/dist/components/patient/PatientCard/usePatientToShow.d.ts +22 -0
- package/dist/components/patient/PatientCard/usePatientToShow.d.ts.map +1 -0
- package/dist/components/patient/PatientCard/usePatientToShow.js +40 -0
- package/dist/components/patient/PatientCard/usePatientToShow.js.map +1 -0
- package/dist/components/patient/PatientIntakeForm.d.ts +16 -0
- package/dist/components/patient/PatientIntakeForm.d.ts.map +1 -0
- package/dist/components/patient/PatientIntakeForm.js +114 -0
- package/dist/components/patient/PatientIntakeForm.js.map +1 -0
- package/dist/components/patient/PatientSearch.d.ts +12 -0
- package/dist/components/patient/PatientSearch.d.ts.map +1 -0
- package/dist/components/patient/PatientSearch.js +148 -0
- package/dist/components/patient/PatientSearch.js.map +1 -0
- package/dist/components/patient/{Benefits.d.ts → PatientSummary/BenefitsInputForm.d.ts} +2 -2
- package/dist/components/patient/PatientSummary/BenefitsInputForm.d.ts.map +1 -0
- package/dist/components/patient/{Benefits.js → PatientSummary/BenefitsInputForm.js} +5 -5
- package/dist/components/patient/PatientSummary/BenefitsInputForm.js.map +1 -0
- package/dist/components/patient/{Clinical.d.ts → PatientSummary/ClinicalInputForm.d.ts} +13 -15
- package/dist/components/patient/PatientSummary/ClinicalInputForm.d.ts.map +1 -0
- package/dist/components/patient/{Clinical.js → PatientSummary/ClinicalInputForm.js} +11 -11
- package/dist/components/patient/PatientSummary/ClinicalInputForm.js.map +1 -0
- package/dist/components/patient/PatientSummary/CollapsedSummary.d.ts +5 -0
- package/dist/components/patient/PatientSummary/CollapsedSummary.d.ts.map +1 -0
- package/dist/components/patient/PatientSummary/CollapsedSummary.js +30 -0
- package/dist/components/patient/PatientSummary/CollapsedSummary.js.map +1 -0
- package/dist/components/patient/PatientSummary/PatientDetailsForm.d.ts +10 -0
- package/dist/components/patient/PatientSummary/PatientDetailsForm.d.ts.map +1 -0
- package/dist/components/patient/PatientSummary/PatientDetailsForm.js +65 -0
- package/dist/components/patient/PatientSummary/PatientDetailsForm.js.map +1 -0
- package/dist/components/patient/PatientSummary/PatientDetailsSchema.d.ts +53 -0
- package/dist/components/patient/PatientSummary/PatientDetailsSchema.d.ts.map +1 -0
- package/dist/components/patient/PatientSummary/PatientDetailsSchema.js +78 -0
- package/dist/components/patient/PatientSummary/PatientDetailsSchema.js.map +1 -0
- package/dist/components/patient/PatientSummary/PatientSummary.d.ts +46 -0
- package/dist/components/patient/PatientSummary/PatientSummary.d.ts.map +1 -0
- package/dist/components/patient/PatientSummary/PatientSummary.js +57 -0
- package/dist/components/patient/PatientSummary/PatientSummary.js.map +1 -0
- package/dist/components/patient/PatientSummary/SummaryHeader.d.ts +19 -0
- package/dist/components/patient/PatientSummary/SummaryHeader.d.ts.map +1 -0
- package/dist/components/patient/PatientSummary/SummaryHeader.js +22 -0
- package/dist/components/patient/PatientSummary/SummaryHeader.js.map +1 -0
- package/dist/components/patient/fields.d.ts +7 -25
- package/dist/components/patient/fields.d.ts.map +1 -1
- package/dist/components/patient/fields.js +11 -53
- package/dist/components/patient/fields.js.map +1 -1
- package/dist/components/patient/parsePatientSearchQuery.d.ts +16 -0
- package/dist/components/patient/parsePatientSearchQuery.d.ts.map +1 -0
- package/dist/components/patient/{query.js → parsePatientSearchQuery.js} +3 -15
- package/dist/components/patient/parsePatientSearchQuery.js.map +1 -0
- package/dist/components/prescription/PrescriptionCard.d.ts +14 -8
- package/dist/components/prescription/PrescriptionCard.d.ts.map +1 -1
- package/dist/components/prescription/PrescriptionCard.js +10 -3
- package/dist/components/prescription/PrescriptionCard.js.map +1 -1
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.d.ts +6 -6
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.d.ts.map +1 -1
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.js +6 -6
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.js.map +1 -1
- package/dist/components/schemaErrors.d.ts +3 -2
- package/dist/components/schemaErrors.d.ts.map +1 -1
- package/dist/components/schemaErrors.js +2 -1
- package/dist/components/schemaErrors.js.map +1 -1
- package/dist/components/search.d.ts +1 -1
- package/dist/components/search.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/meta/version.js +1 -1
- package/package.json +5 -2
- package/src/analytics/PhotonAnalyticsProvider.test.tsx +0 -1
- package/src/analytics/PhotonAnalyticsProvider.tsx +75 -20
- package/src/analytics/cardLifecycle.test.tsx +272 -0
- package/src/analytics/cardLifecycle.ts +44 -0
- package/src/analytics/fieldInteraction.test.tsx +11 -9
- package/src/analytics/lifecycleOutcomes.test.ts +78 -0
- package/src/analytics/lifecycleOutcomes.ts +29 -0
- package/src/analytics/tracker.test.ts +1 -1
- package/src/analytics/tracker.ts +13 -6
- package/src/analytics/usePhotonAnalytics.test.tsx +106 -0
- package/src/components/PhotonOrder.test.tsx +146 -8
- package/src/components/PhotonOrder.tsx +37 -26
- package/src/components/PhotonPatient.tsx +8 -163
- package/src/components/PhotonPrescription.test.tsx +22 -18
- package/src/components/PhotonPrescription.tsx +14 -14
- package/src/components/ScreeningAlerts.test.tsx +81 -0
- package/src/components/open.ts +13 -16
- package/src/components/order/DraftOrderPrompt.test.tsx +3 -6
- package/src/components/patient/PatientCard/PatientCard.test.tsx +255 -0
- package/src/components/patient/PatientCard/PatientCard.tsx +177 -0
- package/src/components/patient/PatientCard/usePatientToShow.ts +44 -0
- package/src/components/patient/PatientIntakeForm.test.tsx +262 -0
- package/src/components/patient/PatientIntakeForm.tsx +222 -0
- package/src/components/patient/PatientSearch.test.tsx +204 -0
- package/src/components/patient/PatientSearch.tsx +221 -0
- package/src/components/patient/PatientSummary/BenefitsInputForm.test.tsx +164 -0
- package/src/components/patient/{Benefits.tsx → PatientSummary/BenefitsInputForm.tsx} +4 -4
- package/src/components/patient/PatientSummary/ClinicalInputForm.test.tsx +247 -0
- package/src/components/patient/{Clinical.tsx → PatientSummary/ClinicalInputForm.tsx} +23 -23
- package/src/components/patient/PatientSummary/CollapsedSummary.test.tsx +90 -0
- package/src/components/patient/PatientSummary/CollapsedSummary.tsx +46 -0
- package/src/components/patient/PatientSummary/PatientDetailsForm.test.tsx +201 -0
- package/src/components/patient/PatientSummary/PatientDetailsForm.tsx +320 -0
- package/src/components/patient/PatientSummary/PatientDetailsSchema.test.ts +296 -0
- package/src/components/patient/PatientSummary/PatientDetailsSchema.ts +95 -0
- package/src/components/patient/PatientSummary/PatientSummary.test.tsx +194 -0
- package/src/components/patient/PatientSummary/PatientSummary.tsx +225 -0
- package/src/components/patient/PatientSummary/SummaryHeader.test.tsx +183 -0
- package/src/components/patient/PatientSummary/SummaryHeader.tsx +85 -0
- package/src/components/patient/fields.tsx +12 -138
- package/src/components/patient/parsePatientSearchQuery.test.ts +107 -0
- package/src/components/patient/{query.ts → parsePatientSearchQuery.ts} +4 -21
- package/src/components/prescription/PrescriptionCard.test.tsx +174 -12
- package/src/components/prescription/PrescriptionCard.tsx +28 -14
- package/src/components/prescription/PrescriptionDetailsForm/DirectionsInput.test.tsx +2 -5
- package/src/components/prescription/PrescriptionDetailsForm/DispenseInputs.test.tsx +3 -6
- package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.test.tsx +34 -37
- package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.tsx +14 -14
- package/src/components/prescription/PrescriptionDetailsForm/TemplatePicker.test.tsx +2 -5
- package/src/components/prescription/TreatmentSearch/TreatmentSearch.test.tsx +3 -7
- package/src/components/schemaErrors.ts +3 -2
- package/src/components/search.tsx +1 -1
- package/src/index.ts +1 -1
- package/src/meta/version.test.ts +1 -0
- package/src/meta/version.ts +1 -1
- package/dist/components/patient/Benefits.d.ts.map +0 -1
- package/dist/components/patient/Benefits.js.map +0 -1
- package/dist/components/patient/Clinical.d.ts.map +0 -1
- package/dist/components/patient/Clinical.js.map +0 -1
- package/dist/components/patient/IntakeForm.d.ts +0 -10
- package/dist/components/patient/IntakeForm.d.ts.map +0 -1
- package/dist/components/patient/IntakeForm.js +0 -333
- package/dist/components/patient/IntakeForm.js.map +0 -1
- package/dist/components/patient/Summary.d.ts +0 -48
- package/dist/components/patient/Summary.d.ts.map +0 -1
- package/dist/components/patient/Summary.js +0 -90
- package/dist/components/patient/Summary.js.map +0 -1
- package/dist/components/patient/query.d.ts +0 -37
- package/dist/components/patient/query.d.ts.map +0 -1
- package/dist/components/patient/query.js.map +0 -1
- package/src/components/patient/IntakeForm.test.tsx +0 -89
- package/src/components/patient/IntakeForm.tsx +0 -564
- package/src/components/patient/Summary.test.tsx +0 -106
- package/src/components/patient/Summary.tsx +0 -330
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/** PhotonPatient before a record: the fields a prescriber fills to find or add the patient, and the candidates. */
|
|
3
|
-
import { useComponents } from "../../primitives/index.js";
|
|
4
|
-
import { asksForAddress, classify } from "@photonhealth/client";
|
|
5
|
-
import { useLatestCallback, useLive } from "../../hooks/index.js";
|
|
6
|
-
import { useEffect, useId, useRef, useState } from "react";
|
|
7
|
-
import { useHeldActivity } from "../activity.js";
|
|
8
|
-
import { ChangeList } from "../ChangeList.js";
|
|
9
|
-
import { formatDate, formatPhone, PHONE_PATTERN, toE164 } from "../format.js";
|
|
10
|
-
import { FEW, searchKeys, SearchResults, useTypeAhead } from "../search.js";
|
|
11
|
-
import { noAutofill, SEX_OPTIONS } from "./fields.js";
|
|
12
|
-
import { focusProps, searchProps } from "../flow.js";
|
|
13
|
-
import { isSearchable, parseQuery, searchBoth, toSearchInput } from "./query.js";
|
|
14
|
-
import { TrackedField, useFieldInteractions } from "../../analytics/fieldInteraction.js";
|
|
15
|
-
const IDENTITY_KEYS = ["demographic.name.first", "demographic.name.last", "demographic.dateOfBirth", "demographic.sex"];
|
|
16
|
-
export function PatientIntakeForm({ patient, notice, }) {
|
|
17
|
-
const { Alert, Badge, Button, Card, CardBody, CardFooter, CardHeader, Grid, Input, Select, Spinner, Stack } = useComponents();
|
|
18
|
-
const snap = useLive(patient);
|
|
19
|
-
const formId = useId();
|
|
20
|
-
// Starts from what's already been sent — e.g. a host's details the server hasn't matched yet — to edit on.
|
|
21
|
-
const known = patient.known;
|
|
22
|
-
const [first, setFirst] = useState(known.demographic?.name?.first ?? "");
|
|
23
|
-
const [last, setLast] = useState(known.demographic?.name?.last ?? "");
|
|
24
|
-
const [dob, setDob] = useState(known.demographic?.dateOfBirth ?? "");
|
|
25
|
-
const [sex, setSex] = useState(known.demographic?.sex ?? null);
|
|
26
|
-
const sexPicked = useFieldInteractions("new_patient_form")("sex", { isOptional: false, hasValue: Boolean(sex) });
|
|
27
|
-
const [email, setEmail] = useState(known.contact?.email ?? "");
|
|
28
|
-
const [phone, setPhone] = useState(known.contact?.phone ? formatPhone(known.contact.phone) : "");
|
|
29
|
-
const [street1, setStreet1] = useState(known.contact?.address?.street1 ?? "");
|
|
30
|
-
const [street2, setStreet2] = useState(known.contact?.address?.street2 ?? "");
|
|
31
|
-
const [city, setCity] = useState(known.contact?.address?.city ?? "");
|
|
32
|
-
const [state, setState] = useState(known.contact?.address?.state ?? "");
|
|
33
|
-
const [postalCode, setPostalCode] = useState(known.contact?.address?.postalCode ?? "");
|
|
34
|
-
/**
|
|
35
|
-
* Finding someone and adding them are two different jobs, so the card does one at a time. Searching is
|
|
36
|
-
* one field and never writes (`search` goes without `sex`, which is what network-api needs to create).
|
|
37
|
-
* "Create a new patient" is the prescriber saying none of these — it opens the form, filled in from what
|
|
38
|
-
* they typed. Details handed in that the server hasn't matched start there, as they always did.
|
|
39
|
-
*/
|
|
40
|
-
const [mode, setMode] = useState(() => known.demographic?.name?.first || known.demographic?.name?.last || known.demographic?.dateOfBirth
|
|
41
|
-
? "create"
|
|
42
|
-
: "search");
|
|
43
|
-
const [query, setQuery] = useState("");
|
|
44
|
-
const creating = mode === "create";
|
|
45
|
-
/** What the matches below answer — the query as it was typed when the search went out. */
|
|
46
|
-
const [searched, setSearched] = useState(null);
|
|
47
|
-
/** The row the keys are on, by DOM id: the field says so with `aria-activedescendant`. */
|
|
48
|
-
const [activeId, setActiveId] = useState(null);
|
|
49
|
-
/** Which of the four network-api needs were empty when Save was last pressed. */
|
|
50
|
-
const [missing, setMissing] = useState([]);
|
|
51
|
-
/** What a required field says while Save is waiting on it. The server names all four at once; we don't. */
|
|
52
|
-
const gap = (field) => missing.includes(field) ? { invalid: true, errorMessage: "Needed to add a patient" } : {};
|
|
53
|
-
const busy = snap.status === "loading" || snap.status === "saving";
|
|
54
|
-
const candidates = snap.candidates;
|
|
55
|
-
const addressComplete = Boolean(street1.trim() && city.trim() && state.trim() && postalCode.trim());
|
|
56
|
-
const asksAddress = asksForAddress(snap.changes, snap.error?.message);
|
|
57
|
-
// What the server still needs to add the patient (name, DOB, sex) is what this form asks for next — not an
|
|
58
|
-
// error. Once the prescriber has filled all four, anything it still rejects about them is shown.
|
|
59
|
-
const identityFilled = Boolean(first.trim() && last.trim() && dob && sex);
|
|
60
|
-
const changes = classify({
|
|
61
|
-
...snap.changes,
|
|
62
|
-
unapplied: snap.changes.unapplied.filter((c) => identityFilled || !IDENTITY_KEYS.includes(c.key)),
|
|
63
|
-
});
|
|
64
|
-
/** Everything known on the form. Phone / email ride along once they're valid; the browser shows why otherwise. */
|
|
65
|
-
const form = (overrides = {}) => {
|
|
66
|
-
const chosenSex = overrides.sex !== undefined ? overrides.sex : sex;
|
|
67
|
-
const validPhone = new RegExp(`^(?:${PHONE_PATTERN})$`).test(phone.trim());
|
|
68
|
-
const validEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email.trim());
|
|
69
|
-
const demographic = {
|
|
70
|
-
name: { first, last },
|
|
71
|
-
dateOfBirth: dob,
|
|
72
|
-
...(chosenSex ? { sex: chosenSex } : {}),
|
|
73
|
-
};
|
|
74
|
-
const contact = {
|
|
75
|
-
...(validPhone ? { phone: toE164(phone) } : {}),
|
|
76
|
-
...(validEmail ? { email: email.trim() } : {}),
|
|
77
|
-
...(addressComplete
|
|
78
|
-
? {
|
|
79
|
-
address: {
|
|
80
|
-
street1: street1.trim(),
|
|
81
|
-
street2: street2.trim() || undefined,
|
|
82
|
-
city: city.trim(),
|
|
83
|
-
state: state.trim().toUpperCase(),
|
|
84
|
-
postalCode: postalCode.trim(),
|
|
85
|
-
country: "US",
|
|
86
|
-
},
|
|
87
|
-
}
|
|
88
|
-
: {}),
|
|
89
|
-
};
|
|
90
|
-
return { demographic, contact };
|
|
91
|
-
};
|
|
92
|
-
// What the list of matches answers: the form as it was last sent — and whether typing sent it (a search), not
|
|
93
|
-
// leaving a field.
|
|
94
|
-
const sent = useRef(null);
|
|
95
|
-
const typedSearch = useRef(false);
|
|
96
|
-
// The field whose change or exit sent the call in flight shows the spinner (held briefly, so it doesn't flicker).
|
|
97
|
-
const [sentFrom, setSentFrom] = useState(null);
|
|
98
|
-
if (sentFrom && !busy)
|
|
99
|
-
setSentFrom(null); // answered
|
|
100
|
-
const spinning = useHeldActivity(sentFrom);
|
|
101
|
-
/**
|
|
102
|
-
* Send everything known — `sync` (a field left: the server may find or add the patient) or `search` (typing:
|
|
103
|
-
* it only lists who it might be). The object adds it to what it sent before; the same query isn't sent twice.
|
|
104
|
-
*/
|
|
105
|
-
const send = (from, kind = "sync", overrides = {}) => {
|
|
106
|
-
const input = form(overrides);
|
|
107
|
-
sent.current = JSON.stringify(input);
|
|
108
|
-
typedSearch.current = kind === "search";
|
|
109
|
-
void (kind === "sync" ? patient.sync(input) : patient.search(input)).catch(() => { }); // failures land on the object
|
|
110
|
-
if (patient.busy)
|
|
111
|
-
setSentFrom(from);
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* The one search field, answered. Only ever `search`: it can't create, and it can't change whoever it
|
|
115
|
-
* finds. One word could be either name, so if it draws a blank as a first name it's asked again as a
|
|
116
|
-
* last name — "Lovelace" is as likely to be typed as "Ada".
|
|
117
|
-
*/
|
|
118
|
-
const runSearch = useLatestCallback(() => {
|
|
119
|
-
const text = query.trim();
|
|
120
|
-
const parsed = parseQuery(text);
|
|
121
|
-
if (!isSearchable(parsed))
|
|
122
|
-
return;
|
|
123
|
-
typedSearch.current = true;
|
|
124
|
-
setSentFrom("query");
|
|
125
|
-
void (async () => {
|
|
126
|
-
try {
|
|
127
|
-
await patient.search(toSearchInput(parsed));
|
|
128
|
-
const alsoLast = searchBoth(parsed);
|
|
129
|
-
if (alsoLast && patient.snapshot.candidates.length === 0)
|
|
130
|
-
await patient.search(toSearchInput(alsoLast));
|
|
131
|
-
}
|
|
132
|
-
catch {
|
|
133
|
-
// failures land on the object
|
|
134
|
-
}
|
|
135
|
-
setSearched(text);
|
|
136
|
-
})();
|
|
137
|
-
});
|
|
138
|
-
// Two characters: network-api matches "a first/last name prefix of 2+ characters" (`AmbiguousPatientMatch`),
|
|
139
|
-
// and short surnames are real — Ng, Wu, Li. Not one: that would match thousands, and the server returns at
|
|
140
|
-
// most twenty candidates, so it would hand back an arbitrary slice — a list without your patient in it reads
|
|
141
|
-
// as "not here", which is how a duplicate gets made.
|
|
142
|
-
const typeAhead = useTypeAhead((field) => (field === "query" ? runSearch() : send(field, "search")), {
|
|
143
|
-
minChars: 2,
|
|
144
|
-
});
|
|
145
|
-
/** A field changed: keep it, and search once typing pauses. */
|
|
146
|
-
const type = (field, set) => (e) => {
|
|
147
|
-
set(e.target.value);
|
|
148
|
-
// Answering what Save asked for puts it right at once: an error about a field you have just filled in
|
|
149
|
-
// is the thing this whole screen is meant to stop doing.
|
|
150
|
-
if (e.target.value.trim())
|
|
151
|
-
setMissing((m) => m.filter((f) => f !== field));
|
|
152
|
-
// While adding, there is nobody to look up — the prescriber has already said this is someone new.
|
|
153
|
-
if (!creating)
|
|
154
|
-
typeAhead.typed(field, e.target.value);
|
|
155
|
-
};
|
|
156
|
-
// Rows open one at a time, as fields are left: first / last → DOB / sex → phone / email. Once open, a row
|
|
157
|
-
// stays open. Fields it started with (a patient given that isn't matched yet) count as left: their rows are open.
|
|
158
|
-
const [visited, setVisited] = useState(() => new Set(Object.entries({ first, last, dob, sex, email, phone })
|
|
159
|
-
.filter(([, value]) => value)
|
|
160
|
-
.map(([field]) => field)));
|
|
161
|
-
const visit = (field) => setVisited((v) => (v.has(field) ? v : new Set(v).add(field)));
|
|
162
|
-
const bothLeft = (a, b) => visited.has(a) && visited.has(b);
|
|
163
|
-
// Searching opened rows one at a time as the server narrowed things down. Adding is a form: it shows
|
|
164
|
-
// what it needs, all of it, so the prescriber can see what Save is waiting on.
|
|
165
|
-
const rows = creating ? 3 : bothLeft("dob", "sex") ? 3 : bothLeft("first", "last") ? 2 : 1;
|
|
166
|
-
// A few matches listed: they're the next thing to look at.
|
|
167
|
-
const few = candidates.length > 0 && candidates.length < FEW;
|
|
168
|
-
/** The search is answered, and nobody came back. Not the same as nobody being there. */
|
|
169
|
-
const answeredNothing = mode === "search" &&
|
|
170
|
-
searched !== null &&
|
|
171
|
-
searched === query.trim() &&
|
|
172
|
-
candidates.length === 0 &&
|
|
173
|
-
!busy &&
|
|
174
|
-
!typeAhead.waiting();
|
|
175
|
-
const matches = useRef(null);
|
|
176
|
-
// The field last typed in: Esc in the matches goes back to it.
|
|
177
|
-
const lastField = useRef(null);
|
|
178
|
-
// Each field is a search field over the matches (searchKeys): Tab goes to the first when a few answer
|
|
179
|
-
// what's typed. Otherwise — many matches, none, or the answer not back yet — Tab goes on to narrow them
|
|
180
|
-
// down: the field is marked on Tab's keydown, not only on blur, so the next row renders within the same
|
|
181
|
-
// keystroke and Tab moves into it instead of skipping ahead.
|
|
182
|
-
const onKeys = (e, field) => {
|
|
183
|
-
const answered = !typeAhead.waiting() &&
|
|
184
|
-
!busy &&
|
|
185
|
-
(field === "query" ? searched === query.trim() : sent.current === JSON.stringify(form()));
|
|
186
|
-
if (searchKeys(e, matches.current, answered))
|
|
187
|
-
return;
|
|
188
|
-
if (e.key === "Tab" && !e.shiftKey && field !== "query")
|
|
189
|
-
visit(field);
|
|
190
|
-
};
|
|
191
|
-
// A few matches for what's being typed (a search, not a field left), and the prescriber is still in the field:
|
|
192
|
-
// focus goes to the first, ready to pick — typing carries on in the field (search.tsx). Once per answer; moving
|
|
193
|
-
// there isn't leaving the field.
|
|
194
|
-
const moving = useRef(false);
|
|
195
|
-
const matchesFor = candidates.map((c) => c.id).join();
|
|
196
|
-
const focusedFor = useRef(null);
|
|
197
|
-
const focusFew = useLatestCallback(() => {
|
|
198
|
-
const field = lastField.current;
|
|
199
|
-
const answered = !typeAhead.waiting() &&
|
|
200
|
-
!busy &&
|
|
201
|
-
(mode === "search" ? searched === query.trim() : sent.current === JSON.stringify(form()));
|
|
202
|
-
if (!few || !answered || !typedSearch.current || !field || document.activeElement !== field)
|
|
203
|
-
return;
|
|
204
|
-
if (focusedFor.current === matchesFor)
|
|
205
|
-
return;
|
|
206
|
-
focusedFor.current = matchesFor;
|
|
207
|
-
moving.current = true;
|
|
208
|
-
matches.current?.focus(true);
|
|
209
|
-
moving.current = false;
|
|
210
|
-
});
|
|
211
|
-
// Also on `searched`: the matches can land before the card has noted which query they answer, and until
|
|
212
|
-
// it has, they aren't an answer to move to.
|
|
213
|
-
useEffect(() => focusFew(), [matchesFor, busy, searched, focusFew]);
|
|
214
|
-
const leaveField = (field) => {
|
|
215
|
-
if (moving.current)
|
|
216
|
-
return;
|
|
217
|
-
typeAhead.cancel();
|
|
218
|
-
if (matches.current?.pointing?.())
|
|
219
|
-
return; // a match is being picked: that's what's next
|
|
220
|
-
if (!few)
|
|
221
|
-
visit(field);
|
|
222
|
-
// Adding a patient is its own act: nothing goes to the server until Save. Moving between fields can't
|
|
223
|
-
// create anyone, and can't change whoever a half-finished name happens to resemble.
|
|
224
|
-
if (!creating)
|
|
225
|
-
send(field);
|
|
226
|
-
};
|
|
227
|
-
const submit = (e) => {
|
|
228
|
-
e.preventDefault();
|
|
229
|
-
typeAhead.cancel();
|
|
230
|
-
if (creating)
|
|
231
|
-
return save();
|
|
232
|
-
send("address");
|
|
233
|
-
};
|
|
234
|
-
/**
|
|
235
|
-
* Add them. network-api creates a patient only with a first name, a last name, a date of birth and a sex
|
|
236
|
-
* (`Sex` has UNKNOWN, so there is always an answer), and the schema says nothing about which of them a
|
|
237
|
-
* payload is short of — so the form checks before it sends, rather than Save failing with a rejection
|
|
238
|
-
* naming every field at once.
|
|
239
|
-
*
|
|
240
|
-
* The server still decides what this means: it may find the patient instead of adding them, or come back
|
|
241
|
-
* with people it might be. Only this press asks it.
|
|
242
|
-
*/
|
|
243
|
-
const REQUIRED = [
|
|
244
|
-
["first", Boolean(first.trim())],
|
|
245
|
-
["last", Boolean(last.trim())],
|
|
246
|
-
["dob", Boolean(dob)],
|
|
247
|
-
["sex", Boolean(sex)],
|
|
248
|
-
];
|
|
249
|
-
const save = () => {
|
|
250
|
-
const empty = REQUIRED.filter(([, filled]) => !filled).map(([field]) => field);
|
|
251
|
-
setMissing(empty);
|
|
252
|
-
if (empty.length)
|
|
253
|
-
return; // the fields say which; the cursor goes to the first of them (below)
|
|
254
|
-
send("sex");
|
|
255
|
-
};
|
|
256
|
-
/**
|
|
257
|
-
* None of these: add them instead. What was typed is split into the fields, so nothing is retyped and
|
|
258
|
-
* the prescriber can see — and correct — how it was read. Sex is the one thing still missing, and the
|
|
259
|
-
* one network-api needs to create, so that's where focus goes: the form is filled in and the deliberate
|
|
260
|
-
* act is choosing it.
|
|
261
|
-
*/
|
|
262
|
-
const sexField = useRef(null);
|
|
263
|
-
const fields = useRef(null);
|
|
264
|
-
// Save pressed with gaps: the cursor goes to the first field it is waiting on, so answering starts there.
|
|
265
|
-
useEffect(() => {
|
|
266
|
-
if (!missing.length)
|
|
267
|
-
return;
|
|
268
|
-
fields.current?.querySelector('[aria-invalid="true"], [data-invalid]')?.focus();
|
|
269
|
-
}, [missing]);
|
|
270
|
-
const startCreate = () => {
|
|
271
|
-
typeAhead.cancel();
|
|
272
|
-
const parsed = parseQuery(query);
|
|
273
|
-
setFirst(parsed.name?.first ?? "");
|
|
274
|
-
setLast(parsed.name?.last ?? "");
|
|
275
|
-
setDob(parsed.dateOfBirth ?? "");
|
|
276
|
-
if (parsed.phone)
|
|
277
|
-
setPhone(formatPhone(parsed.phone));
|
|
278
|
-
if (parsed.email)
|
|
279
|
-
setEmail(parsed.email);
|
|
280
|
-
setVisited(new Set(["first", "last", "dob", ...(parsed.phone || parsed.email ? ["sex"] : [])]));
|
|
281
|
-
setMode("create");
|
|
282
|
-
};
|
|
283
|
-
// Once the form is up, the cursor goes to Sex (the Select is a building block, so by where it lands).
|
|
284
|
-
const landed = useRef(false);
|
|
285
|
-
useEffect(() => {
|
|
286
|
-
if (!creating || landed.current || !sexField.current)
|
|
287
|
-
return;
|
|
288
|
-
landed.current = true;
|
|
289
|
-
sexField.current.querySelector("input, select, button")?.focus();
|
|
290
|
-
}, [creating]);
|
|
291
|
-
return (_jsxs(Card, { divided: true, children: [_jsx(CardHeader, { title: "Patient" }), _jsx(CardBody, { children: _jsx("form", { ...noAutofill, ref: fields, id: formId, onSubmit: submit, onFocus: (e) => {
|
|
292
|
-
if (e.target instanceof HTMLInputElement)
|
|
293
|
-
lastField.current = e.target;
|
|
294
|
-
}, children: _jsxs(Stack, { gap: "3", children: [mode === "search" && (_jsx("div", { ...focusProps, ...searchProps, children: _jsx(TrackedField, { formName: "find_patient", fieldName: "patientSearch", isOptional: false, children: _jsx(Input, { label: "Find patient", placeholder: "Name, date of birth, phone or email", value: query, onChange: (e) => {
|
|
295
|
-
setQuery(e.target.value);
|
|
296
|
-
typeAhead.typed("query", e.target.value);
|
|
297
|
-
// Too little left to search on: the matches on screen answer a query that isn't there
|
|
298
|
-
// any more, so they go, and the card is back where it started — including what it has
|
|
299
|
-
// already moved the cursor to, or typing the same name again would land nowhere.
|
|
300
|
-
if (typeAhead.tooShort(e.target.value)) {
|
|
301
|
-
setSearched(null);
|
|
302
|
-
focusedFor.current = null;
|
|
303
|
-
}
|
|
304
|
-
}, onBlur: () => {
|
|
305
|
-
// Leaving asks now rather than after the pause — a search, never a sync: it can't
|
|
306
|
-
// create anyone and it can't change whoever it finds.
|
|
307
|
-
typeAhead.cancel();
|
|
308
|
-
if (query.trim() !== searched)
|
|
309
|
-
runSearch();
|
|
310
|
-
}, onKeyDown: (e) => onKeys(e, "query"), loading: spinning === "query", role: "combobox", "aria-expanded": searched !== null, "aria-autocomplete": "list", "aria-activedescendant": activeId ?? undefined, autoFocus: true, ...noAutofill }) }) })), creating && (_jsxs(Grid, { min: "200px", gap: "3", children: [_jsx("div", { ...focusProps, children: _jsx(TrackedField, { formName: "new_patient_form", fieldName: "firstName", isOptional: false, children: _jsx(Input, { ...gap("first"), label: "First name", value: first, onChange: type("first", setFirst), onBlur: () => leaveField("first"), onKeyDown: (e) => onKeys(e, "first"), loading: spinning === "first", autoFocus: true, ...noAutofill }) }) }), _jsx(TrackedField, { formName: "new_patient_form", fieldName: "lastName", isOptional: false, children: _jsx(Input, { ...gap("last"), label: "Last name", value: last, onChange: type("last", setLast), onBlur: () => leaveField("last"), onKeyDown: (e) => onKeys(e, "last"), loading: spinning === "last", ...noAutofill }) }), rows >= 2 && (_jsxs(_Fragment, { children: [_jsx(TrackedField, { formName: "new_patient_form", fieldName: "dateOfBirth", isOptional: false, children: _jsx(Input, { ...gap("dob"), label: "Date of birth", type: "date", ...noAutofill, value: dob, onChange: type("dob", setDob), onBlur: () => leaveField("dob"), onKeyDown: (e) => onKeys(e, "dob"), loading: spinning === "dob" }) }), _jsx("div", { ref: sexField, onFocus: sexPicked.onFocus, onBlur: (e) => {
|
|
311
|
-
sexPicked.onBlur(e);
|
|
312
|
-
if (!e.currentTarget.contains(e.relatedTarget))
|
|
313
|
-
visit("sex");
|
|
314
|
-
}, onKeyDown: (e) => onKeys(e, "sex"), children: _jsx(Select, { ...gap("sex"), label: "Sex", placeholder: "Select\u2026", options: SEX_OPTIONS, value: sex, onChange: (next) => {
|
|
315
|
-
sexPicked.onChange(true);
|
|
316
|
-
setSex(next);
|
|
317
|
-
visit("sex");
|
|
318
|
-
setMissing((m) => m.filter((f) => f !== "sex"));
|
|
319
|
-
} }) }), rows >= 3 && (_jsxs(_Fragment, { children: [_jsx(TrackedField, { formName: "new_patient_form", fieldName: "phone", isOptional: true, children: _jsx(Input, { label: "Phone", helper: "The patient is texted their order link here, so a mobile number.", type: "tel", inputMode: "tel", pattern: PHONE_PATTERN, value: phone, onChange: type("phone", setPhone), onBlur: () => {
|
|
320
|
-
setPhone(formatPhone(phone));
|
|
321
|
-
leaveField("phone");
|
|
322
|
-
}, onKeyDown: (e) => onKeys(e, "phone"), loading: spinning === "phone", ...noAutofill }) }), _jsx(TrackedField, { formName: "new_patient_form", fieldName: "email", isOptional: true, children: _jsx(Input, { label: "Email", type: "email", inputMode: "email", value: email, onChange: type("email", setEmail), onBlur: () => leaveField("email"), onKeyDown: (e) => onKeys(e, "email"), loading: spinning === "email", ...noAutofill }) })] }))] }))] })), mode === "search" && answeredNothing && (_jsx(Alert, { title: "Spelling has to be exact.", description: "Try another spelling, fewer letters, or a date of birth." })), mode === "search" && searched !== null && (_jsx(SearchResults, { label: candidates.length > 0 ? "Matching patients" : "No matching patients", results: candidates.map((m) => ({
|
|
323
|
-
key: m.id,
|
|
324
|
-
label: [m.firstName, m.lastName].filter(Boolean).join(" "),
|
|
325
|
-
meta: m.dateOfBirth ? formatDate(m.dateOfBirth) : undefined,
|
|
326
|
-
})), onPick: (id) => void patient.pick(id).catch(() => { }), busy: busy, handleRef: matches, onBack: () => lastField.current?.focus(),
|
|
327
|
-
// The cursor stays in the field: ↑ ↓ move a highlight, Return takes it, and a letter or a
|
|
328
|
-
// Backspace always lands in the field — the prescriber can narrow or start over mid-list.
|
|
329
|
-
inField: true, onActive: setActiveId,
|
|
330
|
-
// The last row: ↓ past the final match lands on it, and Return takes it.
|
|
331
|
-
action: { label: "Add new patient", icon: "add", onChoose: startCreate } })), notice && _jsx(Alert, { tone: "critical", title: notice.title, description: notice.description }), _jsx(ChangeList, { changes: changes }), snap.error && !asksForAddress(null, snap.error.message) && (_jsx(Badge, { tone: "critical", children: snap.error.message })), asksAddress && (_jsx("div", { onBlur: () => addressComplete && send("address"), children: _jsxs(Stack, { gap: "2", children: [snap.error && asksForAddress(null, snap.error.message) && (_jsx(Alert, { tone: "warning", title: "Address needed", description: snap.error.message })), _jsxs(Grid, { min: "120px", gap: "3", children: [_jsx(TrackedField, { formName: "new_patient_form", fieldName: "address_street1", isOptional: false, children: _jsx(Input, { label: "Street", value: street1, onChange: (e) => setStreet1(e.target.value), ...noAutofill }) }), _jsx(TrackedField, { formName: "new_patient_form", fieldName: "address_street2", isOptional: true, children: _jsx(Input, { label: "Apt / suite", value: street2, onChange: (e) => setStreet2(e.target.value), ...noAutofill }) })] }), _jsxs(Grid, { min: "120px", gap: "3", children: [_jsx(TrackedField, { formName: "new_patient_form", fieldName: "address_city", isOptional: false, children: _jsx(Input, { label: "City", value: city, onChange: (e) => setCity(e.target.value), ...noAutofill }) }), _jsx(TrackedField, { formName: "new_patient_form", fieldName: "address_state", isOptional: false, children: _jsx(Input, { label: "State", value: state, onChange: (e) => setState(e.target.value), maxLength: 2, ...noAutofill }) }), _jsx(TrackedField, { formName: "new_patient_form", fieldName: "address_zip", isOptional: false, children: _jsx(Input, { label: "ZIP", value: postalCode, onChange: (e) => setPostalCode(e.target.value), inputMode: "numeric", ...noAutofill }) })] })] }) }))] }) }) }), creating && (_jsx(CardFooter, { start: busy ? _jsx(Spinner, { label: "Adding\u2026" }) : undefined, children: _jsx(Button, { type: "submit", form: formId, loading: busy, children: "Save patient" }) }))] }));
|
|
332
|
-
}
|
|
333
|
-
//# sourceMappingURL=IntakeForm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IntakeForm.js","sourceRoot":"","sources":["../../../src/components/patient/IntakeForm.tsx"],"names":[],"mappings":";AAAA,mHAAmH;AAC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E,IAAI,6BAExC,GACE,CACd,IACI,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { type ChangeOption, type ClassifiedChanges, type MedicationStatus, type PatientInput, type PatientRecord } from "@photonhealth/client";
|
|
2
|
-
import { type ReactNode } from "react";
|
|
3
|
-
type PatientDemographicInput = NonNullable<PatientInput["demographic"]>;
|
|
4
|
-
type AddressInput = NonNullable<NonNullable<PatientInput["contact"]>["address"]>;
|
|
5
|
-
import { type BenefitInput } from "./Benefits.tsx";
|
|
6
|
-
export declare function PatientSummary({ patient, pickedNames, saving, changes, choices, problems, onChoose, onAddAllergy, onConfirmNone, onRemoveAllergy, onRemoveMedication, onAddMedication, onAddDiagnosis, onRemoveDiagnosis, onAddBenefit, onRemoveBenefit, onConfirmNoBenefits, onSaveContact, onSaveDetails, addressRequest, onChangePatient, readOnly, }: {
|
|
7
|
-
patient: PatientRecord;
|
|
8
|
-
pickedNames: Readonly<Record<string, string>>;
|
|
9
|
-
saving: boolean;
|
|
10
|
-
changes: ReactNode;
|
|
11
|
-
/** Server choices (AMBIGUOUS changes) — each clinical list shows its own under its field. */
|
|
12
|
-
choices: ClassifiedChanges["needsChoice"];
|
|
13
|
-
/** What the server rejected — each clinical list shows its own under its field (e.g. a name nothing matches). */
|
|
14
|
-
problems: ClassifiedChanges["blocking"];
|
|
15
|
-
onChoose: (option: ChangeOption) => void;
|
|
16
|
-
onAddAllergy: (name: string) => void;
|
|
17
|
-
/** Record "none" for a clinical list (NKDA, no medications, no diagnoses). */
|
|
18
|
-
onConfirmNone: (list: "allergies" | "medications" | "diagnoses") => void;
|
|
19
|
-
onRemoveAllergy: (allergy: {
|
|
20
|
-
id: string;
|
|
21
|
-
}) => void;
|
|
22
|
-
onRemoveMedication: (medication: {
|
|
23
|
-
id: string;
|
|
24
|
-
status: MedicationStatus;
|
|
25
|
-
}) => void;
|
|
26
|
-
onAddMedication: (name: string) => void;
|
|
27
|
-
onAddDiagnosis: (text: string) => void;
|
|
28
|
-
onRemoveDiagnosis: (diagnosis: {
|
|
29
|
-
id: string;
|
|
30
|
-
}) => void;
|
|
31
|
-
onAddBenefit: (benefit: BenefitInput) => void;
|
|
32
|
-
onRemoveBenefit: (benefit: {
|
|
33
|
-
id: string;
|
|
34
|
-
}) => void;
|
|
35
|
-
onConfirmNoBenefits: () => void;
|
|
36
|
-
onSaveContact: (contact: {
|
|
37
|
-
phone?: string;
|
|
38
|
-
email?: string;
|
|
39
|
-
address?: AddressInput;
|
|
40
|
-
}) => void;
|
|
41
|
-
onSaveDetails: (details: PatientDemographicInput) => void;
|
|
42
|
-
addressRequest: string | null;
|
|
43
|
-
onChangePatient?: () => void;
|
|
44
|
-
/** Read-only (e.g. on a sent order): the summary alone — no editors, no pencil. */
|
|
45
|
-
readOnly?: boolean;
|
|
46
|
-
}): import("react").JSX.Element;
|
|
47
|
-
export {};
|
|
48
|
-
//# sourceMappingURL=Summary.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Summary.d.ts","sourceRoot":"","sources":["../../../src/components/patient/Summary.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG3D,KAAK,uBAAuB,GAAG,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC;AACxE,KAAK,YAAY,GAAG,WAAW,CAAC,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AACjF,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AASpE,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,WAAW,EACX,MAAM,EACN,OAAO,EACP,OAAO,EACP,QAAQ,E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AAC,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACnD,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,aAAa,EAAE,CAAC,OAAO,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,YAAY,CAAA;KAAE,KAAK,IAAI,CAAC;IAC7F,aAAa,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAC1D,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,mFAAmF;IACnF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,+BA4LA"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/** PhotonPatient with a record: the summary and its details editor, with the clinical lists and benefits. */
|
|
3
|
-
import { useComponents } from "../../primitives/index.js";
|
|
4
|
-
import {} from "@photonhealth/client";
|
|
5
|
-
import { Fragment, useState } from "react";
|
|
6
|
-
import { ageOn, displayName, shortDate } from "../format.js";
|
|
7
|
-
import { BenefitsSection } from "./Benefits.js";
|
|
8
|
-
import { choicesIn, ClinicalList, sectionOf } from "./Clinical.js";
|
|
9
|
-
import { noAutofill, SEX_OPTIONS, ContactFields } from "./fields.js";
|
|
10
|
-
import { focusProps } from "../flow.js";
|
|
11
|
-
import { TrackedField, useFieldInteractions } from "../../analytics/fieldInteraction.js";
|
|
12
|
-
const fullName = (p) => [p.demographic?.name.first, p.demographic?.name.last].filter(Boolean).join(" ") || "Unnamed patient";
|
|
13
|
-
export function PatientSummary({ patient, pickedNames, saving, changes, choices, problems, onChoose, onAddAllergy, onConfirmNone, onRemoveAllergy, onRemoveMedication, onAddMedication, onAddDiagnosis, onRemoveDiagnosis, onAddBenefit, onRemoveBenefit, onConfirmNoBenefits, onSaveContact, onSaveDetails, addressRequest, onChangePatient, readOnly, }) {
|
|
14
|
-
const { Badge, Button, Card, CardBody, CardHeader, Row, Stack, Text } = useComponents();
|
|
15
|
-
// Allergies / medications / diagnoses / insurance are summarised in the header; the pencil opens their
|
|
16
|
-
// lists to add or remove, and they open by themselves when the server asks the prescriber to choose
|
|
17
|
-
// (e.g. which penicillin).
|
|
18
|
-
// A list with something to pick or fix opens by itself, and shows it under its field.
|
|
19
|
-
const clinicalChoices = [...choices, ...problems].filter((c) => sectionOf(c.key));
|
|
20
|
-
// One card, two states. Shut, it says who the patient is; open, it is everything about them that can be
|
|
21
|
-
// changed — the fields they were added with, their contact details, and their clinical lists. Each saves
|
|
22
|
-
// as it is answered (`UpdatePatient` on a record that already exists), so there is nothing to confirm.
|
|
23
|
-
// It also opens itself when a send fails for want of an address, and shuts again once that is answered.
|
|
24
|
-
const [editing, setEditing] = useState(Boolean(addressRequest));
|
|
25
|
-
const [seenRequest, setSeenRequest] = useState(addressRequest);
|
|
26
|
-
if (addressRequest !== seenRequest) {
|
|
27
|
-
setSeenRequest(addressRequest);
|
|
28
|
-
setEditing(Boolean(addressRequest));
|
|
29
|
-
}
|
|
30
|
-
const d = patient.demographic;
|
|
31
|
-
const contact = patient.contact;
|
|
32
|
-
// Each list: null when nothing is recorded, [] when "none" is (core's PatientRecord).
|
|
33
|
-
const recorded = {
|
|
34
|
-
allergies: patient.clinical?.allergies ?? null,
|
|
35
|
-
medications: patient.clinical?.medications ?? null,
|
|
36
|
-
diagnoses: patient.clinical?.diagnoses ?? null,
|
|
37
|
-
benefits: patient.benefits,
|
|
38
|
-
};
|
|
39
|
-
const confirmedNkda = recorded.allergies?.length === 0;
|
|
40
|
-
const allergies = recorded.allergies ?? [];
|
|
41
|
-
const meds = (recorded.medications ?? []).filter((m) => m.status === "ACTIVE");
|
|
42
|
-
const diagnoses = (recorded.diagnoses ?? []).map((x) => ({ ...x, name: x.name ?? x.icd10Code ?? "" }));
|
|
43
|
-
const benefits = recorded.benefits ?? [];
|
|
44
|
-
const nameOf = (item, unknown) => item.name && item.name !== item.id ? item.name : (pickedNames[item.id] ?? unknown);
|
|
45
|
-
const listed = (items, unknown, none) => items.length ? items.map((x) => nameOf(x, unknown)).join(", ") : none;
|
|
46
|
-
// Under the name, like a prescription's product under its drug: "Male · Adult (35) · 7/8/91".
|
|
47
|
-
const age = ageOn(d?.dateOfBirth);
|
|
48
|
-
const sex = d?.sex === "FEMALE" ? "Female" : d?.sex === "MALE" ? "Male" : null;
|
|
49
|
-
const ageGroup = age != null ? `${age >= 18 ? "Adult" : "Pediatric"} (${age})` : null;
|
|
50
|
-
const line = [sex, ageGroup, d?.dateOfBirth ? shortDate(d.dateOfBirth) : null].filter(Boolean).join(" · ");
|
|
51
|
-
// A choice the server is waiting on (which penicillin?) opens the card too — the answer lives in here.
|
|
52
|
-
const expanded = !readOnly && (editing || clinicalChoices.length > 0);
|
|
53
|
-
// The clinical picture, below the line, said once like a prescription's dispense line: allergies · meds ·
|
|
54
|
-
// diagnoses · insurance. An allergy stands out. A recorded "none" is said plainly ("No active meds"); a list
|
|
55
|
-
// not recorded isn't shown — except allergies, where not knowing matters.
|
|
56
|
-
const named = (items, unknown) => listed(items, unknown, "");
|
|
57
|
-
const facts = [
|
|
58
|
-
allergies.length ? (_jsxs(Badge, { tone: "warning", children: [allergies.length === 1 ? "Allergy" : "Allergies", ": ", named(allergies, "Unknown allergy")] })) : confirmedNkda ? ("No known allergies") : ("Allergies not recorded"),
|
|
59
|
-
meds.length ? `Active meds: ${named(meds, "Unknown medication")}` : recorded.medications && "No active meds",
|
|
60
|
-
diagnoses.length ? `Diagnoses: ${named(diagnoses, "Unknown diagnosis")}` : recorded.diagnoses && "No diagnoses",
|
|
61
|
-
benefits.length
|
|
62
|
-
? `Insurance: ${benefits.map((b) => `BIN ${b.bin}`).join(", ")}`
|
|
63
|
-
: recorded.benefits && "No insurance",
|
|
64
|
-
].filter(Boolean);
|
|
65
|
-
const factLine = (_jsx(Text, { tone: "secondary", children: facts.map((fact, i) => (_jsxs(Fragment, { children: [i > 0 && " · ", _jsx("span", { children: fact })] }, i))) }));
|
|
66
|
-
return (_jsxs(Card, { divided: true, children: [_jsx(CardHeader, { title: displayName(fullName(patient)), description: line || undefined, action: _jsxs(Row, { gap: "1", children: [!readOnly && (_jsx("span", { ...focusProps, children: _jsx(Button, { variant: "ghost", icon: expanded ? "check" : "edit", "aria-label": expanded ? "Done editing patient" : "Edit patient", title: expanded ? "Done" : "Edit patient", "aria-expanded": expanded, onClick: () => setEditing(!expanded) }) })), onChangePatient && (_jsx(Button, { variant: "ghost", onClick: onChangePatient, "aria-label": "Change patient", title: "Change patient", icon: "close" }))] }) }), _jsx(CardBody, { children: _jsxs(Stack, { gap: "4", children: [!expanded && factLine, expanded && (_jsxs(Stack, { gap: "4", children: [_jsx(DetailsEditor, { patient: patient, onSave: onSaveDetails }), _jsx(ContactFields, { phone: contact?.phone ?? null, email: contact?.email ?? null, address: contact?.address ?? null, onSave: onSaveContact, addressRequest: addressRequest }), _jsx(ClinicalList, { label: "Allergies", fieldName: "allergies", choices: choicesIn(choices, "allergies"), problems: choicesIn(problems, "allergies"), onChoose: onChoose, items: allergies, tone: "warning", addLabel: "Add allergy", noneLabel: "No known allergies", noneAction: "Mark NKDA", confirmedNone: confirmedNkda, unknownLabel: "Unknown allergy", pickedNames: pickedNames, saving: saving, onAdd: onAddAllergy, onRemove: onRemoveAllergy, onNone: () => onConfirmNone("allergies") }), _jsx(ClinicalList, { label: "Medications", fieldName: "medications", choices: choicesIn(choices, "medications"), problems: choicesIn(problems, "medications"), onChoose: onChoose, items: meds, tone: "neutral", addLabel: "Add medication", noneLabel: "No active meds", noneAction: "Mark none", confirmedNone: recorded.medications?.length === 0, onNone: () => onConfirmNone("medications"), unknownLabel: "Unknown medication", pickedNames: pickedNames, saving: saving, onAdd: onAddMedication, onRemove: onRemoveMedication }), _jsx(ClinicalList, { label: "Diagnoses", fieldName: "diagnoses", choices: choicesIn(choices, "diagnoses"), problems: choicesIn(problems, "diagnoses"), onChoose: onChoose, items: diagnoses, tone: "neutral", addLabel: "Add diagnosis", noneLabel: "No diagnoses", noneAction: "Mark none", confirmedNone: recorded.diagnoses?.length === 0, onNone: () => onConfirmNone("diagnoses"), unknownLabel: "Unknown diagnosis", pickedNames: pickedNames, saving: saving, onAdd: onAddDiagnosis, onRemove: onRemoveDiagnosis }), _jsx(BenefitsSection, { benefits: recorded.benefits, saving: saving, onAdd: onAddBenefit, onRemove: onRemoveBenefit, onNone: onConfirmNoBenefits })] })), changes] }) })] }));
|
|
67
|
-
}
|
|
68
|
-
/** Name / DOB / sex of a saved patient — each saves when you leave it (save early, fix in place). */
|
|
69
|
-
function DetailsEditor({ patient, onSave, }) {
|
|
70
|
-
const { Grid, Input, Select } = useComponents();
|
|
71
|
-
const d = patient.demographic;
|
|
72
|
-
const sexPicked = useFieldInteractions("update_patient_form")("sex", {
|
|
73
|
-
isOptional: false,
|
|
74
|
-
hasValue: Boolean(d?.sex),
|
|
75
|
-
});
|
|
76
|
-
const [first, setFirst] = useState(d?.name.first ?? "");
|
|
77
|
-
const [last, setLast] = useState(d?.name.last ?? "");
|
|
78
|
-
const [dob, setDob] = useState(d?.dateOfBirth ?? "");
|
|
79
|
-
const saveName = () => {
|
|
80
|
-
if (first.trim() && last.trim() && (first.trim() !== d?.name.first || last.trim() !== d?.name.last)) {
|
|
81
|
-
onSave({ name: { first: first.trim(), last: last.trim() } });
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
return (_jsxs(Grid, { min: "200px", gap: "3", children: [_jsx(TrackedField, { formName: "update_patient_form", fieldName: "firstName", isOptional: false, children: _jsx(Input, { label: "First name", value: first, onChange: (e) => setFirst(e.target.value), onBlur: saveName, ...noAutofill }) }), _jsx(TrackedField, { formName: "update_patient_form", fieldName: "lastName", isOptional: false, children: _jsx(Input, { label: "Last name", value: last, onChange: (e) => setLast(e.target.value), onBlur: saveName, ...noAutofill }) }), _jsx(TrackedField, { formName: "update_patient_form", fieldName: "dateOfBirth", isOptional: false, children: _jsx(Input, { label: "Date of birth", type: "date", ...noAutofill, value: dob, onChange: (e) => setDob(e.target.value), onBlur: () => dob && dob !== d?.dateOfBirth && onSave({ dateOfBirth: dob }) }) }), _jsx("div", { style: { display: "contents" }, onFocus: sexPicked.onFocus, onBlur: sexPicked.onBlur, children: _jsx(Select, { label: "Sex", placeholder: "Select\u2026", options: SEX_OPTIONS, value: d?.sex ?? null, onChange: (sex) => {
|
|
85
|
-
sexPicked.onChange(true);
|
|
86
|
-
if (sex !== d?.sex)
|
|
87
|
-
onSave({ sex });
|
|
88
|
-
} }) })] }));
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=Summary.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Summary.js","sourceRoot":"","sources":["../../../src/components/patient/Summary.tsx"],"names":[],"mappings":";AAAA,6GAA6G;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAMN,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI7D,OAAO,EAAE,eAAe,EAAqB,MAAM,eAAgB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAgB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAc,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,qCAAsC,CAAC;AAE1F,MAAM,QAAQ,GAAG,CAAC,CAAgB,EAAE,EAAE,CACpC,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,CAAC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AAC,KAAK,IACJ,KAAK,EAAC,eAAe,EACrB,IAAI,EAAC,MAAM,KACP,UAAU,EACd,KAAK,EAAE,GAAG,EACV,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACvC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,EAAE,WAAW,IAAI,MAAM,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,GAC3E,GACW,EACf,cAAK,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,YACvF,KAAC,MAAM,IACL,KAAK,EAAC,KAAK,EACX,WAAW,EAAC,cAAS,EACrB,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,IAAI,EACrB,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;wBAChB,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;wBACzB,IAAI,GAAG,KAAK,CAAC,EAAE,GAAG;4BAAE,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;oBACtC,CAAC,GACD,GACE,IACD,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export interface ParsedQuery {
|
|
2
|
-
name?: {
|
|
3
|
-
first?: string;
|
|
4
|
-
last?: string;
|
|
5
|
-
};
|
|
6
|
-
dateOfBirth?: string;
|
|
7
|
-
phone?: string;
|
|
8
|
-
email?: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* What was typed, as the server takes it. Anything that reads as a date, a phone or an email is taken as
|
|
12
|
-
* one; what's left is the name, first word first. A single word is a first name — `searchBoth` says when
|
|
13
|
-
* it's worth trying as a last name too.
|
|
14
|
-
*/
|
|
15
|
-
export declare function parseQuery(text: string): ParsedQuery;
|
|
16
|
-
/** query as patient input */
|
|
17
|
-
export declare const toSearchInput: ({ phone, email, ...demographic }: ParsedQuery) => {
|
|
18
|
-
demographic: {
|
|
19
|
-
name?: {
|
|
20
|
-
first?: string;
|
|
21
|
-
last?: string;
|
|
22
|
-
};
|
|
23
|
-
dateOfBirth?: string;
|
|
24
|
-
};
|
|
25
|
-
contact: {
|
|
26
|
-
email?: string | undefined;
|
|
27
|
-
phone?: string | undefined;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
/** Whether a query says anything the server can match on. */
|
|
31
|
-
export declare const isSearchable: (q: ParsedQuery) => boolean;
|
|
32
|
-
/**
|
|
33
|
-
* One word could be either name. It goes as a first name; if nothing comes back, it's worth asking again
|
|
34
|
-
* as a last name — "Lovelace" is as likely as "Ada".
|
|
35
|
-
*/
|
|
36
|
-
export declare const searchBoth: (q: ParsedQuery) => ParsedQuery | null;
|
|
37
|
-
//# sourceMappingURL=query.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/components/patient/query.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAoBD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAuBpD;AAED,6BAA6B;AAC7B,eAAO,MAAM,aAAa,GAAI,kCAAkC,WAAW;;eAvDlE;YAAE,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE;sBAC1B,MAAM;;;;;;CAyDpB,CAAC;AAEH,6DAA6D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