patterns #79
|
|
@ -18,6 +18,7 @@ interface PatternData {
|
||||||
code?: string;
|
code?: string;
|
||||||
clinicalManifestation?: string | string[];
|
clinicalManifestation?: string | string[];
|
||||||
pathology?: string;
|
pathology?: string;
|
||||||
|
treatmentPrinciple?: string | string[];
|
||||||
treatment?: string;
|
treatment?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -236,6 +237,11 @@ export function ThreeBurnersDetailRenderer({
|
||||||
|
|
||||||
const clinical = parseBullets(clinicalRaw);
|
const clinical = parseBullets(clinicalRaw);
|
||||||
const pathology = asString(a.pathology);
|
const pathology = asString(a.pathology);
|
||||||
|
const treatmentPrincipleRaw =
|
||||||
|
a.treatment_principle ??
|
||||||
|
a["treatment principle"] ??
|
||||||
|
a.treatmentPrinciple;
|
||||||
|
const treatmentPrinciple = parseBullets(treatmentPrincipleRaw);
|
||||||
const treatment = asString(a.treatment);
|
const treatment = asString(a.treatment);
|
||||||
|
|
||||||
map.set(normalizeKey(name), {
|
map.set(normalizeKey(name), {
|
||||||
|
|
@ -243,6 +249,7 @@ export function ThreeBurnersDetailRenderer({
|
||||||
code: asString(a.code) || undefined,
|
code: asString(a.code) || undefined,
|
||||||
clinicalManifestation: clinical.length > 0 ? clinical : undefined,
|
clinicalManifestation: clinical.length > 0 ? clinical : undefined,
|
||||||
pathology: pathology || undefined,
|
pathology: pathology || undefined,
|
||||||
|
treatmentPrinciple: treatmentPrinciple.length > 0 ? treatmentPrinciple : undefined,
|
||||||
treatment: treatment || undefined,
|
treatment: treatment || undefined,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -284,12 +291,18 @@ export function ThreeBurnersDetailRenderer({
|
||||||
data.clinical_manifestation;
|
data.clinical_manifestation;
|
||||||
|
|
||||||
const clinical = parseBullets(clinicalRaw);
|
const clinical = parseBullets(clinicalRaw);
|
||||||
|
const treatmentPrincipleRaw =
|
||||||
|
data.treatment_principle ??
|
||||||
|
data["treatment principle"] ??
|
||||||
|
data.treatmentPrinciple;
|
||||||
|
const treatmentPrinciple = parseBullets(treatmentPrincipleRaw);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name,
|
name,
|
||||||
code: asString(data.code) || undefined,
|
code: asString(data.code) || undefined,
|
||||||
clinicalManifestation: clinical.length > 0 ? clinical : undefined,
|
clinicalManifestation: clinical.length > 0 ? clinical : undefined,
|
||||||
pathology: asString(data.pathology) || undefined,
|
pathology: asString(data.pathology) || undefined,
|
||||||
|
treatmentPrinciple: treatmentPrinciple.length > 0 ? treatmentPrinciple : undefined,
|
||||||
treatment: asString(data.treatment) || undefined,
|
treatment: asString(data.treatment) || undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -327,6 +340,20 @@ export function ThreeBurnersDetailRenderer({
|
||||||
activePatternData.treatment || "",
|
activePatternData.treatment || "",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const rawPrinciples =
|
||||||
|
activePatternData.treatmentPrinciple &&
|
||||||
|
(Array.isArray(activePatternData.treatmentPrinciple)
|
||||||
|
? activePatternData.treatmentPrinciple
|
||||||
|
: parseBullets(activePatternData.treatmentPrinciple));
|
||||||
|
|
||||||
|
const allPrinciples =
|
||||||
|
rawPrinciples && rawPrinciples.length > 0 ? rawPrinciples : principles;
|
||||||
|
|
||||||
|
const treatmentText =
|
||||||
|
acupuncture.length > 0
|
||||||
|
? acupuncture.join("\n")
|
||||||
|
: activePatternData.treatment;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollView
|
<ScrollView
|
||||||
contentContainerStyle={styles.container}
|
contentContainerStyle={styles.container}
|
||||||
|
|
@ -334,7 +361,14 @@ export function ThreeBurnersDetailRenderer({
|
||||||
>
|
>
|
||||||
<Hero title={activePatternData.name} />
|
<Hero title={activePatternData.name} />
|
||||||
|
|
||||||
{/* 1. Clinical Manifestations Card */}
|
{/* 1. Pathology Card */}
|
||||||
|
{activePatternData.pathology ? (
|
||||||
|
<SectionCard title="Pathology">
|
||||||
|
<Paragraphs items={[activePatternData.pathology]} />
|
||||||
|
</SectionCard>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{/* 2. Clinical Manifestations Card */}
|
||||||
{activePatternData.clinicalManifestation ? (
|
{activePatternData.clinicalManifestation ? (
|
||||||
<SectionCard title="Clinical Manifestations">
|
<SectionCard title="Clinical Manifestations">
|
||||||
<BulletList
|
<BulletList
|
||||||
|
|
@ -347,41 +381,17 @@ export function ThreeBurnersDetailRenderer({
|
||||||
</SectionCard>
|
</SectionCard>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{/* 2. Pathology Card */}
|
{/* 3. Treatment Principle Card */}
|
||||||
{activePatternData.pathology ? (
|
{allPrinciples && allPrinciples.length > 0 ? (
|
||||||
<SectionCard title="Pathology">
|
<SectionCard title="Treatment Principle">
|
||||||
<Paragraphs items={[activePatternData.pathology]} />
|
<BulletList items={allPrinciples} />
|
||||||
</SectionCard>
|
</SectionCard>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{/* 3. Treatment Card */}
|
{/* 4. Treatment Card */}
|
||||||
{activePatternData.treatment ? (
|
{treatmentText ? (
|
||||||
<SectionCard title="Treatment">
|
<SectionCard title="Treatment">
|
||||||
{principles.length > 0 ? (
|
<Paragraphs items={[treatmentText]} />
|
||||||
<View style={styles.subSection}>
|
|
||||||
<Text style={styles.subSectionTitle}>Treatment Principle:</Text>
|
|
||||||
{principles.map((p, i) => (
|
|
||||||
<Text key={i} style={styles.bulletItem}>
|
|
||||||
• {p}
|
|
||||||
</Text>
|
|
||||||
))}
|
|
||||||
</View>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
{acupuncture.length > 0 ? (
|
|
||||||
<View style={[styles.subSection, principles.length > 0 && styles.subSectionSpacing]}>
|
|
||||||
<Text style={styles.subSectionTitle}>Acupuncture Points:</Text>
|
|
||||||
{acupuncture.map((a, i) => (
|
|
||||||
<Text key={i} style={styles.bodyText}>
|
|
||||||
{a}
|
|
||||||
</Text>
|
|
||||||
))}
|
|
||||||
</View>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
{principles.length === 0 && acupuncture.length === 0 ? (
|
|
||||||
<Paragraphs items={[activePatternData.treatment]} />
|
|
||||||
) : null}
|
|
||||||
</SectionCard>
|
</SectionCard>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue