diff options
-rw-r--r-- | ksh-discharge.el | 72 | ||||
-rw-r--r-- | ksh-forms-improved.el | 3 | ||||
-rw-r--r-- | ksh-scan2.el | 184 | ||||
-rw-r--r-- | ksh-scan3.el | 167 |
4 files changed, 210 insertions, 216 deletions
diff --git a/ksh-discharge.el b/ksh-discharge.el index 9bd0e6d..4aa382d 100644 --- a/ksh-discharge.el +++ b/ksh-discharge.el @@ -20,44 +20,44 @@ (setq forms-format-list (append (list "Discharge Summary\n\n") - (form-entries - '(("IP/OP No" . ip-op-no) - ("Age" . age) - ("Sex" . sex) - ("Name of Patient" . patient-name) - ("Address" . address) - ("Date of Admission" . admission-date) - ("Date of Discharge" . discharge-date) - ("Diagnosis" . diagnosis) - ("Surgical Procedure" . surgical-procedure) - ("History" . history) - ("Clinical Examination" . clinical-examination) - ("Course in Hospital" . course-in-hospital) - ("Investigation" . investigation) - ("Treatment" . treatment) - ("Condition on Discharge" . condition-on-discharge) - ("Advice" . advice))))) + (seq-mapcat 'form-entry + '(("IP/OP No" . ip-op-no) + ("Age" . age) + ("Sex" . sex) + ("Name of Patient" . patient-name) + ("Address" . address) + ("Date of Admission" . admission-date) + ("Date of Discharge" . discharge-date) + ("Diagnosis" . diagnosis) + ("Surgical Procedure" . surgical-procedure) + ("History" . history) + ("Clinical Examination" . clinical-examination) + ("Course in Hospital" . course-in-hospital) + ("Investigation" . investigation) + ("Treatment" . treatment) + ("Condition on Discharge" . condition-on-discharge) + ("Advice" . advice))))) (setq form-to-org (lambda () (with-output-to-string (make-report-header "DISCHARGE SUMMARY") - (single-line-org-entries - `(("IP/OP No" . ,ip-op-no) - ("Age" . ,age) - ("Sex" . ,sex) - ("Name of Patient" . ,patient-name) - ("Date of Admission" . ,admission-date) - ("Date of Discharge" . ,discharge-date))) - (multi-line-org-entries - `(("Address" . ,address) - ("Diagnosis" . ,diagnosis) - ("Surgical Procedure" . ,surgical-procedure) - ("History" . ,history) - ("Clinical Examination" . ,clinical-examination) - ("Course in Hospital" . ,course-in-hospital) - ("Investigation" . ,investigation) - ("Treatment" . ,treatment) - ("Condition on Discharge" . ,condition-on-discharge) - ("Advice" . ,advice) - ("Signature of the Medical Officer" . "")))))) + (seq-do 'single-line-org-entry + `(("IP/OP No" . ,ip-op-no) + ("Age" . ,age) + ("Sex" . ,sex) + ("Name of Patient" . ,patient-name) + ("Date of Admission" . ,admission-date) + ("Date of Discharge" . ,discharge-date))) + (seq-do 'multi-line-org-entry + `(("Address" . ,address) + ("Diagnosis" . ,diagnosis) + ("Surgical Procedure" . ,surgical-procedure) + ("History" . ,history) + ("Clinical Examination" . ,clinical-examination) + ("Course in Hospital" . ,course-in-hospital) + ("Investigation" . ,investigation) + ("Treatment" . ,treatment) + ("Condition on Discharge" . ,condition-on-discharge) + ("Advice" . ,advice) + ("Signature of the Medical Officer" . "")))))) diff --git a/ksh-forms-improved.el b/ksh-forms-improved.el index ed2cf7e..67f03b1 100644 --- a/ksh-forms-improved.el +++ b/ksh-forms-improved.el @@ -40,7 +40,6 @@ (list (format "%s\n" (car label-field)) (cdr label-field) "\n\n")) -(setfun form-entries (mapped 'cl-mapcan 'form-entry)) (defun new-record-filter (record) (set-values record default-field-values) @@ -65,8 +64,6 @@ (setfun single-line-org-entry (make-org-entry-function "*%s:* %s\n\n")) (setfun multi-line-org-entry (make-org-entry-function "\n* %s\n%s\n\n")) -(setfun single-line-org-entries (mapped 'mapc 'single-line-org-entry)) -(setfun multi-line-org-entries (mapped 'mapc 'multi-line-org-entry)) (defun text-if-non-blank (text) (if (and text (not (string-blank-p text))) diff --git a/ksh-scan2.el b/ksh-scan2.el index 75f3ae4..fae934d 100644 --- a/ksh-scan2.el +++ b/ksh-scan2.el @@ -50,96 +50,95 @@ (setq forms-format-list (append (list "Trimester 2 - Scan Report\n\n") - (form-entries - '(("IP/OP No" . ip-op-no) - ("Patient Name" . patient-name) - ("Age" . age) - ("Sex" . sex) - ("Visit Date" . visit-date) - ("LMP Date" . lmp-date) - ("LMP EDD" . lmp-edd))) + (seq-mapcat 'form-entry + '(("IP/OP No" . ip-op-no) + ("Patient Name" . patient-name) + ("Age" . age) + ("Sex" . sex) + ("Visit Date" . visit-date) + ("LMP Date" . lmp-date) + ("LMP EDD" . lmp-edd))) (list "Indications\n" "Growth Scan\n" "Real time B-mode ultrasonography of gravid uterus done.\n" "Route: Transabdominal\n" scan "\n\n") (list "Maternal\n") - (form-entries - '(("Cervix" . maternal-cervix) - ("Internal os" . maternal-internal-os))) + (seq-mapcat 'form-entry + '(("Cervix" . maternal-cervix) + ("Internal os" . maternal-internal-os))) (list "Fetal Survey\n") - (form-entries - '(("Presentation" . survey-presentation) - ("Placenta" . survey-placenta) - ("Liquor" . survey-liquor) - ("Umbilical cord" . survey-umbilical-cord) - ("Fetal activity" . survey-fetal-activity) - ("Cardiac activity" . survey-cardiac-activity))) + (seq-mapcat 'form-entry + '(("Presentation" . survey-presentation) + ("Placenta" . survey-placenta) + ("Liquor" . survey-liquor) + ("Umbilical cord" . survey-umbilical-cord) + ("Fetal activity" . survey-fetal-activity) + ("Cardiac activity" . survey-cardiac-activity))) (list "Fetal Biometry\n") - (form-entries - '(("BPD" . biometry-bpd) - ("BPD-Age" . biometry-bpd-age) - ("BPD-Percentile" . biometry-bpd-percentile) - ("HC" . biometry-hc) - ("HC-Age" . biometry-hc-age) - ("HC-Percentile" . biometry-hc-percentile) - ("AC" . biometry-ac) - ("AC-Age" . biometry-ac-age) - ("AC-Percentile" . biometry-ac-percentile) - ("FL" . biometry-fl) - ("FL-Age" . biometry-fl-age) - ("FL-Percentile" . biometry-fl-percentile) - ("Estimated fetal weight according to BPD, HC, AC, FL" . biometry-fetal-weight))) + (seq-mapcat 'form-entry + '(("BPD" . biometry-bpd) + ("BPD-Age" . biometry-bpd-age) + ("BPD-Percentile" . biometry-bpd-percentile) + ("HC" . biometry-hc) + ("HC-Age" . biometry-hc-age) + ("HC-Percentile" . biometry-hc-percentile) + ("AC" . biometry-ac) + ("AC-Age" . biometry-ac-age) + ("AC-Percentile" . biometry-ac-percentile) + ("FL" . biometry-fl) + ("FL-Age" . biometry-fl-age) + ("FL-Percentile" . biometry-fl-percentile) + ("Estimated fetal weight according to BPD, HC, AC, FL" . biometry-fetal-weight))) (list "Extended Biometry\n") - (form-entries - '(("Foot Length" . extended-foot-length) - ("TCD" . extended-tcd))) + (seq-mapcat 'form-entry + '(("Foot Length" . extended-foot-length) + ("TCD" . extended-tcd))) (list "Fetal Anatomy\n") - (form-entries - '(("Intracranial structures" . anatomy-intracranial) - ("Neck" . anatomy-neck) - ("Spine" . anatomy-spine) - ("Fetal face" . anatomy-face) - ("Both lungs" . anatomy-lungs) - ("Heart" . anatomy-heart) - ("Abdominal situs" . anatomy-abdominal-situs) - ("Both kidneys and bladder" . anatomy-kidneys-bladder) - ("All long bones" . anatomy-long-bones))) + (seq-mapcat 'form-entry + '(("Intracranial structures" . anatomy-intracranial) + ("Neck" . anatomy-neck) + ("Spine" . anatomy-spine) + ("Fetal face" . anatomy-face) + ("Both lungs" . anatomy-lungs) + ("Heart" . anatomy-heart) + ("Abdominal situs" . anatomy-abdominal-situs) + ("Both kidneys and bladder" . anatomy-kidneys-bladder) + ("All long bones" . anatomy-long-bones))) (list "Impression\n") - (form-entries - '(("Gestational age" . impression-gestational-age) - ("Menstrual age" . impression-menstrual-age) - ("Corrected EDD" . impression-corrected-edd) - ("Notes" . impression-notes) - ("Sonologist" . sonologist))))) + (seq-mapcat 'form-entry + '(("Gestational age" . impression-gestational-age) + ("Menstrual age" . impression-menstrual-age) + ("Corrected EDD" . impression-corrected-edd) + ("Notes" . impression-notes) + ("Sonologist" . sonologist))))) (setq form-to-org (lambda () (with-output-to-string (make-report-header "OB - 2/3 TRIMESTER SCAN REPORT") - (single-line-org-entries - `(("IP/OP No" . ,ip-op-no) - ("Age" . ,age) - ("Sex" . ,sex) - ("Name of Patient" . ,patient-name) - ("Visit Date" . ,visit-date) - ("LMP Date" . ,lmp-date) - ("LMP EDD" . ,lmp-edd))) + (seq-do 'single-line-org-entry + `(("IP/OP No" . ,ip-op-no) + ("Age" . ,age) + ("Sex" . ,sex) + ("Name of Patient" . ,patient-name) + ("Visit Date" . ,visit-date) + ("LMP Date" . ,lmp-date) + ("LMP EDD" . ,lmp-edd))) (mapc 'princ `("* Indications\n" "** Target Scan\n" "Real time B-mode ultrasonography of gravid uterus done.\n\n")) - (single-line-org-entries - `(("Route" . "Transabdominal"))) + (single-line-org-entry '("Route" . "Transabdominal")) (princ (get-field scan)) (princ "\n\n* Maternal\n") - (single-line-org-entries - `(("Cervix" . ,maternal-cervix) - ("Internal os" . ,maternal-internal-os))) + (seq-do 'single-line-org-entry + `(("Cervix" . ,maternal-cervix) + ("Internal os" . ,maternal-internal-os))) (princ "* Fetal Survey\n") - (single-line-org-entries - `(("Presentation" . ,survey-presentation) - ("Placenta" . ,survey-placenta) - ("Liquor" . ,survey-liquor) - ("Umbilical cord" . ,survey-umbilical-cord) - ("Fetal activity" . ,survey-fetal-activity) - ("Cardiac activity" . ,survey-cardiac-activity))) + (seq-do 'single-line-org-entry + `(("Presentation" . ,survey-presentation) + ("Placenta" . ,survey-placenta) + ("Liquor" . ,survey-liquor) + ("Umbilical cord" . ,survey-umbilical-cord) + ("Fetal activity" . ,survey-fetal-activity) + ("Cardiac activity" . ,survey-cardiac-activity))) (princ "* Fetal Biometry\n") (insert-biometry `(("BPD" ,biometry-bpd ,biometry-bpd-age ,biometry-bpd-percentile) @@ -147,31 +146,30 @@ ("AC" ,biometry-ac ,biometry-ac-age ,biometry-ac-percentile) ("FL" ,biometry-fl ,biometry-fl-age ,biometry-fl-percentile))) (princ "* Extended Biometry\n") - (single-line-org-entries - `(("Foot Length" . ,extended-foot-length) - ("TCD" . ,extended-tcd))) + (seq-do 'single-line-org-entry + `(("Foot Length" . ,extended-foot-length) + ("TCD" . ,extended-tcd))) (princ "* Fetal Anatomy\n") - (single-line-org-entries - `(("Intracranial structures" . ,anatomy-intracranial) - ("Neck" . ,anatomy-neck) - ("Spine" . ,anatomy-spine) - ("Fetal face" . ,anatomy-face) - ("Both lungs" . ,anatomy-lungs) - ("Heart" . ,anatomy-heart) - ("Abdominal situs" . ,anatomy-abdominal-situs) - ("Both kidneys and bladder" . ,anatomy-kidneys-bladder) - ("All long bones" . ,anatomy-long-bones))) + (seq-do 'single-line-org-entry + `(("Intracranial structures" . ,anatomy-intracranial) + ("Neck" . ,anatomy-neck) + ("Spine" . ,anatomy-spine) + ("Fetal face" . ,anatomy-face) + ("Both lungs" . ,anatomy-lungs) + ("Heart" . ,anatomy-heart) + ("Abdominal situs" . ,anatomy-abdominal-situs) + ("Both kidneys and bladder" . ,anatomy-kidneys-bladder) + ("All long bones" . ,anatomy-long-bones))) (princ "* Impression\n") (princ (format "%s corresponding to a gestational age of %s\n\n" (get-field scan) (get-field impression-gestational-age))) (princ "Gestational age assigned as per biometry (CRL)\n\n") - (single-line-org-entries - `(("Menstrual age" . ,impression-menstrual-age) - ("Corrected EDD" . ,impression-corrected-edd) - ("Placenta" . ,survey-placenta) - ("Presentation" . ,survey-presentation) - ("Liquor" . ,survey-liquor) - ("Estimated fetal weight according to BPD, HC, AC, FL" . ,biometry-fetal-weight))) + (seq-do 'single-line-org-entry + `(("Menstrual age" . ,impression-menstrual-age) + ("Corrected EDD" . ,impression-corrected-edd) + ("Placenta" . ,survey-placenta) + ("Presentation" . ,survey-presentation) + ("Liquor" . ,survey-liquor) + ("Estimated fetal weight according to BPD, HC, AC, FL" . ,biometry-fetal-weight))) (text-if-non-blank (get-field impression-notes)) - (multi-line-org-entries - `(("Sonologist" . ,sonologist)))))) + (multi-line-org-entry '("Sonologist" . ,sonologist))))) diff --git a/ksh-scan3.el b/ksh-scan3.el index 83018c5..ac50f36 100644 --- a/ksh-scan3.el +++ b/ksh-scan3.el @@ -37,94 +37,93 @@ (setq forms-format-list (append (list "Trimester 3 - Scan Report\n\n") - (form-entries - '(("IP/OP No" . ip-op-no) - ("Patient Name" . patient-name) - ("Age" . age) - ("Sex" . sex) - ("Visit Date" . visit-date) - ("LMP Date" . lmp-date) - ("LMP EDD" . lmp-edd))) + (seq-mapcat 'form-entry + '(("IP/OP No" . ip-op-no) + ("Patient Name" . patient-name) + ("Age" . age) + ("Sex" . sex) + ("Visit Date" . visit-date) + ("LMP Date" . lmp-date) + ("LMP EDD" . lmp-edd))) (list "Indications\n" "Growth Scan\n" - "Real time B-mode ultrasonography of gravid uterus done.\n" - "Route: Transabdominal\n" scan "\n\n") + "Real time B-mode ultrasonography of gravid uterus done.\n" + "Route: Transabdominal\n" scan "\n\n") (list "Fetal Survey\n") - (form-entries - '(("Presentation" . survey-presentation) - ("Placenta" . survey-placenta) - ("Liquor" . survey-liquor) - ("Amniotic fluid index" . survey-amniotic-fluid-index) - ("Umbilical cord" . survey-umbilical-cord) - ("Fetal activity" . survey-fetal-activity) - ("Cardiac activity" . survey-cardiac-activity) - ("Fetal heart rate" . survey-fetal-heart-rate))) + (seq-mapcat 'form-entry + '(("Presentation" . survey-presentation) + ("Placenta" . survey-placenta) + ("Liquor" . survey-liquor) + ("Amniotic fluid index" . survey-amniotic-fluid-index) + ("Umbilical cord" . survey-umbilical-cord) + ("Fetal activity" . survey-fetal-activity) + ("Cardiac activity" . survey-cardiac-activity) + ("Fetal heart rate" . survey-fetal-heart-rate))) (list "Fetal Biometry\n") - (form-entries - '(("BPD" . biometry-bpd) - ("BPD-Age" . biometry-bpd-age) - ("BPD-Percentile" . biometry-bpd-percentile) - ("HC" . biometry-hc) - ("HC-Age" . biometry-hc-age) - ("HC-Percentile" . biometry-hc-percentile) - ("AC" . biometry-ac) - ("AC-Age" . biometry-ac-age) - ("AC-Percentile" . biometry-ac-percentile) - ("FL" . biometry-fl) - ("FL-Age" . biometry-fl-age) - ("FL-Percentile" . biometry-fl-percentile) - ("Estimated fetal weight according to BPD, HC, AC, FL" . biometry-fetal-weight))) + (seq-mapcat 'form-entry + '(("BPD" . biometry-bpd) + ("BPD-Age" . biometry-bpd-age) + ("BPD-Percentile" . biometry-bpd-percentile) + ("HC" . biometry-hc) + ("HC-Age" . biometry-hc-age) + ("HC-Percentile" . biometry-hc-percentile) + ("AC" . biometry-ac) + ("AC-Age" . biometry-ac-age) + ("AC-Percentile" . biometry-ac-percentile) + ("FL" . biometry-fl) + ("FL-Age" . biometry-fl-age) + ("FL-Percentile" . biometry-fl-percentile) + ("Estimated fetal weight according to BPD, HC, AC, FL" . biometry-fetal-weight))) (list "Impression\n") - (form-entries - '(("Gestational age" . impression-gestational-age) - ("Menstrual age" . impression-menstrual-age) - ("Corrected EDD" . impression-corrected-edd) - ("Notes" . impression-notes) - ("Sonologist" . sonologist))))) + (seq-mapcat 'form-entry + '(("Gestational age" . impression-gestational-age) + ("Menstrual age" . impression-menstrual-age) + ("Corrected EDD" . impression-corrected-edd) + ("Notes" . impression-notes) + ("Sonologist" . sonologist))))) (setq form-to-org (lambda () - (with-output-to-string - (make-report-header "OB - 3/3 TRIMESTER SCAN REPORT") - (single-line-org-entries - `(("IP/OP No" . ,ip-op-no) - ("Age" . ,age) - ("Sex" . ,sex) - ("Name of Patient" . ,patient-name) - ("Visit Date" . ,visit-date) - ("LMP Date" . ,lmp-date) - ("LMP EDD" . ,lmp-edd))) - (mapc 'princ `("* Indications\n" "** Growth Scan\n" - "Real time B-mode ultrasonography of gravid uterus done.\n\n")) - (single-line-org-entries - `(("Route" . "Transabdominal"))) - (text-if-non-blank (get-field scan)) - (princ "* Fetal Survey\n") - (single-line-org-entries - `(("Presentation" . ,survey-presentation) - ("Placenta" . ,survey-placenta) - ("Liquor" . ,survey-liquor) - ("Amniotic fluid index" . ,survey-amniotic-fluid-index) - ("Umbilical cord" . ,survey-umbilical-cord) - ("Fetal activity" . ,survey-fetal-activity) - ("Cardiac activity" . ,survey-cardiac-activity) - ("Fetal heart rate" . ,survey-fetal-heart-rate))) - (princ "* Fetal Biometry\n") - (insert-biometry - `(("BPD" ,biometry-bpd ,biometry-bpd-age ,biometry-bpd-percentile) - ("HC" ,biometry-hc ,biometry-hc-age ,biometry-hc-percentile) - ("AC" ,biometry-ac ,biometry-ac-age ,biometry-ac-percentile) - ("FL" ,biometry-fl ,biometry-fl-age ,biometry-fl-percentile))) - (princ "* Impression\n") - (princ (format "%s corresponding to a gestational age of %s\n\n" - (get-field scan) (get-field impression-gestational-age))) - (princ "Gestational age assigned as per biometry (CRL)\n\n") - (single-line-org-entries - `(("Menstrual age" . ,impression-menstrual-age) - ("Corrected EDD" . ,impression-corrected-edd) - ("Placenta" . ,survey-placenta) - ("Presentation" . ,survey-presentation) - ("Liquor" . ,survey-liquor) - ("Estimated fetal weight according to BPD, HC, AC, FL" . ,biometry-fetal-weight))) - (text-if-non-blank (get-field impression-notes)) - (multi-line-org-entries - `(("Sonologist" . ,sonologist)))))) + (with-output-to-string + (make-report-header "OB - 3/3 TRIMESTER SCAN REPORT") + (seq-do 'single-line-org-entry + `(("IP/OP No" . ,ip-op-no) + ("Age" . ,age) + ("Sex" . ,sex) + ("Name of Patient" . ,patient-name) + ("Visit Date" . ,visit-date) + ("LMP Date" . ,lmp-date) + ("LMP EDD" . ,lmp-edd))) + (mapc 'princ `("* Indications\n" "** Growth Scan\n" + "Real time B-mode ultrasonography of gravid uterus done.\n\n")) + (seq-do 'single-line-org-entry + `(("Route" . "Transabdominal"))) + (text-if-non-blank (get-field scan)) + (princ "* Fetal Survey\n") + (seq-do 'single-line-org-entry + `(("Presentation" . ,survey-presentation) + ("Placenta" . ,survey-placenta) + ("Liquor" . ,survey-liquor) + ("Amniotic fluid index" . ,survey-amniotic-fluid-index) + ("Umbilical cord" . ,survey-umbilical-cord) + ("Fetal activity" . ,survey-fetal-activity) + ("Cardiac activity" . ,survey-cardiac-activity) + ("Fetal heart rate" . ,survey-fetal-heart-rate))) + (princ "* Fetal Biometry\n") + (insert-biometry + `(("BPD" ,biometry-bpd ,biometry-bpd-age ,biometry-bpd-percentile) + ("HC" ,biometry-hc ,biometry-hc-age ,biometry-hc-percentile) + ("AC" ,biometry-ac ,biometry-ac-age ,biometry-ac-percentile) + ("FL" ,biometry-fl ,biometry-fl-age ,biometry-fl-percentile))) + (princ "* Impression\n") + (princ (format "%s corresponding to a gestational age of %s\n\n" + (get-field scan) (get-field impression-gestational-age))) + (princ "Gestational age assigned as per biometry (CRL)\n\n") + (seq-do 'single-line-org-entry + `(("Menstrual age" . ,impression-menstrual-age) + ("Corrected EDD" . ,impression-corrected-edd) + ("Placenta" . ,survey-placenta) + ("Presentation" . ,survey-presentation) + ("Liquor" . ,survey-liquor) + ("Estimated fetal weight according to BPD, HC, AC, FL" . ,biometry-fetal-weight))) + (text-if-non-blank (get-field impression-notes)) + (multi-line-org-entry '("Sonologist" . ,sonologist))))) |