Exemplo n.º 1
0
def save_event_summary(request):
    event_summary = EventSummary(patient=User.objects.get(id=request.POST['patient_id']), summary=request.POST['summary'])
    event_summary.save()
    encounter = Encounter.objects.get(id=request.POST['encounter_id'])
    ctype = ContentType.objects.get_for_model(event_summary)
    encounter_event = EncounterEvent(content_type=ctype, object_id=event_summary.id)
    encounter_event.save()
    encounter.events.add(encounter_event)
    encounter.save()
    return HttpResponse('')
Exemplo n.º 2
0
def save_event_summary(request):
    if request.POST['objname'] == 'goal':
        goal = Goal.objects.get(id=request.POST['id'])
        value = True if request.POST['value'] == 'true' else False
        setattr(goal,'is_controlled', value)
        goal.save()
    else:
        event_summary = EventSummary(patient=User.objects.get(id=request.POST['patient_id']), summary=request.POST['summary'])
        event_summary.save()
        encounter = Encounter.objects.get(id=request.POST['encounter_id'])
        ctype = ContentType.objects.get_for_model(event_summary)
        encounter_event = EncounterEvent(content_type=ctype, object_id=event_summary.id)
        encounter_event.save()
        encounter.events.add(encounter_event)
        encounter.save()
    return HttpResponse('')