@photonhealth/react 2.0.0-rc.1 → 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 +52 -9
- package/dist/adapters/tailwind.d.ts.map +1 -1
- package/dist/adapters/tailwind.js +7 -4
- package/dist/adapters/tailwind.js.map +1 -1
- package/dist/analytics/PhotonAnalyticsProvider.d.ts +19 -0
- package/dist/analytics/PhotonAnalyticsProvider.d.ts.map +1 -0
- package/dist/analytics/PhotonAnalyticsProvider.js +76 -0
- package/dist/analytics/PhotonAnalyticsProvider.js.map +1 -0
- 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/fieldInteraction.d.ts +18 -0
- package/dist/analytics/fieldInteraction.d.ts.map +1 -0
- package/dist/analytics/fieldInteraction.js +102 -0
- package/dist/analytics/fieldInteraction.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 +19 -0
- package/dist/analytics/tracker.d.ts.map +1 -0
- package/dist/analytics/tracker.js +41 -0
- package/dist/analytics/tracker.js.map +1 -0
- package/dist/analytics/viewed.d.ts +11 -0
- package/dist/analytics/viewed.d.ts.map +1 -0
- package/dist/analytics/viewed.js +16 -0
- package/dist/analytics/viewed.js.map +1 -0
- package/dist/components/PhotonOrder.d.ts +18 -18
- package/dist/components/PhotonOrder.d.ts.map +1 -1
- package/dist/components/PhotonOrder.js +34 -19
- 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 +6 -78
- package/dist/components/PhotonPatient.js.map +1 -1
- package/dist/components/PhotonPrescription.d.ts +15 -26
- package/dist/components/PhotonPrescription.d.ts.map +1 -1
- package/dist/components/PhotonPrescription.js +6 -360
- package/dist/components/PhotonPrescription.js.map +1 -1
- package/dist/components/format.d.ts +2 -2
- package/dist/components/format.js +2 -2
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.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/order/DraftOrderPrompt.d.ts +18 -0
- package/dist/components/order/DraftOrderPrompt.d.ts.map +1 -0
- package/dist/components/order/DraftOrderPrompt.js +26 -0
- package/dist/components/order/DraftOrderPrompt.js.map +1 -0
- 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} +6 -5
- package/dist/components/patient/PatientSummary/BenefitsInputForm.js.map +1 -0
- package/dist/components/patient/{Clinical.d.ts → PatientSummary/ClinicalInputForm.d.ts} +15 -16
- package/dist/components/patient/PatientSummary/ClinicalInputForm.d.ts.map +1 -0
- package/dist/components/patient/{Clinical.js → PatientSummary/ClinicalInputForm.js} +29 -28
- 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 -26
- package/dist/components/patient/fields.d.ts.map +1 -1
- package/dist/components/patient/fields.js +11 -52
- 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 -10
- package/dist/components/patient/parsePatientSearchQuery.js.map +1 -0
- package/dist/components/prescription/PrescriptionCard.d.ts +51 -0
- package/dist/components/prescription/PrescriptionCard.d.ts.map +1 -0
- package/dist/components/prescription/PrescriptionCard.js +186 -0
- package/dist/components/prescription/PrescriptionCard.js.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/DirectionsInput.d.ts +15 -0
- package/dist/components/prescription/PrescriptionDetailsForm/DirectionsInput.d.ts.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/DirectionsInput.js +18 -0
- package/dist/components/prescription/PrescriptionDetailsForm/DirectionsInput.js.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/DispenseInputs.d.ts +23 -0
- package/dist/components/prescription/PrescriptionDetailsForm/DispenseInputs.d.ts.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/DispenseInputs.js +42 -0
- package/dist/components/prescription/PrescriptionDetailsForm/DispenseInputs.js.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.d.ts +27 -0
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.d.ts.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.js +169 -0
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.js.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.d.ts +8 -0
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.d.ts.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.js +12 -0
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.js.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/TemplatePicker.d.ts +11 -0
- package/dist/components/prescription/PrescriptionDetailsForm/TemplatePicker.d.ts.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/TemplatePicker.js +25 -0
- package/dist/components/prescription/PrescriptionDetailsForm/TemplatePicker.js.map +1 -0
- package/dist/components/prescription/TreatmentSearch/TreatmentPicker.d.ts +50 -0
- package/dist/components/prescription/TreatmentSearch/TreatmentPicker.d.ts.map +1 -0
- package/dist/components/{TreatmentPicker.js → prescription/TreatmentSearch/TreatmentPicker.js} +113 -105
- package/dist/components/prescription/TreatmentSearch/TreatmentPicker.js.map +1 -0
- package/dist/components/prescription/TreatmentSearch/TreatmentSearch.d.ts +28 -0
- package/dist/components/prescription/TreatmentSearch/TreatmentSearch.d.ts.map +1 -0
- package/dist/components/prescription/TreatmentSearch/TreatmentSearch.js +146 -0
- package/dist/components/prescription/TreatmentSearch/TreatmentSearch.js.map +1 -0
- package/dist/components/schemaErrors.d.ts +13 -0
- package/dist/components/schemaErrors.d.ts.map +1 -0
- package/dist/components/schemaErrors.js +25 -0
- package/dist/components/schemaErrors.js.map +1 -0
- package/dist/components/search.d.ts +1 -1
- package/dist/components/search.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/meta/version.d.ts +5 -0
- package/dist/meta/version.d.ts.map +1 -0
- package/dist/meta/version.js +5 -0
- package/dist/meta/version.js.map +1 -0
- package/dist/primitives/PhotonProvider.d.ts +3 -1
- package/dist/primitives/PhotonProvider.d.ts.map +1 -1
- package/dist/primitives/PhotonProvider.js +23 -11
- package/dist/primitives/PhotonProvider.js.map +1 -1
- package/dist/primitives/defaults.d.ts.map +1 -1
- package/dist/primitives/defaults.js +6 -3
- package/dist/primitives/defaults.js.map +1 -1
- package/dist/primitives/photonContext.d.ts +3 -0
- package/dist/primitives/photonContext.d.ts.map +1 -0
- package/dist/primitives/photonContext.js +3 -0
- package/dist/primitives/photonContext.js.map +1 -0
- package/dist/primitives/types.d.ts +15 -3
- package/dist/primitives/types.d.ts.map +1 -1
- package/dist/primitives/types.js.map +1 -1
- package/dist/primitives/useProvidedPhoton.d.ts +8 -0
- package/dist/primitives/useProvidedPhoton.d.ts.map +1 -0
- package/dist/primitives/useProvidedPhoton.js +8 -0
- package/dist/primitives/useProvidedPhoton.js.map +1 -0
- package/dist/styles.css +45 -3
- package/dist/test-utils/contract.d.ts.map +1 -1
- package/dist/test-utils/contract.js +23 -2
- package/dist/test-utils/contract.js.map +1 -1
- package/package.json +8 -3
- package/src/adapters/tailwind.tsx +52 -24
- package/src/analytics/PhotonAnalyticsProvider.test.tsx +190 -0
- package/src/analytics/PhotonAnalyticsProvider.tsx +151 -0
- package/src/analytics/cardLifecycle.test.tsx +272 -0
- package/src/analytics/cardLifecycle.ts +44 -0
- package/src/analytics/fieldInteraction.test.tsx +186 -0
- package/src/analytics/fieldInteraction.tsx +148 -0
- package/src/analytics/lifecycleOutcomes.test.ts +78 -0
- package/src/analytics/lifecycleOutcomes.ts +29 -0
- package/src/analytics/tracker.test.ts +52 -0
- package/src/analytics/tracker.ts +49 -0
- package/src/analytics/usePhotonAnalytics.test.tsx +106 -0
- package/src/analytics/viewed.ts +27 -0
- package/src/components/PhotonOrder.test.tsx +394 -0
- package/src/components/PhotonOrder.tsx +79 -53
- package/src/components/PhotonPatient.tsx +15 -166
- package/src/components/PhotonPrescription.test.tsx +120 -0
- package/src/components/PhotonPrescription.tsx +23 -583
- package/src/components/ScreeningAlerts.test.tsx +81 -0
- package/src/components/format.ts +2 -2
- package/src/components/index.ts +1 -1
- package/src/components/open.ts +13 -16
- package/src/components/order/DraftOrderPrompt.test.tsx +77 -0
- package/src/components/order/DraftOrderPrompt.tsx +81 -0
- 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} +24 -16
- package/src/components/patient/PatientSummary/ClinicalInputForm.test.tsx +247 -0
- package/src/components/patient/{Clinical.tsx → PatientSummary/ClinicalInputForm.tsx} +53 -48
- 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 -124
- package/src/components/patient/parsePatientSearchQuery.test.ts +107 -0
- package/src/components/patient/{query.ts → parsePatientSearchQuery.ts} +4 -15
- package/src/components/prescription/PrescriptionCard.test.tsx +247 -0
- package/src/components/prescription/PrescriptionCard.tsx +361 -0
- package/src/components/prescription/PrescriptionDetailsForm/DirectionsInput.test.tsx +82 -0
- package/src/components/prescription/PrescriptionDetailsForm/DirectionsInput.tsx +41 -0
- package/src/components/prescription/PrescriptionDetailsForm/DispenseInputs.test.tsx +206 -0
- package/src/components/prescription/PrescriptionDetailsForm/DispenseInputs.tsx +99 -0
- package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.test.tsx +453 -0
- package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.tsx +238 -0
- package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.test.ts +63 -0
- package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.ts +15 -0
- package/src/components/prescription/PrescriptionDetailsForm/TemplatePicker.test.tsx +72 -0
- package/src/components/prescription/PrescriptionDetailsForm/TemplatePicker.tsx +41 -0
- package/src/components/prescription/TreatmentSearch/TreatmentPicker.tsx +375 -0
- package/src/components/prescription/TreatmentSearch/TreatmentSearch.test.tsx +695 -0
- package/src/components/prescription/TreatmentSearch/TreatmentSearch.tsx +220 -0
- package/src/components/schemaErrors.test.ts +49 -0
- package/src/components/schemaErrors.ts +34 -0
- package/src/components/search.tsx +1 -1
- package/src/index.ts +2 -0
- package/src/meta/version.test.ts +11 -0
- package/src/meta/version.ts +4 -0
- package/src/primitives/PhotonProvider.tsx +30 -15
- package/src/primitives/defaults.tsx +44 -21
- package/src/primitives/photonContext.ts +4 -0
- package/src/primitives/types.ts +15 -3
- package/src/primitives/useProvidedPhoton.ts +21 -0
- package/src/styles.css +45 -3
- package/src/test-utils/contract.tsx +45 -2
- package/dist/components/TreatmentPicker.d.ts +0 -45
- package/dist/components/TreatmentPicker.d.ts.map +0 -1
- package/dist/components/TreatmentPicker.js.map +0 -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 -324
- 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 -80
- package/dist/components/patient/Summary.js.map +0 -1
- package/dist/components/patient/query.d.ts +0 -23
- package/dist/components/patient/query.d.ts.map +0 -1
- package/dist/components/patient/query.js.map +0 -1
- package/src/components/TreatmentPicker.tsx +0 -350
- package/src/components/patient/IntakeForm.tsx +0 -532
- package/src/components/patient/Summary.tsx +0 -310
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } 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 { useState } from "react";
|
|
6
|
+
import { ChangeList } from "../../ChangeList.js";
|
|
7
|
+
import { BenefitsInputForm } from "./BenefitsInputForm.js";
|
|
8
|
+
import { choicesIn, ClinicalInputForm, diagnosisRef, sectionOf, withoutInline, } from "./ClinicalInputForm.js";
|
|
9
|
+
import { PatientDetailsForm } from "./PatientDetailsForm.js";
|
|
10
|
+
import { SummaryHeader } from "./SummaryHeader.js";
|
|
11
|
+
import { CollapsedSummary } from "./CollapsedSummary.js";
|
|
12
|
+
export function PatientSummary({ patient, saving, changes, error, onChoose, onAddAllergy, onConfirmNone, onRemoveAllergy, onRemoveMedication, onAddMedication, onAddDiagnosis, onRemoveDiagnosis, onAddBenefit, onRemoveBenefit, onConfirmNoBenefits, onSaveDetails, addressRequest, onChangePatient, readOnly, }) {
|
|
13
|
+
const { Alert, Card, CardBody, Stack } = useComponents();
|
|
14
|
+
const choices = changes.needsChoice;
|
|
15
|
+
const problems = changes.blocking;
|
|
16
|
+
// What the clinical lists don't show under their own fields goes at the bottom of the card.
|
|
17
|
+
const messages = withoutInline(changes);
|
|
18
|
+
const hasMessages = messages.needsChoice.length + messages.blocking.length + messages.advisories.length > 0 || Boolean(error);
|
|
19
|
+
// Allergies / medications / diagnoses / insurance are summarized under the header (CollapsedSummary); the
|
|
20
|
+
// pencil opens their lists to add or remove, and they open by themselves when the server asks the prescriber
|
|
21
|
+
// to choose (e.g. which penicillin).
|
|
22
|
+
// A list with something to pick or fix opens by itself, and shows it under its field.
|
|
23
|
+
const clinicalChoices = [...choices, ...problems].filter((c) => sectionOf(c.key));
|
|
24
|
+
// One card, two states. Shut, it says who the patient is; open, it is everything about them that can be
|
|
25
|
+
// changed — the fields they were added with, their contact details, and their clinical lists. Each saves
|
|
26
|
+
// as it is answered (`UpdatePatient` on a record that already exists), so there is nothing to confirm.
|
|
27
|
+
// It also opens itself when a send fails for want of an address, and shuts again once that is answered.
|
|
28
|
+
const [editing, setEditing] = useState(Boolean(addressRequest));
|
|
29
|
+
const [seenRequest, setSeenRequest] = useState(addressRequest);
|
|
30
|
+
if (addressRequest !== seenRequest) {
|
|
31
|
+
setSeenRequest(addressRequest);
|
|
32
|
+
setEditing(Boolean(addressRequest));
|
|
33
|
+
}
|
|
34
|
+
// Each list: null when nothing is recorded, [] when "none" is (core's PatientRecord).
|
|
35
|
+
const recorded = {
|
|
36
|
+
allergies: patient.clinical?.allergies ?? null,
|
|
37
|
+
medications: patient.clinical?.medications ?? null,
|
|
38
|
+
diagnoses: patient.clinical?.diagnoses ?? null,
|
|
39
|
+
benefits: patient.benefits,
|
|
40
|
+
};
|
|
41
|
+
const confirmedNkda = recorded.allergies?.length === 0;
|
|
42
|
+
const allergies = recorded.allergies ?? [];
|
|
43
|
+
const meds = (recorded.medications ?? []).filter((m) => m.status === "ACTIVE");
|
|
44
|
+
const diagnoses = (recorded.diagnoses ?? []).map((x) => ({ ...x, name: x.name ?? x.icd10Code ?? "" }));
|
|
45
|
+
// A choice the server is waiting on (which penicillin?) opens the card too — the answer lives in here.
|
|
46
|
+
const expanded = !readOnly && (editing || clinicalChoices.length > 0);
|
|
47
|
+
// What the server said (choices, problems, a failed save) goes at the bottom of whichever section is shown.
|
|
48
|
+
const messageList = hasMessages && (_jsxs(_Fragment, { children: [_jsx(ChangeList, { changes: messages, onChoose: onChoose, busy: saving }), error && _jsx(Alert, { tone: "critical", title: "Couldn't save", description: error.message })] }));
|
|
49
|
+
return (_jsxs(Card, { divided: true, children: [_jsx(SummaryHeader, { patient: patient, expanded: expanded, readOnly: readOnly, onStartEditing: () => setEditing(true), onCancelEditing: () => setEditing(false), onChangePatient: onChangePatient }), !expanded && (_jsx(CardBody, { children: _jsxs(Stack, { gap: "4", children: [_jsx(CollapsedSummary, { patient: patient }), messageList] }) })), expanded && (_jsx(CardBody, { children: _jsx(Stack, { gap: "4", children: _jsx(PatientDetailsForm, { patient: patient, addressRequest: addressRequest,
|
|
50
|
+
// The editors stay open until network-api answers, and stay open with what was typed if it fails.
|
|
51
|
+
onSave: async (input) => {
|
|
52
|
+
const success = await onSaveDetails(input);
|
|
53
|
+
if (success)
|
|
54
|
+
setEditing(false);
|
|
55
|
+
} }) }) })), expanded && (_jsx(CardBody, { children: _jsxs(Stack, { gap: "4", children: [_jsx(ClinicalInputForm, { 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", saving: saving, onAdd: onAddAllergy, onRemove: onRemoveAllergy, onNone: () => onConfirmNone("allergies") }), _jsx(ClinicalInputForm, { 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", saving: saving, onAdd: onAddMedication, onRemove: onRemoveMedication }), _jsx(ClinicalInputForm, { 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", saving: saving, onAdd: (text) => onAddDiagnosis(diagnosisRef(text)), onRemove: onRemoveDiagnosis }), _jsx(BenefitsInputForm, { benefits: recorded.benefits, saving: saving, onAdd: onAddBenefit, onRemove: onRemoveBenefit, onNone: onConfirmNoBenefits }), messageList] }) }))] }));
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=PatientSummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PatientSummary.js","sourceRoot":"","sources":["../../../../src/components/patient/PatientSummary/PatientSummary.tsx"],"names":[],"mappings":";AAAA,6GAA6G;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAMN,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAsB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAqB,MAAM,wBAAyB,CAAC;AAC/E,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,aAAa,GAEd,MAAM,wBAAyB,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAA4B,MAAM,yBAA0B,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAwB,CAAC;AAE1D,MAAM,UAAU,cAAc,CAAC,EAC7B,OAAO,EACP,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,eAAe,EACf,QAAQ,GAgCT;IACC,MAAM,EAAE,K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AM,EACd,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,mBAAmB,GAC3B,EACD,WAAW,IACN,GACC,CACZ,IACI,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type PatientRecord } from "@photonhealth/client";
|
|
2
|
+
type Demographic = NonNullable<PatientRecord["demographic"]>;
|
|
3
|
+
type Name = Demographic["name"];
|
|
4
|
+
export declare const fullName: (name: Name | undefined) => string;
|
|
5
|
+
export declare const demographicLine: (d: Pick<Demographic, "sex" | "dateOfBirth"> | undefined) => string;
|
|
6
|
+
export declare function SummaryHeader({ patient, expanded, readOnly, onStartEditing, onCancelEditing, onChangePatient, }: {
|
|
7
|
+
patient: PatientRecord;
|
|
8
|
+
/** Whether the card's editors are showing: the pencil is hidden, and Cancel shows in place of Change patient. */
|
|
9
|
+
expanded: boolean;
|
|
10
|
+
/** Read-only (e.g. on a sent order): no pencil. */
|
|
11
|
+
readOnly?: boolean;
|
|
12
|
+
/** Open the editors. Shown while collapsed; PatientDetailsForm's Save closes them again. */
|
|
13
|
+
onStartEditing: () => void;
|
|
14
|
+
/** Close the editors without saving. Shown while `expanded`, in place of Change patient. */
|
|
15
|
+
onCancelEditing: () => void;
|
|
16
|
+
onChangePatient?: () => void;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=SummaryHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SummaryHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/patient/PatientSummary/SummaryHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAI1D,KAAK,WAAW,GAAG,WAAW,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC;AAC7D,KAAK,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAEhC,eAAO,MAAM,QAAQ,GAAI,MAAM,IAAI,GAAG,SAAS,WAC2B,CAAC;AAE3E,eAAO,MAAM,eAAe,GAAI,GAAG,IAAI,CAAC,WAAW,EAAE,KAAK,GAAG,aAAa,CAAC,GAAG,SAAS,WAKtF,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,eAAe,EACf,eAAe,GAChB,EAAE;IACD,OAAO,EAAE,aAAa,CAAC;IACvB,iHAAiH;IACjH,QAAQ,EAAE,OAAO,CAAC;IAClB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4FAA4F;IAC5F,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,4FAA4F;IAC5F,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B,+BA+CA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/** PatientSummary's header: who the patient is, and the buttons to edit them, cancel an edit, or change them. */
|
|
3
|
+
import { useComponents } from "../../../primitives/index.js";
|
|
4
|
+
import {} from "@photonhealth/client";
|
|
5
|
+
import { ageOn, shortDate } from "../../format.js";
|
|
6
|
+
import { focusProps } from "../../flow.js";
|
|
7
|
+
export const fullName = (name) => [name?.first, name?.last].filter(Boolean).join(" ") || "Unnamed patient";
|
|
8
|
+
export const demographicLine = (d) => {
|
|
9
|
+
const age = ageOn(d?.dateOfBirth);
|
|
10
|
+
const sex = d?.sex === "FEMALE" ? "Female" : d?.sex === "MALE" ? "Male" : null;
|
|
11
|
+
const ageGroup = age != null ? `${age >= 18 ? "Adult" : "Pediatric"} (${age})` : null;
|
|
12
|
+
return [sex, ageGroup, d?.dateOfBirth ? shortDate(d.dateOfBirth) : null].filter(Boolean).join(" · ");
|
|
13
|
+
};
|
|
14
|
+
export function SummaryHeader({ patient, expanded, readOnly, onStartEditing, onCancelEditing, onChangePatient, }) {
|
|
15
|
+
const { Button, CardHeader, Row } = useComponents();
|
|
16
|
+
const line = demographicLine(patient.demographic ?? undefined);
|
|
17
|
+
return (_jsx(CardHeader, { title: fullName(patient.demographic?.name), description: line || undefined, action: _jsxs(Row, { gap: "1", children: [!readOnly && !expanded && (_jsx("span", { ...focusProps, children: _jsx(Button, { variant: "ghost", icon: "edit", "aria-label": "Edit patient", title: "Edit patient", "aria-expanded": false, onClick: onStartEditing }) })), expanded ? (_jsx(Button, { variant: "ghost",
|
|
18
|
+
// Pressing the button would take focus from the field being typed in first, and leaving a field shows
|
|
19
|
+
// its error. Keep focus where it is, so the click closes the editors without flashing an error.
|
|
20
|
+
onMouseDown: (e) => e.preventDefault(), onClick: onCancelEditing, "aria-label": "Cancel editing patient", title: "Cancel", icon: "close" })) : (onChangePatient && (_jsx(Button, { variant: "ghost", onClick: onChangePatient, "aria-label": "Change patient", title: "Change patient", icon: "close" })))] }) }));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=SummaryHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SummaryHeader.js","sourceRoot":"","sources":["../../../../src/components/patient/PatientSummary/SummaryHeader.tsx"],"names":[],"mappings":";AAAA,iHAAiH;AACjH,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAsB,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAsB,EAAE,EAAE,CACjD,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,iBAAiB,CAAC;AAE3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,YAClB,KAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,MAAM,gBACA,cAAc,EACzB,KAAK,EAAC,cAAc,mBACL,KAAK,EACpB,OAAO,EAAE,cAAc,GACvB,GACG,CACR,EACA,QAAQ,CAAC,CAAC,CAAC,CACV,KAAC,MAAM,IACL,OAAO,EAAC,OAAO;oBACf,sGAAsG;oBACtG,gGAAgG;oBAChG,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,EACtC,OAAO,EAAE,eAAe,gBACb,wBAAwB,EACnC,KAAK,EAAC,QAAQ,EACd,IAAI,EAAC,OAAO,GACZ,CACH,CAAC,CAAC,CAAC,CACF,eAAe,IAAI,CACjB,KAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,OAAO,EAAE,eAAe,gBACb,gBAAgB,EAC3B,KAAK,EAAC,gBAAgB,EACtB,IAAI,EAAC,OAAO,GACZ,CACH,CACF,IACG,GAER,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
type
|
|
3
|
-
|
|
1
|
+
/** What PatientCard's forms share: the identity keys, the sex options, and no autofill. */
|
|
2
|
+
import { type Sex } from "@photonhealth/client";
|
|
3
|
+
/**
|
|
4
|
+
* What network-api needs to add a patient. While the prescriber is still finding or filling them in, the server's
|
|
5
|
+
* "still needed" about these is what the card asks for next, not an error to show.
|
|
6
|
+
*/
|
|
7
|
+
export declare const IDENTITY_KEYS: string[];
|
|
4
8
|
/**
|
|
5
9
|
* These fields describe the patient, not the prescriber: keep the browser's autofill and password managers
|
|
6
10
|
* (1Password, LastPass, Bitwarden, Dashlane) from offering the prescriber's own name, birthday, phone or address.
|
|
@@ -17,27 +21,4 @@ export declare const SEX_OPTIONS: {
|
|
|
17
21
|
value: Sex;
|
|
18
22
|
label: string;
|
|
19
23
|
}[];
|
|
20
|
-
/**
|
|
21
|
-
* Phone / email / address, inside the demographics editor. Nothing here is required up front: the server
|
|
22
|
-
* decides (a send needs a phone), and the editor opens itself when a send fails for want of one —
|
|
23
|
-
* `addressRequest`.
|
|
24
|
-
*/
|
|
25
|
-
export declare function ContactFields({ phone, email, address, onSave, addressRequest, }: {
|
|
26
|
-
phone: string | null;
|
|
27
|
-
email: string | null;
|
|
28
|
-
address: {
|
|
29
|
-
street1: string | null;
|
|
30
|
-
street2: string | null;
|
|
31
|
-
city: string | null;
|
|
32
|
-
state: string | null;
|
|
33
|
-
postalCode: string | null;
|
|
34
|
-
} | null;
|
|
35
|
-
onSave: (contact: {
|
|
36
|
-
phone?: string;
|
|
37
|
-
email?: string;
|
|
38
|
-
address?: AddressInput;
|
|
39
|
-
}) => void;
|
|
40
|
-
addressRequest: string | null;
|
|
41
|
-
}): import("react").JSX.Element;
|
|
42
|
-
export {};
|
|
43
24
|
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/components/patient/fields.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/components/patient/fields.tsx"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,aAAa,UAKzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;CAMb,CAAC;AAEX,mGAAmG;AACnG,eAAO,MAAM,WAAW,EAAE;IAAE,KAAK,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAItD,CAAC"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
/** Fields both the intake form and the details editor use: sex, contact, no autofill. */
|
|
3
|
-
import { useComponents } from "../../primitives/index.js";
|
|
1
|
+
/** What PatientCard's forms share: the identity keys, the sex options, and no autofill. */
|
|
4
2
|
import {} from "@photonhealth/client";
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
/**
|
|
4
|
+
* What network-api needs to add a patient. While the prescriber is still finding or filling them in, the server's
|
|
5
|
+
* "still needed" about these is what the card asks for next, not an error to show.
|
|
6
|
+
*/
|
|
7
|
+
export const IDENTITY_KEYS = [
|
|
8
|
+
"demographic.name.first",
|
|
9
|
+
"demographic.name.last",
|
|
10
|
+
"demographic.dateOfBirth",
|
|
11
|
+
"demographic.sex",
|
|
12
|
+
];
|
|
7
13
|
/**
|
|
8
14
|
* These fields describe the patient, not the prescriber: keep the browser's autofill and password managers
|
|
9
15
|
* (1Password, LastPass, Bitwarden, Dashlane) from offering the prescriber's own name, birthday, phone or address.
|
|
@@ -21,51 +27,4 @@ export const SEX_OPTIONS = [
|
|
|
21
27
|
{ value: "FEMALE", label: "Female" },
|
|
22
28
|
{ value: "UNKNOWN", label: "Unknown" },
|
|
23
29
|
];
|
|
24
|
-
/**
|
|
25
|
-
* Phone / email / address, inside the demographics editor. Nothing here is required up front: the server
|
|
26
|
-
* decides (a send needs a phone), and the editor opens itself when a send fails for want of one —
|
|
27
|
-
* `addressRequest`.
|
|
28
|
-
*/
|
|
29
|
-
export function ContactFields({ phone, email, address, onSave, addressRequest, }) {
|
|
30
|
-
const { Alert, Grid, Input, Stack } = useComponents();
|
|
31
|
-
const [phoneValue, setPhone] = useState(formatPhone(phone));
|
|
32
|
-
const [emailValue, setEmail] = useState(email ?? "");
|
|
33
|
-
const [street1, setStreet1] = useState(address?.street1 ?? "");
|
|
34
|
-
const [street2, setStreet2] = useState(address?.street2 ?? "");
|
|
35
|
-
const [city, setCity] = useState(address?.city ?? "");
|
|
36
|
-
const [state, setState] = useState(address?.state ?? "");
|
|
37
|
-
const [postalCode, setPostalCode] = useState(address?.postalCode ?? "");
|
|
38
|
-
// Save early: each field saves when you leave it (the browser validates phone / email first);
|
|
39
|
-
// the address saves once it's complete and you leave it.
|
|
40
|
-
const addressComplete = Boolean(street1.trim() && city.trim() && state.trim() && postalCode.trim());
|
|
41
|
-
const savePhone = (input) => {
|
|
42
|
-
setPhone(formatPhone(phoneValue));
|
|
43
|
-
if (input.checkValidity() && toE164(phoneValue) !== (phone || undefined))
|
|
44
|
-
onSave({ phone: toE164(phoneValue) ?? "" });
|
|
45
|
-
};
|
|
46
|
-
const saveEmail = (input) => {
|
|
47
|
-
if (input.checkValidity() && emailValue.trim() !== (email ?? ""))
|
|
48
|
-
onSave({ email: emailValue.trim() });
|
|
49
|
-
};
|
|
50
|
-
const saveAddress = () => {
|
|
51
|
-
if (!addressComplete)
|
|
52
|
-
return;
|
|
53
|
-
const next = {
|
|
54
|
-
street1: street1.trim(),
|
|
55
|
-
street2: street2.trim() || undefined,
|
|
56
|
-
city: city.trim(),
|
|
57
|
-
state: state.trim().toUpperCase(),
|
|
58
|
-
postalCode: postalCode.trim(),
|
|
59
|
-
country: "US",
|
|
60
|
-
};
|
|
61
|
-
const same = next.street1 === (address?.street1 ?? "") &&
|
|
62
|
-
(next.street2 ?? "") === (address?.street2 ?? "") &&
|
|
63
|
-
next.city === (address?.city ?? "") &&
|
|
64
|
-
next.state === (address?.state ?? "") &&
|
|
65
|
-
next.postalCode === (address?.postalCode ?? "");
|
|
66
|
-
if (!same)
|
|
67
|
-
onSave({ address: next });
|
|
68
|
-
};
|
|
69
|
-
return (_jsxs(Stack, { gap: "2", children: [addressRequest && _jsx(Alert, { tone: "warning", title: phone ? "Address needed to send" : "Phone needed to send" }), _jsxs(Grid, { min: "120px", gap: "3", children: [_jsx(Input, { label: "Phone", type: "tel", inputMode: "tel", pattern: PHONE_PATTERN, value: phoneValue, onChange: (e) => setPhone(e.target.value), onBlur: (e) => savePhone(e.currentTarget), ...noAutofill }), _jsx(Input, { label: "Email", type: "email", inputMode: "email", value: emailValue, onChange: (e) => setEmail(e.target.value), onBlur: (e) => saveEmail(e.currentTarget), ...noAutofill })] }), _jsx("div", { onBlur: saveAddress, children: _jsxs(Stack, { gap: "3", children: [_jsxs(Grid, { min: "120px", gap: "3", children: [_jsx(Input, { label: "Street", value: street1, onChange: (e) => setStreet1(e.target.value), ...noAutofill }), _jsx(Input, { label: "Apt / suite", value: street2, onChange: (e) => setStreet2(e.target.value), ...noAutofill })] }), _jsxs(Grid, { min: "120px", gap: "3", children: [_jsx(Input, { label: "City", value: city, onChange: (e) => setCity(e.target.value), ...noAutofill }), _jsx(Input, { label: "State", value: state, onChange: (e) => setState(e.target.value), maxLength: 2, ...noAutofill }), _jsx(Input, { label: "ZIP", value: postalCode, onChange: (e) => setPostalCode(e.target.value), inputMode: "numeric", ...noAutofill })] })] }) })] }));
|
|
70
|
-
}
|
|
71
30
|
//# sourceMappingURL=fields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../src/components/patient/fields.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../src/components/patient/fields.tsx"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,OAAO,EAAY,MAAM,sBAAsB,CAAC;AAEhD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,wBAAwB;IACxB,uBAAuB;IACvB,yBAAyB;IACzB,iBAAiB;CAClB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,YAAY,EAAE,KAAK;IACnB,gBAAgB,EAAE,MAAM;IACxB,eAAe,EAAE,MAAM;IACvB,eAAe,EAAE,MAAM;IACvB,gBAAgB,EAAE,OAAO;CACjB,CAAC;AAEX,mGAAmG;AACnG,MAAM,CAAC,MAAM,WAAW,GAAoC;IAC1D,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IAChC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;IACpC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;CACvC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ParsedPatientSearchQuery {
|
|
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 — PatientSearch's `searchBoth` says when
|
|
13
|
+
* it's worth trying as a last name too.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parsePatientSearchQuery(text: string): ParsedPatientSearchQuery;
|
|
16
|
+
//# sourceMappingURL=parsePatientSearchQuery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsePatientSearchQuery.d.ts","sourceRoot":"","sources":["../../../src/components/patient/parsePatientSearchQuery.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,wBAAwB;IACvC,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,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,wBAAwB,CAuB9E"}
|
|
@@ -27,10 +27,10 @@ function asPhone(token) {
|
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* What was typed, as the server takes it. Anything that reads as a date, a phone or an email is taken as
|
|
30
|
-
* one; what's left is the name, first word first. A single word is a first name — `searchBoth` says when
|
|
30
|
+
* one; what's left is the name, first word first. A single word is a first name — PatientSearch's `searchBoth` says when
|
|
31
31
|
* it's worth trying as a last name too.
|
|
32
32
|
*/
|
|
33
|
-
export function
|
|
33
|
+
export function parsePatientSearchQuery(text) {
|
|
34
34
|
const parsed = {};
|
|
35
35
|
const words = [];
|
|
36
36
|
for (const token of text.trim().split(/\s+/).filter(Boolean)) {
|
|
@@ -55,11 +55,4 @@ export function parseQuery(text) {
|
|
|
55
55
|
parsed.name = rest.length ? { first, last: rest.join(" ") } : { first };
|
|
56
56
|
return parsed;
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
export const isSearchable = (q) => Boolean(q.name?.first || q.name?.last || q.dateOfBirth || q.phone || q.email);
|
|
60
|
-
/**
|
|
61
|
-
* One word could be either name. It goes as a first name; if nothing comes back, it's worth asking again
|
|
62
|
-
* as a last name — "Lovelace" is as likely as "Ada".
|
|
63
|
-
*/
|
|
64
|
-
export const searchBoth = (q) => q.name?.first && !q.name.last && !q.dateOfBirth && !q.phone && !q.email ? { name: { last: q.name.first } } : null;
|
|
65
|
-
//# sourceMappingURL=query.js.map
|
|
58
|
+
//# sourceMappingURL=parsePatientSearchQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsePatientSearchQuery.js","sourceRoot":"","sources":["../../../src/components/patient/parsePatientSearchQuery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAStC,MAAM,KAAK,GAAG,4BAA4B,CAAC;AAC3C,yEAAyE;AACzE,MAAM,GAAG,GAAG,2BAA2B,CAAC;AACxC,MAAM,EAAE,GAAG,qCAAqC,CAAC;AAEjD,oEAAoE;AACpE,SAAS,MAAM,CAAC,KAAa;IAC3B,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAClC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CA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,KAAK,CAAC,CAAC;IACpB,CAAC;IACD,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;IAC/B,IAAI,KAAK;QAAE,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;IACnF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Patient, Prescription, type PatientInput, type PrescriptionInput, type PrescriptionRecord } from "@photonhealth/client";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* One prescription line, bound to a live Prescription: PhotonPrescription's card (which adds the analytics workflow
|
|
5
|
+
* and the sign-in), and each line of PhotonOrder. Internal: the package index exports only PhotonPrescription.
|
|
6
|
+
*/
|
|
7
|
+
export interface PrescriptionCardProps {
|
|
8
|
+
/**
|
|
9
|
+
* The prescription, one of:
|
|
10
|
+
* - a live `Prescription`: used as is; anything else holding it sees the same changes
|
|
11
|
+
* - its id, `"rx_…"` or `{ id }`: gets the prescription
|
|
12
|
+
* - its id with fields, `{ id, … }`: updates the prescription
|
|
13
|
+
* - fields without an id, e.g. `{ templateId }` or `{ treatment: { name } }`: upserts the prescription
|
|
14
|
+
*/
|
|
15
|
+
prescription?: Prescription | PrescriptionInput | string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Who it's for, one of:
|
|
18
|
+
* - a live `Patient`: used as is
|
|
19
|
+
* - its id, `"pat_…"` or `{ id }`: gets the patient
|
|
20
|
+
* - its id with fields, `{ id, … }`: updates the patient
|
|
21
|
+
* - fields without an id: upserts the patient
|
|
22
|
+
*
|
|
23
|
+
* Until it's known, a new line only looks drugs up (a line from an order already knows).
|
|
24
|
+
*/
|
|
25
|
+
patient?: Patient | PatientInput | string | null;
|
|
26
|
+
/** Read-only (e.g. on a finalized order). A signed prescription is always read-only. */
|
|
27
|
+
locked?: boolean;
|
|
28
|
+
/** The prescriber signed it on this card — once per prescription. */
|
|
29
|
+
onSigned?: (prescription: Prescription) => void;
|
|
30
|
+
/**
|
|
31
|
+
* The card's prescription, once it has a record and each time that record changes from the backend
|
|
32
|
+
* (created, saved, signed).
|
|
33
|
+
*/
|
|
34
|
+
onPrescription?: (prescription: Prescription) => void;
|
|
35
|
+
/** Shows a Remove button (an order's line). */
|
|
36
|
+
onRemove?: () => void;
|
|
37
|
+
/** Put the cursor in Treatment (a line the prescriber just added). */
|
|
38
|
+
autoFocus?: boolean;
|
|
39
|
+
/** Put the cursor in Treatment each time this changes (e.g. a patient was just picked). */
|
|
40
|
+
focusSignal?: number;
|
|
41
|
+
}
|
|
42
|
+
export declare function StatusBadge({ rx }: {
|
|
43
|
+
rx: PrescriptionRecord | null;
|
|
44
|
+
}): import("react").JSX.Element | null;
|
|
45
|
+
export declare function PrescriptionCard({ patient, prescription, locked, onSigned, onPrescription, onRemove, autoFocus, focusSignal, }: PrescriptionCardProps): import("react").JSX.Element;
|
|
46
|
+
/** A saved prescription: its instructions — with its status tag at the end of that line — then what's dispensed. */
|
|
47
|
+
export declare function ReadOnlyRx({ rx, status }: {
|
|
48
|
+
rx: PrescriptionRecord | null;
|
|
49
|
+
status: ReactNode;
|
|
50
|
+
}): import("react").JSX.Element;
|
|
51
|
+
//# sourceMappingURL=PrescriptionCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrescriptionCard.d.ts","sourceRoot":"","sources":["../../../src/components/prescription/PrescriptionCard.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,OAAO,EACP,YAAY,EACZ,KAAK,YAAY,EAGjB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EAGxB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAapE;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,YAAY,GAAG,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAAC;IAChE;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,YAAY,GAAG,MAAM,GAAG,IAAI,CAAC;IACjD,wFAAwF;IACxF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IAChD;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IACtD,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,sEAAsE;IACtE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,2FAA2F;IAC3F,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE;IAAE,EAAE,EAAE,kBAAkB,GAAG,IAAI,CAAA;CAAE,sCAcpE;AAQD,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,SAAS,EACT,WAAW,GACZ,EAAE,qBAAqB,+BA4OvB;AAED,oHAAoH;AACpH,wBAAgB,UAAU,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;IAAE,EAAE,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAE,+BAmB9F"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useComponents, usePhoton } from "../../primitives/index.js";
|
|
3
|
+
import { classify, Patient, Prescription, } from "@photonhealth/client";
|
|
4
|
+
import { useLive, useOnChange } from "../../hooks/index.js";
|
|
5
|
+
import { useEffect, useRef, useState } from "react";
|
|
6
|
+
import { useHeldActivity } from "../activity.js";
|
|
7
|
+
import { SearchResults } from "../search.js";
|
|
8
|
+
import { NotFound, openFailed, toOpen, useOpened } from "../open.js";
|
|
9
|
+
import { treatmentHeading } from "../display.js";
|
|
10
|
+
import { dispenseSummary } from "../format.js";
|
|
11
|
+
import { ChangeList } from "../ChangeList.js";
|
|
12
|
+
import { PrescriptionDetailsForm } from "./PrescriptionDetailsForm/PrescriptionDetailsForm.js";
|
|
13
|
+
import { ScreeningAlerts } from "../ScreeningAlerts.js";
|
|
14
|
+
import { TreatmentSearch } from "./TreatmentSearch/TreatmentSearch.js";
|
|
15
|
+
import { usePhotonAnalytics } from "../../analytics/PhotonAnalyticsProvider.js";
|
|
16
|
+
import { useSendDraftPrescriptionAdded } from "../../analytics/cardLifecycle.js";
|
|
17
|
+
export function StatusBadge({ rx }) {
|
|
18
|
+
const { Badge } = useComponents();
|
|
19
|
+
if (!rx)
|
|
20
|
+
return null;
|
|
21
|
+
if (rx.signing.state === "SIGNED")
|
|
22
|
+
return (_jsx(Badge, { tone: "success", icon: "check", children: "Signed" }));
|
|
23
|
+
if (rx.signing.state === "INVALIDATED_SIGN")
|
|
24
|
+
return _jsx(Badge, { tone: "warning", children: "Changed since signing" });
|
|
25
|
+
// No tag for screening: its alerts are listed above the sig. Nor for nothing found: network-api doesn't screen
|
|
26
|
+
// allergies without an RxNorm id (and doesn't say which), so "No alerts" could read as a clinical check that
|
|
27
|
+
// didn't happen.
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
// One empty list, so a line with no templates doesn't hand PrescriptionDetailsForm new options every render.
|
|
31
|
+
const NO_TEMPLATES = [];
|
|
32
|
+
// At module level, not inline: useOpened re-runs its server call when these functions change.
|
|
33
|
+
const prescriptionOf = (r) => r.prescription;
|
|
34
|
+
const patientOf = (r) => r.patient;
|
|
35
|
+
export function PrescriptionCard({ patient, prescription, locked, onSigned, onPrescription, onRemove, autoFocus, focusSignal, }) {
|
|
36
|
+
const { Alert, Button, Card, CardBody, CardHeader, Spinner, Stack } = useComponents();
|
|
37
|
+
const ph = usePhoton();
|
|
38
|
+
// A new line when the host gives no prescription (and none to open).
|
|
39
|
+
const shared = prescription instanceof Prescription ? prescription : null;
|
|
40
|
+
const given = toOpen(prescription, Boolean(shared));
|
|
41
|
+
const [own] = useState(() => (shared || given ? null : ph.prescription()));
|
|
42
|
+
const { opened, error: rxError } = useOpened(ph.prescription, given, prescriptionOf, "prescription");
|
|
43
|
+
// Who it's for, opened the same way; its id once it has a record.
|
|
44
|
+
const sharedPatient = patient instanceof Patient ? patient : null;
|
|
45
|
+
const { opened: openedPatient, error: patientError } = useOpened(ph.patient, toOpen(patient, Boolean(sharedPatient)), patientOf, "patient");
|
|
46
|
+
const patientSnap = useLive(sharedPatient ?? openedPatient);
|
|
47
|
+
// Not given: leave it (a line from an order has its own). Given: its id once it has one; null clears it.
|
|
48
|
+
const patientId = patient === undefined ? undefined : patient === null ? null : patientSnap?.state?.id;
|
|
49
|
+
const openError = rxError ?? patientError;
|
|
50
|
+
const live = shared ?? opened ?? own;
|
|
51
|
+
const snap = useLive(live);
|
|
52
|
+
useOnChange(live, (rx) => rx.state, onPrescription);
|
|
53
|
+
useSendDraftPrescriptionAdded(live);
|
|
54
|
+
const analytics = usePhotonAnalytics();
|
|
55
|
+
const signedHere = useRef(new Set()); // onSigned: once per prescription
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (live && patientId !== undefined)
|
|
58
|
+
void live.sync({ patient: patientId ? { id: patientId } : null }).catch(() => { });
|
|
59
|
+
}, [live, patientId]);
|
|
60
|
+
const rx = snap?.state ?? null;
|
|
61
|
+
const changes = classify(snap?.changes ?? { applied: [], unapplied: [] });
|
|
62
|
+
const [signing, setSigning] = useState(false);
|
|
63
|
+
// The error showing came from Sign, which signs (its title says so); the next save's error is a save's again.
|
|
64
|
+
const [signFailed, setSignFailed] = useState(false);
|
|
65
|
+
const busy = signing || snap?.status === "saving" || snap?.status === "loading";
|
|
66
|
+
// Signing is per prescription, and a signed one is final here: no edits (any change would void the
|
|
67
|
+
// signature). A different drug or sig is a new line.
|
|
68
|
+
const readOnly = Boolean(locked) || Boolean(live?.signed);
|
|
69
|
+
// Sign (the signature) is offered once the server left nothing open. Screening alerts don't stop it: signing is the
|
|
70
|
+
// prescriber's acknowledgement of what they show (network-api can't acknowledge an alert yet).
|
|
71
|
+
const canSign = Boolean(rx) && changes.settled;
|
|
72
|
+
// The field whose change sent the call in flight shows a spinner — nowhere else, so nothing opens and
|
|
73
|
+
// closes while the prescriber works (held briefly, so it doesn't flicker).
|
|
74
|
+
const [sentFrom, setSentFrom] = useState(null);
|
|
75
|
+
const working = snap?.status === "saving" || snap?.status === "loading";
|
|
76
|
+
if (sentFrom && !working)
|
|
77
|
+
setSentFrom(null); // answered: a later call (e.g. signing) isn't that field's
|
|
78
|
+
const spinning = useHeldActivity(sentFrom);
|
|
79
|
+
const save = (edits, from) => {
|
|
80
|
+
if (readOnly || !live)
|
|
81
|
+
return;
|
|
82
|
+
setSignFailed(false);
|
|
83
|
+
// Its id known: update that prescription; before, sync what's known.
|
|
84
|
+
void (live.id ? live.update(edits) : live.sync(edits)).catch(() => { }); // a failure lands on the object (snap.error)
|
|
85
|
+
if (from && live.busy)
|
|
86
|
+
setSentFrom(from);
|
|
87
|
+
};
|
|
88
|
+
const add = () => {
|
|
89
|
+
if (!live)
|
|
90
|
+
return;
|
|
91
|
+
const alertsShownWhenSigning = openAlerts(rx);
|
|
92
|
+
setSigning(true);
|
|
93
|
+
setSignFailed(false);
|
|
94
|
+
void live
|
|
95
|
+
.sign()
|
|
96
|
+
.then(() => {
|
|
97
|
+
if (!live.signed || !live.id || signedHere.current.has(live.id))
|
|
98
|
+
return;
|
|
99
|
+
signedHere.current.add(live.id);
|
|
100
|
+
void analytics.prescriptionSigned({ id: live.id, screeningAlerts: alertsShownWhenSigning });
|
|
101
|
+
onSigned?.(live);
|
|
102
|
+
})
|
|
103
|
+
.catch(() => setSignFailed(true)) // a refusal or failure lands on the object (snap.error)
|
|
104
|
+
.finally(() => setSigning(false));
|
|
105
|
+
};
|
|
106
|
+
const pick = snap?.pick ?? null;
|
|
107
|
+
// A drug chosen, until the server answers: the picker stays as it was picked (a spinner on the drug's row), and
|
|
108
|
+
// the directions and dispense wait — a moment to see what was picked before the form changes under it.
|
|
109
|
+
const [choosing, setChoosing] = useState(null);
|
|
110
|
+
const chooseTreatment = (choice) => {
|
|
111
|
+
if (!live)
|
|
112
|
+
return;
|
|
113
|
+
setChoosing(choice);
|
|
114
|
+
void live
|
|
115
|
+
.choose(choice.option)
|
|
116
|
+
.catch(() => { }) // a failure lands on the object (snap.error)
|
|
117
|
+
.finally(() => setChoosing(null));
|
|
118
|
+
};
|
|
119
|
+
// The title is the resolved treatment — not what the provider is typing (or an unresolved choice).
|
|
120
|
+
const drugChoices = changes.needsChoice.filter((c) => c.key.startsWith("treatment"));
|
|
121
|
+
const otherChoices = changes.needsChoice.filter((c) => !c.key.startsWith("treatment"));
|
|
122
|
+
const treatmentPending = drugChoices.length > 0;
|
|
123
|
+
// Choosing among the drugs: the picker's up (none while a product chosen saves: it heads the card at once).
|
|
124
|
+
const pickerUp = treatmentPending && !choosing;
|
|
125
|
+
const resolvedName = (rx ? !treatmentPending : pick) && !choosing ? (live?.name ?? null) : null;
|
|
126
|
+
// Sig / dispense can be filled once a drug is picked (and its choice has saved) — before a patient too (kept
|
|
127
|
+
// until the line attaches).
|
|
128
|
+
const fieldsOpen = Boolean(rx || pick) && !choosing;
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
if (fieldsOpen && !readOnly)
|
|
131
|
+
live?.loadTemplates();
|
|
132
|
+
}, [live, fieldsOpen, readOnly]);
|
|
133
|
+
// "Lisinopril 10 mg tablet" over "Oral tablet · 10 mg" — the picked product, said once. A product chosen heads the
|
|
134
|
+
// card as soon as it's picked, from the option itself, while the server drafts it.
|
|
135
|
+
const heading = choosing
|
|
136
|
+
? treatmentHeading(choosing.option.displayName, choosing.option.treatment)
|
|
137
|
+
: resolvedName
|
|
138
|
+
? treatmentHeading(resolvedName, live?.treatment)
|
|
139
|
+
: null;
|
|
140
|
+
// The Treatment field is for finding a drug: shown until one is picked. A different drug is a new line.
|
|
141
|
+
const searching = !choosing && (!fieldsOpen || pickerUp);
|
|
142
|
+
// A failed call: shown where the drug list drops down (under Treatment), with the card's other messages — and so
|
|
143
|
+
// is a prescription this line stands in for that the server doesn't have (an order link's `rx=`), until it's filled.
|
|
144
|
+
const missing = live?.missing && !rx ? new NotFound("prescription", live.missing) : null;
|
|
145
|
+
const opening = openError ?? missing;
|
|
146
|
+
const error = snap?.error ?? opening;
|
|
147
|
+
const failure = error && (_jsx(Alert, { tone: "critical", title: !snap?.error && opening
|
|
148
|
+
? openFailed(opening === patientError ? "patient" : "prescription", opening)
|
|
149
|
+
: signFailed
|
|
150
|
+
? "Couldn't sign this prescription"
|
|
151
|
+
: snap?.error?.kind === "refused" && !rx
|
|
152
|
+
? "Can't start a new prescription"
|
|
153
|
+
: "Couldn't save this prescription", description: error.message }));
|
|
154
|
+
// The body above the form shows only when something is in it. A divided card draws a line above each section, so an
|
|
155
|
+
// empty one (Treatment closed once a drug is picked, nothing to say) would show as a double line. Keep this in step
|
|
156
|
+
// with what the body renders.
|
|
157
|
+
const hasBody = readOnly ||
|
|
158
|
+
searching ||
|
|
159
|
+
Boolean(error) ||
|
|
160
|
+
otherChoices.length + changes.blocking.length + changes.advisories.length > 0 ||
|
|
161
|
+
Boolean(snap?.drafts) ||
|
|
162
|
+
openAlerts(rx).length > 0 ||
|
|
163
|
+
Boolean(choosing);
|
|
164
|
+
return (_jsxs(Card, { divided: true, label: heading?.title ?? "Prescription", children: [_jsx(CardHeader, { title: heading?.title ?? "Prescription",
|
|
165
|
+
// The product in parts — a brand's ingredients, its form · strength, a controlled substance's schedule —
|
|
166
|
+
// with no NDC / RxNorm stand-ins.
|
|
167
|
+
description: heading?.detail, action: !locked &&
|
|
168
|
+
onRemove && (_jsx(Button, { variant: "ghost", size: "sm", tone: "critical", icon: "trash", "aria-label": "Remove prescription", title: "Remove prescription", onClick: onRemove })) }), hasBody && (_jsx(CardBody, { children: _jsx(Stack, { gap: "4", children: readOnly ? (_jsxs(_Fragment, { children: [failure, _jsx(ReadOnlyRx, { rx: rx, status: _jsx(StatusBadge, { rx: rx }) }), _jsx(ScreeningAlerts, { alerts: openAlerts(rx) })] })) : (_jsxs(_Fragment, { children: [_jsx(TreatmentSearch, { live: live, rx: rx, pickId: pick?.id ?? null, drugChoices: drugChoices, choosing: choosing, open: searching, busy: busy, spinning: spinning, autoFocus: autoFocus, focusSignal: focusSignal, save: save, onChoose: chooseTreatment }), failure, _jsx(ChangeList, { changes: { ...changes, needsChoice: otherChoices }, onChoose: (o) => void live?.choose(o).catch(() => { }), busy: busy }), snap?.drafts && (_jsx(SearchResults, { label: "Continue a draft", busy: busy, results: snap.drafts.map((d) => ({
|
|
169
|
+
key: d.id,
|
|
170
|
+
label: d.treatment.name,
|
|
171
|
+
description: [d.instructions, dispenseSummary(d)].filter(Boolean).join(" · ") || undefined,
|
|
172
|
+
})), onPick: (id) => void live?.continueDraft(id).catch(() => { }) })), _jsx(ScreeningAlerts, { alerts: openAlerts(rx) }), choosing && _jsx(Spinner, {})] })) }) })), !readOnly && (_jsx(PrescriptionDetailsForm, { live: live, rx: rx, open: fieldsOpen, focusable: !searching, templates: snap?.templates ?? NO_TEMPLATES, spinning: spinning, save: save, status: _jsx(StatusBadge, { rx: rx }), onSign: add, signing: signing, signDisabled: snap?.status === "loading" || (Boolean(rx) && !canSign) }))] }));
|
|
173
|
+
}
|
|
174
|
+
/** A saved prescription: its instructions — with its status tag at the end of that line — then what's dispensed. */
|
|
175
|
+
export function ReadOnlyRx({ rx, status }) {
|
|
176
|
+
const { Row, Stack, Text } = useComponents();
|
|
177
|
+
// Locked before there's anything in it: say so, rather than an empty card.
|
|
178
|
+
if (!rx)
|
|
179
|
+
return _jsx(Text, { tone: "tertiary", children: "No prescription" });
|
|
180
|
+
const dispense = dispenseSummary(rx);
|
|
181
|
+
const first = rx.instructions ? (_jsx("span", { children: rx.instructions })) : dispense ? (_jsx(Text, { tone: "secondary", children: dispense })) : null;
|
|
182
|
+
return (_jsxs(Stack, { gap: "1", children: [_jsxs(Row, { gap: "2", justify: "between", children: [first ?? _jsx("span", {}), status] }), rx.instructions && dispense && _jsx(Text, { tone: "secondary", children: dispense })] }));
|
|
183
|
+
}
|
|
184
|
+
/** What screening found, until it's signed: the signature acknowledges them. */
|
|
185
|
+
const openAlerts = (rx) => rx?.signing.state === "SIGNED" ? [] : (rx?.screeningAlerts ?? []);
|
|
186
|
+
//# sourceMappingURL=PrescriptionCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrescriptionCard.js","sourceRoot":"","sources":["../../../src/components/prescription/PrescriptionCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EACL,QAAQ,EACR,OAAO,EACP,YAAY,GAQb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAe,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAmB,CAAC;AAC/C,OAAO,EAAE,uBAA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CACR,CAAC;AACJ,CAAC;AAED,oHAAoH;AACpH,MAAM,UAAU,UAAU,CAAC,EAAE,EAAE,EAAE,MAAM,EAAwD;IAC7F,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,CAAC;IAC7C,2EAA2E;IAC3E,IAAI,CAAC,EAAE;QAAE,OAAO,KAAC,IAAI,IAAC,IAAI,EAAC,UAAU,gCAAuB,CAAC;IAC7D,MAAM,QAAQ,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAC9B,yBAAO,EAAE,CAAC,YAAY,GAAQ,CAC/B,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACb,KAAC,IAAI,IAAC,IAAI,EAAC,WAAW,YAAE,QAAQ,GAAQ,CACzC,CAAC,CAAC,CAAC,IAAI,CAAC;IACT,OAAO,CACL,MAAC,KAAK,IAAC,GAAG,EAAC,GAAG,aACZ,MAAC,GAAG,IAAC,GAAG,EAAC,GAAG,EAAC,OAAO,EAAC,SAAS,aAC3B,KAAK,IAAI,gBAAQ,EACjB,MAAM,IACH,EACL,EAAE,CAAC,YAAY,IAAI,QAAQ,IAAI,KAAC,IAAI,IAAC,IAAI,EAAC,WAAW,YAAE,QAAQ,GAAQ,IAClE,CACT,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,GAAG,CAAC,EAA6B,EAAE,EAAE,CACnD,EAAE,EAAE,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,eAAe,IAAI,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** A prescription's directions (sig). Its value is kept by PrescriptionDetailsForm, which decides what's saved. */
|
|
2
|
+
export interface DirectionsInputProps {
|
|
3
|
+
value: string;
|
|
4
|
+
/** What's wrong with it, shown under it. */
|
|
5
|
+
errorMessage?: string;
|
|
6
|
+
/** Typed since it was last committed. */
|
|
7
|
+
edited: boolean;
|
|
8
|
+
/** Where the card flow (← / →) lands, when Treatment isn't. */
|
|
9
|
+
focusable: boolean;
|
|
10
|
+
onEdit: (value: string) => void;
|
|
11
|
+
/** Leaving the field after editing it. */
|
|
12
|
+
onCommit: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function DirectionsInput({ value, errorMessage, edited, focusable, onEdit, onCommit }: DirectionsInputProps): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=DirectionsInput.d.ts.map
|