Guest User

Untitled

a guest
Jan 22nd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. (defun calculate-insulin-dose (blood-glucose)
  2. "Returns a cons as: ("bolus dose" . "infusion rate")
  3. (cond ((and (> kan-sekeri 116) (<= kan-sekeri 143)) (cons 0 1))
  4. ((and (> kan-sekeri 143) (<= kan-sekeri 179)) (cons 5 1))
  5. ((and (> kan-sekeri 179) (<= kan-sekeri 233)) (cons 7 2))
  6. ((and (> kan-sekeri 233) (<= kan-sekeri 287)) (cons 10 3))
  7. ((and (> kan-sekeri 287) (<= kan-sekeri 360)) (cons 13 4))
  8. ((> kan-sekeri 360) (cons 15 5))))
  9.  
  10. (defparameter *INFUSION-TABLE*
  11. '((117 - 143 0 1 )
  12. (144 - 179 5 1 )
  13. (180 - 233 7 2 )
  14. (234 - 287 10 3 )
  15. (288 - 359 13 4 )
  16. (360 - 999 15 5 ))
  17. "Blood glucose range Bolus dose Infusion rate" )
  18.  
  19. (defun check-protocol (blood-glucose row)
  20. (when (and (> blood-glucose (first row))
  21. (<= blood-glucose (third row)))
  22. (list* (fourth row) (fifth row))))
  23.  
  24. (defun calculate-insulin-dose (blood-glucose)
  25. (mapcan #'(lambda (x)
  26. (check blood-glucose (nth x *INFUSION-TABLE*)))
  27. '(0 1 2 3 4 5)))
  28.  
  29. '(old-person fragile undernourished diabetic) x '(144 - 179 3 1)
  30.  
  31. '(young-person fit obese non-diabetic) x '(144 - 179 6 2)
  32.  
  33. #2A((YOUNG-PERSON FIT OBESE NON-DIABETIC) (144 179 6 2))
  34.  
  35. (defun calculate-insulin-dose (blood-glucose)
  36. "Returns bolus dose and infusion rate"
  37. (cond ((<= 117 blood-glucose 143) (values 0 1))
  38. ((<= 144 blood-glucose 179) (values 5 1))
  39. ((<= 180 blood-glucose 233) (values 7 2))
  40. ((<= 234 blood-glucose 287) (values 10 3))
  41. ((<= 288 blood-glucose 360) (values 13 4))
  42. ((<= 361 blood-glucose ) (values 15 5))))
  43.  
  44. (defparameter *INFUSION-TABLE*
  45. '((117 - 143 0 1 )
  46. (144 - 179 5 1 )
  47. (180 - 233 7 2 )
  48. (234 - 287 10 3 )
  49. (288 - 359 13 4 )
  50. (360 - 999 15 5 ))
  51. "Blood glucose range Bolus dose Infusion rate" )
  52.  
  53. (defun calculate-insulin-dose (blood-glucose)
  54. (loop for (a nil b dose rate) in *INFUSION-TABLE*
  55. when (<= a blood-glucose b)
  56. do (return (values dose rate))))
Add Comment
Please, Sign In to add comment