feat(gynecology): add GynecologyDiseaseCollectionRenderer with disease overview and pattern accordions

This commit is contained in:
ShivaniKhaire 2026-11-05 09:10:48 +05:30
parent bf167e3f0a
commit 6354ae0cc5
2 changed files with 385 additions and 0 deletions

View File

@ -0,0 +1,346 @@
import React, { useMemo } from "react";
import { StyleSheet, Text, View } from "react-native";
import { Ionicons } from "@expo/vector-icons";
import { moderateScale, verticalScale } from "react-native-size-matters";
import { Colors } from "@/theme";
import { asString, humanizeKey } from "../helpers/value";
import { Hero } from "../shared/Hero";
import { CollectionScaffold } from "../shared/CollectionScaffold";
import type { CollectionRendererProps } from "../../types/renderer.types";
export interface GynecologyDiseaseInfo {
title: string;
code?: string;
overview: string;
}
export const GYNECOLOGY_DISEASE_DATA: Record<string, GynecologyDiseaseInfo> = {
"m0042_ct0011": {
title: "Early Periods",
code: "early_periods",
overview: "Early Periods are defined as periods that come consistently up to 9 days early so that the cycle is less than 28 days long; the definition applies if this happens more than twice in succession. The amount of bleeding may be normal, scanty or excessive.",
},
"m0042_ct0012": {
title: "Late Periods",
code: "late_periods",
overview: "The periods are defined as Late Periods when they arrive late so that the menstrual cycle is longer than 28–30 days consistently (or at least for 3 consecutive months). It can be up to 40–50 days long. If the periods are only occasionally late, this may be due to external circumstances such as emotional upsets or travelling. Obviously, if after always being regular the period is suddenly late one month, then this might indicate pregnancy.",
},
"m0042_ct0013": {
title: "Irregular Periods",
code: "irregular_periods",
overview: "The term ‘Irregular Periods’ refers to periods that come with an irregular cycle, sometimes early, sometimes late. It is important to note that if the periods come consistently early or consistently late, they fall under the categories of Early Periods or Late Periods respectively: thus, it is only when they are sometimes late and sometimes early in an unpredictable manner that they constitute Irregular Periods. An irregularity of the cycle in the time preceding the menopause is normal; similarly for some months after the menarche.",
},
"m0042_ct0014": {
title: "Heavy Periods",
code: "heavy_periods",
overview: "‘Heavy Periods’ means periods that occur regularly and last the customary 5 days or thereabouts but are heavier than normal. As mentioned in physiology, the average blood loss during a menstrual cycle is 30-80 ml. Since the range of blood loss is quite broad, the definition of a ‘heavy’ period can be rather subjective and difficult to gauge. Generally speaking, a period may be called ‘heavy’ if it starts with a gush of blood, catching the woman unaware and necessitating an urgent resort to a tampon or sanitary towel (pad), or if the woman has to make very frequent changes of these protective devices.\n\nAs a category of disease-symptom in Chinese medicine, Heavy Periods should be differentiated from Flooding and Trickling. The former consists of heavy bleeding which occurs at the proper time and within the proper span of the periods (approximately 5 days); the latter consists of very heavy bleeding that may both start before the proper time and continue after it, and may also trickle on for a long time after the period should have ended. The distinction between these two conditions is not too important in terms of pathology and treatment, which are essentially the same, but it matters from a prognostic perspective: in fact, Flooding and Trickling is more difficult to treat than Heavy Periods.",
},
"m0042_ct0015": {
title: "Scanty Periods",
code: "scanty_periods",
overview: "The periods are defined as ‘Scanty Periods’ when the bleeding is very light (so as to necessitate few changes of sanitary towels/pads or tampons), or when the bleeding lasts only 2–3 days or is extremely scanty, like a small drip. It is important to ask women about the amount of bleeding in detail as most of them do not see scanty bleeding as a ‘problem’. Thus, if we ask only a general question, such as ‘Is the amount of bleeding normal?’, a woman might reply ‘Yes’ although her periods in fact last only 2 days. Because few women see scanty periods as a matter of concern, it is seldom the main presenting problem and is usually treated only when it accompanies other conditions. For example, a woman might complain of tiredness as her main problem; were this due to Blood deficiency, her periods might be scanty and therefore need treatment.",
},
"m0042_ct0016": {
title: "Long Periods",
code: "long_periods",
overview: "Long Periods are characterized by prolonged bleeding which may last 7–10 days; the cycle is regular and the amount of bleeding itself is not excessive. Thus, they differ from Heavy Periods, in which the amount of bleeding is excessive, and from Flooding and Trickling, in which the cycle is somewhat irregular because bleeding can occur before the right time.",
},
"m0042_ct0017": {
title: "Painful Periods",
code: "painful_periods",
overview: "Painful Periods indicates menstrual pain that occurs before, during or after menstruation. The pain may occur in the lower abdomen or sacral region and sometimes extend to the legs. In severe cases, there may be nausea and vomiting or even fainting.\n\nThe Liver, Penetrating Vessel and Directing Vessel are responsible for the physiology of menstruation. For a normal period to occur, Blood must be abundant and move adequately. Proper movement of Blood relies on the free flow of Liver-Qi and of the Qi of the Penetrating Vessel.\n\nAs we have seen in physiology, four different phases may be identified in each menstrual cycle. During the pre-menstrual phase, Yang rises and Liver-Qi moves in preparation for moving Blood during the period. Thus, a proper movement of Liver-Qi and Liver-Blood is essential for a pain-free period. If Liver-Qi stagnates, it may cause pain, especially before the period, while if Liver-Blood stagnates, it causes pain during the period. Stagnation is therefore the most important pathological condition causing painful periods: even in deficiency conditions when the pain is mild, it is some element of stagnation that causes it.",
},
"m0042_ct0018": {
title: "Bleeding between Periods",
code: "bleeding_between_periods",
overview: "An irregularity of the cycle is menstrual bleeding that occurs consistently at about the mid-point of the cycle. The bleeding may last 1-2 days or even longer; if it lasts much longer and is relatively heavy, this condition may be mistakenly interpreted as being Early Periods. The main factors are usually a disharmony of Yin-Yang, imbalance of Qi and Blood, stasis of Blood or Damp-Heat.\n\nBleeding between Periods should be differentiated from Early Periods, Flooding and Trickling (Beng Lou) and Red or White-Red Leucorrhea. Early Periods are characterized by bleeding some time before the normal; the amount of bleeding is normal or profuse. Flooding and Trickling is characterized by either very heavy bleeding at or before the right time or long trickling of blood after the period. Red or Red–White Leucorrhea is characterized by a persistent discharge, unrelated to the cycle, but which, especially in the case of Red Leucorrhea, may be mistaken for menstrual blood.",
},
"m0042_ct0019": {
title: "No Periods (Amenorrhea)",
code: "no_periods_amenorrhea",
overview: "The absence of periods (amenorrhea) is called Bi Jing in Chinese: Jing means menstruation and bi means 'shut' or 'closed'. Western medicine distinguishes between primary amenorrhea, which occurs when a woman has not had a period by the time she is 18, and secondary amenorrhea, which occurs when a woman has had periods but they have stopped for at least 3 months.\n\nObviously, the temporary interruption of the menses that occurs after childbirth and during breastfeeding is not considered amenorrhea, nor, similarly, is the stopping of the menses for 1 or 2 months as a consequence of sudden environmental or living condition changes. If a woman presents with secondary amenorrhea, it is of course very important to exclude pregnancy first of all because, were the patient treated for amenorrhea, the medicines are contraindicated in pregnancy. We shall call this condition 'No Periods' rather than 'amenorrhea'.",
},
"m0042_ct0020": {
title: "Flooding and Trickling (Metrorrhagia)",
code: "flooding_and_trickling_metrorrhagia",
overview: "The condition of Flooding and Trickling is called Beng Lou in Chinese: beng means 'flood' or 'flooding, bursting through' and lou means 'trickle, drip, dribble' or 'trickling, dripping, dribbling, leaking'. It corresponds to metrorrhagia in Western medicine.\n\nFlooding and Trickling encompasses two distinct symptoms, the former (Beng) indicating a period that starts suddenly with a flood, often before the proper time, and the latter (Lou) a period that continues with a trickle after the proper time. Flooding and Trickling should be distinguished from Heavy Periods: the latter indicates heavy blood loss during the proper period time (about 5 days), with the periods coming at regular intervals, rather than the sudden, profuse and often early bleeding of Flooding. In terms of quantity, Flooding involves a heavier bleeding than Heavy Periods. In general, the pathology of Heavy Periods and of Flooding and Trickling is the same although the latter is a more serious condition and therefore more difficult to treat.\n\n“When Yin is deficient and Yang throbs, Flooding occurs”. This statement refers to pulse diagnosis, i.e. when the Yin pulses are deficient and the Yang pulses forceful, a woman may suffer from Flooding. However, the statement may also be interpreted in a general sense, i.e. when Yin is deficient and Yang in excess, there may be Flooding because excess Yang heats the Blood and makes it spill from the blood vessels.",
},
"m0042_ct0021": {
title: "Pre-Menstrual Syndrome (PMS)",
code: "pre_menstrual_syndrome_pms",
overview: "The term Pre-Menstrual Syndrome (PMS) broadly describes emotional and physical symptoms occurring before a period. These may include depression, sadness, irritability, anxiety, lethargy, loss of concentration, aggressiveness, changes in libido, changes in bowel habit, skin eruptions, food cravings, crying, propensity to outbursts of anger, clumsiness, distension of abdomen and breasts, and insomnia. These symptoms can vary in intensity from very mild to extremely serious; a woman suffering severe Pre-Menstrual Syndrome may actually injure a member of her family or some other person. The symptoms vary in duration as well as in intensity, ranging from 1 day to 2 weeks before the period. Rarely, these symptoms may be experienced after the period. Pre-Menstrual Syndrome is more common in the 30–40 age groups.",
},
"m0042_ct0031": {
title: "Pre-Menstrual Breast Distension",
code: "pre_menstrual_breast_distension",
overview: "Pre-menstrual breast distension is a very common problem occurring mostly before the onset of a period, although occasionally it may occur after a period. It can vary from mild to a very severe distension, with swelling, enlargement, hardness and pain. In many cases, pre-menstrual breast distension is also accompanied by small lumps in the breast which may become larger before and during the period and smaller afterwards. This corresponds to benign fibrocystic breast disease and will be discussed separately under the chapter on benign breast lumps.",
},
"m0042_ct0032": {
title: "Headaches During Periods",
code: "headaches_during_periods",
overview: "Headache occurring at period time is an extremely common problem. When chronic headache is linked to the menstrual cycle it must be treated by regulating the menses and the Uterus, plus any other treatment that may be called for. Headaches at period time may occur before, during or after the period; the incidence is more or less equal. As a rough guide, headaches occurring before the period are due to Qi or Blood stagnation; headaches during the period, to Liver-Yang rising; headaches after the period, to Blood deficiency. However, this is only a rough diagnostic guide and, in practice, there may be deviations from the above rule.",
},
"m0042_ct0033": {
title: "Edema During Periods",
code: "edema_during_periods",
overview: "Edema at period time can affect the face, hands, lower legs and abdomen. It usually occurs before the period.",
},
"m0042_ct0034": {
title: "Diarrhea During Period",
code: "diarrhea_during_period",
overview: "This includes diarrhea or loose stools occurring before, during or after each period.",
},
"m0042_ct0035": {
title: "Dizziness during Period",
code: "dizziness_during_period",
overview: "Dizziness during or in connection with the period is frequently encountered in clinical practice. It is most commonly associated with Blood deficiency or Liver-Yang rising.",
},
"m0042_ct0036": {
title: "Body Aches during Period",
code: "body_aches_during_period",
overview: "The aches and pains occur in connection with the menstrual cycle, they are often related to a Blood pathology rather than to actual Painful Obstruction Syndrome with invasion of external Wind, Dampness or Cold. Of course, the two conditions may be, and often are, combined so that there is a deficiency of Blood in the channel, which facilitates the invasion of external pathogenic factors. The treatment in such cases must definitely stress nourishing the Blood as, if this is not done, external pathogenic factors will not be expelled.",
},
"m0042_ct0037": {
title: "Fever during Period",
code: "fever_during_period",
overview: "‘Fever’ here includes both an actual fever and a pronounced feeling of heat, which is more frequent before or during the period but may also occur after it. It should be stressed that if there is only a feeling of heat, this should be both subjective and objective, i.e. the patient has a feeling of heat and her skin (particularly of the dorsum of the hands) also feels hot to the touch.",
},
"m0042_ct0038": {
title: "Mouth Ulcers during Period",
code: "mouth_ulcers_during_period",
overview: "This condition consists in the appearance of mouth and/or tongue ulcers at period time.",
},
"m0042_ct0039": {
title: "Skin Eruptions during Period",
code: "skin_eruptions_during_period",
overview: "Papular, itchy skin eruptions may appear suddenly before the period and subside after the period. Generalized skin eruptions such as these are not common but the localized around the chin and face are very common.",
},
"m0042_ct0040": {
title: "Epistaxis or Hemoptysis during Period",
code: "epistaxis_or_hemoptysis_during_period",
overview: "Epistaxis or hemoptysis may occur before, during or after the period. From a Western perspective, these symptoms may indicate endometriosis, but they may also occur in the absence of such a disease. From a Chinese perspective, they are usually associated with a situation of Qi rebelling upwards and are therefore strongly related to a Penetrating Vessel pathology: for these reasons, this condition was sometimes called ‘rebellious period’, or ‘reverse period’.",
},
"m0042_ct0051": {
title: "Morning Sickness",
code: "morning_sickness",
overview: "Morning sickness is one of the earliest signs of pregnancy although not all pregnant women have it. It may range from a mild nausea to very severe and frequent vomiting. It usually lasts only for about 3 months but in severe cases it may go on for a long time or even for the whole pregnancy. The intensity of morning sickness is obviously related to the pre-existing state of the woman’s digestive system. In spite of its name, ‘morning sickness’ can occur at any time of day although it is usually more pronounced in the morning.\n\nThe symptoms associated with nausea and vomiting should be carefully considered to distinguish Heat from Cold and deficiency from excess:\n• Vomiting soon after eating: Heat and Fullness.\n• Vomiting of dilute fluids: Cold and deficiency.\n• Vomiting with retching and belching: Liver-Qi stagnation.\n• Only slight nausea: Stomach-Qi deficiency.\n• Vomiting of sour fluids: Liver-Qi stagnation.\n• Vomiting of bitter fluids: Stomach and Liver-Heat.",
},
"m0042_ct0052": {
title: "Abdominal Pain during Pregnancy",
code: "abdominal_pain_during_pregnancy",
overview: "Mild abdominal pain is relatively frequent during pregnancy and in most cases it poses no danger to the mother or fetus. However, when faced by a pregnant woman with abdominal pain, we should first exclude the possibility of ectopic pregnancy or threatened miscarriage.",
},
"m0042_ct0053": {
title: "Fetus not Growing",
code: "fetus_not_growing",
overview: "There is essentially only one pattern in this condition and that is a deficiency of Blood and Kidneys in varying degrees. The Kidney deficiency may be of Yang or Yin.",
},
"m0042_ct0054": {
title: "Threatened Miscarriage",
code: "threatened_miscarriage",
overview: "Three conditions may be identified in Chinese medicine: ‘Vaginal Bleeding during Pregnancy’, ‘Restless Fetus’ and ‘Miscarriage’. These three conditions represent different stages of the same process: in the first two stages, the fetus has not yet been damaged and miscarriage can be prevented, while in the third stage the fetus has been injured or has already left the uterus and miscarriage cannot be prevented.\n\nFrom a Western perspective, ‘Vaginal Bleeding during Pregnancy’ corresponds to ‘threatened abortion’ and ‘Restless Fetus’ may correspond to either ‘threatened abortion’ or to ‘inevitable abortion’.\n\nWith regard to vaginal bleeding, however, it should be remembered that a slight bleeding a few weeks after becoming pregnant sometimes occurs without consequence and does not necessarily indicate a threatened miscarriage.",
},
"m0042_ct0055": {
title: "Habitual Miscarriage",
code: "habitual_miscarriage",
overview: "‘Habitual miscarriage’ is usually defined as such after three occurrences. In Chinese medicine, miscarriage takes different names according to the time of pregnancy it occurs. If it occurs within 1 month of pregnancy, it is called an chan, which means ‘hidden labor’. Between 1 and 3 months, it is called duo tai, which means ‘falling fetus’. After 3 months it is called xiao chan or ban chan, which mean ‘small labor’ or ‘half labor’ respectively. Habitual miscarriage is called hua tai, which means ‘slippery fetus’.\n\nIt is important to remember that, according to the experience of Chinese medicine, a miscarriage is as draining to a woman’s energy as labor.",
},
"m0042_ct0056": {
title: "Feeling of Suffocation during Pregnancy",
code: "feeling_of_suffocation_during_pregnancy",
overview: "This condition is called zi xuan in Chinese, xuan meaning ‘suspended’ or ‘anxious’, and also tai qi shang ni, which means ‘fetus’s Qi rebelling upwards’. It includes a feeling of tightness of the chest, anxiety, breathlessness and mental restlessness.",
},
"m0042_ct0057": {
title: "Edema during Pregnancy",
code: "edema_during_pregnancy",
overview: "In Chinese medicine, edema in pregnancy was given different names according to its location:\n• Zi zhong: ‘edema of pregnancy’, indicated edema of the face and whole body together with scanty urination.\n• Zi man: ‘fullness of pregnancy’, indicated swelling of the body with abdominal distension and breathlessness.\n• Zi Qi: ‘Qi of pregnancy’, referred to edema below the knees, with scanty urination, and was caused by Dampness.\n• Zhou jiao: ‘wrinkled foot’, indicated edema of the feet from Dampness.\n• Cui jiao: ‘brittle foot’, referred to edema of the feet from overflowing of Water.",
},
"m0042_ct0058": {
title: "Urinary Syndrome during Pregnancy",
code: "urinary_syndrome_during_pregnancy",
overview: "This condition includes frequency, pain and urgency of urination. It was called zi lin, i.e. ‘lin’ disease in pregnancy, ‘lin’ being Urinary Syndrome.",
},
"m0042_ct0059": {
title: "Retention of Urine during Pregnancy",
code: "retention_of_urine_during_pregnancy",
overview: "This condition is characterized by difficult urination, slight retention of urine, an uncomfortable feeling in the lower abdomen and a feeling of irritability.",
},
"m0042_ct0060": {
title: "Anxiety during Pregnancy",
code: "anxiety_during_pregnancy",
overview: "Anxiety in pregnancy is called zi fan, which literally means ‘child mental restlessness’, intending by that ‘mental restlessness of pregnancy’.",
},
"m0042_ct0061": {
title: "Dizziness during Pregnancy",
code: "dizziness_during_pregnancy",
overview: "Dizziness and vertigo, called zi yun, usually occur in the second and third trimesters of pregnancy. They occur with different degrees of severity: very severe vertigo can be a prodromal symptom of pre-eclampsia or eclampsia, which in Chinese medicine corresponds to ‘convulsions in pregnancy’ (zi xian).",
},
"m0042_ct0062": {
title: "Convulsions during Pregnancy",
code: "convulsions_during_pregnancy",
overview: "This condition is called zi xian, which means ‘convulsions in pregnancy’: it clearly corresponds to eclampsia in Western medicine. It is a condition that occurs not only in pregnancy but also soon after childbirth. The main manifestations are severe dizziness, headache, vomiting, hypertension and, in its late stages, tremors of limbs, convulsions and coma.",
},
"m0042_ct0063": {
title: "Cough during Pregnancy",
code: "cough_during_pregnancy",
overview: "Cough in pregnancy is a condition that is characterized not only by a persistent cough but also by mental restlessness and a feeling of heat.",
},
"m0042_ct0064": {
title: "Aphonia during Pregnancy",
code: "aphonia_during_pregnancy",
overview: "Loss of voice or hoarseness occurring towards the end of pregnancy is called zi yin, which means ‘loss of voice in pregnancy’.",
},
};
export function findGynecologyDiseaseInfo(
templateCode?: string | null,
itemCodeOrName?: string | null,
): GynecologyDiseaseInfo | null {
if (templateCode) {
const normalized = templateCode.trim().toLowerCase();
if (GYNECOLOGY_DISEASE_DATA[normalized]) {
return GYNECOLOGY_DISEASE_DATA[normalized];
}
}
if (itemCodeOrName) {
const target = itemCodeOrName.trim().toLowerCase();
for (const info of Object.values(GYNECOLOGY_DISEASE_DATA)) {
if (info.code && target.startsWith(info.code.toLowerCase())) {
return info;
}
if (target.includes(info.title.toLowerCase())) {
return info;
}
}
}
return null;
}
export interface GynecologyDiseaseCollectionRendererProps extends CollectionRendererProps {
templateCode?: string;
}
export function GynecologyDiseaseCollectionRenderer(
props: GynecologyDiseaseCollectionRendererProps,
) {
const firstItem = props.items[0];
const itemCode = firstItem
? asString(firstItem.attributes?.code) || asString(firstItem.slug)
: null;
const diseaseInfo = useMemo(() => {
return findGynecologyDiseaseInfo(props.templateCode, itemCode);
}, [props.templateCode, itemCode]);
const title = diseaseInfo?.title
? humanizeKey(diseaseInfo.title)
: firstItem
? humanizeKey(asString(firstItem.attributes?.name) || firstItem.title)
: "Patterns";
const overviewText = useMemo(() => {
if (diseaseInfo?.overview) return diseaseInfo.overview;
for (const item of props.items) {
const defn =
asString(item.attributes?.definition) ||
asString(item.attributes?.description) ||
asString(item.attributes?.overview);
if (defn) return defn;
}
return "";
}, [diseaseInfo?.overview, props.items]);
const paragraphs = useMemo(() => {
if (!overviewText) return [];
return overviewText
.split(/\n{2,}|\r\n\r\n/)
.map((p) => p.trim())
.filter(Boolean);
}, [overviewText]);
const totalCount = props.total || props.items.length;
const countSubtitle = totalCount
? `${totalCount} ${totalCount === 1 ? "Pattern" : "Patterns"}`
: undefined;
const header = (
<View style={styles.overviewContainer}>
<Hero
title={title}
subtitle={countSubtitle}
tone="purple"
/>
{paragraphs.length > 0 ? (
<View style={styles.overviewCard}>
<View style={styles.overviewHeader}>
<Ionicons name="information-circle" size={20} color={Colors.purple} />
<Text style={styles.overviewTitle}>Overview</Text>
</View>
{paragraphs.map((para, index) => (
<Text
key={index}
style={index === 0 ? styles.overviewText : styles.overviewParagraph}
>
{para}
</Text>
))}
</View>
) : null}
</View>
);
return <CollectionScaffold {...props} header={header} />;
}
export function createGynecologyDiseaseCollectionRenderer(templateCode: string) {
return function GynecologySpecificCollectionRenderer(
props: CollectionRendererProps,
) {
return (
<GynecologyDiseaseCollectionRenderer
{...props}
templateCode={templateCode}
/>
);
};
}
const styles = StyleSheet.create({
overviewContainer: {
marginBottom: verticalScale(14),
},
overviewCard: {
backgroundColor: "#FFFFFF",
borderRadius: moderateScale(16),
borderWidth: 1,
borderColor: "#E2EAE5",
padding: moderateScale(16),
marginTop: verticalScale(12),
},
overviewHeader: {
flexDirection: "row",
alignItems: "center",
gap: moderateScale(8),
marginBottom: verticalScale(10),
},
overviewTitle: {
fontSize: moderateScale(15),
fontWeight: "700",
color: Colors.textPrimary,
},
overviewText: {
fontSize: moderateScale(13),
lineHeight: moderateScale(20),
color: "#374151",
},
overviewParagraph: {
fontSize: moderateScale(13),
lineHeight: moderateScale(20),
color: "#374151",
marginTop: verticalScale(8),
},
});

View File

@ -54,6 +54,10 @@ import { SixStagesDetailRenderer } from "./details/SixStagesDetailRenderer";
import { TcmPatternDetailRenderer } from "./details/TcmPatternDetailRenderer";
import { ExtraOrdinaryVesselsDetailRenderer } from "./details/ExtraOrdinaryVesselsDetailRenderer";
import { NutritionCategoryDetailRenderer } from "./details/NutritionCategoryDetailRenderer";
import {
GynecologyDiseaseCollectionRenderer,
createGynecologyDiseaseCollectionRenderer,
} from "./collections/GynecologyRenderers";
export const collectionRenderers: Readonly<Record<string, CollectionRendererComponent>> = Object.freeze({
module_catalog_collection: ModuleCatalogCollectionRenderer,
@ -75,12 +79,14 @@ export const collectionRenderers: Readonly<Record<string, CollectionRendererComp
nutrition_effect_collection: ModuleCatalogCollectionRenderer,
disease_collection: ModuleCatalogCollectionRenderer,
auriculotherapy_collection: ModuleCatalogCollectionRenderer,
gynecology_disease_collection: GynecologyDiseaseCollectionRenderer,
// Module-specific renderers removed for generic handling
});
export const collectionItemRenderers: Readonly<Record<string, CollectionItemRendererComponent>> = Object.freeze({
module_catalog_card: ModuleCatalogCardRenderer,
pattern_accordion_card: PatternAccordionCardRenderer,
gynecology_pattern_card: PatternAccordionCardRenderer,
acu_point_index_card: AcuPointIndexCardRenderer,
acu_point_card: AcuPointCardRenderer,
meridian_index_card: MeridianIndexCardRenderer,
@ -204,6 +210,25 @@ export function resolveCollectionRenderer(
const normalizedModule = moduleCode?.trim().toLowerCase();
const normalizedTemplate = templateCode?.trim().toLowerCase();
if (code === "gynecology_disease_collection") {
return normalizedTemplate
? createGynecologyDiseaseCollectionRenderer(normalizedTemplate)
: GynecologyDiseaseCollectionRenderer;
}
if (
normalizedModule === "m0042" &&
normalizedTemplate &&
normalizedTemplate !== "m0042_ct0001" &&
normalizedTemplate !== "m0042_ct0002" &&
normalizedTemplate !== "m0042_ct0003" &&
normalizedTemplate !== "m0042_ct0004" &&
normalizedTemplate !== "m0042_ct0006" &&
normalizedTemplate !== "m0042_ct0007"
) {
return createGynecologyDiseaseCollectionRenderer(normalizedTemplate);
}
if (normalizedTemplate === "m0016_ct0001" || normalizedModule === "m0016") {
return FourLevelsCollectionRenderer;
}
@ -260,6 +285,20 @@ export function resolveCollectionItemRenderer(
const normalizedModule = moduleCode?.trim().toLowerCase();
const normalizedTemplate = templateCode?.trim().toLowerCase();
if (
code === "gynecology_pattern_card" ||
(normalizedModule === "m0042" &&
normalizedTemplate &&
normalizedTemplate !== "m0042_ct0001" &&
normalizedTemplate !== "m0042_ct0002" &&
normalizedTemplate !== "m0042_ct0003" &&
normalizedTemplate !== "m0042_ct0004" &&
normalizedTemplate !== "m0042_ct0006" &&
normalizedTemplate !== "m0042_ct0007")
) {
return PatternAccordionCardRenderer;
}
if (normalizedTemplate === "m0016_ct0001" || normalizedModule === "m0016") {
return FourLevelsCardRenderer;
}