Advertisement
stronk_8s

Rough DB Design

Aug 14th, 2024 (edited)
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 2.89 KB | Source Code | 0 0
  1. // Staff Collection
  2. {
  3.   "_id": ObjectId(),
  4.   "photo":any || binary,
  5.   "firstName": "",
  6.   "middleName": "",
  7.   "lastName": "",
  8.   "bloodGroup": "",
  9.   "addresses": [
  10.     {
  11.       "addressLine1":"",
  12.       "addressLine2":"",
  13.       "state": "", //datalist from external api
  14.       "city": "", //datalist from external api
  15.       "country": "", //datalist form external api
  16.       "pincode":""
  17.     },
  18.     {
  19.       //secondary  if applicable
  20.     }
  21.   ],
  22.   "email": "",
  23.   "phones": [
  24.     "+389123918",
  25.     "+19381930" //secondary if applicable
  26.   ],
  27.   "role": "doctor"|| "nurse" || "receptionist" || "peon",
  28.   "shifts": [ //will be updated alongside the shift collection if shift is changed
  29.     {
  30.       "shiftId": ObjectId(),
  31.       "startTime": ISODate(),
  32.       "endTime": ISODate()
  33.     }
  34.   ]
  35. }
  36.  
  37.  
  38. // Shift Collection
  39. {
  40.   "_id": ObjectId(),
  41.   "name":"morning"|| etc....,
  42.   "startTime": ISODate(),
  43.   "endTime": ISODate(),
  44.   "receptionists": [
  45.     ObjectId("..."),
  46.     ObjectId("...")
  47.   ],
  48.   "nurses": [
  49.     ObjectId("..."),
  50.     ObjectId("..."),
  51.     ObjectId("..."),
  52.     ObjectId("...")
  53.   ],
  54.   "doctors": [
  55.     ObjectId("..."),
  56.     ObjectId("...")
  57.   ],
  58.   "triageDoctor": ObjectId("...")
  59. }
  60.  
  61.  
  62. // Patient Collection
  63. {
  64.   "_id": ObjectId(),
  65.   "photo":any || binary,
  66.   "firstName": "",
  67.   "middleName": "",
  68.   "lastName": "",
  69.   "addresses": [
  70.     {
  71.       "addressLine1":"",
  72.       "addressLine2":"",
  73.       "state": "",//datalist form external api
  74.       "city": "",//datalist form external api
  75.       "country": "",//datalist form external api
  76.       "pincode":""
  77.     },
  78.     {
  79.       //secondary  if applicable
  80.     }
  81.   ],
  82.   "emails": "" || null,
  83.   "phones": [
  84.     "+2987654321",
  85.     "+1021231230" //secondary if applicable
  86.   ],
  87.   "gaudian": [
  88.     {
  89.       "name": "",
  90.       "relation": "",
  91.       "mobileNo": ""
  92.     }
  93.   ],
  94.   "bloodGroup": "",
  95.   "admittedBy": ObjectId(), // reference to the receptionist
  96.   "triageDoctor": ObjectId(), // reference to the triage doctor
  97.   "caseDoctors": [
  98.     {
  99.       "id":ObjectId(), // only if admitted
  100.       "name": "" //
  101.     }
  102.   ],
  103.   "bedAssigned": {
  104.     "bedId": ObjectId(), // only if admitted
  105.     "nurse": ObjectId() // only if admitted
  106.   },
  107.   "medications": [ //nullable depends on situation
  108.     {
  109.       "medicationName": "",
  110.       "prescribedBy": ObjectId(), //doctor reference
  111.       "administeredBy": [
  112.         {
  113.           "nurseId": ObjectId(),
  114.           "shiftId": ObjectId()
  115.         }
  116.       ]
  117.     }
  118.   ],
  119.   "type": "regular"||"staff",
  120.   "staffRole": "doctor"||"peon"||"nurse"||"receptionist",
  121.   "status": "admitted" || "sent home"
  122. }
  123.  
  124.  
  125. //Bed Collection
  126. {
  127.   "_id": ObjectId(),
  128.   "bedNumber": "",
  129.   "location": "floors no.",
  130.   "type": "regular"||"deluxe"...,
  131.   "status": "available"|| "occupied",
  132.   "patient": {
  133.     "patientId": ObjectId(), // only if assigned
  134.     "admittedDate": ISODate() // only if assigned
  135.   }
  136. }
Tags: er
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement