generated from t3-oss/create-t3-turbo
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from trevorpfiz/elektrikspark/ttp-60-health-re…
…cords-react-native ttp 60 health records react native
- Loading branch information
Showing
82 changed files
with
3,364 additions
and
852 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 49 additions & 2 deletions
51
apps/expo/src/app/portal/(tabs)/health-record/allergies.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,56 @@ | ||
import { Text, View } from "react-native"; | ||
import { FlashList } from "@shopify/flash-list"; | ||
import { atom, useAtom } from "jotai"; | ||
|
||
import AllergyItem from "~/components/ui/health-record/allergy-item"; | ||
import { api } from "~/utils/api"; | ||
|
||
export const patientAtom = atom("e7836251cbed4bd5bb2d792bc02893fd"); | ||
|
||
export default function Allergies() { | ||
const [patientId] = useAtom(patientAtom); | ||
|
||
const { isLoading, isError, data, error } = | ||
api.patientMedicalHistory.getPatientAllergies.useQuery({ patientId }); | ||
|
||
if (isLoading) { | ||
return <Text>Loading...</Text>; | ||
} | ||
|
||
if (isError) { | ||
return <Text>Error: {error.message}</Text>; | ||
} | ||
|
||
const allergies = data?.entry; | ||
|
||
return ( | ||
<View> | ||
<Text>Allergies</Text> | ||
<View className="flex-1 bg-gray-100"> | ||
{data.total > 0 ? ( | ||
<FlashList | ||
data={allergies} | ||
renderItem={({ item, index }) => ( | ||
<AllergyItem | ||
allergen={item.resource.code.text} | ||
type={item.resource.type} | ||
severity={item.resource.reaction?.[0]?.severity ?? ""} | ||
reaction={ | ||
item.resource.reaction?.[0]?.manifestation[0]?.text ?? "" | ||
} | ||
first={index === 0} | ||
last={index === data.total - 1} | ||
/> | ||
)} | ||
estimatedItemSize={100} | ||
keyExtractor={(item, index) => index.toString()} | ||
contentContainerStyle={{ | ||
paddingBottom: 16, | ||
// paddingTop: 16, | ||
// paddingHorizontal: 16, | ||
}} | ||
/> | ||
) : ( | ||
<Text className="p-8">{`No allergies found.`}</Text> | ||
)} | ||
</View> | ||
); | ||
} |
52 changes: 50 additions & 2 deletions
52
apps/expo/src/app/portal/(tabs)/health-record/conditions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,57 @@ | ||
import { Text, View } from "react-native"; | ||
import { FlashList } from "@shopify/flash-list"; | ||
import { useAtom } from "jotai"; | ||
|
||
import ConditionItem from "~/components/ui/health-record/condition-item"; | ||
import { api } from "~/utils/api"; | ||
import { patientAtom } from "./allergies"; | ||
|
||
export default function Conditions() { | ||
const [patientId] = useAtom(patientAtom); | ||
|
||
const { isLoading, isError, data, error } = | ||
api.patientMedicalHistory.getPatientConditions.useQuery({ patientId }); | ||
|
||
if (isLoading) { | ||
return <Text>Loading...</Text>; | ||
} | ||
|
||
if (isError) { | ||
return <Text>Error: {error.message}</Text>; | ||
} | ||
|
||
const conditions = data?.entry; | ||
|
||
return ( | ||
<View> | ||
<Text>Conditions</Text> | ||
<View className="flex-1 bg-gray-100"> | ||
{data?.total > 0 ? ( | ||
<FlashList | ||
data={conditions} | ||
renderItem={({ item, index }) => ( | ||
<ConditionItem | ||
condition={ | ||
item.resource.category?.[0]?.coding[0]?.display ?? "unknown" | ||
} | ||
status={ | ||
item.resource.clinicalStatus?.coding[0]?.display ?? "unknown" | ||
} | ||
onset={item.resource.onsetDateTime ?? "unknown"} | ||
abatement={item.resource.abatementDateTime ?? "unknown"} | ||
first={index === 0} | ||
last={index === data.total - 1} | ||
/> | ||
)} | ||
estimatedItemSize={100} | ||
keyExtractor={(item, index) => index.toString()} | ||
contentContainerStyle={{ | ||
paddingBottom: 16, | ||
// paddingTop: 16, | ||
// paddingHorizontal: 16, | ||
}} | ||
/> | ||
) : ( | ||
<Text className="p-8">{`No immunizations found.`}</Text> | ||
)} | ||
</View> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
apps/expo/src/app/portal/(tabs)/health-record/forms/_layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { Stack } from "expo-router"; | ||
|
||
import { LeftHeaderBack } from "~/components/ui/tabs-header"; | ||
|
||
export default function FormsLayout() { | ||
return ( | ||
<Stack> | ||
<Stack.Screen | ||
name="index" | ||
options={{ | ||
title: "Forms", | ||
headerStyle: { | ||
backgroundColor: "#fff", | ||
}, | ||
headerLeft: () => <LeftHeaderBack />, | ||
}} | ||
/> | ||
<Stack.Screen | ||
name="goals" | ||
options={{ | ||
title: "Goals", | ||
headerStyle: { | ||
backgroundColor: "#fff", | ||
}, | ||
headerLeft: () => <LeftHeaderBack />, | ||
}} | ||
/> | ||
<Stack.Screen | ||
name="questionnaires" | ||
options={{ | ||
title: "Questionnaires", | ||
headerStyle: { | ||
backgroundColor: "#fff", | ||
}, | ||
headerShown: false, | ||
}} | ||
/> | ||
<Stack.Screen | ||
name="consents" | ||
options={{ | ||
title: "Consents", | ||
headerStyle: { | ||
backgroundColor: "#fff", | ||
}, | ||
headerShown: false, | ||
}} | ||
/> | ||
</Stack> | ||
); | ||
} |
26 changes: 26 additions & 0 deletions
26
apps/expo/src/app/portal/(tabs)/health-record/forms/consents/[consentId].tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Text, View } from "react-native"; | ||
import { Stack, useLocalSearchParams } from "expo-router"; | ||
|
||
import { | ||
ChatRightHeaderClose, | ||
MessagesLeftHeaderBack, | ||
} from "~/components/ui/messages-header"; | ||
|
||
export default function ConsentPage() { | ||
const { consentId } = useLocalSearchParams<{ | ||
consentId: string; | ||
}>(); | ||
return ( | ||
<View> | ||
<Stack.Screen | ||
options={{ | ||
title: consentId, | ||
headerLeft: () => <MessagesLeftHeaderBack />, | ||
headerRight: () => <ChatRightHeaderClose />, | ||
}} | ||
/> | ||
<Text>Consent Page</Text> | ||
<Text>{consentId}</Text> | ||
</View> | ||
); | ||
} |
18 changes: 18 additions & 0 deletions
18
apps/expo/src/app/portal/(tabs)/health-record/forms/consents/_layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Stack } from "expo-router"; | ||
|
||
import { LeftHeaderBack } from "~/components/ui/tabs-header"; | ||
|
||
export default function ConsentsLayout() { | ||
return ( | ||
<Stack> | ||
<Stack.Screen | ||
name="index" | ||
options={{ | ||
headerTitle: "Consents", | ||
headerStyle: { backgroundColor: "#fff" }, | ||
headerLeft: () => <LeftHeaderBack />, | ||
}} | ||
/> | ||
</Stack> | ||
); | ||
} |
58 changes: 58 additions & 0 deletions
58
apps/expo/src/app/portal/(tabs)/health-record/forms/consents/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Text, View } from "react-native"; | ||
import { FlashList } from "@shopify/flash-list"; | ||
import { useAtom } from "jotai"; | ||
|
||
import ConsentItem from "~/components/ui/health-record/consent-item"; | ||
import { api } from "~/utils/api"; | ||
import { patientAtom } from "../../allergies"; | ||
|
||
export default function ConsentsPage() { | ||
const [patientId] = useAtom(patientAtom); | ||
|
||
const { isLoading, isError, data, error } = | ||
api.patientMedicalHistory.getPatientConsents.useQuery({ | ||
patientId, | ||
}); | ||
|
||
if (isLoading) { | ||
return <Text>Loading...</Text>; | ||
} | ||
|
||
if (isError) { | ||
return <Text>Error: {error.message}</Text>; | ||
} | ||
|
||
const consents = data?.entry; | ||
|
||
return ( | ||
<View className="flex-1 bg-gray-100"> | ||
{data?.total > 0 ? ( | ||
<FlashList | ||
data={consents} | ||
renderItem={({ item, index }) => ( | ||
<ConsentItem | ||
consent={ | ||
item.resource?.category?.[0]?.coding?.[0]?.display ?? | ||
"unknown consent" | ||
} | ||
status={item.resource?.status ?? "unknown"} | ||
start={item.resource?.provision?.period?.start ?? "unknown"} | ||
end={item.resource?.provision?.period?.end ?? "unknown"} | ||
first={index === 0} | ||
last={index === data?.total - 1} | ||
/> | ||
)} | ||
estimatedItemSize={100} | ||
keyExtractor={(item, index) => index.toString()} | ||
contentContainerStyle={{ | ||
paddingBottom: 16, | ||
// paddingTop: 16, | ||
// paddingHorizontal: 16, | ||
}} | ||
/> | ||
) : ( | ||
<Text className="p-8">{`No consents found.`}</Text> | ||
)} | ||
</View> | ||
); | ||
} |
Oops, something went wrong.