Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun calculate-insulin-dose (blood-glucose)
- "Returns a cons as: ("bolus dose" . "infusion rate")
- (cond ((and (> kan-sekeri 116) (<= kan-sekeri 143)) (cons 0 1))
- ((and (> kan-sekeri 143) (<= kan-sekeri 179)) (cons 5 1))
- ((and (> kan-sekeri 179) (<= kan-sekeri 233)) (cons 7 2))
- ((and (> kan-sekeri 233) (<= kan-sekeri 287)) (cons 10 3))
- ((and (> kan-sekeri 287) (<= kan-sekeri 360)) (cons 13 4))
- ((> kan-sekeri 360) (cons 15 5))))
- (defparameter *INFUSION-TABLE*
- '((117 - 143 0 1 )
- (144 - 179 5 1 )
- (180 - 233 7 2 )
- (234 - 287 10 3 )
- (288 - 359 13 4 )
- (360 - 999 15 5 ))
- "Blood glucose range Bolus dose Infusion rate" )
- (defun check-protocol (blood-glucose row)
- (when (and (> blood-glucose (first row))
- (<= blood-glucose (third row)))
- (list* (fourth row) (fifth row))))
- (defun calculate-insulin-dose (blood-glucose)
- (mapcan #'(lambda (x)
- (check blood-glucose (nth x *INFUSION-TABLE*)))
- '(0 1 2 3 4 5)))
- '(old-person fragile undernourished diabetic) x '(144 - 179 3 1)
- '(young-person fit obese non-diabetic) x '(144 - 179 6 2)
- #2A((YOUNG-PERSON FIT OBESE NON-DIABETIC) (144 179 6 2))
- (defun calculate-insulin-dose (blood-glucose)
- "Returns bolus dose and infusion rate"
- (cond ((<= 117 blood-glucose 143) (values 0 1))
- ((<= 144 blood-glucose 179) (values 5 1))
- ((<= 180 blood-glucose 233) (values 7 2))
- ((<= 234 blood-glucose 287) (values 10 3))
- ((<= 288 blood-glucose 360) (values 13 4))
- ((<= 361 blood-glucose ) (values 15 5))))
- (defparameter *INFUSION-TABLE*
- '((117 - 143 0 1 )
- (144 - 179 5 1 )
- (180 - 233 7 2 )
- (234 - 287 10 3 )
- (288 - 359 13 4 )
- (360 - 999 15 5 ))
- "Blood glucose range Bolus dose Infusion rate" )
- (defun calculate-insulin-dose (blood-glucose)
- (loop for (a nil b dose rate) in *INFUSION-TABLE*
- when (<= a blood-glucose b)
- do (return (values dose rate))))
Add Comment
Please, Sign In to add comment