summaryrefslogtreecommitdiff
path: root/ksh-discharge.el
blob: 07d32fca22931d51d960becd58b8199b41d91392 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
;; -*- lexical-binding: t -*-

(require 'ksh-forms)

;; Datafile path and fields
(setq forms-file (expand-file-name "data/discharge.dat" ksh-path))
(setq forms-number-of-fields
      (forms-enumerate
       '(ip-op-no patient-name age sex address admission-date
		  discharge-date diagnosis surgical-procedure
		  history clinical-examination course-in-hospital
		  investigation treatment condition-on-discharge advice)))

;; Default values for fields
(setq default-field-values
      `((,sex . "F")
	(,advice . "Triple A Cal Forte - 30 Cap")))

;; Format specification for form display
(setq forms-format-list
      (append
       (list "Discharge Summary\n\n")
       (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")
	  (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" . ""))))))