|
|
147
|
+ def __str__(self):
|
|
|
148
|
+ return f"{self.title} {self.address_text}"
|
|
|
149
|
+
|
|
|
150
|
+
|
|
|
151
|
+class Bed(models.Model):
|
|
|
152
|
+ code = models.CharField(max_length=30)
|
|
|
153
|
+ occupy = models.BooleanField(default=False)
|
|
|
154
|
+ patient = models.ForeignKey(Patient, on_delete=models.SET_NULL, null=True, blank=True)
|
|
|
155
|
+ hospital = models.ForeignKey(Hospital, on_delete=models.CASCADE)
|
|
|
156
|
+ created_at = models.DateTimeField(auto_now_add=True, null=True)
|
|
|
157
|
+ updated_at = models.DateTimeField(auto_now=True)
|
|
|
158
|
+
|
|
|
159
|
+
|
|
|
160
|
+ def __str__(self):
|
|
|
161
|
+ return self.code
|
|
|
162
|
+
|
|
|
163
|
+
|
|
|
164
|
+class PatientLog(models.Model):
|
|
|
165
|
+ patient = models.ForeignKey(Patient, on_delete=models.SET_NULL, null=True)
|
|
|
166
|
+ hospital = models.ForeignKey(Hospital, on_delete=models.CASCADE, null=True)
|
|
|
167
|
+ bed = ChainedForeignKey(
|
|
|
168
|
+ "Bed",
|
|
|
169
|
+ chained_field="hospital",
|
|
|
170
|
+ chained_model_field="hospital",
|
|
|
171
|
+ show_all=False,
|
|
|
172
|
+ auto_choose=True,
|
|
|
173
|
+ null=True
|
|
|
174
|
+ )
|
|
|
175
|
+ notes = models.TextField(blank=True, null=True)
|
|
|
176
|
+ condition_level = models.CharField(
|
|
|
177
|
+ max_length=30,
|
|
|
178
|
+ choices=(("green", "Green"), ("yellow", "Yellow"), ("red", "Red")),
|
|
|
179
|
+ null=True,
|
|
|
180
|
+ )
|
|
|
181
|
+ status = models.CharField(
|
|
|
182
|
+ max_length=30,
|
|
|
183
|
+ choices=(("active", "Active"), ("inactive", "Inactive"), ("transfer", "Transfer")),
|
|
|
184
|
+ null=True,
|
|
|
185
|
+ )
|
|
|
186
|
+ checkin_at = models.DateTimeField(null=True, blank=True)
|
|
|
187
|
+ checkout_at = models.DateTimeField(null=True, blank=True)
|
|
|
188
|
+
|
|
|
189
|
+ created_at = models.DateTimeField(auto_now_add=True, null=True)
|
|
|
190
|
+ updated_at = models.DateTimeField(auto_now=True)
|
|
|
191
|
+
|
|
|
192
|
+
|
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+from django.test import TestCase
|
|
|
2
|
+
|
|
|
3
|
+# Create your tests here.
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+from django.urls import path
|
|
|
2
|
+
|
|
|
3
|
+from . import views
|
|
|
4
|
+
|
|
|
5
|
+urlpatterns = [
|
|
|
6
|
+ path('', views.index, name='index'),
|
|
|
7
|
+]
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+from django.shortcuts import render
|
|
|
2
|
+
|
|
|
3
|
+# Create your views here.
|
|
|
4
|
+from django.http import HttpResponse
|
|
|
5
|
+
|
|
|
6
|
+
|
|
|
7
|
+def index(request):
|
|
|
8
|
+ return HttpResponse("Hello, world. You're at the polls index.")
|