formanitor 0.0.44 → 0.0.46
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/dist/index.cjs +2125 -210
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.mjs +2125 -210
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -53,23 +53,23 @@ function validateField(value, field) {
|
|
|
53
53
|
const rules = field.validation;
|
|
54
54
|
if (!rules) return null;
|
|
55
55
|
if (field.type === "number") {
|
|
56
|
-
const
|
|
57
|
-
if (isNaN(
|
|
58
|
-
if (rules.min !== void 0 &&
|
|
56
|
+
const num2 = Number(value);
|
|
57
|
+
if (isNaN(num2)) return "Must be a valid number";
|
|
58
|
+
if (rules.min !== void 0 && num2 < rules.min) {
|
|
59
59
|
return `Must be at least ${rules.min}`;
|
|
60
60
|
}
|
|
61
|
-
if (rules.max !== void 0 &&
|
|
61
|
+
if (rules.max !== void 0 && num2 > rules.max) {
|
|
62
62
|
return `Must be at most ${rules.max}`;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
if (field.type === "slider") {
|
|
66
|
-
const
|
|
67
|
-
if (isNaN(
|
|
66
|
+
const num2 = Number(value);
|
|
67
|
+
if (isNaN(num2)) return "Must be a valid number";
|
|
68
68
|
const s = field;
|
|
69
69
|
const min = s.min ?? 0;
|
|
70
70
|
const max = s.max ?? 10;
|
|
71
|
-
if (
|
|
72
|
-
if (
|
|
71
|
+
if (num2 < min) return `Must be at least ${min}`;
|
|
72
|
+
if (num2 > max) return `Must be at most ${max}`;
|
|
73
73
|
}
|
|
74
74
|
if (typeof value === "string") {
|
|
75
75
|
if (rules.minLength !== void 0 && value.length < rules.minLength) {
|
|
@@ -388,7 +388,7 @@ function normalizeGeneralSurgerySmartHistory(raw) {
|
|
|
388
388
|
...painIn,
|
|
389
389
|
severity: Number.isFinite(sev) ? Math.min(10, Math.max(0, Math.round(sev))) : d.pain.severity
|
|
390
390
|
};
|
|
391
|
-
const
|
|
391
|
+
const str5 = (x) => typeof x === "string" ? x : "";
|
|
392
392
|
const strArr = (x) => Array.isArray(x) ? x.filter((i) => typeof i === "string") : [];
|
|
393
393
|
const swell = v.swelling && typeof v.swelling === "object" ? v.swelling : {};
|
|
394
394
|
const gi = v.gi && typeof v.gi === "object" ? v.gi : {};
|
|
@@ -398,44 +398,44 @@ function normalizeGeneralSurgerySmartHistory(raw) {
|
|
|
398
398
|
return {
|
|
399
399
|
pain,
|
|
400
400
|
swelling: {
|
|
401
|
-
duration:
|
|
402
|
-
sizeProgression:
|
|
403
|
-
painfulPainless:
|
|
401
|
+
duration: str5(swell.duration),
|
|
402
|
+
sizeProgression: str5(swell.sizeProgression),
|
|
403
|
+
painfulPainless: str5(swell.painfulPainless),
|
|
404
404
|
checks: strArr(swell.checks)
|
|
405
405
|
},
|
|
406
406
|
gi: {
|
|
407
|
-
appetite:
|
|
408
|
-
weightLoss:
|
|
409
|
-
bowelHabits:
|
|
407
|
+
appetite: str5(gi.appetite),
|
|
408
|
+
weightLoss: str5(gi.weightLoss),
|
|
409
|
+
bowelHabits: str5(gi.bowelHabits),
|
|
410
410
|
checks: strArr(gi.checks)
|
|
411
411
|
},
|
|
412
412
|
breast: {
|
|
413
|
-
lumpDuration:
|
|
414
|
-
nippleDischarge:
|
|
413
|
+
lumpDuration: str5(breast.lumpDuration),
|
|
414
|
+
nippleDischarge: str5(breast.nippleDischarge),
|
|
415
415
|
checks: strArr(breast.checks)
|
|
416
416
|
},
|
|
417
417
|
ano: { checks: strArr(ano.checks) },
|
|
418
418
|
thyroid: {
|
|
419
|
-
swellingDuration:
|
|
419
|
+
swellingDuration: str5(thy.swellingDuration),
|
|
420
420
|
checks: strArr(thy.checks)
|
|
421
421
|
}
|
|
422
422
|
};
|
|
423
423
|
}
|
|
424
424
|
function normalizeBreastExamSide(partial) {
|
|
425
425
|
const e = defaultBreastExamSide();
|
|
426
|
-
const
|
|
427
|
-
const
|
|
426
|
+
const str5 = (x) => typeof x === "string" ? x : "";
|
|
427
|
+
const bool3 = (x) => x === true;
|
|
428
428
|
if (!partial || typeof partial !== "object") return e;
|
|
429
429
|
const p = partial;
|
|
430
430
|
return {
|
|
431
|
-
size:
|
|
432
|
-
quadrant:
|
|
433
|
-
tenderness:
|
|
434
|
-
fixity:
|
|
435
|
-
skinInvolvement:
|
|
436
|
-
consistency:
|
|
437
|
-
axillaryNodes:
|
|
438
|
-
nippleAreolarComplex:
|
|
431
|
+
size: str5(p.size),
|
|
432
|
+
quadrant: str5(p.quadrant),
|
|
433
|
+
tenderness: str5(p.tenderness),
|
|
434
|
+
fixity: str5(p.fixity),
|
|
435
|
+
skinInvolvement: str5(p.skinInvolvement),
|
|
436
|
+
consistency: str5(p.consistency),
|
|
437
|
+
axillaryNodes: bool3(p.axillaryNodes),
|
|
438
|
+
nippleAreolarComplex: bool3(p.nippleAreolarComplex)
|
|
439
439
|
};
|
|
440
440
|
}
|
|
441
441
|
function normalizeBreastExaminationBlock(raw) {
|
|
@@ -459,7 +459,7 @@ function normalizeGeneralSurgeryExamination(raw) {
|
|
|
459
459
|
const th = v.thyroid && typeof v.thyroid === "object" ? v.thyroid : {};
|
|
460
460
|
const ar = v.anorectal && typeof v.anorectal === "object" ? v.anorectal : {};
|
|
461
461
|
const lm = v.limb && typeof v.limb === "object" ? v.limb : {};
|
|
462
|
-
const
|
|
462
|
+
const bool3 = (x) => x === true;
|
|
463
463
|
return {
|
|
464
464
|
general: strArr(v.general),
|
|
465
465
|
regions: strArr(v.regions),
|
|
@@ -472,27 +472,27 @@ function normalizeGeneralSurgeryExamination(raw) {
|
|
|
472
472
|
},
|
|
473
473
|
hernia: {
|
|
474
474
|
site: typeof hb.site === "string" ? hb.site : "",
|
|
475
|
-
reducible:
|
|
476
|
-
coughImpulse:
|
|
477
|
-
tenderness:
|
|
475
|
+
reducible: bool3(hb.reducible),
|
|
476
|
+
coughImpulse: bool3(hb.coughImpulse),
|
|
477
|
+
tenderness: bool3(hb.tenderness)
|
|
478
478
|
},
|
|
479
479
|
breast: normalizeBreastExaminationBlock(br),
|
|
480
480
|
thyroid: {
|
|
481
481
|
size: typeof th.size === "string" ? th.size : "",
|
|
482
|
-
mobileDeglutition:
|
|
483
|
-
nodules:
|
|
484
|
-
cervicalNodes:
|
|
482
|
+
mobileDeglutition: bool3(th.mobileDeglutition),
|
|
483
|
+
nodules: bool3(th.nodules),
|
|
484
|
+
cervicalNodes: bool3(th.cervicalNodes)
|
|
485
485
|
},
|
|
486
486
|
anorectal: {
|
|
487
487
|
inspection: typeof ar.inspection === "string" ? ar.inspection : "",
|
|
488
|
-
dreDone:
|
|
489
|
-
proctoscopyDone:
|
|
488
|
+
dreDone: bool3(ar.dreDone),
|
|
489
|
+
proctoscopyDone: bool3(ar.proctoscopyDone),
|
|
490
490
|
notes: typeof ar.notes === "string" ? ar.notes : ""
|
|
491
491
|
},
|
|
492
492
|
limb: {
|
|
493
|
-
dilatedVeins:
|
|
494
|
-
ulcer:
|
|
495
|
-
oedema:
|
|
493
|
+
dilatedVeins: bool3(lm.dilatedVeins),
|
|
494
|
+
ulcer: bool3(lm.ulcer),
|
|
495
|
+
oedema: bool3(lm.oedema)
|
|
496
496
|
}
|
|
497
497
|
};
|
|
498
498
|
}
|
|
@@ -1138,11 +1138,17 @@ function normalizeUrologyPathway(raw) {
|
|
|
1138
1138
|
}
|
|
1139
1139
|
|
|
1140
1140
|
// src/core/painScaleFlags.ts
|
|
1141
|
+
var UPT_VALUES = ["", "Positive", "Negative", "Not done"];
|
|
1142
|
+
function isUpt(x) {
|
|
1143
|
+
return typeof x === "string" && UPT_VALUES.includes(x);
|
|
1144
|
+
}
|
|
1141
1145
|
function normalizePainScaleFlags(raw, bounds) {
|
|
1142
1146
|
const min = bounds?.min ?? 0;
|
|
1143
1147
|
const max = bounds?.max ?? 10;
|
|
1144
1148
|
let pain = min;
|
|
1145
1149
|
let flags = [];
|
|
1150
|
+
let bp = "";
|
|
1151
|
+
let upt = "";
|
|
1146
1152
|
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
1147
1153
|
const o = raw;
|
|
1148
1154
|
const p = Number(o.pain);
|
|
@@ -1150,8 +1156,10 @@ function normalizePainScaleFlags(raw, bounds) {
|
|
|
1150
1156
|
if (Array.isArray(o.flags)) {
|
|
1151
1157
|
flags = o.flags.filter((x) => typeof x === "string");
|
|
1152
1158
|
}
|
|
1159
|
+
if (typeof o.bp === "string") bp = o.bp;
|
|
1160
|
+
if (isUpt(o.upt)) upt = o.upt;
|
|
1153
1161
|
}
|
|
1154
|
-
return { pain, flags };
|
|
1162
|
+
return { pain, flags, bp, upt };
|
|
1155
1163
|
}
|
|
1156
1164
|
|
|
1157
1165
|
// src/core/store.ts
|
|
@@ -3074,6 +3082,18 @@ var DateTimeWidget = ({ fieldId }) => {
|
|
|
3074
3082
|
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
3075
3083
|
] });
|
|
3076
3084
|
};
|
|
3085
|
+
function extractImageDisplayUrl(value) {
|
|
3086
|
+
if (value == null) return null;
|
|
3087
|
+
if (typeof value === "string") {
|
|
3088
|
+
return /^https?:\/\//i.test(value) ? value : null;
|
|
3089
|
+
}
|
|
3090
|
+
if (typeof value === "object") {
|
|
3091
|
+
const o = value;
|
|
3092
|
+
const u = o.presigned_url || o.value;
|
|
3093
|
+
if (typeof u === "string" && /^https?:\/\//i.test(u)) return u;
|
|
3094
|
+
}
|
|
3095
|
+
return null;
|
|
3096
|
+
}
|
|
3077
3097
|
var ImageUploadWidget = ({ fieldId }) => {
|
|
3078
3098
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
3079
3099
|
const store = useFormStore();
|
|
@@ -3081,7 +3101,14 @@ var ImageUploadWidget = ({ fieldId }) => {
|
|
|
3081
3101
|
const [isUploading, setIsUploading] = useState(false);
|
|
3082
3102
|
const [preview, setPreview] = useState(null);
|
|
3083
3103
|
const fileInputRef = useRef(null);
|
|
3104
|
+
const blobUrlRef = useRef(null);
|
|
3084
3105
|
const showError = !!error && (touched || state.submitAttempted);
|
|
3106
|
+
const revokeTrackedBlob = () => {
|
|
3107
|
+
if (blobUrlRef.current) {
|
|
3108
|
+
URL.revokeObjectURL(blobUrlRef.current);
|
|
3109
|
+
blobUrlRef.current = null;
|
|
3110
|
+
}
|
|
3111
|
+
};
|
|
3085
3112
|
if (!fieldDef) return null;
|
|
3086
3113
|
const uploadHandler = store.getUploadHandler();
|
|
3087
3114
|
if (!uploadHandler) {
|
|
@@ -3094,12 +3121,24 @@ var ImageUploadWidget = ({ fieldId }) => {
|
|
|
3094
3121
|
] });
|
|
3095
3122
|
}
|
|
3096
3123
|
React15__default.useEffect(() => {
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3124
|
+
const displayUrl = extractImageDisplayUrl(value);
|
|
3125
|
+
if (displayUrl) {
|
|
3126
|
+
revokeTrackedBlob();
|
|
3127
|
+
setPreview(displayUrl);
|
|
3128
|
+
return;
|
|
3129
|
+
}
|
|
3130
|
+
if (value === null || value === void 0 || value === "") {
|
|
3131
|
+
revokeTrackedBlob();
|
|
3100
3132
|
setPreview(null);
|
|
3133
|
+
return;
|
|
3101
3134
|
}
|
|
3102
3135
|
}, [value]);
|
|
3136
|
+
React15__default.useEffect(
|
|
3137
|
+
() => () => {
|
|
3138
|
+
revokeTrackedBlob();
|
|
3139
|
+
},
|
|
3140
|
+
[]
|
|
3141
|
+
);
|
|
3103
3142
|
const handleFileSelect = async (event) => {
|
|
3104
3143
|
const file = event.target.files?.[0];
|
|
3105
3144
|
if (!file) return;
|
|
@@ -3115,15 +3154,18 @@ var ImageUploadWidget = ({ fieldId }) => {
|
|
|
3115
3154
|
setIsUploading(true);
|
|
3116
3155
|
setTouched();
|
|
3117
3156
|
store.incrementPendingUploads();
|
|
3157
|
+
revokeTrackedBlob();
|
|
3158
|
+
const previewUrl = URL.createObjectURL(file);
|
|
3159
|
+
blobUrlRef.current = previewUrl;
|
|
3160
|
+
setPreview(previewUrl);
|
|
3118
3161
|
try {
|
|
3119
|
-
const previewUrl = URL.createObjectURL(file);
|
|
3120
|
-
setPreview(previewUrl);
|
|
3121
3162
|
const s3Key = await uploadHandler(file, file.name);
|
|
3122
3163
|
setValue(s3Key);
|
|
3123
3164
|
} catch (error2) {
|
|
3124
3165
|
console.error("Upload failed:", error2);
|
|
3125
3166
|
const errorMessage = error2 instanceof Error ? error2.message : "Upload failed. Please try again.";
|
|
3126
3167
|
alert(errorMessage);
|
|
3168
|
+
revokeTrackedBlob();
|
|
3127
3169
|
setPreview(null);
|
|
3128
3170
|
} finally {
|
|
3129
3171
|
setIsUploading(false);
|
|
@@ -3131,6 +3173,7 @@ var ImageUploadWidget = ({ fieldId }) => {
|
|
|
3131
3173
|
}
|
|
3132
3174
|
};
|
|
3133
3175
|
const handleRemove = () => {
|
|
3176
|
+
revokeTrackedBlob();
|
|
3134
3177
|
setValue(null);
|
|
3135
3178
|
setPreview(null);
|
|
3136
3179
|
if (fileInputRef.current) {
|
|
@@ -3208,6 +3251,18 @@ function isAcceptedMediaFile(file) {
|
|
|
3208
3251
|
if (file.name.toLowerCase().endsWith(".pdf")) return true;
|
|
3209
3252
|
return false;
|
|
3210
3253
|
}
|
|
3254
|
+
function extractMediaDisplayUrl(value) {
|
|
3255
|
+
if (value == null) return null;
|
|
3256
|
+
if (typeof value === "string") {
|
|
3257
|
+
return /^https?:\/\//i.test(value) ? value : null;
|
|
3258
|
+
}
|
|
3259
|
+
if (typeof value === "object") {
|
|
3260
|
+
const o = value;
|
|
3261
|
+
const u = o.presigned_url || o.value;
|
|
3262
|
+
if (typeof u === "string" && /^https?:\/\//i.test(u)) return u;
|
|
3263
|
+
}
|
|
3264
|
+
return null;
|
|
3265
|
+
}
|
|
3211
3266
|
var MediaUploadWidget = ({ fieldId }) => {
|
|
3212
3267
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
3213
3268
|
const store = useFormStore();
|
|
@@ -3217,7 +3272,14 @@ var MediaUploadWidget = ({ fieldId }) => {
|
|
|
3217
3272
|
const [previewIsPdf, setPreviewIsPdf] = useState(false);
|
|
3218
3273
|
const fileInputRef = useRef(null);
|
|
3219
3274
|
const pendingPreviewKindRef = useRef(null);
|
|
3275
|
+
const blobUrlRef = useRef(null);
|
|
3220
3276
|
const showError = !!error && (touched || state.submitAttempted);
|
|
3277
|
+
const revokeTrackedBlob = () => {
|
|
3278
|
+
if (blobUrlRef.current) {
|
|
3279
|
+
URL.revokeObjectURL(blobUrlRef.current);
|
|
3280
|
+
blobUrlRef.current = null;
|
|
3281
|
+
}
|
|
3282
|
+
};
|
|
3221
3283
|
if (!fieldDef) return null;
|
|
3222
3284
|
const uploadHandler = store.getUploadHandler();
|
|
3223
3285
|
if (!uploadHandler) {
|
|
@@ -3230,19 +3292,32 @@ var MediaUploadWidget = ({ fieldId }) => {
|
|
|
3230
3292
|
] });
|
|
3231
3293
|
}
|
|
3232
3294
|
React15__default.useEffect(() => {
|
|
3233
|
-
|
|
3234
|
-
|
|
3295
|
+
const displayUrl = extractMediaDisplayUrl(value);
|
|
3296
|
+
if (displayUrl) {
|
|
3297
|
+
revokeTrackedBlob();
|
|
3298
|
+
setPreview(displayUrl);
|
|
3235
3299
|
if (pendingPreviewKindRef.current) {
|
|
3236
3300
|
setPreviewIsPdf(pendingPreviewKindRef.current === "pdf");
|
|
3237
3301
|
pendingPreviewKindRef.current = null;
|
|
3238
3302
|
} else {
|
|
3239
|
-
setPreviewIsPdf(urlLooksLikePdf(
|
|
3303
|
+
setPreviewIsPdf(urlLooksLikePdf(displayUrl));
|
|
3240
3304
|
}
|
|
3241
|
-
|
|
3305
|
+
return;
|
|
3306
|
+
}
|
|
3307
|
+
if (value === null || value === void 0 || value === "") {
|
|
3308
|
+
revokeTrackedBlob();
|
|
3309
|
+
pendingPreviewKindRef.current = null;
|
|
3242
3310
|
setPreview(null);
|
|
3243
3311
|
setPreviewIsPdf(false);
|
|
3312
|
+
return;
|
|
3244
3313
|
}
|
|
3245
3314
|
}, [value]);
|
|
3315
|
+
React15__default.useEffect(
|
|
3316
|
+
() => () => {
|
|
3317
|
+
revokeTrackedBlob();
|
|
3318
|
+
},
|
|
3319
|
+
[]
|
|
3320
|
+
);
|
|
3246
3321
|
const handleFileSelect = async (event) => {
|
|
3247
3322
|
const file = event.target.files?.[0];
|
|
3248
3323
|
if (!file) return;
|
|
@@ -3259,10 +3334,12 @@ var MediaUploadWidget = ({ fieldId }) => {
|
|
|
3259
3334
|
setIsUploading(true);
|
|
3260
3335
|
setTouched();
|
|
3261
3336
|
store.incrementPendingUploads();
|
|
3337
|
+
revokeTrackedBlob();
|
|
3338
|
+
const previewUrl = URL.createObjectURL(file);
|
|
3339
|
+
blobUrlRef.current = previewUrl;
|
|
3340
|
+
setPreview(previewUrl);
|
|
3341
|
+
setPreviewIsPdf(isPdf);
|
|
3262
3342
|
try {
|
|
3263
|
-
const previewUrl = URL.createObjectURL(file);
|
|
3264
|
-
setPreview(previewUrl);
|
|
3265
|
-
setPreviewIsPdf(isPdf);
|
|
3266
3343
|
const s3Key = await uploadHandler(file, file.name);
|
|
3267
3344
|
pendingPreviewKindRef.current = isPdf ? "pdf" : "image";
|
|
3268
3345
|
setValue(s3Key);
|
|
@@ -3270,6 +3347,8 @@ var MediaUploadWidget = ({ fieldId }) => {
|
|
|
3270
3347
|
console.error("Upload failed:", error2);
|
|
3271
3348
|
const errorMessage = error2 instanceof Error ? error2.message : "Upload failed. Please try again.";
|
|
3272
3349
|
alert(errorMessage);
|
|
3350
|
+
pendingPreviewKindRef.current = null;
|
|
3351
|
+
revokeTrackedBlob();
|
|
3273
3352
|
setPreview(null);
|
|
3274
3353
|
setPreviewIsPdf(false);
|
|
3275
3354
|
} finally {
|
|
@@ -3279,6 +3358,7 @@ var MediaUploadWidget = ({ fieldId }) => {
|
|
|
3279
3358
|
};
|
|
3280
3359
|
const handleRemove = () => {
|
|
3281
3360
|
pendingPreviewKindRef.current = null;
|
|
3361
|
+
revokeTrackedBlob();
|
|
3282
3362
|
setValue(null);
|
|
3283
3363
|
setPreview(null);
|
|
3284
3364
|
setPreviewIsPdf(false);
|
|
@@ -4264,24 +4344,24 @@ function Spinner({
|
|
|
4264
4344
|
value,
|
|
4265
4345
|
onChange
|
|
4266
4346
|
}) {
|
|
4267
|
-
const
|
|
4347
|
+
const num2 = parseInt(value, 10) || 0;
|
|
4268
4348
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
4269
4349
|
/* @__PURE__ */ jsx(
|
|
4270
4350
|
"button",
|
|
4271
4351
|
{
|
|
4272
4352
|
type: "button",
|
|
4273
4353
|
className: "text-muted-foreground hover:text-foreground cursor-pointer",
|
|
4274
|
-
onClick: () => onChange(String(
|
|
4354
|
+
onClick: () => onChange(String(num2 + 1)),
|
|
4275
4355
|
children: /* @__PURE__ */ jsx(ChevronUp, { className: "h-3 w-3" })
|
|
4276
4356
|
}
|
|
4277
4357
|
),
|
|
4278
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm w-4 text-center leading-none", children:
|
|
4358
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm w-4 text-center leading-none", children: num2 }),
|
|
4279
4359
|
/* @__PURE__ */ jsx(
|
|
4280
4360
|
"button",
|
|
4281
4361
|
{
|
|
4282
4362
|
type: "button",
|
|
4283
4363
|
className: "text-muted-foreground hover:text-foreground cursor-pointer",
|
|
4284
|
-
onClick: () => onChange(String(Math.max(0,
|
|
4364
|
+
onClick: () => onChange(String(Math.max(0, num2 - 1))),
|
|
4285
4365
|
children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" })
|
|
4286
4366
|
}
|
|
4287
4367
|
)
|
|
@@ -5862,14 +5942,14 @@ var FollowupWidget = ({ fieldId }) => {
|
|
|
5862
5942
|
const handleValueChange = useCallback(
|
|
5863
5943
|
(newValue) => {
|
|
5864
5944
|
setTouched();
|
|
5865
|
-
const
|
|
5945
|
+
const num2 = parseInt(newValue, 10);
|
|
5866
5946
|
const min = displayUnit === "days" ? 0 : 1;
|
|
5867
|
-
const valid = (Number.isNaN(
|
|
5947
|
+
const valid = (Number.isNaN(num2) ? min : num2) >= min || newValue === "";
|
|
5868
5948
|
if (!valid && newValue !== "") {
|
|
5869
5949
|
setValue({ followupType: "one time", value: String(displayUnit === "days" ? 0 : durationToDays(1, displayUnit)), unit: "days" });
|
|
5870
5950
|
return;
|
|
5871
5951
|
}
|
|
5872
|
-
const days = durationToDays(Number.isNaN(
|
|
5952
|
+
const days = durationToDays(Number.isNaN(num2) ? displayUnit === "days" ? 0 : 1 : num2, displayUnit);
|
|
5873
5953
|
setValue({ followupType: "one time", value: String(days), unit: "days" });
|
|
5874
5954
|
},
|
|
5875
5955
|
[displayUnit, setValue, setTouched]
|
|
@@ -6406,14 +6486,22 @@ var Switch = React15.forwardRef(
|
|
|
6406
6486
|
}
|
|
6407
6487
|
);
|
|
6408
6488
|
Switch.displayName = "Switch";
|
|
6489
|
+
var DEFAULT_MENSTRUAL = {
|
|
6490
|
+
menarche_age: 13,
|
|
6491
|
+
cycle_length: 28,
|
|
6492
|
+
flow_days: 4,
|
|
6493
|
+
cycle_regular: true,
|
|
6494
|
+
dysmenorrhea: 0
|
|
6495
|
+
};
|
|
6409
6496
|
var DEFAULT_DRAFT = {
|
|
6410
6497
|
gpal: { G: 0, P: 0, A: 0, L: 0 },
|
|
6411
6498
|
lmp: "",
|
|
6412
|
-
|
|
6499
|
+
pregnancy_status: "not_pregnant",
|
|
6413
6500
|
eddUSG: "",
|
|
6414
6501
|
primaryEDD: "lmp",
|
|
6415
6502
|
complications: "",
|
|
6416
|
-
outcome: null
|
|
6503
|
+
outcome: null,
|
|
6504
|
+
menstrual: { ...DEFAULT_MENSTRUAL }
|
|
6417
6505
|
};
|
|
6418
6506
|
function pad2(n) {
|
|
6419
6507
|
return String(n).padStart(2, "0");
|
|
@@ -6446,6 +6534,33 @@ function clampInt(val, min, max) {
|
|
|
6446
6534
|
if (!Number.isFinite(val)) return min;
|
|
6447
6535
|
return Math.max(min, Math.min(max, Math.trunc(val)));
|
|
6448
6536
|
}
|
|
6537
|
+
function clampDysmenorrhea(val) {
|
|
6538
|
+
const n = Math.round(Number(val));
|
|
6539
|
+
if (!Number.isFinite(n)) return 0;
|
|
6540
|
+
if (n <= 0) return 0;
|
|
6541
|
+
if (n >= 3) return 3;
|
|
6542
|
+
return n;
|
|
6543
|
+
}
|
|
6544
|
+
function isPregnancyStatus(x) {
|
|
6545
|
+
return x === "not_pregnant" || x === "pregnant" || x === "unknown";
|
|
6546
|
+
}
|
|
6547
|
+
function normalizeMenstrual(raw) {
|
|
6548
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
6549
|
+
return { ...DEFAULT_MENSTRUAL };
|
|
6550
|
+
}
|
|
6551
|
+
const o = raw;
|
|
6552
|
+
const num2 = (v, fb) => {
|
|
6553
|
+
const n = Number(v);
|
|
6554
|
+
return Number.isFinite(n) ? n : fb;
|
|
6555
|
+
};
|
|
6556
|
+
return {
|
|
6557
|
+
menarche_age: num2(o.menarche_age, DEFAULT_MENSTRUAL.menarche_age),
|
|
6558
|
+
cycle_length: num2(o.cycle_length, DEFAULT_MENSTRUAL.cycle_length),
|
|
6559
|
+
flow_days: num2(o.flow_days, DEFAULT_MENSTRUAL.flow_days),
|
|
6560
|
+
cycle_regular: typeof o.cycle_regular === "boolean" ? o.cycle_regular : DEFAULT_MENSTRUAL.cycle_regular,
|
|
6561
|
+
dysmenorrhea: clampDysmenorrhea(o.dysmenorrhea)
|
|
6562
|
+
};
|
|
6563
|
+
}
|
|
6449
6564
|
function parseLegacyString(input) {
|
|
6450
6565
|
const result = {};
|
|
6451
6566
|
const gpalMatch = input.match(/G(\d+)\s*P(\d+)\s*A(\d+)\s*L(\d+)/i);
|
|
@@ -6475,6 +6590,11 @@ function normalizeToDraft(value) {
|
|
|
6475
6590
|
const json = safeJsonParse(value);
|
|
6476
6591
|
parsed = json ?? value;
|
|
6477
6592
|
}
|
|
6593
|
+
const resolvePregnancyStatus = (o) => {
|
|
6594
|
+
if (isPregnancyStatus(o?.pregnancy_status)) return o.pregnancy_status;
|
|
6595
|
+
if (typeof o?.is_pregnant === "boolean") return o.is_pregnant ? "pregnant" : "not_pregnant";
|
|
6596
|
+
return "not_pregnant";
|
|
6597
|
+
};
|
|
6478
6598
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed) && "gpal" in parsed && parsed.gpal && typeof parsed.gpal === "object") {
|
|
6479
6599
|
const gpal = parsed.gpal ?? {};
|
|
6480
6600
|
const edd = parsed.edd ?? null;
|
|
@@ -6483,7 +6603,6 @@ function normalizeToDraft(value) {
|
|
|
6483
6603
|
const lmp = parsed.lmp ?? "";
|
|
6484
6604
|
const complications = parsed.complications ?? "";
|
|
6485
6605
|
const outcome = parsed.outcome ?? null;
|
|
6486
|
-
const is_pregnant = !!parsed.is_pregnant;
|
|
6487
6606
|
return {
|
|
6488
6607
|
isNewEntry: false,
|
|
6489
6608
|
draft: {
|
|
@@ -6494,7 +6613,7 @@ function normalizeToDraft(value) {
|
|
|
6494
6613
|
L: clampInt(Number(gpal.L ?? 0), 0, 20)
|
|
6495
6614
|
},
|
|
6496
6615
|
lmp: typeof lmp === "string" ? lmp : "",
|
|
6497
|
-
|
|
6616
|
+
pregnancy_status: resolvePregnancyStatus(parsed),
|
|
6498
6617
|
eddUSG: typeof eddUSG === "string" ? eddUSG : "",
|
|
6499
6618
|
primaryEDD: primaryEDD === "usg" ? "usg" : "lmp",
|
|
6500
6619
|
complications: typeof complications === "string" ? complications : "",
|
|
@@ -6503,7 +6622,8 @@ function normalizeToDraft(value) {
|
|
|
6503
6622
|
date: typeof outcome.date === "string" ? outcome.date : "",
|
|
6504
6623
|
notes: typeof outcome.notes === "string" ? outcome.notes : "",
|
|
6505
6624
|
is_final: !!outcome.is_final
|
|
6506
|
-
} : null
|
|
6625
|
+
} : null,
|
|
6626
|
+
menstrual: normalizeMenstrual(parsed.menstrual)
|
|
6507
6627
|
}
|
|
6508
6628
|
};
|
|
6509
6629
|
}
|
|
@@ -6529,7 +6649,8 @@ function normalizeToDraft(value) {
|
|
|
6529
6649
|
notes: typeof parsed.outcome.notes === "string" ? parsed.outcome.notes : "",
|
|
6530
6650
|
is_final: !!parsed.outcome.is_final
|
|
6531
6651
|
} : null,
|
|
6532
|
-
|
|
6652
|
+
pregnancy_status: resolvePregnancyStatus(parsed),
|
|
6653
|
+
menstrual: normalizeMenstrual(parsed.menstrual)
|
|
6533
6654
|
}
|
|
6534
6655
|
};
|
|
6535
6656
|
}
|
|
@@ -6580,16 +6701,18 @@ function computeTrimester(ga) {
|
|
|
6580
6701
|
function buildStored(draft, today) {
|
|
6581
6702
|
const lmpIso = isValidIsoDate(draft.lmp) ? draft.lmp : null;
|
|
6582
6703
|
const eddUsgIso = isValidIsoDate(draft.eddUSG) ? draft.eddUSG : null;
|
|
6583
|
-
if (
|
|
6704
|
+
if (draft.pregnancy_status !== "pregnant") {
|
|
6584
6705
|
return {
|
|
6585
6706
|
gpal: draft.gpal,
|
|
6586
6707
|
lmp: lmpIso,
|
|
6587
6708
|
is_pregnant: false,
|
|
6709
|
+
pregnancy_status: draft.pregnancy_status,
|
|
6588
6710
|
edd: null,
|
|
6589
6711
|
gestationalAge: null,
|
|
6590
6712
|
trimester: null,
|
|
6591
6713
|
complications: draft.complications.trim() ? draft.complications : null,
|
|
6592
|
-
outcome: draft.outcome
|
|
6714
|
+
outcome: draft.outcome,
|
|
6715
|
+
menstrual: { ...draft.menstrual }
|
|
6593
6716
|
};
|
|
6594
6717
|
}
|
|
6595
6718
|
const eddFromLmp = lmpIso ? computeEddFromLmp(lmpIso) : null;
|
|
@@ -6601,11 +6724,13 @@ function buildStored(draft, today) {
|
|
|
6601
6724
|
gpal: draft.gpal,
|
|
6602
6725
|
lmp: lmpIso,
|
|
6603
6726
|
is_pregnant: true,
|
|
6727
|
+
pregnancy_status: "pregnant",
|
|
6604
6728
|
edd: { lmp: eddFromLmp, usg: eddUsgIso, primary },
|
|
6605
6729
|
gestationalAge: gaPrimary,
|
|
6606
6730
|
trimester: computeTrimester(gaPrimary),
|
|
6607
6731
|
complications: draft.complications.trim() ? draft.complications : null,
|
|
6608
|
-
outcome: draft.outcome
|
|
6732
|
+
outcome: draft.outcome,
|
|
6733
|
+
menstrual: { ...draft.menstrual }
|
|
6609
6734
|
};
|
|
6610
6735
|
}
|
|
6611
6736
|
function stripGpalSuffix(label) {
|
|
@@ -6650,7 +6775,8 @@ var ObstetricHistoryWidget = ({ fieldId }) => {
|
|
|
6650
6775
|
};
|
|
6651
6776
|
const commitDebounced = useDebouncedCommit(commitImmediate, 500);
|
|
6652
6777
|
const storedComputed = useMemo(() => buildStored(draft, today), [draft, today]);
|
|
6653
|
-
const
|
|
6778
|
+
const isPregnant = draft.pregnancy_status === "pregnant";
|
|
6779
|
+
const rightPanelEnabled = isPregnant && (!!storedComputed.lmp || !!storedComputed.edd?.usg);
|
|
6654
6780
|
const headerLabel = fieldDef?.label ? stripGpalSuffix(fieldDef.label) : "Obstetric History";
|
|
6655
6781
|
const setDraft = (updater, persist) => {
|
|
6656
6782
|
setDraftState((prev) => {
|
|
@@ -6688,10 +6814,13 @@ var ObstetricHistoryWidget = ({ fieldId }) => {
|
|
|
6688
6814
|
setLmpError(null);
|
|
6689
6815
|
setDraft((prev) => ({ ...prev, lmp: nextIso }), "debounce");
|
|
6690
6816
|
};
|
|
6691
|
-
const handlePregStatus = (
|
|
6817
|
+
const handlePregStatus = (status) => {
|
|
6692
6818
|
setLmpError(null);
|
|
6693
6819
|
setPrimaryEddError(null);
|
|
6694
|
-
setDraft((prev) => ({ ...prev,
|
|
6820
|
+
setDraft((prev) => ({ ...prev, pregnancy_status: status }), "immediate");
|
|
6821
|
+
};
|
|
6822
|
+
const setMenstrualPatch = (patch) => {
|
|
6823
|
+
setDraft((prev) => ({ ...prev, menstrual: { ...prev.menstrual, ...patch } }), "debounce");
|
|
6695
6824
|
};
|
|
6696
6825
|
const handleEddUsgChange = (nextIso) => {
|
|
6697
6826
|
setPrimaryEddError(null);
|
|
@@ -6788,17 +6917,17 @@ var ObstetricHistoryWidget = ({ fieldId }) => {
|
|
|
6788
6917
|
),
|
|
6789
6918
|
lmpError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-600", children: lmpError })
|
|
6790
6919
|
] }),
|
|
6791
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-2 rounded-lg border bg-white p-4", children: [
|
|
6920
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2 rounded-lg border bg-white p-4 min-w-0", children: [
|
|
6792
6921
|
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: "Pregnancy Status" }),
|
|
6793
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
6922
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap gap-2", children: [
|
|
6794
6923
|
/* @__PURE__ */ jsx(
|
|
6795
6924
|
"button",
|
|
6796
6925
|
{
|
|
6797
6926
|
type: "button",
|
|
6798
|
-
onClick: () => handlePregStatus(
|
|
6927
|
+
onClick: () => handlePregStatus("not_pregnant"),
|
|
6799
6928
|
className: cn(
|
|
6800
|
-
"
|
|
6801
|
-
|
|
6929
|
+
"shrink-0 rounded-full border px-3 py-1.5 text-[11px] font-medium transition-colors",
|
|
6930
|
+
draft.pregnancy_status === "not_pregnant" ? "border-green-600 bg-green-600 text-white" : "border-slate-300 bg-white text-slate-700 hover:bg-slate-50"
|
|
6802
6931
|
),
|
|
6803
6932
|
children: "Not Pregnant"
|
|
6804
6933
|
}
|
|
@@ -6807,15 +6936,104 @@ var ObstetricHistoryWidget = ({ fieldId }) => {
|
|
|
6807
6936
|
"button",
|
|
6808
6937
|
{
|
|
6809
6938
|
type: "button",
|
|
6810
|
-
onClick: () => handlePregStatus(
|
|
6939
|
+
onClick: () => handlePregStatus("pregnant"),
|
|
6811
6940
|
className: cn(
|
|
6812
|
-
"
|
|
6813
|
-
draft.
|
|
6941
|
+
"shrink-0 rounded-full border px-3 py-1.5 text-[11px] font-medium transition-colors",
|
|
6942
|
+
draft.pregnancy_status === "pregnant" ? "border-green-600 bg-green-600 text-white" : "border-slate-300 bg-white text-slate-700 hover:bg-slate-50"
|
|
6814
6943
|
),
|
|
6815
6944
|
children: "Pregnant"
|
|
6816
6945
|
}
|
|
6946
|
+
),
|
|
6947
|
+
/* @__PURE__ */ jsx(
|
|
6948
|
+
"button",
|
|
6949
|
+
{
|
|
6950
|
+
type: "button",
|
|
6951
|
+
onClick: () => handlePregStatus("unknown"),
|
|
6952
|
+
className: cn(
|
|
6953
|
+
"shrink-0 rounded-full border px-3 py-1.5 text-[11px] font-medium transition-colors",
|
|
6954
|
+
draft.pregnancy_status === "unknown" ? "border-amber-500 bg-amber-500 text-white" : "border-slate-300 bg-white text-slate-700 hover:bg-slate-50"
|
|
6955
|
+
),
|
|
6956
|
+
children: "Unknown"
|
|
6957
|
+
}
|
|
6958
|
+
)
|
|
6959
|
+
] })
|
|
6960
|
+
] })
|
|
6961
|
+
] }),
|
|
6962
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-white p-4", children: [
|
|
6963
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-muted-foreground mb-3", children: "Menstrual" }),
|
|
6964
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 sm:grid-cols-4", children: [
|
|
6965
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
6966
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `${fieldId}-menarche`, className: "text-[11px] text-muted-foreground", children: "Menarche (age)" }),
|
|
6967
|
+
/* @__PURE__ */ jsx(
|
|
6968
|
+
Input,
|
|
6969
|
+
{
|
|
6970
|
+
id: `${fieldId}-menarche`,
|
|
6971
|
+
type: "number",
|
|
6972
|
+
min: 5,
|
|
6973
|
+
max: 25,
|
|
6974
|
+
value: draft.menstrual.menarche_age,
|
|
6975
|
+
onChange: (e) => setMenstrualPatch({ menarche_age: Number(e.target.value) || 0 })
|
|
6976
|
+
}
|
|
6977
|
+
)
|
|
6978
|
+
] }),
|
|
6979
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
6980
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `${fieldId}-cycle-length`, className: "text-[11px] text-muted-foreground", children: "Cycle (days)" }),
|
|
6981
|
+
/* @__PURE__ */ jsx(
|
|
6982
|
+
Input,
|
|
6983
|
+
{
|
|
6984
|
+
id: `${fieldId}-cycle-length`,
|
|
6985
|
+
type: "number",
|
|
6986
|
+
min: 0,
|
|
6987
|
+
max: 120,
|
|
6988
|
+
value: draft.menstrual.cycle_length,
|
|
6989
|
+
onChange: (e) => setMenstrualPatch({ cycle_length: Number(e.target.value) || 0 })
|
|
6990
|
+
}
|
|
6991
|
+
)
|
|
6992
|
+
] }),
|
|
6993
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
6994
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `${fieldId}-flow-days`, className: "text-[11px] text-muted-foreground", children: "Flow (days)" }),
|
|
6995
|
+
/* @__PURE__ */ jsx(
|
|
6996
|
+
Input,
|
|
6997
|
+
{
|
|
6998
|
+
id: `${fieldId}-flow-days`,
|
|
6999
|
+
type: "number",
|
|
7000
|
+
min: 0,
|
|
7001
|
+
max: 30,
|
|
7002
|
+
value: draft.menstrual.flow_days,
|
|
7003
|
+
onChange: (e) => setMenstrualPatch({ flow_days: Number(e.target.value) || 0 })
|
|
7004
|
+
}
|
|
7005
|
+
)
|
|
7006
|
+
] }),
|
|
7007
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
7008
|
+
/* @__PURE__ */ jsx(Label, { className: "text-[11px] text-muted-foreground", children: "Dysmenorrhea" }),
|
|
7009
|
+
/* @__PURE__ */ jsxs(
|
|
7010
|
+
"select",
|
|
7011
|
+
{
|
|
7012
|
+
className: "h-9 w-full rounded-md border border-input bg-background px-2 text-sm",
|
|
7013
|
+
value: String(draft.menstrual.dysmenorrhea),
|
|
7014
|
+
onChange: (e) => setMenstrualPatch({
|
|
7015
|
+
dysmenorrhea: clampDysmenorrhea(Number(e.target.value))
|
|
7016
|
+
}),
|
|
7017
|
+
children: [
|
|
7018
|
+
/* @__PURE__ */ jsx("option", { value: "0", children: "0 \u2014 none" }),
|
|
7019
|
+
/* @__PURE__ */ jsx("option", { value: "1", children: "1 \u2014 mild" }),
|
|
7020
|
+
/* @__PURE__ */ jsx("option", { value: "2", children: "2 \u2014 moderate" }),
|
|
7021
|
+
/* @__PURE__ */ jsx("option", { value: "3", children: "3 \u2014 severe" })
|
|
7022
|
+
]
|
|
7023
|
+
}
|
|
6817
7024
|
)
|
|
6818
7025
|
] })
|
|
7026
|
+
] }),
|
|
7027
|
+
/* @__PURE__ */ jsxs("label", { className: "mt-3 flex items-center gap-2 text-sm", children: [
|
|
7028
|
+
/* @__PURE__ */ jsx(
|
|
7029
|
+
"input",
|
|
7030
|
+
{
|
|
7031
|
+
type: "checkbox",
|
|
7032
|
+
checked: draft.menstrual.cycle_regular,
|
|
7033
|
+
onChange: (e) => setMenstrualPatch({ cycle_regular: e.target.checked })
|
|
7034
|
+
}
|
|
7035
|
+
),
|
|
7036
|
+
"Regular cycle"
|
|
6819
7037
|
] })
|
|
6820
7038
|
] }),
|
|
6821
7039
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2 rounded-lg border bg-white p-4", children: [
|
|
@@ -6833,9 +7051,9 @@ var ObstetricHistoryWidget = ({ fieldId }) => {
|
|
|
6833
7051
|
] })
|
|
6834
7052
|
] }),
|
|
6835
7053
|
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-white p-4 min-h-[260px]", children: [
|
|
6836
|
-
!
|
|
6837
|
-
|
|
6838
|
-
|
|
7054
|
+
!isPregnant && /* @__PURE__ */ jsx("div", { className: "h-full flex items-center justify-center text-center text-sm text-muted-foreground px-6 py-10", children: draft.pregnancy_status === "unknown" ? "Pregnancy status unknown \u2014 confirm with UPT/USG to enable gestational age and EDD." : 'Only for "Pregnant Women" and enter LMP to calculate gestational age and EDD' }),
|
|
7055
|
+
isPregnant && !rightPanelEnabled && /* @__PURE__ */ jsx("div", { className: "h-full flex items-center justify-center text-center text-sm text-muted-foreground px-6 py-10", children: "Enter LMP and/or EDD (USG) to enable gestational age and EDD calculations." }),
|
|
7056
|
+
isPregnant && rightPanelEnabled && /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
6839
7057
|
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border p-4", children: [
|
|
6840
7058
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
6841
7059
|
/* @__PURE__ */ jsx("div", { className: "text-sm font-semibold text-blue-700", children: "Expected Delivery Date (EDD)" }),
|
|
@@ -9917,7 +10135,7 @@ var SliderWidget = ({ fieldId }) => {
|
|
|
9917
10135
|
const max = def.max ?? 10;
|
|
9918
10136
|
const step = def.step ?? 1;
|
|
9919
10137
|
const raw = value == null || value === "" ? min : Number(value);
|
|
9920
|
-
const
|
|
10138
|
+
const num2 = Number.isFinite(raw) ? Math.min(max, Math.max(min, raw)) : min;
|
|
9921
10139
|
const theme = getThemeConfig("textarea", def.theme);
|
|
9922
10140
|
const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
|
|
9923
10141
|
const labelClass = theme?.labelClassName;
|
|
@@ -9926,7 +10144,7 @@ var SliderWidget = ({ fieldId }) => {
|
|
|
9926
10144
|
" ",
|
|
9927
10145
|
def.required && /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" }),
|
|
9928
10146
|
/* @__PURE__ */ jsxs("span", { className: "ml-2 text-muted-foreground font-normal tabular-nums", children: [
|
|
9929
|
-
|
|
10147
|
+
num2,
|
|
9930
10148
|
"/",
|
|
9931
10149
|
max
|
|
9932
10150
|
] })
|
|
@@ -9942,7 +10160,7 @@ var SliderWidget = ({ fieldId }) => {
|
|
|
9942
10160
|
min,
|
|
9943
10161
|
max,
|
|
9944
10162
|
step,
|
|
9945
|
-
value: [
|
|
10163
|
+
value: [num2],
|
|
9946
10164
|
onValueChange: (v) => {
|
|
9947
10165
|
const n = v[0] ?? min;
|
|
9948
10166
|
setValue(n);
|
|
@@ -10944,8 +11162,10 @@ var PainScaleFlagsWidget = ({ fieldId }) => {
|
|
|
10944
11162
|
const sel = safe.flags;
|
|
10945
11163
|
const isSelected = isFlagSelected(sel, optValue);
|
|
10946
11164
|
const nextFlags = isSelected ? sel.filter((v) => v !== optValue && String(v) !== String(optValue)) : [...sel, String(optValue)];
|
|
10947
|
-
update({ pain: safe.pain, flags: nextFlags });
|
|
11165
|
+
update({ pain: safe.pain, flags: nextFlags, bp: safe.bp, upt: safe.upt });
|
|
10948
11166
|
};
|
|
11167
|
+
const setBp = (bp) => update({ pain: safe.pain, flags: safe.flags, bp, upt: safe.upt });
|
|
11168
|
+
const setUpt = (upt) => update({ pain: safe.pain, flags: safe.flags, bp: safe.bp, upt });
|
|
10949
11169
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10950
11170
|
def.label,
|
|
10951
11171
|
" ",
|
|
@@ -10980,7 +11200,7 @@ var PainScaleFlagsWidget = ({ fieldId }) => {
|
|
|
10980
11200
|
value: [safe.pain],
|
|
10981
11201
|
onValueChange: (v) => {
|
|
10982
11202
|
const n = v[0] ?? min;
|
|
10983
|
-
update({ pain: n, flags: safe.flags });
|
|
11203
|
+
update({ pain: n, flags: safe.flags, bp: safe.bp, upt: safe.upt });
|
|
10984
11204
|
}
|
|
10985
11205
|
}
|
|
10986
11206
|
)
|
|
@@ -11006,6 +11226,42 @@ var PainScaleFlagsWidget = ({ fieldId }) => {
|
|
|
11006
11226
|
}
|
|
11007
11227
|
)
|
|
11008
11228
|
] }, String(opt.value))) })
|
|
11229
|
+
] }) : null,
|
|
11230
|
+
def.showBp || def.showUpt ? /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-3 pt-1 sm:grid-cols-2", children: [
|
|
11231
|
+
def.showBp ? /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
11232
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `${fieldId}-bp`, className: "text-sm font-medium text-slate-700", children: "BP recorded" }),
|
|
11233
|
+
/* @__PURE__ */ jsx(
|
|
11234
|
+
Input,
|
|
11235
|
+
{
|
|
11236
|
+
id: `${fieldId}-bp`,
|
|
11237
|
+
value: safe.bp ?? "",
|
|
11238
|
+
onChange: (e) => setBp(e.target.value),
|
|
11239
|
+
placeholder: "e.g. 130/86",
|
|
11240
|
+
disabled,
|
|
11241
|
+
className: "h-8 text-xs"
|
|
11242
|
+
}
|
|
11243
|
+
)
|
|
11244
|
+
] }) : null,
|
|
11245
|
+
def.showUpt ? /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
11246
|
+
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium text-slate-700", children: "UPT (if reproductive age)" }),
|
|
11247
|
+
/* @__PURE__ */ jsxs(
|
|
11248
|
+
Select,
|
|
11249
|
+
{
|
|
11250
|
+
value: safe.upt ? safe.upt : "none",
|
|
11251
|
+
onValueChange: (val) => setUpt(val === "none" ? "" : val),
|
|
11252
|
+
disabled,
|
|
11253
|
+
children: [
|
|
11254
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
11255
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
11256
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
11257
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Positive", children: "Positive" }),
|
|
11258
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Negative", children: "Negative" }),
|
|
11259
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Not done", children: "Not done" })
|
|
11260
|
+
] })
|
|
11261
|
+
]
|
|
11262
|
+
}
|
|
11263
|
+
)
|
|
11264
|
+
] }) : null
|
|
11009
11265
|
] }) : null
|
|
11010
11266
|
] }) }),
|
|
11011
11267
|
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
@@ -11853,125 +12109,1758 @@ var UrologyPathwayWidget = ({ fieldId }) => {
|
|
|
11853
12109
|
] })
|
|
11854
12110
|
] });
|
|
11855
12111
|
};
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
12112
|
+
|
|
12113
|
+
// src/core/obgPathway.ts
|
|
12114
|
+
var UTERUS_SIZES = ["", "Normal", "Bulky", "Enlarged"];
|
|
12115
|
+
function bool2(x) {
|
|
12116
|
+
return x === true;
|
|
12117
|
+
}
|
|
12118
|
+
function str4(x) {
|
|
12119
|
+
return typeof x === "string" ? x : "";
|
|
12120
|
+
}
|
|
12121
|
+
function defaultObgExamination() {
|
|
12122
|
+
return {
|
|
12123
|
+
general: {
|
|
12124
|
+
pallor: false,
|
|
12125
|
+
oedema: false,
|
|
12126
|
+
thyroid: false,
|
|
12127
|
+
hirsutism: false,
|
|
12128
|
+
acanthosis: false
|
|
12129
|
+
},
|
|
12130
|
+
abdomen: { surgicalScars: false, massTenderness: false },
|
|
12131
|
+
breast: { lump: false, nippleDischarge: false, skinChanges: false, axillaryNodes: false },
|
|
12132
|
+
pelvic: {
|
|
12133
|
+
speculumDone: false,
|
|
12134
|
+
discharge: false,
|
|
12135
|
+
cervicalErosion: false,
|
|
12136
|
+
cervicalGrowth: false,
|
|
12137
|
+
activeBleeding: false,
|
|
12138
|
+
bimanualDone: false,
|
|
12139
|
+
adnexalMass: false,
|
|
12140
|
+
cmt: false
|
|
12141
|
+
},
|
|
12142
|
+
uterusSize: "",
|
|
12143
|
+
examinationNotes: ""
|
|
12144
|
+
};
|
|
12145
|
+
}
|
|
12146
|
+
function normalizeObgExamination(raw) {
|
|
12147
|
+
const base = defaultObgExamination();
|
|
12148
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return base;
|
|
12149
|
+
const o = raw;
|
|
12150
|
+
const g = o.general && typeof o.general === "object" ? o.general : {};
|
|
12151
|
+
const a = o.abdomen && typeof o.abdomen === "object" ? o.abdomen : {};
|
|
12152
|
+
const b = o.breast && typeof o.breast === "object" ? o.breast : {};
|
|
12153
|
+
const p = o.pelvic && typeof o.pelvic === "object" ? o.pelvic : {};
|
|
12154
|
+
const us = str4(o.uterusSize);
|
|
12155
|
+
return {
|
|
12156
|
+
general: {
|
|
12157
|
+
pallor: bool2(g.pallor),
|
|
12158
|
+
oedema: bool2(g.oedema),
|
|
12159
|
+
thyroid: bool2(g.thyroid),
|
|
12160
|
+
hirsutism: bool2(g.hirsutism),
|
|
12161
|
+
acanthosis: bool2(g.acanthosis)
|
|
12162
|
+
},
|
|
12163
|
+
abdomen: {
|
|
12164
|
+
surgicalScars: bool2(a.surgicalScars),
|
|
12165
|
+
massTenderness: bool2(a.massTenderness)
|
|
12166
|
+
},
|
|
12167
|
+
breast: {
|
|
12168
|
+
lump: bool2(b.lump),
|
|
12169
|
+
nippleDischarge: bool2(b.nippleDischarge),
|
|
12170
|
+
skinChanges: bool2(b.skinChanges),
|
|
12171
|
+
axillaryNodes: bool2(b.axillaryNodes)
|
|
12172
|
+
},
|
|
12173
|
+
pelvic: {
|
|
12174
|
+
speculumDone: bool2(p.speculumDone),
|
|
12175
|
+
discharge: bool2(p.discharge),
|
|
12176
|
+
cervicalErosion: bool2(p.cervicalErosion),
|
|
12177
|
+
cervicalGrowth: bool2(p.cervicalGrowth),
|
|
12178
|
+
activeBleeding: bool2(p.activeBleeding),
|
|
12179
|
+
bimanualDone: bool2(p.bimanualDone),
|
|
12180
|
+
adnexalMass: bool2(p.adnexalMass),
|
|
12181
|
+
cmt: bool2(p.cmt)
|
|
12182
|
+
},
|
|
12183
|
+
uterusSize: UTERUS_SIZES.includes(us) ? us : "",
|
|
12184
|
+
examinationNotes: str4(o.examinationNotes)
|
|
12185
|
+
};
|
|
12186
|
+
}
|
|
12187
|
+
var GENERAL_LABELS = {
|
|
12188
|
+
pallor: "Pallor",
|
|
12189
|
+
oedema: "Oedema",
|
|
12190
|
+
thyroid: "Thyroid",
|
|
12191
|
+
hirsutism: "Hirsutism",
|
|
12192
|
+
acanthosis: "Acanthosis"
|
|
11862
12193
|
};
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
|
|
11870
|
-
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
|
|
11875
|
-
|
|
11876
|
-
|
|
11877
|
-
|
|
11878
|
-
|
|
11879
|
-
|
|
11880
|
-
|
|
11881
|
-
|
|
11882
|
-
|
|
11883
|
-
|
|
11884
|
-
|
|
11885
|
-
|
|
11886
|
-
|
|
11887
|
-
|
|
11888
|
-
|
|
11889
|
-
|
|
11890
|
-
|
|
11891
|
-
|
|
11892
|
-
|
|
11893
|
-
|
|
11894
|
-
|
|
11895
|
-
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
|
|
11900
|
-
|
|
11901
|
-
|
|
11902
|
-
|
|
11903
|
-
|
|
11904
|
-
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
|
|
11915
|
-
|
|
11916
|
-
return /* @__PURE__ */ jsx(FollowupWidget, { fieldId });
|
|
11917
|
-
case "smart_textarea":
|
|
11918
|
-
return /* @__PURE__ */ jsx(SmartTextareaWidget, { fieldId });
|
|
11919
|
-
case "diagnosis_textarea":
|
|
11920
|
-
return /* @__PURE__ */ jsx(DiagnosisTextareaWidget, { fieldId });
|
|
11921
|
-
case "obstetric_history":
|
|
11922
|
-
return /* @__PURE__ */ jsx(ObstetricHistoryWidget, { fieldId });
|
|
11923
|
-
case "eye_prescription":
|
|
11924
|
-
return /* @__PURE__ */ jsx(OphthalmologyWidget, { fieldId });
|
|
11925
|
-
case "ophthal_diagnosis":
|
|
11926
|
-
return /* @__PURE__ */ jsx(OphthalDiagnosisWidget, { fieldId });
|
|
11927
|
-
case "orthopedic_exam":
|
|
11928
|
-
return /* @__PURE__ */ jsx(OrthopedicExamWidget, { fieldId });
|
|
11929
|
-
case "general_surgery_smart_history":
|
|
11930
|
-
return /* @__PURE__ */ jsx(GsSmartHistoryWidget, { fieldId });
|
|
11931
|
-
case "general_surgery_examination":
|
|
11932
|
-
return /* @__PURE__ */ jsx(GsExaminationWidget, { fieldId });
|
|
11933
|
-
case "general_surgery_grading":
|
|
11934
|
-
return /* @__PURE__ */ jsx(GsGradingWidget, { fieldId });
|
|
11935
|
-
case "pain_scale_flags":
|
|
11936
|
-
return /* @__PURE__ */ jsx(PainScaleFlagsWidget, { fieldId });
|
|
11937
|
-
case "urology_smart_history":
|
|
11938
|
-
return /* @__PURE__ */ jsx(UrologySmartHistoryWidget, { fieldId });
|
|
11939
|
-
case "urology_examination":
|
|
11940
|
-
return /* @__PURE__ */ jsx(UrologyExaminationWidget, { fieldId });
|
|
11941
|
-
case "urology_pathway":
|
|
11942
|
-
return /* @__PURE__ */ jsx(UrologyPathwayWidget, { fieldId });
|
|
11943
|
-
case "toggle": {
|
|
11944
|
-
const { value, setValue, setTouched, disabled } = useField(fieldId);
|
|
11945
|
-
const store = useFormStore();
|
|
11946
|
-
const excludes = fieldDef.excludes ?? [];
|
|
11947
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
11948
|
-
/* @__PURE__ */ jsx(
|
|
11949
|
-
Switch,
|
|
11950
|
-
{
|
|
11951
|
-
checked: value === true,
|
|
11952
|
-
disabled,
|
|
11953
|
-
onCheckedChange: (checked) => {
|
|
11954
|
-
setValue(checked);
|
|
11955
|
-
setTouched();
|
|
11956
|
-
if (checked) excludes.forEach((id) => store.setValue(id, false));
|
|
11957
|
-
}
|
|
11958
|
-
}
|
|
11959
|
-
),
|
|
11960
|
-
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium leading-none cursor-pointer select-none", children: fieldDef.label })
|
|
11961
|
-
] });
|
|
12194
|
+
var ABDOMEN_LABELS = {
|
|
12195
|
+
surgicalScars: "Surgical scars",
|
|
12196
|
+
massTenderness: "Mass / tenderness"
|
|
12197
|
+
};
|
|
12198
|
+
var BREAST_LABELS = {
|
|
12199
|
+
lump: "Lump",
|
|
12200
|
+
nippleDischarge: "Nipple discharge",
|
|
12201
|
+
skinChanges: "Skin changes",
|
|
12202
|
+
axillaryNodes: "Axillary nodes"
|
|
12203
|
+
};
|
|
12204
|
+
var PELVIC_LABELS = {
|
|
12205
|
+
speculumDone: "Speculum done",
|
|
12206
|
+
discharge: "Discharge",
|
|
12207
|
+
cervicalErosion: "Cervical erosion",
|
|
12208
|
+
cervicalGrowth: "Cervical growth",
|
|
12209
|
+
activeBleeding: "Active bleeding",
|
|
12210
|
+
bimanualDone: "Bimanual done",
|
|
12211
|
+
adnexalMass: "Adnexal mass",
|
|
12212
|
+
cmt: "Cervical motion tenderness"
|
|
12213
|
+
};
|
|
12214
|
+
function pickLabels(group, labels) {
|
|
12215
|
+
return Object.keys(labels).filter((k) => group[k]).map((k) => labels[k]);
|
|
12216
|
+
}
|
|
12217
|
+
function formatObgExaminationToClinicalExamination(v) {
|
|
12218
|
+
const lines = [];
|
|
12219
|
+
const general = pickLabels(v.general, GENERAL_LABELS);
|
|
12220
|
+
if (general.length) lines.push(`General: ${general.join(", ")}`);
|
|
12221
|
+
const abd = pickLabels(v.abdomen, ABDOMEN_LABELS);
|
|
12222
|
+
if (abd.length) lines.push(`Abdomen: ${abd.join(", ")}`);
|
|
12223
|
+
const breast = pickLabels(v.breast, BREAST_LABELS);
|
|
12224
|
+
if (breast.length) lines.push(`Breast: ${breast.join(", ")}`);
|
|
12225
|
+
const pelvic = pickLabels(v.pelvic, PELVIC_LABELS);
|
|
12226
|
+
let pelvicLine = pelvic.length ? `Pelvic: ${pelvic.join(", ")}` : "";
|
|
12227
|
+
if (v.pelvic.bimanualDone && v.uterusSize) {
|
|
12228
|
+
pelvicLine = pelvicLine ? `${pelvicLine} \u2014 uterus ${v.uterusSize.toLowerCase()}` : `Pelvic: uterus ${v.uterusSize.toLowerCase()}`;
|
|
12229
|
+
}
|
|
12230
|
+
if (pelvicLine) lines.push(pelvicLine);
|
|
12231
|
+
return lines.join("\n");
|
|
12232
|
+
}
|
|
12233
|
+
var OBG_ZONE_ORDER = [
|
|
12234
|
+
"menstrual_reproductive",
|
|
12235
|
+
"antenatal",
|
|
12236
|
+
"gynaecological",
|
|
12237
|
+
"obstetric",
|
|
12238
|
+
"infertility",
|
|
12239
|
+
"postoperative"
|
|
12240
|
+
];
|
|
12241
|
+
var OBG_ZONE_SET = new Set(OBG_ZONE_ORDER);
|
|
12242
|
+
function coerceZones(raw) {
|
|
12243
|
+
const list = [];
|
|
12244
|
+
const push = (x) => {
|
|
12245
|
+
if (typeof x === "string" && OBG_ZONE_SET.has(x) && !list.includes(x)) {
|
|
12246
|
+
list.push(x);
|
|
11962
12247
|
}
|
|
11963
|
-
|
|
11964
|
-
|
|
11965
|
-
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
|
|
11972
|
-
|
|
11973
|
-
|
|
11974
|
-
|
|
12248
|
+
};
|
|
12249
|
+
if (Array.isArray(raw)) raw.forEach(push);
|
|
12250
|
+
else push(raw);
|
|
12251
|
+
return list.sort((a, b) => OBG_ZONE_ORDER.indexOf(a) - OBG_ZONE_ORDER.indexOf(b));
|
|
12252
|
+
}
|
|
12253
|
+
function num(x, fallback = 0) {
|
|
12254
|
+
const n = Number(x);
|
|
12255
|
+
return Number.isFinite(n) ? n : fallback;
|
|
12256
|
+
}
|
|
12257
|
+
function clampDysmenorrhea2(x) {
|
|
12258
|
+
const n = Math.round(num(x, 0));
|
|
12259
|
+
if (n <= 0) return 0;
|
|
12260
|
+
if (n >= 3) return 3;
|
|
12261
|
+
return n;
|
|
12262
|
+
}
|
|
12263
|
+
function defaultObgPathway() {
|
|
12264
|
+
return {
|
|
12265
|
+
zones: [],
|
|
12266
|
+
menstrual: {
|
|
12267
|
+
menarcheAge: 13,
|
|
12268
|
+
cycleLength: 28,
|
|
12269
|
+
flowDays: 4,
|
|
12270
|
+
cycleRegular: true,
|
|
12271
|
+
dysmenorrhea: 0,
|
|
12272
|
+
amount: "",
|
|
12273
|
+
lmp: "",
|
|
12274
|
+
menopauseStatus: ""
|
|
12275
|
+
},
|
|
12276
|
+
antenatal: {
|
|
12277
|
+
gravida: 0,
|
|
12278
|
+
gaWeeksLmp: 0,
|
|
12279
|
+
gaDaysLmp: 0,
|
|
12280
|
+
gaWeeksUsg: 0,
|
|
12281
|
+
gaDaysUsg: 0,
|
|
12282
|
+
edd: "",
|
|
12283
|
+
riskCategory: "",
|
|
12284
|
+
symptoms: {
|
|
12285
|
+
nauseaVomiting: false,
|
|
12286
|
+
bleedingPV: false,
|
|
12287
|
+
painAbdomen: false,
|
|
12288
|
+
decreasedFetalMovements: false
|
|
12289
|
+
},
|
|
12290
|
+
exam: {
|
|
12291
|
+
weightKg: 0,
|
|
12292
|
+
heightCm: 0,
|
|
12293
|
+
bmi: 0,
|
|
12294
|
+
bp: "",
|
|
12295
|
+
pallor: false,
|
|
12296
|
+
oedema: false,
|
|
12297
|
+
fundalHeightCm: 0,
|
|
12298
|
+
fhrBpm: 0,
|
|
12299
|
+
presentation: "",
|
|
12300
|
+
lie: ""
|
|
12301
|
+
},
|
|
12302
|
+
investigations: {
|
|
12303
|
+
bloodGroup: "",
|
|
12304
|
+
cbc: "",
|
|
12305
|
+
tsh: "",
|
|
12306
|
+
rbsOgtt: "",
|
|
12307
|
+
serology: "",
|
|
12308
|
+
urine: "",
|
|
12309
|
+
usg: ""
|
|
12310
|
+
}
|
|
12311
|
+
},
|
|
12312
|
+
gynae: {
|
|
12313
|
+
symptoms: {
|
|
12314
|
+
aub: false,
|
|
12315
|
+
whiteDischarge: false,
|
|
12316
|
+
pelvicPain: false,
|
|
12317
|
+
dyspareunia: false,
|
|
12318
|
+
urinaryComplaints: false,
|
|
12319
|
+
prolapse: false
|
|
12320
|
+
}
|
|
12321
|
+
},
|
|
12322
|
+
obstetric: [],
|
|
12323
|
+
infertility: {
|
|
12324
|
+
type: "",
|
|
12325
|
+
durationMonths: 0,
|
|
12326
|
+
previousTreatments: "",
|
|
12327
|
+
female: { ovulation: "", pcosFeatures: false, endometriosisSuspicion: false },
|
|
12328
|
+
male: { age: 0, semenAnalysis: "" },
|
|
12329
|
+
investigations: { amh: "", fshLh: "", prolactin: "", tsh: "", tvs: "", hsg: "" }
|
|
12330
|
+
},
|
|
12331
|
+
postop: {
|
|
12332
|
+
surgeryDate: "",
|
|
12333
|
+
procedure: "",
|
|
12334
|
+
histopathology: "",
|
|
12335
|
+
woundStatus: "",
|
|
12336
|
+
painScore: 0,
|
|
12337
|
+
complications: ""
|
|
12338
|
+
}
|
|
12339
|
+
};
|
|
12340
|
+
}
|
|
12341
|
+
function normalizeObgPathway(raw) {
|
|
12342
|
+
const base = defaultObgPathway();
|
|
12343
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return base;
|
|
12344
|
+
const o = raw;
|
|
12345
|
+
const zones = coerceZones(o.zones ?? o.zone);
|
|
12346
|
+
const m = o.menstrual && typeof o.menstrual === "object" ? o.menstrual : {};
|
|
12347
|
+
const a = o.antenatal && typeof o.antenatal === "object" ? o.antenatal : {};
|
|
12348
|
+
const aSym = a.symptoms && typeof a.symptoms === "object" ? a.symptoms : {};
|
|
12349
|
+
const aExam = a.exam && typeof a.exam === "object" ? a.exam : {};
|
|
12350
|
+
const aInv = a.investigations && typeof a.investigations === "object" ? a.investigations : {};
|
|
12351
|
+
const g = o.gynae && typeof o.gynae === "object" ? o.gynae : {};
|
|
12352
|
+
const gSym = g.symptoms && typeof g.symptoms === "object" ? g.symptoms : {};
|
|
12353
|
+
const inf = o.infertility && typeof o.infertility === "object" ? o.infertility : {};
|
|
12354
|
+
const infF = inf.female && typeof inf.female === "object" ? inf.female : {};
|
|
12355
|
+
const infM = inf.male && typeof inf.male === "object" ? inf.male : {};
|
|
12356
|
+
const infInv = inf.investigations && typeof inf.investigations === "object" ? inf.investigations : {};
|
|
12357
|
+
const po = o.postop && typeof o.postop === "object" ? o.postop : {};
|
|
12358
|
+
const obstetricRows = Array.isArray(o.obstetric) ? o.obstetric.map((row) => {
|
|
12359
|
+
const r = row && typeof row === "object" ? row : {};
|
|
12360
|
+
const mode = str4(r.mode);
|
|
12361
|
+
return {
|
|
12362
|
+
year: str4(r.year),
|
|
12363
|
+
ga: str4(r.ga),
|
|
12364
|
+
mode: ["", "NVD", "LSCS", "Instrumental", "Abortion", "Stillbirth"].includes(mode) ? mode : "",
|
|
12365
|
+
indicationLscs: str4(r.indicationLscs),
|
|
12366
|
+
babyOutcome: str4(r.babyOutcome),
|
|
12367
|
+
complications: str4(r.complications)
|
|
12368
|
+
};
|
|
12369
|
+
}) : [];
|
|
12370
|
+
return {
|
|
12371
|
+
zones,
|
|
12372
|
+
menstrual: {
|
|
12373
|
+
menarcheAge: num(m.menarcheAge, base.menstrual.menarcheAge),
|
|
12374
|
+
cycleLength: num(m.cycleLength, base.menstrual.cycleLength),
|
|
12375
|
+
flowDays: num(m.flowDays, base.menstrual.flowDays),
|
|
12376
|
+
cycleRegular: m.cycleRegular === void 0 ? base.menstrual.cycleRegular : bool2(m.cycleRegular),
|
|
12377
|
+
dysmenorrhea: clampDysmenorrhea2(m.dysmenorrhea),
|
|
12378
|
+
amount: ["", "Scanty", "Normal", "Heavy"].includes(str4(m.amount)) ? str4(m.amount) : "",
|
|
12379
|
+
lmp: str4(m.lmp),
|
|
12380
|
+
menopauseStatus: ["", "Pre", "Peri", "Post"].includes(str4(m.menopauseStatus)) ? str4(m.menopauseStatus) : ""
|
|
12381
|
+
},
|
|
12382
|
+
antenatal: {
|
|
12383
|
+
gravida: num(a.gravida),
|
|
12384
|
+
gaWeeksLmp: num(a.gaWeeksLmp),
|
|
12385
|
+
gaDaysLmp: num(a.gaDaysLmp),
|
|
12386
|
+
gaWeeksUsg: num(a.gaWeeksUsg),
|
|
12387
|
+
gaDaysUsg: num(a.gaDaysUsg),
|
|
12388
|
+
edd: str4(a.edd),
|
|
12389
|
+
riskCategory: ["", "Low", "High"].includes(str4(a.riskCategory)) ? str4(a.riskCategory) : "",
|
|
12390
|
+
symptoms: {
|
|
12391
|
+
nauseaVomiting: bool2(aSym.nauseaVomiting),
|
|
12392
|
+
bleedingPV: bool2(aSym.bleedingPV),
|
|
12393
|
+
painAbdomen: bool2(aSym.painAbdomen),
|
|
12394
|
+
decreasedFetalMovements: bool2(aSym.decreasedFetalMovements)
|
|
12395
|
+
},
|
|
12396
|
+
exam: {
|
|
12397
|
+
weightKg: num(aExam.weightKg),
|
|
12398
|
+
heightCm: num(aExam.heightCm),
|
|
12399
|
+
bmi: num(aExam.bmi),
|
|
12400
|
+
bp: str4(aExam.bp),
|
|
12401
|
+
pallor: bool2(aExam.pallor),
|
|
12402
|
+
oedema: bool2(aExam.oedema),
|
|
12403
|
+
fundalHeightCm: num(aExam.fundalHeightCm),
|
|
12404
|
+
fhrBpm: num(aExam.fhrBpm),
|
|
12405
|
+
presentation: ["", "Cephalic", "Breech", "Other"].includes(str4(aExam.presentation)) ? str4(aExam.presentation) : "",
|
|
12406
|
+
lie: ["", "Longitudinal", "Transverse", "Oblique"].includes(str4(aExam.lie)) ? str4(aExam.lie) : ""
|
|
12407
|
+
},
|
|
12408
|
+
investigations: {
|
|
12409
|
+
bloodGroup: str4(aInv.bloodGroup),
|
|
12410
|
+
cbc: ["", "Done", "Pending", "Abnormal"].includes(str4(aInv.cbc)) ? str4(aInv.cbc) : "",
|
|
12411
|
+
tsh: ["", "Done", "Pending", "Abnormal"].includes(str4(aInv.tsh)) ? str4(aInv.tsh) : "",
|
|
12412
|
+
rbsOgtt: ["", "Done", "Pending", "Abnormal"].includes(str4(aInv.rbsOgtt)) ? str4(aInv.rbsOgtt) : "",
|
|
12413
|
+
serology: ["", "Done", "Pending", "Abnormal"].includes(str4(aInv.serology)) ? str4(aInv.serology) : "",
|
|
12414
|
+
urine: ["", "Done", "Pending", "Abnormal"].includes(str4(aInv.urine)) ? str4(aInv.urine) : "",
|
|
12415
|
+
usg: ["", "Dating", "NT", "Anomaly", "Growth", "Pending"].includes(str4(aInv.usg)) ? str4(aInv.usg) : ""
|
|
12416
|
+
}
|
|
12417
|
+
},
|
|
12418
|
+
gynae: {
|
|
12419
|
+
symptoms: {
|
|
12420
|
+
aub: bool2(gSym.aub),
|
|
12421
|
+
whiteDischarge: bool2(gSym.whiteDischarge),
|
|
12422
|
+
pelvicPain: bool2(gSym.pelvicPain),
|
|
12423
|
+
dyspareunia: bool2(gSym.dyspareunia),
|
|
12424
|
+
urinaryComplaints: bool2(gSym.urinaryComplaints),
|
|
12425
|
+
prolapse: bool2(gSym.prolapse)
|
|
12426
|
+
}
|
|
12427
|
+
},
|
|
12428
|
+
obstetric: obstetricRows,
|
|
12429
|
+
infertility: {
|
|
12430
|
+
type: ["", "Primary", "Secondary"].includes(str4(inf.type)) ? str4(inf.type) : "",
|
|
12431
|
+
durationMonths: num(inf.durationMonths),
|
|
12432
|
+
previousTreatments: str4(inf.previousTreatments),
|
|
12433
|
+
female: {
|
|
12434
|
+
ovulation: ["", "Ovulatory", "Anovulatory", "Unknown"].includes(str4(infF.ovulation)) ? str4(infF.ovulation) : "",
|
|
12435
|
+
pcosFeatures: bool2(infF.pcosFeatures),
|
|
12436
|
+
endometriosisSuspicion: bool2(infF.endometriosisSuspicion)
|
|
12437
|
+
},
|
|
12438
|
+
male: {
|
|
12439
|
+
age: num(infM.age),
|
|
12440
|
+
semenAnalysis: ["", "Normal", "Abnormal", "Pending"].includes(str4(infM.semenAnalysis)) ? str4(infM.semenAnalysis) : ""
|
|
12441
|
+
},
|
|
12442
|
+
investigations: {
|
|
12443
|
+
amh: str4(infInv.amh),
|
|
12444
|
+
fshLh: str4(infInv.fshLh),
|
|
12445
|
+
prolactin: str4(infInv.prolactin),
|
|
12446
|
+
tsh: str4(infInv.tsh),
|
|
12447
|
+
tvs: str4(infInv.tvs),
|
|
12448
|
+
hsg: str4(infInv.hsg)
|
|
12449
|
+
}
|
|
12450
|
+
},
|
|
12451
|
+
postop: {
|
|
12452
|
+
surgeryDate: str4(po.surgeryDate),
|
|
12453
|
+
procedure: str4(po.procedure),
|
|
12454
|
+
histopathology: str4(po.histopathology),
|
|
12455
|
+
woundStatus: ["", "Healthy", "Erythema", "Discharge", "Dehisced"].includes(str4(po.woundStatus)) ? str4(po.woundStatus) : "",
|
|
12456
|
+
painScore: Math.max(0, Math.min(10, num(po.painScore))),
|
|
12457
|
+
complications: str4(po.complications)
|
|
12458
|
+
}
|
|
12459
|
+
};
|
|
12460
|
+
}
|
|
12461
|
+
var ZONE_LABELS = {
|
|
12462
|
+
menstrual_reproductive: "Menstrual & reproductive",
|
|
12463
|
+
antenatal: "Antenatal",
|
|
12464
|
+
gynaecological: "Gynaecological",
|
|
12465
|
+
obstetric: "Obstetric",
|
|
12466
|
+
infertility: "Infertility",
|
|
12467
|
+
postoperative: "Post-operative"
|
|
12468
|
+
};
|
|
12469
|
+
function obgZoneLabel(zone) {
|
|
12470
|
+
return ZONE_LABELS[zone];
|
|
12471
|
+
}
|
|
12472
|
+
function nonEmpty(parts) {
|
|
12473
|
+
return parts.map((s) => (s ?? "").trim()).filter(Boolean);
|
|
12474
|
+
}
|
|
12475
|
+
function formatMenstrualBlock(m) {
|
|
12476
|
+
const bits = nonEmpty([
|
|
12477
|
+
m.menarcheAge ? `menarche ${m.menarcheAge}y` : "",
|
|
12478
|
+
m.cycleLength ? `cycle ${m.cycleLength}d` : "",
|
|
12479
|
+
m.flowDays ? `flow ${m.flowDays}d` : "",
|
|
12480
|
+
m.cycleRegular ? "regular" : "irregular",
|
|
12481
|
+
m.amount ? `flow ${m.amount.toLowerCase()}` : "",
|
|
12482
|
+
m.dysmenorrhea ? `dysmenorrhea grade ${m.dysmenorrhea}` : "",
|
|
12483
|
+
m.lmp ? `LMP ${m.lmp}` : "",
|
|
12484
|
+
m.menopauseStatus ? `${m.menopauseStatus.toLowerCase()}menopausal` : ""
|
|
12485
|
+
]);
|
|
12486
|
+
return bits.length ? `Menstrual: ${bits.join(", ")}` : "";
|
|
12487
|
+
}
|
|
12488
|
+
function formatAntenatalBlock(a) {
|
|
12489
|
+
const lines = [];
|
|
12490
|
+
const head = nonEmpty([
|
|
12491
|
+
a.gravida ? `G${a.gravida}` : "",
|
|
12492
|
+
a.gaWeeksLmp || a.gaDaysLmp ? `GA(LMP) ${a.gaWeeksLmp}w ${a.gaDaysLmp}d` : "",
|
|
12493
|
+
a.gaWeeksUsg || a.gaDaysUsg ? `GA(USG) ${a.gaWeeksUsg}w ${a.gaDaysUsg}d` : "",
|
|
12494
|
+
a.edd ? `EDD ${a.edd}` : "",
|
|
12495
|
+
a.riskCategory ? `${a.riskCategory} risk` : ""
|
|
12496
|
+
]);
|
|
12497
|
+
if (head.length) lines.push(`Antenatal: ${head.join(", ")}`);
|
|
12498
|
+
const sym = nonEmpty([
|
|
12499
|
+
a.symptoms.nauseaVomiting ? "nausea/vomiting" : "",
|
|
12500
|
+
a.symptoms.bleedingPV ? "bleeding PV" : "",
|
|
12501
|
+
a.symptoms.painAbdomen ? "pain abdomen" : "",
|
|
12502
|
+
a.symptoms.decreasedFetalMovements ? "decreased fetal movements" : ""
|
|
12503
|
+
]);
|
|
12504
|
+
if (sym.length) lines.push(`Antenatal symptoms: ${sym.join(", ")}`);
|
|
12505
|
+
return lines.join("\n");
|
|
12506
|
+
}
|
|
12507
|
+
function formatGynaeBlock(g) {
|
|
12508
|
+
const sym = nonEmpty([
|
|
12509
|
+
g.symptoms.aub ? "AUB" : "",
|
|
12510
|
+
g.symptoms.whiteDischarge ? "white discharge" : "",
|
|
12511
|
+
g.symptoms.pelvicPain ? "pelvic pain" : "",
|
|
12512
|
+
g.symptoms.dyspareunia ? "dyspareunia" : "",
|
|
12513
|
+
g.symptoms.urinaryComplaints ? "urinary complaints" : "",
|
|
12514
|
+
g.symptoms.prolapse ? "prolapse" : ""
|
|
12515
|
+
]);
|
|
12516
|
+
return sym.length ? `Gynae symptoms: ${sym.join(", ")}` : "";
|
|
12517
|
+
}
|
|
12518
|
+
function formatObstetricBlock(rows) {
|
|
12519
|
+
if (!rows.length) return "";
|
|
12520
|
+
const summary = rows.map((r) => nonEmpty([r.year, r.ga, r.mode, r.babyOutcome]).join(" / ")).filter(Boolean).join("; ");
|
|
12521
|
+
return summary ? `Obstetric history (${rows.length}): ${summary}` : "";
|
|
12522
|
+
}
|
|
12523
|
+
function formatInfertilityBlock(i) {
|
|
12524
|
+
const bits = nonEmpty([
|
|
12525
|
+
i.type ? `${i.type} infertility` : "",
|
|
12526
|
+
i.durationMonths ? `${i.durationMonths} months` : "",
|
|
12527
|
+
i.female.pcosFeatures ? "PCOS features" : "",
|
|
12528
|
+
i.female.endometriosisSuspicion ? "endometriosis suspicion" : "",
|
|
12529
|
+
i.female.ovulation ? `ovulation: ${i.female.ovulation}` : "",
|
|
12530
|
+
i.male.semenAnalysis ? `semen: ${i.male.semenAnalysis}` : ""
|
|
12531
|
+
]);
|
|
12532
|
+
return bits.length ? `Infertility: ${bits.join(", ")}` : "";
|
|
12533
|
+
}
|
|
12534
|
+
function formatPostOpBlock(p) {
|
|
12535
|
+
const bits = nonEmpty([
|
|
12536
|
+
p.surgeryDate ? `op ${p.surgeryDate}` : "",
|
|
12537
|
+
p.procedure || "",
|
|
12538
|
+
p.woundStatus ? `wound ${p.woundStatus.toLowerCase()}` : "",
|
|
12539
|
+
p.painScore ? `pain ${p.painScore}/10` : "",
|
|
12540
|
+
p.complications ? `complications: ${p.complications}` : ""
|
|
12541
|
+
]);
|
|
12542
|
+
return bits.length ? `Post-op: ${bits.join(", ")}` : "";
|
|
12543
|
+
}
|
|
12544
|
+
var ZONE_FORMATTERS = {
|
|
12545
|
+
menstrual_reproductive: (v) => formatMenstrualBlock(v.menstrual),
|
|
12546
|
+
antenatal: (v) => formatAntenatalBlock(v.antenatal),
|
|
12547
|
+
gynaecological: (v) => formatGynaeBlock(v.gynae),
|
|
12548
|
+
obstetric: (v) => formatObstetricBlock(v.obstetric),
|
|
12549
|
+
infertility: (v) => formatInfertilityBlock(v.infertility),
|
|
12550
|
+
postoperative: (v) => formatPostOpBlock(v.postop)
|
|
12551
|
+
};
|
|
12552
|
+
function formatObgPathwayToSymptomsNarrative(v) {
|
|
12553
|
+
if (!v.zones.length) return "";
|
|
12554
|
+
const sections = [`Pathway: ${v.zones.map(obgZoneLabel).join(", ")}`];
|
|
12555
|
+
for (const z of v.zones) {
|
|
12556
|
+
const block = ZONE_FORMATTERS[z](v).trim();
|
|
12557
|
+
if (block) sections.push(block);
|
|
12558
|
+
}
|
|
12559
|
+
return sections.join("\n\n");
|
|
12560
|
+
}
|
|
12561
|
+
var CLINICAL_EXAMINATION_FIELD = "clinical_examination";
|
|
12562
|
+
var GENERAL_ROWS2 = [
|
|
12563
|
+
{ key: "pallor", label: "Pallor" },
|
|
12564
|
+
{ key: "oedema", label: "Oedema" },
|
|
12565
|
+
{ key: "thyroid", label: "Thyroid" },
|
|
12566
|
+
{ key: "hirsutism", label: "Hirsutism" },
|
|
12567
|
+
{ key: "acanthosis", label: "Acanthosis" }
|
|
12568
|
+
];
|
|
12569
|
+
var ABDOMEN_ROWS = [
|
|
12570
|
+
{ key: "surgicalScars", label: "Surgical scars" },
|
|
12571
|
+
{ key: "massTenderness", label: "Mass / tenderness" }
|
|
12572
|
+
];
|
|
12573
|
+
var BREAST_ROWS = [
|
|
12574
|
+
{ key: "lump", label: "Lump" },
|
|
12575
|
+
{ key: "nippleDischarge", label: "Nipple discharge" },
|
|
12576
|
+
{ key: "skinChanges", label: "Skin changes" },
|
|
12577
|
+
{ key: "axillaryNodes", label: "Axillary nodes" }
|
|
12578
|
+
];
|
|
12579
|
+
var PELVIC_ROWS = [
|
|
12580
|
+
{ key: "speculumDone", label: "Speculum done" },
|
|
12581
|
+
{ key: "discharge", label: "Discharge" },
|
|
12582
|
+
{ key: "cervicalErosion", label: "Cervical erosion" },
|
|
12583
|
+
{ key: "cervicalGrowth", label: "Cervical growth" },
|
|
12584
|
+
{ key: "activeBleeding", label: "Active bleeding" },
|
|
12585
|
+
{ key: "bimanualDone", label: "Bimanual done" },
|
|
12586
|
+
{ key: "adnexalMass", label: "Adnexal mass" },
|
|
12587
|
+
{ key: "cmt", label: "Cervical motion tenderness" }
|
|
12588
|
+
];
|
|
12589
|
+
var UTERUS_OPTIONS = [
|
|
12590
|
+
{ value: "", label: "\u2014" },
|
|
12591
|
+
{ value: "Normal", label: "Normal" },
|
|
12592
|
+
{ value: "Bulky", label: "Bulky" },
|
|
12593
|
+
{ value: "Enlarged", label: "Enlarged" }
|
|
12594
|
+
];
|
|
12595
|
+
var OBGExaminationWidget = ({ fieldId }) => {
|
|
12596
|
+
const { fieldDef, value, setValue, setTouched, error, touched, disabled } = useField(fieldId);
|
|
12597
|
+
const clinicalField = useField(CLINICAL_EXAMINATION_FIELD);
|
|
12598
|
+
const { state } = useForm();
|
|
12599
|
+
const showError = !!error && (touched || state.submitAttempted);
|
|
12600
|
+
const safe = useMemo(() => normalizeObgExamination(value), [value]);
|
|
12601
|
+
useEffect(() => {
|
|
12602
|
+
if (disabled) return;
|
|
12603
|
+
const norm = normalizeObgExamination(value);
|
|
12604
|
+
const next = formatObgExaminationToClinicalExamination(norm);
|
|
12605
|
+
clinicalField.setValue(next);
|
|
12606
|
+
if (norm.examinationNotes !== next) {
|
|
12607
|
+
setValue({ ...norm, examinationNotes: next });
|
|
12608
|
+
}
|
|
12609
|
+
}, [value, disabled]);
|
|
12610
|
+
const bump = (next) => {
|
|
12611
|
+
setValue(next);
|
|
12612
|
+
setTouched();
|
|
12613
|
+
};
|
|
12614
|
+
const toggleGeneral = (key) => bump({ ...safe, general: { ...safe.general, [key]: !safe.general[key] } });
|
|
12615
|
+
const toggleAbdomen = (key) => bump({ ...safe, abdomen: { ...safe.abdomen, [key]: !safe.abdomen[key] } });
|
|
12616
|
+
const toggleBreast = (key) => bump({ ...safe, breast: { ...safe.breast, [key]: !safe.breast[key] } });
|
|
12617
|
+
const togglePelvic = (key) => {
|
|
12618
|
+
const nextPelvic = { ...safe.pelvic, [key]: !safe.pelvic[key] };
|
|
12619
|
+
const nextUterus = !nextPelvic.bimanualDone ? "" : safe.uterusSize;
|
|
12620
|
+
bump({ ...safe, pelvic: nextPelvic, uterusSize: nextUterus });
|
|
12621
|
+
};
|
|
12622
|
+
const setUterusSize = (val) => bump({ ...safe, uterusSize: val });
|
|
12623
|
+
if (!fieldDef) return null;
|
|
12624
|
+
const theme = getThemeConfig("textarea", fieldDef.theme);
|
|
12625
|
+
const wrapperClass = theme?.wrapperClassName ?? "rounded-md overflow-hidden flex flex-col border border-[#D0D0D0]";
|
|
12626
|
+
const labelClass = theme?.labelClassName;
|
|
12627
|
+
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12628
|
+
fieldDef.label,
|
|
12629
|
+
fieldDef.required ? /* @__PURE__ */ jsx("span", { className: "ml-1 text-red-500", children: "*" }) : null
|
|
12630
|
+
] });
|
|
12631
|
+
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
12632
|
+
const bodyClass = cn(
|
|
12633
|
+
"-mt-1 flex min-w-0 flex-col gap-3 border-t border-[#D0D0D0] bg-white px-3 py-3",
|
|
12634
|
+
disabled && "pointer-events-none opacity-60"
|
|
12635
|
+
);
|
|
12636
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("w-full min-w-0", wrapperClass), children: [
|
|
12637
|
+
labelEl,
|
|
12638
|
+
fieldDef.description ? /* @__PURE__ */ jsx("p", { className: "px-3 pt-2 text-[11px] text-muted-foreground", children: fieldDef.description }) : null,
|
|
12639
|
+
/* @__PURE__ */ jsxs("div", { className: bodyClass, children: [
|
|
12640
|
+
showError ? /* @__PURE__ */ jsx("p", { className: "text-xs text-red-600", children: error }) : null,
|
|
12641
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-3 text-xs md:grid-cols-2 xl:grid-cols-4", children: [
|
|
12642
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
12643
|
+
/* @__PURE__ */ jsx("p", { className: "font-semibold text-slate-800", children: "General" }),
|
|
12644
|
+
GENERAL_ROWS2.map((r) => /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
12645
|
+
/* @__PURE__ */ jsx(
|
|
12646
|
+
Checkbox,
|
|
12647
|
+
{
|
|
12648
|
+
checked: safe.general[r.key],
|
|
12649
|
+
onCheckedChange: () => toggleGeneral(r.key),
|
|
12650
|
+
disabled
|
|
12651
|
+
}
|
|
12652
|
+
),
|
|
12653
|
+
r.label
|
|
12654
|
+
] }, r.key))
|
|
12655
|
+
] }),
|
|
12656
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
12657
|
+
/* @__PURE__ */ jsx("p", { className: "font-semibold text-slate-800", children: "Abdomen" }),
|
|
12658
|
+
ABDOMEN_ROWS.map((r) => /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
12659
|
+
/* @__PURE__ */ jsx(
|
|
12660
|
+
Checkbox,
|
|
12661
|
+
{
|
|
12662
|
+
checked: safe.abdomen[r.key],
|
|
12663
|
+
onCheckedChange: () => toggleAbdomen(r.key),
|
|
12664
|
+
disabled
|
|
12665
|
+
}
|
|
12666
|
+
),
|
|
12667
|
+
r.label
|
|
12668
|
+
] }, r.key)),
|
|
12669
|
+
/* @__PURE__ */ jsx("p", { className: "text-[10px] text-muted-foreground", children: "Pregnancy \u2192 fundal ht / FHR / lie captured in Antenatal pathway." })
|
|
12670
|
+
] }),
|
|
12671
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
12672
|
+
/* @__PURE__ */ jsx("p", { className: "font-semibold text-slate-800", children: "Breast" }),
|
|
12673
|
+
BREAST_ROWS.map((r) => /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
12674
|
+
/* @__PURE__ */ jsx(
|
|
12675
|
+
Checkbox,
|
|
12676
|
+
{
|
|
12677
|
+
checked: safe.breast[r.key],
|
|
12678
|
+
onCheckedChange: () => toggleBreast(r.key),
|
|
12679
|
+
disabled
|
|
12680
|
+
}
|
|
12681
|
+
),
|
|
12682
|
+
r.label
|
|
12683
|
+
] }, r.key))
|
|
12684
|
+
] }),
|
|
12685
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
12686
|
+
/* @__PURE__ */ jsx("p", { className: "font-semibold text-slate-800", children: "Pelvic (consent applied)" }),
|
|
12687
|
+
PELVIC_ROWS.map((r) => /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
12688
|
+
/* @__PURE__ */ jsx(
|
|
12689
|
+
Checkbox,
|
|
12690
|
+
{
|
|
12691
|
+
checked: safe.pelvic[r.key],
|
|
12692
|
+
onCheckedChange: () => togglePelvic(r.key),
|
|
12693
|
+
disabled
|
|
12694
|
+
}
|
|
12695
|
+
),
|
|
12696
|
+
r.label
|
|
12697
|
+
] }, r.key)),
|
|
12698
|
+
safe.pelvic.bimanualDone ? /* @__PURE__ */ jsxs("label", { className: "block pt-1", children: [
|
|
12699
|
+
/* @__PURE__ */ jsx("span", { className: "mb-1 block font-medium", children: "Uterus size (on bimanual)" }),
|
|
12700
|
+
/* @__PURE__ */ jsxs(
|
|
12701
|
+
Select,
|
|
12702
|
+
{
|
|
12703
|
+
value: safe.uterusSize === "" ? "none" : safe.uterusSize,
|
|
12704
|
+
onValueChange: (v) => setUterusSize(v === "none" ? "" : v),
|
|
12705
|
+
disabled,
|
|
12706
|
+
children: [
|
|
12707
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
12708
|
+
/* @__PURE__ */ jsx(SelectContent, { children: UTERUS_OPTIONS.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: opt.value === "" ? "none" : opt.value, children: opt.label }, opt.value || "none")) })
|
|
12709
|
+
]
|
|
12710
|
+
}
|
|
12711
|
+
)
|
|
12712
|
+
] }) : null
|
|
12713
|
+
] })
|
|
12714
|
+
] }),
|
|
12715
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1 border-t border-[#D0D0D0] pt-3", children: [
|
|
12716
|
+
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium", children: "Clinical examination" }),
|
|
12717
|
+
/* @__PURE__ */ jsx(
|
|
12718
|
+
Textarea,
|
|
12719
|
+
{
|
|
12720
|
+
value: formatObgExaminationToClinicalExamination(safe),
|
|
12721
|
+
readOnly: true,
|
|
12722
|
+
disabled,
|
|
12723
|
+
className: "min-h-[80px] text-xs",
|
|
12724
|
+
placeholder: "Derived from examination selections above."
|
|
12725
|
+
}
|
|
12726
|
+
)
|
|
12727
|
+
] })
|
|
12728
|
+
] })
|
|
12729
|
+
] });
|
|
12730
|
+
};
|
|
12731
|
+
var SYMPTOMS_FIELD2 = "symptoms";
|
|
12732
|
+
function Panel3({
|
|
12733
|
+
title,
|
|
12734
|
+
right,
|
|
12735
|
+
children
|
|
12736
|
+
}) {
|
|
12737
|
+
return /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-md border border-[#D0D0D0] bg-white", children: [
|
|
12738
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b border-[#D0D0D0] bg-[#FEE8EC]/50 px-3 py-1.5", children: [
|
|
12739
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-slate-700", children: title }),
|
|
12740
|
+
right
|
|
12741
|
+
] }),
|
|
12742
|
+
/* @__PURE__ */ jsx("div", { className: "p-3 text-xs", children })
|
|
12743
|
+
] });
|
|
12744
|
+
}
|
|
12745
|
+
function ChipRow({
|
|
12746
|
+
options,
|
|
12747
|
+
selected,
|
|
12748
|
+
onToggle,
|
|
12749
|
+
disabled
|
|
12750
|
+
}) {
|
|
12751
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: options.map((o) => {
|
|
12752
|
+
const on = !!selected[o.key];
|
|
12753
|
+
return /* @__PURE__ */ jsx(
|
|
12754
|
+
"button",
|
|
12755
|
+
{
|
|
12756
|
+
type: "button",
|
|
12757
|
+
onClick: () => onToggle(o.key),
|
|
12758
|
+
disabled,
|
|
12759
|
+
className: cn(
|
|
12760
|
+
"rounded-full border px-3 py-1 text-[11px] transition-colors",
|
|
12761
|
+
on ? "border-rose-500 bg-rose-50 text-rose-700" : "border-slate-300 bg-white text-slate-600 hover:bg-slate-50"
|
|
12762
|
+
),
|
|
12763
|
+
children: o.label
|
|
12764
|
+
},
|
|
12765
|
+
o.key
|
|
12766
|
+
);
|
|
12767
|
+
}) });
|
|
12768
|
+
}
|
|
12769
|
+
var OBGPathwayWidget = ({ fieldId }) => {
|
|
12770
|
+
const { fieldDef, value, setValue, setTouched, error, touched, disabled } = useField(fieldId);
|
|
12771
|
+
const symptomsField = useField(SYMPTOMS_FIELD2);
|
|
12772
|
+
const { state } = useForm();
|
|
12773
|
+
const showError = !!error && (touched || state.submitAttempted);
|
|
12774
|
+
const safe = useMemo(() => normalizeObgPathway(value), [value]);
|
|
12775
|
+
const prevZoneCountRef = useRef(0);
|
|
12776
|
+
useEffect(() => {
|
|
12777
|
+
if (disabled) return;
|
|
12778
|
+
const zoneCount = safe.zones.length;
|
|
12779
|
+
if (!zoneCount) {
|
|
12780
|
+
if (prevZoneCountRef.current > 0) {
|
|
12781
|
+
symptomsField.setValue("");
|
|
12782
|
+
}
|
|
12783
|
+
prevZoneCountRef.current = 0;
|
|
12784
|
+
return;
|
|
12785
|
+
}
|
|
12786
|
+
prevZoneCountRef.current = zoneCount;
|
|
12787
|
+
const next = formatObgPathwayToSymptomsNarrative(safe);
|
|
12788
|
+
if (typeof symptomsField.value !== "string" || symptomsField.value !== next) {
|
|
12789
|
+
symptomsField.setValue(next);
|
|
12790
|
+
}
|
|
12791
|
+
}, [safe, disabled]);
|
|
12792
|
+
const update = (next) => {
|
|
12793
|
+
setValue(next);
|
|
12794
|
+
setTouched();
|
|
12795
|
+
};
|
|
12796
|
+
if (!fieldDef) return null;
|
|
12797
|
+
const theme = getThemeConfig("textarea", fieldDef.theme);
|
|
12798
|
+
const wrapperClass = theme?.wrapperClassName ?? "rounded-md overflow-hidden flex flex-col border border-[#D0D0D0]";
|
|
12799
|
+
const labelClass = theme?.labelClassName;
|
|
12800
|
+
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12801
|
+
fieldDef.label,
|
|
12802
|
+
fieldDef.required ? /* @__PURE__ */ jsx("span", { className: "ml-1 text-red-500", children: "*" }) : null
|
|
12803
|
+
] });
|
|
12804
|
+
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
12805
|
+
const bodyClass = cn(
|
|
12806
|
+
"-mt-1 flex min-w-0 flex-col gap-3 border-t border-[#D0D0D0] bg-white px-3 py-3",
|
|
12807
|
+
disabled && "pointer-events-none opacity-60"
|
|
12808
|
+
);
|
|
12809
|
+
const hasZone = (z) => safe.zones.includes(z);
|
|
12810
|
+
const toggleZone = (z) => update({
|
|
12811
|
+
...safe,
|
|
12812
|
+
zones: hasZone(z) ? safe.zones.filter((x) => x !== z) : OBG_ZONE_ORDER.filter((x) => x === z || hasZone(x))
|
|
12813
|
+
});
|
|
12814
|
+
const m = safe.menstrual;
|
|
12815
|
+
const setMenstrual = (patch) => update({ ...safe, menstrual: { ...m, ...patch } });
|
|
12816
|
+
const a = safe.antenatal;
|
|
12817
|
+
const setAntenatal = (patch) => update({ ...safe, antenatal: { ...a, ...patch } });
|
|
12818
|
+
const setAntenatalSymptom = (key) => update({
|
|
12819
|
+
...safe,
|
|
12820
|
+
antenatal: { ...a, symptoms: { ...a.symptoms, [key]: !a.symptoms[key] } }
|
|
12821
|
+
});
|
|
12822
|
+
const setAntenatalExam = (patch) => update({ ...safe, antenatal: { ...a, exam: { ...a.exam, ...patch } } });
|
|
12823
|
+
const setAntenatalInv = (patch) => update({
|
|
12824
|
+
...safe,
|
|
12825
|
+
antenatal: { ...a, investigations: { ...a.investigations, ...patch } }
|
|
12826
|
+
});
|
|
12827
|
+
const gSym = safe.gynae.symptoms;
|
|
12828
|
+
const toggleGynae = (key) => update({ ...safe, gynae: { symptoms: { ...gSym, [key]: !gSym[key] } } });
|
|
12829
|
+
const setObstetric = (rows) => update({ ...safe, obstetric: rows });
|
|
12830
|
+
const addObstetricRow = () => setObstetric([
|
|
12831
|
+
...safe.obstetric,
|
|
12832
|
+
{ year: "", ga: "", mode: "", indicationLscs: "", babyOutcome: "", complications: "" }
|
|
12833
|
+
]);
|
|
12834
|
+
const updateObstetricRow = (idx, patch) => setObstetric(safe.obstetric.map((row, i) => i === idx ? { ...row, ...patch } : row));
|
|
12835
|
+
const deleteObstetricRow = (idx) => setObstetric(safe.obstetric.filter((_, i) => i !== idx));
|
|
12836
|
+
const inf = safe.infertility;
|
|
12837
|
+
const setInfertility = (patch) => update({ ...safe, infertility: { ...inf, ...patch } });
|
|
12838
|
+
const po = safe.postop;
|
|
12839
|
+
const setPostop = (patch) => update({ ...safe, postop: { ...po, ...patch } });
|
|
12840
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("w-full min-w-0", wrapperClass), children: [
|
|
12841
|
+
labelEl,
|
|
12842
|
+
fieldDef.description ? /* @__PURE__ */ jsx("p", { className: "px-3 pt-2 text-[11px] text-muted-foreground", children: fieldDef.description }) : null,
|
|
12843
|
+
/* @__PURE__ */ jsxs("div", { className: bodyClass, children: [
|
|
12844
|
+
showError ? /* @__PURE__ */ jsx("p", { className: "text-xs text-red-600", children: error }) : null,
|
|
12845
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
12846
|
+
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium", children: "Primary concern (Consultant zone \u2014 multi-select)" }),
|
|
12847
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: OBG_ZONE_ORDER.map((z) => {
|
|
12848
|
+
const on = hasZone(z);
|
|
12849
|
+
return /* @__PURE__ */ jsx(
|
|
12850
|
+
"button",
|
|
12851
|
+
{
|
|
12852
|
+
type: "button",
|
|
12853
|
+
onClick: () => toggleZone(z),
|
|
12854
|
+
disabled,
|
|
12855
|
+
"aria-pressed": on,
|
|
12856
|
+
className: cn(
|
|
12857
|
+
"rounded-full border px-3 py-1 text-[11px] transition-colors",
|
|
12858
|
+
on ? "border-rose-500 bg-rose-50 text-rose-700" : "border-slate-300 bg-white text-slate-600 hover:bg-slate-50"
|
|
12859
|
+
),
|
|
12860
|
+
children: obgZoneLabel(z)
|
|
12861
|
+
},
|
|
12862
|
+
z
|
|
12863
|
+
);
|
|
12864
|
+
}) })
|
|
12865
|
+
] }),
|
|
12866
|
+
hasZone("menstrual_reproductive") ? /* @__PURE__ */ jsx(Panel3, { title: "Menstrual & reproductive history", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-4", children: [
|
|
12867
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
12868
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Menarche (age)" }),
|
|
12869
|
+
/* @__PURE__ */ jsx(
|
|
12870
|
+
Input,
|
|
12871
|
+
{
|
|
12872
|
+
type: "number",
|
|
12873
|
+
min: 5,
|
|
12874
|
+
max: 25,
|
|
12875
|
+
className: "h-8 text-xs",
|
|
12876
|
+
value: m.menarcheAge,
|
|
12877
|
+
onChange: (e) => setMenstrual({ menarcheAge: Number(e.target.value) || 0 }),
|
|
12878
|
+
disabled
|
|
12879
|
+
}
|
|
12880
|
+
)
|
|
12881
|
+
] }),
|
|
12882
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
12883
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Cycle (days)" }),
|
|
12884
|
+
/* @__PURE__ */ jsx(
|
|
12885
|
+
Input,
|
|
12886
|
+
{
|
|
12887
|
+
type: "number",
|
|
12888
|
+
min: 0,
|
|
12889
|
+
max: 120,
|
|
12890
|
+
className: "h-8 text-xs",
|
|
12891
|
+
value: m.cycleLength,
|
|
12892
|
+
onChange: (e) => setMenstrual({ cycleLength: Number(e.target.value) || 0 }),
|
|
12893
|
+
disabled
|
|
12894
|
+
}
|
|
12895
|
+
)
|
|
12896
|
+
] }),
|
|
12897
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
12898
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Flow (days)" }),
|
|
12899
|
+
/* @__PURE__ */ jsx(
|
|
12900
|
+
Input,
|
|
12901
|
+
{
|
|
12902
|
+
type: "number",
|
|
12903
|
+
min: 0,
|
|
12904
|
+
max: 30,
|
|
12905
|
+
className: "h-8 text-xs",
|
|
12906
|
+
value: m.flowDays,
|
|
12907
|
+
onChange: (e) => setMenstrual({ flowDays: Number(e.target.value) || 0 }),
|
|
12908
|
+
disabled
|
|
12909
|
+
}
|
|
12910
|
+
)
|
|
12911
|
+
] }),
|
|
12912
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-end gap-2 pb-1", children: [
|
|
12913
|
+
/* @__PURE__ */ jsx(
|
|
12914
|
+
Checkbox,
|
|
12915
|
+
{
|
|
12916
|
+
checked: m.cycleRegular,
|
|
12917
|
+
onCheckedChange: (c) => setMenstrual({ cycleRegular: c === true }),
|
|
12918
|
+
disabled
|
|
12919
|
+
}
|
|
12920
|
+
),
|
|
12921
|
+
/* @__PURE__ */ jsx("span", { children: "Regular cycle" })
|
|
12922
|
+
] }),
|
|
12923
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
12924
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Amount of flow" }),
|
|
12925
|
+
/* @__PURE__ */ jsxs(
|
|
12926
|
+
Select,
|
|
12927
|
+
{
|
|
12928
|
+
value: m.amount === "" ? "none" : m.amount,
|
|
12929
|
+
onValueChange: (v) => setMenstrual({ amount: v === "none" ? "" : v }),
|
|
12930
|
+
disabled,
|
|
12931
|
+
children: [
|
|
12932
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
12933
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
12934
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
12935
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Scanty", children: "Scanty" }),
|
|
12936
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Normal", children: "Normal" }),
|
|
12937
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Heavy", children: "Heavy" })
|
|
12938
|
+
] })
|
|
12939
|
+
]
|
|
12940
|
+
}
|
|
12941
|
+
)
|
|
12942
|
+
] }),
|
|
12943
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
12944
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Dysmenorrhea" }),
|
|
12945
|
+
/* @__PURE__ */ jsxs(
|
|
12946
|
+
Select,
|
|
12947
|
+
{
|
|
12948
|
+
value: String(m.dysmenorrhea),
|
|
12949
|
+
onValueChange: (v) => setMenstrual({ dysmenorrhea: Number(v) ?? 0 }),
|
|
12950
|
+
disabled,
|
|
12951
|
+
children: [
|
|
12952
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "0" }) }),
|
|
12953
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
12954
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "0", children: "0 \u2014 none" }),
|
|
12955
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "1", children: "1 \u2014 mild" }),
|
|
12956
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "2", children: "2 \u2014 moderate" }),
|
|
12957
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "3", children: "3 \u2014 severe" })
|
|
12958
|
+
] })
|
|
12959
|
+
]
|
|
12960
|
+
}
|
|
12961
|
+
)
|
|
12962
|
+
] }),
|
|
12963
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
12964
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "LMP" }),
|
|
12965
|
+
/* @__PURE__ */ jsx(
|
|
12966
|
+
Input,
|
|
12967
|
+
{
|
|
12968
|
+
type: "date",
|
|
12969
|
+
className: "h-8 text-xs",
|
|
12970
|
+
value: m.lmp,
|
|
12971
|
+
onChange: (e) => setMenstrual({ lmp: e.target.value }),
|
|
12972
|
+
disabled
|
|
12973
|
+
}
|
|
12974
|
+
)
|
|
12975
|
+
] }),
|
|
12976
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
12977
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Menopause status" }),
|
|
12978
|
+
/* @__PURE__ */ jsxs(
|
|
12979
|
+
Select,
|
|
12980
|
+
{
|
|
12981
|
+
value: m.menopauseStatus === "" ? "none" : m.menopauseStatus,
|
|
12982
|
+
onValueChange: (v) => setMenstrual({
|
|
12983
|
+
menopauseStatus: v === "none" ? "" : v
|
|
12984
|
+
}),
|
|
12985
|
+
disabled,
|
|
12986
|
+
children: [
|
|
12987
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
12988
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
12989
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
12990
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Pre", children: "Pre" }),
|
|
12991
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Peri", children: "Peri" }),
|
|
12992
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Post", children: "Post" })
|
|
12993
|
+
] })
|
|
12994
|
+
]
|
|
12995
|
+
}
|
|
12996
|
+
)
|
|
12997
|
+
] })
|
|
12998
|
+
] }) }) : null,
|
|
12999
|
+
hasZone("antenatal") ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
13000
|
+
/* @__PURE__ */ jsx(Panel3, { title: "Current pregnancy details", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-4", children: [
|
|
13001
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13002
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Gravida" }),
|
|
13003
|
+
/* @__PURE__ */ jsx(
|
|
13004
|
+
Input,
|
|
13005
|
+
{
|
|
13006
|
+
type: "number",
|
|
13007
|
+
min: 0,
|
|
13008
|
+
className: "h-8 text-xs",
|
|
13009
|
+
value: a.gravida,
|
|
13010
|
+
onChange: (e) => setAntenatal({ gravida: Number(e.target.value) || 0 }),
|
|
13011
|
+
disabled
|
|
13012
|
+
}
|
|
13013
|
+
)
|
|
13014
|
+
] }),
|
|
13015
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
13016
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "GA (LMP) \u2014 w / d" }),
|
|
13017
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
13018
|
+
/* @__PURE__ */ jsx(
|
|
13019
|
+
Input,
|
|
13020
|
+
{
|
|
13021
|
+
type: "number",
|
|
13022
|
+
min: 0,
|
|
13023
|
+
max: 45,
|
|
13024
|
+
className: "h-8 text-xs",
|
|
13025
|
+
value: a.gaWeeksLmp,
|
|
13026
|
+
onChange: (e) => setAntenatal({ gaWeeksLmp: Number(e.target.value) || 0 }),
|
|
13027
|
+
disabled
|
|
13028
|
+
}
|
|
13029
|
+
),
|
|
13030
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: "w" }),
|
|
13031
|
+
/* @__PURE__ */ jsx(
|
|
13032
|
+
Input,
|
|
13033
|
+
{
|
|
13034
|
+
type: "number",
|
|
13035
|
+
min: 0,
|
|
13036
|
+
max: 6,
|
|
13037
|
+
className: "h-8 text-xs",
|
|
13038
|
+
value: a.gaDaysLmp,
|
|
13039
|
+
onChange: (e) => setAntenatal({ gaDaysLmp: Number(e.target.value) || 0 }),
|
|
13040
|
+
disabled
|
|
13041
|
+
}
|
|
13042
|
+
),
|
|
13043
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: "d" })
|
|
13044
|
+
] })
|
|
13045
|
+
] }),
|
|
13046
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
13047
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "GA (USG) \u2014 w / d" }),
|
|
13048
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
13049
|
+
/* @__PURE__ */ jsx(
|
|
13050
|
+
Input,
|
|
13051
|
+
{
|
|
13052
|
+
type: "number",
|
|
13053
|
+
min: 0,
|
|
13054
|
+
max: 45,
|
|
13055
|
+
className: "h-8 text-xs",
|
|
13056
|
+
value: a.gaWeeksUsg,
|
|
13057
|
+
onChange: (e) => setAntenatal({ gaWeeksUsg: Number(e.target.value) || 0 }),
|
|
13058
|
+
disabled
|
|
13059
|
+
}
|
|
13060
|
+
),
|
|
13061
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: "w" }),
|
|
13062
|
+
/* @__PURE__ */ jsx(
|
|
13063
|
+
Input,
|
|
13064
|
+
{
|
|
13065
|
+
type: "number",
|
|
13066
|
+
min: 0,
|
|
13067
|
+
max: 6,
|
|
13068
|
+
className: "h-8 text-xs",
|
|
13069
|
+
value: a.gaDaysUsg,
|
|
13070
|
+
onChange: (e) => setAntenatal({ gaDaysUsg: Number(e.target.value) || 0 }),
|
|
13071
|
+
disabled
|
|
13072
|
+
}
|
|
13073
|
+
),
|
|
13074
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: "d" })
|
|
13075
|
+
] })
|
|
13076
|
+
] }),
|
|
13077
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13078
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "EDD" }),
|
|
13079
|
+
/* @__PURE__ */ jsx(
|
|
13080
|
+
Input,
|
|
13081
|
+
{
|
|
13082
|
+
type: "date",
|
|
13083
|
+
className: "h-8 text-xs",
|
|
13084
|
+
value: a.edd,
|
|
13085
|
+
onChange: (e) => setAntenatal({ edd: e.target.value }),
|
|
13086
|
+
disabled
|
|
13087
|
+
}
|
|
13088
|
+
)
|
|
13089
|
+
] }),
|
|
13090
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1 md:col-span-2", children: [
|
|
13091
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Risk category" }),
|
|
13092
|
+
/* @__PURE__ */ jsxs(
|
|
13093
|
+
Select,
|
|
13094
|
+
{
|
|
13095
|
+
value: a.riskCategory === "" ? "none" : a.riskCategory,
|
|
13096
|
+
onValueChange: (v) => setAntenatal({
|
|
13097
|
+
riskCategory: v === "none" ? "" : v
|
|
13098
|
+
}),
|
|
13099
|
+
disabled,
|
|
13100
|
+
children: [
|
|
13101
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
13102
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
13103
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
13104
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Low", children: "Low" }),
|
|
13105
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "High", children: "High" })
|
|
13106
|
+
] })
|
|
13107
|
+
]
|
|
13108
|
+
}
|
|
13109
|
+
)
|
|
13110
|
+
] })
|
|
13111
|
+
] }) }),
|
|
13112
|
+
/* @__PURE__ */ jsx(Panel3, { title: "Antenatal symptoms", children: /* @__PURE__ */ jsx(
|
|
13113
|
+
ChipRow,
|
|
13114
|
+
{
|
|
13115
|
+
options: [
|
|
13116
|
+
{ key: "nauseaVomiting", label: "Nausea / vomiting" },
|
|
13117
|
+
{ key: "bleedingPV", label: "Bleeding PV" },
|
|
13118
|
+
{ key: "painAbdomen", label: "Pain abdomen" },
|
|
13119
|
+
{ key: "decreasedFetalMovements", label: "Decreased fetal movements" }
|
|
13120
|
+
],
|
|
13121
|
+
selected: a.symptoms,
|
|
13122
|
+
onToggle: (k) => setAntenatalSymptom(k),
|
|
13123
|
+
disabled
|
|
13124
|
+
}
|
|
13125
|
+
) }),
|
|
13126
|
+
/* @__PURE__ */ jsx(Panel3, { title: "Antenatal examination", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-4", children: [
|
|
13127
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13128
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Weight (kg)" }),
|
|
13129
|
+
/* @__PURE__ */ jsx(
|
|
13130
|
+
Input,
|
|
13131
|
+
{
|
|
13132
|
+
type: "number",
|
|
13133
|
+
className: "h-8 text-xs",
|
|
13134
|
+
value: a.exam.weightKg,
|
|
13135
|
+
onChange: (e) => setAntenatalExam({ weightKg: Number(e.target.value) || 0 }),
|
|
13136
|
+
disabled
|
|
13137
|
+
}
|
|
13138
|
+
)
|
|
13139
|
+
] }),
|
|
13140
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13141
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Height (cm)" }),
|
|
13142
|
+
/* @__PURE__ */ jsx(
|
|
13143
|
+
Input,
|
|
13144
|
+
{
|
|
13145
|
+
type: "number",
|
|
13146
|
+
className: "h-8 text-xs",
|
|
13147
|
+
value: a.exam.heightCm,
|
|
13148
|
+
onChange: (e) => setAntenatalExam({ heightCm: Number(e.target.value) || 0 }),
|
|
13149
|
+
disabled
|
|
13150
|
+
}
|
|
13151
|
+
)
|
|
13152
|
+
] }),
|
|
13153
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13154
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "BMI" }),
|
|
13155
|
+
/* @__PURE__ */ jsx(
|
|
13156
|
+
Input,
|
|
13157
|
+
{
|
|
13158
|
+
type: "number",
|
|
13159
|
+
step: 0.1,
|
|
13160
|
+
className: "h-8 text-xs",
|
|
13161
|
+
value: a.exam.bmi,
|
|
13162
|
+
onChange: (e) => setAntenatalExam({ bmi: Number(e.target.value) || 0 }),
|
|
13163
|
+
disabled
|
|
13164
|
+
}
|
|
13165
|
+
)
|
|
13166
|
+
] }),
|
|
13167
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13168
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "BP" }),
|
|
13169
|
+
/* @__PURE__ */ jsx(
|
|
13170
|
+
Input,
|
|
13171
|
+
{
|
|
13172
|
+
placeholder: "e.g. 120/80",
|
|
13173
|
+
className: "h-8 text-xs",
|
|
13174
|
+
value: a.exam.bp,
|
|
13175
|
+
onChange: (e) => setAntenatalExam({ bp: e.target.value }),
|
|
13176
|
+
disabled
|
|
13177
|
+
}
|
|
13178
|
+
)
|
|
13179
|
+
] }),
|
|
13180
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-end gap-2 pb-1", children: [
|
|
13181
|
+
/* @__PURE__ */ jsx(
|
|
13182
|
+
Checkbox,
|
|
13183
|
+
{
|
|
13184
|
+
checked: a.exam.pallor,
|
|
13185
|
+
onCheckedChange: (c) => setAntenatalExam({ pallor: c === true }),
|
|
13186
|
+
disabled
|
|
13187
|
+
}
|
|
13188
|
+
),
|
|
13189
|
+
/* @__PURE__ */ jsx("span", { children: "Pallor" })
|
|
13190
|
+
] }),
|
|
13191
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-end gap-2 pb-1", children: [
|
|
13192
|
+
/* @__PURE__ */ jsx(
|
|
13193
|
+
Checkbox,
|
|
13194
|
+
{
|
|
13195
|
+
checked: a.exam.oedema,
|
|
13196
|
+
onCheckedChange: (c) => setAntenatalExam({ oedema: c === true }),
|
|
13197
|
+
disabled
|
|
13198
|
+
}
|
|
13199
|
+
),
|
|
13200
|
+
/* @__PURE__ */ jsx("span", { children: "Oedema" })
|
|
13201
|
+
] }),
|
|
13202
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13203
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Fundal height (cm)" }),
|
|
13204
|
+
/* @__PURE__ */ jsx(
|
|
13205
|
+
Input,
|
|
13206
|
+
{
|
|
13207
|
+
type: "number",
|
|
13208
|
+
className: "h-8 text-xs",
|
|
13209
|
+
value: a.exam.fundalHeightCm,
|
|
13210
|
+
onChange: (e) => setAntenatalExam({ fundalHeightCm: Number(e.target.value) || 0 }),
|
|
13211
|
+
disabled
|
|
13212
|
+
}
|
|
13213
|
+
)
|
|
13214
|
+
] }),
|
|
13215
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13216
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "FHR (bpm)" }),
|
|
13217
|
+
/* @__PURE__ */ jsx(
|
|
13218
|
+
Input,
|
|
13219
|
+
{
|
|
13220
|
+
type: "number",
|
|
13221
|
+
className: "h-8 text-xs",
|
|
13222
|
+
value: a.exam.fhrBpm,
|
|
13223
|
+
onChange: (e) => setAntenatalExam({ fhrBpm: Number(e.target.value) || 0 }),
|
|
13224
|
+
disabled
|
|
13225
|
+
}
|
|
13226
|
+
)
|
|
13227
|
+
] }),
|
|
13228
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13229
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Presentation" }),
|
|
13230
|
+
/* @__PURE__ */ jsxs(
|
|
13231
|
+
Select,
|
|
13232
|
+
{
|
|
13233
|
+
value: a.exam.presentation === "" ? "none" : a.exam.presentation,
|
|
13234
|
+
onValueChange: (v) => setAntenatalExam({
|
|
13235
|
+
presentation: v === "none" ? "" : v
|
|
13236
|
+
}),
|
|
13237
|
+
disabled,
|
|
13238
|
+
children: [
|
|
13239
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
13240
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
13241
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
13242
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Cephalic", children: "Cephalic" }),
|
|
13243
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Breech", children: "Breech" }),
|
|
13244
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Other", children: "Other" })
|
|
13245
|
+
] })
|
|
13246
|
+
]
|
|
13247
|
+
}
|
|
13248
|
+
)
|
|
13249
|
+
] }),
|
|
13250
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13251
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Lie" }),
|
|
13252
|
+
/* @__PURE__ */ jsxs(
|
|
13253
|
+
Select,
|
|
13254
|
+
{
|
|
13255
|
+
value: a.exam.lie === "" ? "none" : a.exam.lie,
|
|
13256
|
+
onValueChange: (v) => setAntenatalExam({ lie: v === "none" ? "" : v }),
|
|
13257
|
+
disabled,
|
|
13258
|
+
children: [
|
|
13259
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
13260
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
13261
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
13262
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Longitudinal", children: "Longitudinal" }),
|
|
13263
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Transverse", children: "Transverse" }),
|
|
13264
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Oblique", children: "Oblique" })
|
|
13265
|
+
] })
|
|
13266
|
+
]
|
|
13267
|
+
}
|
|
13268
|
+
)
|
|
13269
|
+
] })
|
|
13270
|
+
] }) }),
|
|
13271
|
+
/* @__PURE__ */ jsx(Panel3, { title: "Investigations tracker", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-3", children: [
|
|
13272
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13273
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Blood Group / Rh" }),
|
|
13274
|
+
/* @__PURE__ */ jsx(
|
|
13275
|
+
Input,
|
|
13276
|
+
{
|
|
13277
|
+
className: "h-8 text-xs",
|
|
13278
|
+
placeholder: "e.g. O+ve",
|
|
13279
|
+
value: a.investigations.bloodGroup,
|
|
13280
|
+
onChange: (e) => setAntenatalInv({ bloodGroup: e.target.value }),
|
|
13281
|
+
disabled
|
|
13282
|
+
}
|
|
13283
|
+
)
|
|
13284
|
+
] }),
|
|
13285
|
+
[
|
|
13286
|
+
{ key: "cbc", label: "CBC" },
|
|
13287
|
+
{ key: "tsh", label: "TSH" },
|
|
13288
|
+
{ key: "rbsOgtt", label: "RBS / OGTT" },
|
|
13289
|
+
{ key: "serology", label: "HIV / HBsAg / VDRL" },
|
|
13290
|
+
{ key: "urine", label: "Urine routine" }
|
|
13291
|
+
].map((row) => /* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13292
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: row.label }),
|
|
13293
|
+
/* @__PURE__ */ jsxs(
|
|
13294
|
+
Select,
|
|
13295
|
+
{
|
|
13296
|
+
value: a.investigations[row.key] === "" ? "none" : a.investigations[row.key],
|
|
13297
|
+
onValueChange: (v) => setAntenatalInv({
|
|
13298
|
+
[row.key]: v === "none" ? "" : v
|
|
13299
|
+
}),
|
|
13300
|
+
disabled,
|
|
13301
|
+
children: [
|
|
13302
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
13303
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
13304
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
13305
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Done", children: "Done" }),
|
|
13306
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Pending", children: "Pending" }),
|
|
13307
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Abnormal", children: "Abnormal" })
|
|
13308
|
+
] })
|
|
13309
|
+
]
|
|
13310
|
+
}
|
|
13311
|
+
)
|
|
13312
|
+
] }, row.key)),
|
|
13313
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13314
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "USG" }),
|
|
13315
|
+
/* @__PURE__ */ jsxs(
|
|
13316
|
+
Select,
|
|
13317
|
+
{
|
|
13318
|
+
value: a.investigations.usg === "" ? "none" : a.investigations.usg,
|
|
13319
|
+
onValueChange: (v) => setAntenatalInv({
|
|
13320
|
+
usg: v === "none" ? "" : v
|
|
13321
|
+
}),
|
|
13322
|
+
disabled,
|
|
13323
|
+
children: [
|
|
13324
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
13325
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
13326
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
13327
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Dating", children: "Dating" }),
|
|
13328
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "NT", children: "NT" }),
|
|
13329
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Anomaly", children: "Anomaly" }),
|
|
13330
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Growth", children: "Growth" }),
|
|
13331
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Pending", children: "Pending" })
|
|
13332
|
+
] })
|
|
13333
|
+
]
|
|
13334
|
+
}
|
|
13335
|
+
)
|
|
13336
|
+
] })
|
|
13337
|
+
] }) })
|
|
13338
|
+
] }) : null,
|
|
13339
|
+
hasZone("gynaecological") ? /* @__PURE__ */ jsx(Panel3, { title: "Gynaecological symptoms", children: /* @__PURE__ */ jsx(
|
|
13340
|
+
ChipRow,
|
|
13341
|
+
{
|
|
13342
|
+
options: [
|
|
13343
|
+
{ key: "aub", label: "Abnormal uterine bleeding" },
|
|
13344
|
+
{ key: "whiteDischarge", label: "White discharge" },
|
|
13345
|
+
{ key: "pelvicPain", label: "Pelvic pain" },
|
|
13346
|
+
{ key: "dyspareunia", label: "Dyspareunia" },
|
|
13347
|
+
{ key: "urinaryComplaints", label: "Urinary complaints" },
|
|
13348
|
+
{ key: "prolapse", label: "Prolapse" }
|
|
13349
|
+
],
|
|
13350
|
+
selected: gSym,
|
|
13351
|
+
onToggle: (k) => toggleGynae(k),
|
|
13352
|
+
disabled
|
|
13353
|
+
}
|
|
13354
|
+
) }) : null,
|
|
13355
|
+
hasZone("obstetric") ? /* @__PURE__ */ jsx(
|
|
13356
|
+
Panel3,
|
|
13357
|
+
{
|
|
13358
|
+
title: "Obstetric history (G-P-A-L)",
|
|
13359
|
+
right: /* @__PURE__ */ jsx(
|
|
13360
|
+
Button,
|
|
13361
|
+
{
|
|
13362
|
+
type: "button",
|
|
13363
|
+
size: "sm",
|
|
13364
|
+
variant: "outline",
|
|
13365
|
+
className: "h-7 text-xs",
|
|
13366
|
+
onClick: addObstetricRow,
|
|
13367
|
+
disabled,
|
|
13368
|
+
children: "+ Add row"
|
|
13369
|
+
}
|
|
13370
|
+
),
|
|
13371
|
+
children: safe.obstetric.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground", children: "No prior pregnancies recorded." }) : /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "w-full text-[11px]", children: [
|
|
13372
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "bg-slate-50 text-left text-slate-600", children: [
|
|
13373
|
+
/* @__PURE__ */ jsx("th", { className: "p-1.5 font-medium", children: "Year" }),
|
|
13374
|
+
/* @__PURE__ */ jsx("th", { className: "p-1.5 font-medium", children: "GA" }),
|
|
13375
|
+
/* @__PURE__ */ jsx("th", { className: "p-1.5 font-medium", children: "Mode" }),
|
|
13376
|
+
/* @__PURE__ */ jsx("th", { className: "p-1.5 font-medium", children: "LSCS indication" }),
|
|
13377
|
+
/* @__PURE__ */ jsx("th", { className: "p-1.5 font-medium", children: "Baby outcome" }),
|
|
13378
|
+
/* @__PURE__ */ jsx("th", { className: "p-1.5 font-medium", children: "Complications" }),
|
|
13379
|
+
/* @__PURE__ */ jsx("th", { className: "p-1.5" })
|
|
13380
|
+
] }) }),
|
|
13381
|
+
/* @__PURE__ */ jsx("tbody", { children: safe.obstetric.map((row, idx) => /* @__PURE__ */ jsxs("tr", { className: "border-t", children: [
|
|
13382
|
+
/* @__PURE__ */ jsx("td", { className: "p-1", children: /* @__PURE__ */ jsx(
|
|
13383
|
+
Input,
|
|
13384
|
+
{
|
|
13385
|
+
className: "h-7 text-[11px]",
|
|
13386
|
+
value: row.year,
|
|
13387
|
+
onChange: (e) => updateObstetricRow(idx, { year: e.target.value }),
|
|
13388
|
+
disabled
|
|
13389
|
+
}
|
|
13390
|
+
) }),
|
|
13391
|
+
/* @__PURE__ */ jsx("td", { className: "p-1", children: /* @__PURE__ */ jsx(
|
|
13392
|
+
Input,
|
|
13393
|
+
{
|
|
13394
|
+
className: "h-7 text-[11px]",
|
|
13395
|
+
value: row.ga,
|
|
13396
|
+
onChange: (e) => updateObstetricRow(idx, { ga: e.target.value }),
|
|
13397
|
+
disabled
|
|
13398
|
+
}
|
|
13399
|
+
) }),
|
|
13400
|
+
/* @__PURE__ */ jsx("td", { className: "p-1", children: /* @__PURE__ */ jsxs(
|
|
13401
|
+
Select,
|
|
13402
|
+
{
|
|
13403
|
+
value: row.mode === "" ? "none" : row.mode,
|
|
13404
|
+
onValueChange: (v) => updateObstetricRow(idx, {
|
|
13405
|
+
mode: v === "none" ? "" : v
|
|
13406
|
+
}),
|
|
13407
|
+
disabled,
|
|
13408
|
+
children: [
|
|
13409
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-7 text-[11px]", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
13410
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
13411
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
13412
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "NVD", children: "NVD" }),
|
|
13413
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "LSCS", children: "LSCS" }),
|
|
13414
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Instrumental", children: "Instrumental" }),
|
|
13415
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Abortion", children: "Abortion" }),
|
|
13416
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Stillbirth", children: "Stillbirth" })
|
|
13417
|
+
] })
|
|
13418
|
+
]
|
|
13419
|
+
}
|
|
13420
|
+
) }),
|
|
13421
|
+
/* @__PURE__ */ jsx("td", { className: "p-1", children: /* @__PURE__ */ jsx(
|
|
13422
|
+
Input,
|
|
13423
|
+
{
|
|
13424
|
+
className: "h-7 text-[11px]",
|
|
13425
|
+
value: row.indicationLscs,
|
|
13426
|
+
onChange: (e) => updateObstetricRow(idx, { indicationLscs: e.target.value }),
|
|
13427
|
+
disabled
|
|
13428
|
+
}
|
|
13429
|
+
) }),
|
|
13430
|
+
/* @__PURE__ */ jsx("td", { className: "p-1", children: /* @__PURE__ */ jsx(
|
|
13431
|
+
Input,
|
|
13432
|
+
{
|
|
13433
|
+
className: "h-7 text-[11px]",
|
|
13434
|
+
value: row.babyOutcome,
|
|
13435
|
+
onChange: (e) => updateObstetricRow(idx, { babyOutcome: e.target.value }),
|
|
13436
|
+
disabled
|
|
13437
|
+
}
|
|
13438
|
+
) }),
|
|
13439
|
+
/* @__PURE__ */ jsx("td", { className: "p-1", children: /* @__PURE__ */ jsx(
|
|
13440
|
+
Input,
|
|
13441
|
+
{
|
|
13442
|
+
className: "h-7 text-[11px]",
|
|
13443
|
+
placeholder: "PIH, GDM, PPH, NICU\u2026",
|
|
13444
|
+
value: row.complications,
|
|
13445
|
+
onChange: (e) => updateObstetricRow(idx, { complications: e.target.value }),
|
|
13446
|
+
disabled
|
|
13447
|
+
}
|
|
13448
|
+
) }),
|
|
13449
|
+
/* @__PURE__ */ jsx("td", { className: "p-1", children: /* @__PURE__ */ jsx(
|
|
13450
|
+
Button,
|
|
13451
|
+
{
|
|
13452
|
+
type: "button",
|
|
13453
|
+
size: "sm",
|
|
13454
|
+
variant: "ghost",
|
|
13455
|
+
className: "h-7 text-[11px] text-rose-600 hover:bg-rose-50",
|
|
13456
|
+
onClick: () => deleteObstetricRow(idx),
|
|
13457
|
+
disabled,
|
|
13458
|
+
children: "\xD7"
|
|
13459
|
+
}
|
|
13460
|
+
) })
|
|
13461
|
+
] }, idx)) })
|
|
13462
|
+
] }) })
|
|
13463
|
+
}
|
|
13464
|
+
) : null,
|
|
13465
|
+
hasZone("infertility") ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
13466
|
+
/* @__PURE__ */ jsx(Panel3, { title: "Infertility profile", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-3", children: [
|
|
13467
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13468
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Type" }),
|
|
13469
|
+
/* @__PURE__ */ jsxs(
|
|
13470
|
+
Select,
|
|
13471
|
+
{
|
|
13472
|
+
value: inf.type === "" ? "none" : inf.type,
|
|
13473
|
+
onValueChange: (v) => setInfertility({ type: v === "none" ? "" : v }),
|
|
13474
|
+
disabled,
|
|
13475
|
+
children: [
|
|
13476
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
13477
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
13478
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
13479
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Primary", children: "Primary" }),
|
|
13480
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Secondary", children: "Secondary" })
|
|
13481
|
+
] })
|
|
13482
|
+
]
|
|
13483
|
+
}
|
|
13484
|
+
)
|
|
13485
|
+
] }),
|
|
13486
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13487
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Duration (months)" }),
|
|
13488
|
+
/* @__PURE__ */ jsx(
|
|
13489
|
+
Input,
|
|
13490
|
+
{
|
|
13491
|
+
type: "number",
|
|
13492
|
+
min: 0,
|
|
13493
|
+
className: "h-8 text-xs",
|
|
13494
|
+
value: inf.durationMonths,
|
|
13495
|
+
onChange: (e) => setInfertility({ durationMonths: Number(e.target.value) || 0 }),
|
|
13496
|
+
disabled
|
|
13497
|
+
}
|
|
13498
|
+
)
|
|
13499
|
+
] }),
|
|
13500
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1 md:col-span-1", children: [
|
|
13501
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Previous treatments" }),
|
|
13502
|
+
/* @__PURE__ */ jsx(
|
|
13503
|
+
Input,
|
|
13504
|
+
{
|
|
13505
|
+
className: "h-8 text-xs",
|
|
13506
|
+
placeholder: "IUI \xD72, OI cycles\u2026",
|
|
13507
|
+
value: inf.previousTreatments,
|
|
13508
|
+
onChange: (e) => setInfertility({ previousTreatments: e.target.value }),
|
|
13509
|
+
disabled
|
|
13510
|
+
}
|
|
13511
|
+
)
|
|
13512
|
+
] })
|
|
13513
|
+
] }) }),
|
|
13514
|
+
/* @__PURE__ */ jsx(Panel3, { title: "Female partner evaluation", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-3", children: [
|
|
13515
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13516
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Ovulation status" }),
|
|
13517
|
+
/* @__PURE__ */ jsxs(
|
|
13518
|
+
Select,
|
|
13519
|
+
{
|
|
13520
|
+
value: inf.female.ovulation === "" ? "none" : inf.female.ovulation,
|
|
13521
|
+
onValueChange: (v) => setInfertility({
|
|
13522
|
+
female: {
|
|
13523
|
+
...inf.female,
|
|
13524
|
+
ovulation: v === "none" ? "" : v
|
|
13525
|
+
}
|
|
13526
|
+
}),
|
|
13527
|
+
disabled,
|
|
13528
|
+
children: [
|
|
13529
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
13530
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
13531
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
13532
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Ovulatory", children: "Ovulatory" }),
|
|
13533
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Anovulatory", children: "Anovulatory" }),
|
|
13534
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Unknown", children: "Unknown" })
|
|
13535
|
+
] })
|
|
13536
|
+
]
|
|
13537
|
+
}
|
|
13538
|
+
)
|
|
13539
|
+
] }),
|
|
13540
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-end gap-2 pb-1", children: [
|
|
13541
|
+
/* @__PURE__ */ jsx(
|
|
13542
|
+
Checkbox,
|
|
13543
|
+
{
|
|
13544
|
+
checked: inf.female.pcosFeatures,
|
|
13545
|
+
onCheckedChange: (c) => setInfertility({
|
|
13546
|
+
female: { ...inf.female, pcosFeatures: c === true }
|
|
13547
|
+
}),
|
|
13548
|
+
disabled
|
|
13549
|
+
}
|
|
13550
|
+
),
|
|
13551
|
+
/* @__PURE__ */ jsx("span", { children: "PCOS features" })
|
|
13552
|
+
] }),
|
|
13553
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-end gap-2 pb-1", children: [
|
|
13554
|
+
/* @__PURE__ */ jsx(
|
|
13555
|
+
Checkbox,
|
|
13556
|
+
{
|
|
13557
|
+
checked: inf.female.endometriosisSuspicion,
|
|
13558
|
+
onCheckedChange: (c) => setInfertility({
|
|
13559
|
+
female: { ...inf.female, endometriosisSuspicion: c === true }
|
|
13560
|
+
}),
|
|
13561
|
+
disabled
|
|
13562
|
+
}
|
|
13563
|
+
),
|
|
13564
|
+
/* @__PURE__ */ jsx("span", { children: "Endometriosis suspicion" })
|
|
13565
|
+
] })
|
|
13566
|
+
] }) }),
|
|
13567
|
+
/* @__PURE__ */ jsx(Panel3, { title: "Male partner details", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-3", children: [
|
|
13568
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13569
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Age" }),
|
|
13570
|
+
/* @__PURE__ */ jsx(
|
|
13571
|
+
Input,
|
|
13572
|
+
{
|
|
13573
|
+
type: "number",
|
|
13574
|
+
min: 0,
|
|
13575
|
+
className: "h-8 text-xs",
|
|
13576
|
+
value: inf.male.age,
|
|
13577
|
+
onChange: (e) => setInfertility({ male: { ...inf.male, age: Number(e.target.value) || 0 } }),
|
|
13578
|
+
disabled
|
|
13579
|
+
}
|
|
13580
|
+
)
|
|
13581
|
+
] }),
|
|
13582
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13583
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Semen analysis" }),
|
|
13584
|
+
/* @__PURE__ */ jsxs(
|
|
13585
|
+
Select,
|
|
13586
|
+
{
|
|
13587
|
+
value: inf.male.semenAnalysis === "" ? "none" : inf.male.semenAnalysis,
|
|
13588
|
+
onValueChange: (v) => setInfertility({
|
|
13589
|
+
male: {
|
|
13590
|
+
...inf.male,
|
|
13591
|
+
semenAnalysis: v === "none" ? "" : v
|
|
13592
|
+
}
|
|
13593
|
+
}),
|
|
13594
|
+
disabled,
|
|
13595
|
+
children: [
|
|
13596
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
13597
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
13598
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
13599
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Normal", children: "Normal" }),
|
|
13600
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Abnormal", children: "Abnormal" }),
|
|
13601
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Pending", children: "Pending" })
|
|
13602
|
+
] })
|
|
13603
|
+
]
|
|
13604
|
+
}
|
|
13605
|
+
)
|
|
13606
|
+
] })
|
|
13607
|
+
] }) }),
|
|
13608
|
+
/* @__PURE__ */ jsx(Panel3, { title: "Investigations", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-3", children: [
|
|
13609
|
+
{ key: "amh", label: "AMH" },
|
|
13610
|
+
{ key: "fshLh", label: "FSH / LH" },
|
|
13611
|
+
{ key: "prolactin", label: "Prolactin" },
|
|
13612
|
+
{ key: "tsh", label: "TSH" },
|
|
13613
|
+
{ key: "tvs", label: "TVS findings" },
|
|
13614
|
+
{ key: "hsg", label: "HSG findings" }
|
|
13615
|
+
].map((row) => /* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13616
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: row.label }),
|
|
13617
|
+
/* @__PURE__ */ jsx(
|
|
13618
|
+
Input,
|
|
13619
|
+
{
|
|
13620
|
+
className: "h-8 text-xs",
|
|
13621
|
+
value: inf.investigations[row.key],
|
|
13622
|
+
onChange: (e) => setInfertility({
|
|
13623
|
+
investigations: { ...inf.investigations, [row.key]: e.target.value }
|
|
13624
|
+
}),
|
|
13625
|
+
disabled
|
|
13626
|
+
}
|
|
13627
|
+
)
|
|
13628
|
+
] }, row.key)) }) })
|
|
13629
|
+
] }) : null,
|
|
13630
|
+
hasZone("postoperative") ? /* @__PURE__ */ jsx(Panel3, { title: "Post-operative follow-up", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-3", children: [
|
|
13631
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13632
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Date of surgery" }),
|
|
13633
|
+
/* @__PURE__ */ jsx(
|
|
13634
|
+
Input,
|
|
13635
|
+
{
|
|
13636
|
+
type: "date",
|
|
13637
|
+
className: "h-8 text-xs",
|
|
13638
|
+
value: po.surgeryDate,
|
|
13639
|
+
onChange: (e) => setPostop({ surgeryDate: e.target.value }),
|
|
13640
|
+
disabled
|
|
13641
|
+
}
|
|
13642
|
+
)
|
|
13643
|
+
] }),
|
|
13644
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1 md:col-span-2", children: [
|
|
13645
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Procedure performed" }),
|
|
13646
|
+
/* @__PURE__ */ jsx(
|
|
13647
|
+
Input,
|
|
13648
|
+
{
|
|
13649
|
+
className: "h-8 text-xs",
|
|
13650
|
+
value: po.procedure,
|
|
13651
|
+
onChange: (e) => setPostop({ procedure: e.target.value }),
|
|
13652
|
+
disabled
|
|
13653
|
+
}
|
|
13654
|
+
)
|
|
13655
|
+
] }),
|
|
13656
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1 md:col-span-2", children: [
|
|
13657
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Histopathology result" }),
|
|
13658
|
+
/* @__PURE__ */ jsx(
|
|
13659
|
+
Input,
|
|
13660
|
+
{
|
|
13661
|
+
className: "h-8 text-xs",
|
|
13662
|
+
value: po.histopathology,
|
|
13663
|
+
onChange: (e) => setPostop({ histopathology: e.target.value }),
|
|
13664
|
+
disabled
|
|
13665
|
+
}
|
|
13666
|
+
)
|
|
13667
|
+
] }),
|
|
13668
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13669
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Wound status" }),
|
|
13670
|
+
/* @__PURE__ */ jsxs(
|
|
13671
|
+
Select,
|
|
13672
|
+
{
|
|
13673
|
+
value: po.woundStatus === "" ? "none" : po.woundStatus,
|
|
13674
|
+
onValueChange: (v) => setPostop({
|
|
13675
|
+
woundStatus: v === "none" ? "" : v
|
|
13676
|
+
}),
|
|
13677
|
+
disabled,
|
|
13678
|
+
children: [
|
|
13679
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
13680
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
13681
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
13682
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Healthy", children: "Healthy" }),
|
|
13683
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Erythema", children: "Erythema" }),
|
|
13684
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Discharge", children: "Discharge" }),
|
|
13685
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Dehisced", children: "Dehisced" })
|
|
13686
|
+
] })
|
|
13687
|
+
]
|
|
13688
|
+
}
|
|
13689
|
+
)
|
|
13690
|
+
] }),
|
|
13691
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
13692
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Pain score (0-10)" }),
|
|
13693
|
+
/* @__PURE__ */ jsx(
|
|
13694
|
+
Input,
|
|
13695
|
+
{
|
|
13696
|
+
type: "number",
|
|
13697
|
+
min: 0,
|
|
13698
|
+
max: 10,
|
|
13699
|
+
className: "h-8 text-xs",
|
|
13700
|
+
value: po.painScore,
|
|
13701
|
+
onChange: (e) => setPostop({
|
|
13702
|
+
painScore: Math.max(0, Math.min(10, Number(e.target.value) || 0))
|
|
13703
|
+
}),
|
|
13704
|
+
disabled
|
|
13705
|
+
}
|
|
13706
|
+
)
|
|
13707
|
+
] }),
|
|
13708
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1 md:col-span-3", children: [
|
|
13709
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Complications" }),
|
|
13710
|
+
/* @__PURE__ */ jsx(
|
|
13711
|
+
Textarea,
|
|
13712
|
+
{
|
|
13713
|
+
className: "min-h-[60px] text-xs",
|
|
13714
|
+
value: po.complications,
|
|
13715
|
+
onChange: (e) => setPostop({ complications: e.target.value }),
|
|
13716
|
+
disabled
|
|
13717
|
+
}
|
|
13718
|
+
)
|
|
13719
|
+
] })
|
|
13720
|
+
] }) }) : null,
|
|
13721
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1 border-t border-[#D0D0D0] pt-3", children: [
|
|
13722
|
+
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium", children: "History of Presenting Complaint" }),
|
|
13723
|
+
/* @__PURE__ */ jsx(
|
|
13724
|
+
Textarea,
|
|
13725
|
+
{
|
|
13726
|
+
value: safe.zones.length > 0 ? formatObgPathwayToSymptomsNarrative(safe) : typeof symptomsField.value === "string" ? symptomsField.value : "",
|
|
13727
|
+
onChange: (e) => {
|
|
13728
|
+
if (safe.zones.length > 0) return;
|
|
13729
|
+
symptomsField.setValue(e.target.value);
|
|
13730
|
+
},
|
|
13731
|
+
readOnly: safe.zones.length > 0,
|
|
13732
|
+
disabled,
|
|
13733
|
+
className: "min-h-[70px] text-xs",
|
|
13734
|
+
placeholder: safe.zones.length > 0 ? "Generated from pathway panels above." : "Free-text history, or select pathway zones above for a structured narrative."
|
|
13735
|
+
}
|
|
13736
|
+
)
|
|
13737
|
+
] })
|
|
13738
|
+
] })
|
|
13739
|
+
] });
|
|
13740
|
+
};
|
|
13741
|
+
var FieldRenderer = ({ fieldId }) => {
|
|
13742
|
+
const { fieldDef, visible } = useField(fieldId);
|
|
13743
|
+
if (!visible || !fieldDef) {
|
|
13744
|
+
return null;
|
|
13745
|
+
}
|
|
13746
|
+
return renderWidget(fieldId, fieldDef);
|
|
13747
|
+
};
|
|
13748
|
+
function renderWidget(fieldId, fieldDef) {
|
|
13749
|
+
switch (fieldDef.type) {
|
|
13750
|
+
case "text":
|
|
13751
|
+
case "number":
|
|
13752
|
+
return /* @__PURE__ */ jsx(TextWidget, { fieldId });
|
|
13753
|
+
case "slider":
|
|
13754
|
+
return /* @__PURE__ */ jsx(SliderWidget, { fieldId });
|
|
13755
|
+
case "textarea":
|
|
13756
|
+
if (fieldMetaRequestsMarMedicationOrdersButton(fieldDef.meta)) {
|
|
13757
|
+
return /* @__PURE__ */ jsx(MarMedicationOrdersWidget, { fieldId });
|
|
13758
|
+
}
|
|
13759
|
+
return /* @__PURE__ */ jsx(TextWidget, { fieldId });
|
|
13760
|
+
case "richtext":
|
|
13761
|
+
return /* @__PURE__ */ jsx(RichTextWidget, { fieldId });
|
|
13762
|
+
case "date":
|
|
13763
|
+
return /* @__PURE__ */ jsx(DateWidget, { fieldId });
|
|
13764
|
+
case "datetime":
|
|
13765
|
+
return /* @__PURE__ */ jsx(DateTimeWidget, { fieldId });
|
|
13766
|
+
case "select":
|
|
13767
|
+
return /* @__PURE__ */ jsx(SelectWidget, { fieldId });
|
|
13768
|
+
case "radio":
|
|
13769
|
+
return /* @__PURE__ */ jsx(RadioWidget, { fieldId });
|
|
13770
|
+
case "checkbox":
|
|
13771
|
+
return /* @__PURE__ */ jsx(CheckboxWidget, { fieldId });
|
|
13772
|
+
case "multiselect":
|
|
13773
|
+
return /* @__PURE__ */ jsx(MultiSelectWidget, { fieldId });
|
|
13774
|
+
case "repeatable":
|
|
13775
|
+
return /* @__PURE__ */ jsx(RepeatableWidget, { fieldId });
|
|
13776
|
+
case "image_upload":
|
|
13777
|
+
return /* @__PURE__ */ jsx(ImageUploadWidget, { fieldId });
|
|
13778
|
+
case "media_upload":
|
|
13779
|
+
return /* @__PURE__ */ jsx(MediaUploadWidget, { fieldId });
|
|
13780
|
+
case "signature":
|
|
13781
|
+
return /* @__PURE__ */ jsx(SignatureUploadWidget, { fieldId });
|
|
13782
|
+
case "editable_table":
|
|
13783
|
+
return /* @__PURE__ */ jsx(EditableTableWidget, { fieldId });
|
|
13784
|
+
case "medications":
|
|
13785
|
+
return /* @__PURE__ */ jsx(AddMedicationWidget, { fieldId });
|
|
13786
|
+
case "discharge_medication_orders":
|
|
13787
|
+
return /* @__PURE__ */ jsx(DischargeMedicationOrdersWidget, { fieldId });
|
|
13788
|
+
case "investigations":
|
|
13789
|
+
return /* @__PURE__ */ jsx(AddInvestigationWidget, { fieldId });
|
|
13790
|
+
case "procedures":
|
|
13791
|
+
return /* @__PURE__ */ jsx(AddProcedureWidget, { fieldId });
|
|
13792
|
+
case "differential_diagnosis":
|
|
13793
|
+
return /* @__PURE__ */ jsx(DifferentialDiagnosisWidget, { fieldId });
|
|
13794
|
+
case "vitals":
|
|
13795
|
+
return /* @__PURE__ */ jsx(VitalsWidget, { fieldId });
|
|
13796
|
+
case "hidden_vitals":
|
|
13797
|
+
return /* @__PURE__ */ jsx(HiddenVitalsWidget, { fieldId });
|
|
13798
|
+
case "referral":
|
|
13799
|
+
return /* @__PURE__ */ jsx(ReferralWidget, { fieldId });
|
|
13800
|
+
case "followup":
|
|
13801
|
+
return /* @__PURE__ */ jsx(FollowupWidget, { fieldId });
|
|
13802
|
+
case "smart_textarea":
|
|
13803
|
+
return /* @__PURE__ */ jsx(SmartTextareaWidget, { fieldId });
|
|
13804
|
+
case "diagnosis_textarea":
|
|
13805
|
+
return /* @__PURE__ */ jsx(DiagnosisTextareaWidget, { fieldId });
|
|
13806
|
+
case "obstetric_history":
|
|
13807
|
+
return /* @__PURE__ */ jsx(ObstetricHistoryWidget, { fieldId });
|
|
13808
|
+
case "eye_prescription":
|
|
13809
|
+
return /* @__PURE__ */ jsx(OphthalmologyWidget, { fieldId });
|
|
13810
|
+
case "ophthal_diagnosis":
|
|
13811
|
+
return /* @__PURE__ */ jsx(OphthalDiagnosisWidget, { fieldId });
|
|
13812
|
+
case "orthopedic_exam":
|
|
13813
|
+
return /* @__PURE__ */ jsx(OrthopedicExamWidget, { fieldId });
|
|
13814
|
+
case "general_surgery_smart_history":
|
|
13815
|
+
return /* @__PURE__ */ jsx(GsSmartHistoryWidget, { fieldId });
|
|
13816
|
+
case "general_surgery_examination":
|
|
13817
|
+
return /* @__PURE__ */ jsx(GsExaminationWidget, { fieldId });
|
|
13818
|
+
case "general_surgery_grading":
|
|
13819
|
+
return /* @__PURE__ */ jsx(GsGradingWidget, { fieldId });
|
|
13820
|
+
case "pain_scale_flags":
|
|
13821
|
+
return /* @__PURE__ */ jsx(PainScaleFlagsWidget, { fieldId });
|
|
13822
|
+
case "urology_smart_history":
|
|
13823
|
+
return /* @__PURE__ */ jsx(UrologySmartHistoryWidget, { fieldId });
|
|
13824
|
+
case "urology_examination":
|
|
13825
|
+
return /* @__PURE__ */ jsx(UrologyExaminationWidget, { fieldId });
|
|
13826
|
+
case "urology_pathway":
|
|
13827
|
+
return /* @__PURE__ */ jsx(UrologyPathwayWidget, { fieldId });
|
|
13828
|
+
case "obg_examination":
|
|
13829
|
+
return /* @__PURE__ */ jsx(OBGExaminationWidget, { fieldId });
|
|
13830
|
+
case "obg_pathway":
|
|
13831
|
+
return /* @__PURE__ */ jsx(OBGPathwayWidget, { fieldId });
|
|
13832
|
+
case "toggle": {
|
|
13833
|
+
const { value, setValue, setTouched, disabled } = useField(fieldId);
|
|
13834
|
+
const store = useFormStore();
|
|
13835
|
+
const excludes = fieldDef.excludes ?? [];
|
|
13836
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
13837
|
+
/* @__PURE__ */ jsx(
|
|
13838
|
+
Switch,
|
|
13839
|
+
{
|
|
13840
|
+
checked: value === true,
|
|
13841
|
+
disabled,
|
|
13842
|
+
onCheckedChange: (checked) => {
|
|
13843
|
+
setValue(checked);
|
|
13844
|
+
setTouched();
|
|
13845
|
+
if (checked) excludes.forEach((id) => store.setValue(id, false));
|
|
13846
|
+
}
|
|
13847
|
+
}
|
|
13848
|
+
),
|
|
13849
|
+
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium leading-none cursor-pointer select-none", children: fieldDef.label })
|
|
13850
|
+
] });
|
|
13851
|
+
}
|
|
13852
|
+
case "suggestion_textarea":
|
|
13853
|
+
case "complaint_chips":
|
|
13854
|
+
return /* @__PURE__ */ jsx(SuggestionTextareaWidget, { fieldId });
|
|
13855
|
+
case "lens_assessment":
|
|
13856
|
+
return /* @__PURE__ */ jsx(LensAssessmentWidget, { fieldId });
|
|
13857
|
+
case "functional_impairment_score":
|
|
13858
|
+
return /* @__PURE__ */ jsx(FunctionalImpairmentScoreWidget, { fieldId });
|
|
13859
|
+
case "biometry_iol_workup":
|
|
13860
|
+
return /* @__PURE__ */ jsx(BiometryIolWorkupWidget, { fieldId });
|
|
13861
|
+
case "surgical_risk_flags":
|
|
13862
|
+
return /* @__PURE__ */ jsx(SurgicalRiskFlagsWidget, { fieldId });
|
|
13863
|
+
case "static_text": {
|
|
11975
13864
|
const def = fieldDef;
|
|
11976
13865
|
const size = def.size ?? "regular";
|
|
11977
13866
|
const labelClass = size === "large" ? "text-base" : "text-sm";
|
|
@@ -12789,18 +14678,18 @@ var ReadOnlyFieldRenderer = ({
|
|
|
12789
14678
|
const locsRecord = locs != null && typeof locs === "object" && !Array.isArray(locs) ? locs : null;
|
|
12790
14679
|
const eyeLine = (label, g) => {
|
|
12791
14680
|
if (!g || typeof g !== "object") return null;
|
|
12792
|
-
const
|
|
14681
|
+
const num2 = (k) => typeof g[k] === "number" ? g[k] : "\u2014";
|
|
12793
14682
|
return /* @__PURE__ */ jsxs("p", { className: "text-xs text-foreground", children: [
|
|
12794
14683
|
label,
|
|
12795
14684
|
": NO ",
|
|
12796
|
-
String(
|
|
14685
|
+
String(num2("NO")),
|
|
12797
14686
|
", NC ",
|
|
12798
|
-
String(
|
|
14687
|
+
String(num2("NC")),
|
|
12799
14688
|
", C ",
|
|
12800
|
-
String(
|
|
14689
|
+
String(num2("C")),
|
|
12801
14690
|
", PSC",
|
|
12802
14691
|
" ",
|
|
12803
|
-
String(
|
|
14692
|
+
String(num2("PSC"))
|
|
12804
14693
|
] });
|
|
12805
14694
|
};
|
|
12806
14695
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-2 rounded-md border p-3 text-sm", children: [
|
|
@@ -12940,6 +14829,32 @@ var ReadOnlyFieldRenderer = ({
|
|
|
12940
14829
|
] }) : null
|
|
12941
14830
|
] });
|
|
12942
14831
|
}
|
|
14832
|
+
case "obg_pathway": {
|
|
14833
|
+
const structuredDisplay = value && typeof value === "object" ? JSON.stringify(normalizeObgPathway(value), null, 2) : value == null || value === "" ? "\u2014" : String(value);
|
|
14834
|
+
const hopcDef = resolveFieldDef?.("symptoms");
|
|
14835
|
+
const hopcRaw = allValues?.["symptoms"];
|
|
14836
|
+
const hopcStr = typeof hopcRaw === "string" ? hopcRaw : hopcRaw != null && hopcRaw !== "" ? String(hopcRaw) : "";
|
|
14837
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
14838
|
+
/* @__PURE__ */ jsx(ReadOnlyText, { fieldDef, value: structuredDisplay }),
|
|
14839
|
+
hopcDef ? /* @__PURE__ */ jsx(ReadOnlyText, { fieldDef: hopcDef, value: hopcStr }) : hopcStr ? /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
14840
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-700", children: "History of presenting complaint" }),
|
|
14841
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem] whitespace-pre-wrap", children: hopcStr })
|
|
14842
|
+
] }) : null
|
|
14843
|
+
] });
|
|
14844
|
+
}
|
|
14845
|
+
case "obg_examination": {
|
|
14846
|
+
const structuredDisplay = value && typeof value === "object" ? JSON.stringify(value, null, 2) : value == null || value === "" ? "\u2014" : String(value);
|
|
14847
|
+
const clinicalDef = resolveFieldDef?.("clinical_examination");
|
|
14848
|
+
const clinicalRaw = allValues?.["clinical_examination"];
|
|
14849
|
+
const clinicalStr = typeof clinicalRaw === "string" ? clinicalRaw : clinicalRaw != null && clinicalRaw !== "" ? String(clinicalRaw) : "";
|
|
14850
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
14851
|
+
/* @__PURE__ */ jsx(ReadOnlyText, { fieldDef, value: structuredDisplay }),
|
|
14852
|
+
clinicalDef ? /* @__PURE__ */ jsx(ReadOnlyText, { fieldDef: clinicalDef, value: clinicalStr }) : clinicalStr ? /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
14853
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-700", children: "Clinical examination" }),
|
|
14854
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem] whitespace-pre-wrap", children: clinicalStr })
|
|
14855
|
+
] }) : null
|
|
14856
|
+
] });
|
|
14857
|
+
}
|
|
12943
14858
|
case "static_text": {
|
|
12944
14859
|
const def = fieldDef;
|
|
12945
14860
|
const size = def.size ?? "regular";
|