Exemple #1
0
def edit_palliative(request, p_id, tp_num):
    tp_fk = TreatmentPlan.objects.get(identity_fk=p_id, num=tp_num)
    if not ChemoTherapy.objects.filter(tp_fk=tp_fk,
                                       type="Palliative").exists():
        return new_palliative(request, p_id, tp_num)
    else:
        p_chemotherapy = get_object_or_404(ChemoTherapy,
                                           tp_fk=tp_fk,
                                           type="Palliative")
        if request.method == "POST":
            form = ChemoTherapyForm(request.POST, instance=p_chemotherapy)
            if form.is_valid():
                p_chemotherapy = form.save(
                )  # """ ekhane change kora lagte pare"""
                return redirect('pbi:view_treatmentplan',
                                p_id=p_id,
                                tp_num=tp_num)
        else:
            form = ChemoTherapyForm(instance=p_chemotherapy)
        ac = autocomplete()
        z = {
            'form': form,
            'p_chemotherapy': p_chemotherapy,
            'type': 'Palliative'
        }
        context = {**z, **ac}
        return render(request, 'chemotherapy/EditChemoTherapy.html', context)
Exemple #2
0
def new_hormone(request, p_id, tp_num):
    if request.method == "POST":
        form = HormoneForm(request.POST)
        if form.is_valid():
            p_hormone = form.save(commit=False)
            tmp_tp_fk = TreatmentPlan.objects.get(identity_fk=p_id, num=tp_num)
            p_hormone.tp_fk = tmp_tp_fk
            p_hormone.save()
        return redirect('pbi:view_treatmentplan', p_id=p_id, tp_num=tp_num)
    else:
        form = HormoneForm()
    ac = autocomplete()
    z = {'form': form}
    context = {**z, **ac}
    return render(request, 'surgeryhormone/EditHormone.html', context)
Exemple #3
0
def new_tki(request, p_id, tp_num):
    tp_fk = TreatmentPlan.objects.get(identity_fk=p_id, num=tp_num)
    if request.method == "POST":
        form = TkiForm(request.POST)
        if form.is_valid():
            p_tki = form.save(commit=False)
            p_tki.tp_fk = tp_fk
            p_tki.save()
        return redirect('pbi:view_treatmentplan', p_id, tp_num)
    else:
        form = TkiForm()
    ac = autocomplete()
    z = {'form': form, 'type': 'TKI'}
    context = {**z, **ac}
    return render(request, 'targetedtherapy/EditTargetedTherapy.html', context)
Exemple #4
0
def new_status(request, p_id):
    pid = p_id
    if request.method == "POST":
        form = StatusForm(request.POST)
        if form.is_valid():
            p_status = form.save(commit=False)
            p_status.identity_fk = Identity.objects.get(pk=p_id)
            p_status.save()
        return redirect('view_patientdetails', p_id=pid)
    else:
        form = StatusForm()
    ac = autocomplete()
    z = {'form': form}
    context = {**z, **ac}
    return render(request, 'status/EditStatus.html', context)
Exemple #5
0
def new_nact(request, p_id, tp_num):
    tp_fk = TreatmentPlan.objects.get(identity_fk=p_id, num=tp_num)
    if request.method == "POST":
        form = ChemoTherapyForm(request.POST)
        if form.is_valid():
            nact = form.save(commit=False)
            nact.tp_fk = tp_fk
            nact.type = "NACT"
            nact.save()
        return redirect('pbi:view_treatmentplan', p_id=p_id, tp_num=tp_num)
    else:
        form = ChemoTherapyForm()
    ac = autocomplete()
    z = {'form': form, 'type': 'NACT'}
    context = {**z, **ac}
    return render(request, 'chemotherapy/EditChemoTherapy.html', context)
Exemple #6
0
def new_Brachy(request, p_id, tp_num):
    if request.method == "POST":
        form = RadioTherapyForm(request.POST)
        if form.is_valid():
            brachy = form.save(commit=False)
            tmp_tp_fk = TreatmentPlan.objects.get(identity_fk=p_id, num=tp_num)
            brachy.tp_fk = tmp_tp_fk
            brachy.type = "Brachy"
            brachy.save()
        return redirect('pbi:view_treatmentplan', p_id=p_id, tp_num=tp_num)
    else:
        form = RadioTherapyForm()
    ac = autocomplete()
    z = {'form': form, 'type': 'Brachy'}
    context = {**z, **ac}
    return render(request, 'radiotherapy/EditRadioTherapy.html', context)
Exemple #7
0
def edit_hormone(request, p_id,tp_num):
    tp = TreatmentPlan.objects.get(identity_fk = p_id, num=tp_num)
    if not Hormone.objects.filter(tp_fk=tp).exists():
        return new_hormone(request, p_id,tp_num)
    else:
        p_hormone = get_object_or_404(Hormone, tp_fk=tp)
        if request.method == "POST":
            form = HormoneForm(request.POST, instance=p_hormone)
            if form.is_valid():
                p_hormone = form.save()
                return redirect('pbi:view_treatmentplan', p_id=p_id, tp_num=tp_num)
        else:
            form = HormoneForm(instance=p_hormone)
        ac = autocomplete()
        z = {'form': form, 'p_hormone': p_hormone}
        context = {**z, **ac}
        return render(request, 'surgeryhormone/EditHormone.html', context)
Exemple #8
0
def edit_status(request, p_id):
    pid = p_id
    if not Status.objects.filter(identity_fk=p_id).exists():
        return new_status(request, p_id)
    else:
        p_status = get_object_or_404(Status, identity_fk=p_id)
        if request.method == "POST":
            form = StatusForm(request.POST, instance=p_status)
            if form.is_valid():
                p_status = form.save()
                return redirect('view_patientdetails', p_id=pid)
        else:
            form = StatusForm(instance=p_status)
        ac = autocomplete()
        z = {'form': form, 'p_status': p_status}
        context = {**z, **ac}
        return render(request, 'status/EditStatus.html', context)
Exemple #9
0
def edit_history(request, p_id):
    pid = p_id
    if not HistoryModel.objects.filter(identity_fk=p_id).exists():
        return new_history(request, p_id)
    else:
        p_history = get_object_or_404(HistoryModel, identity_fk=p_id)
        if request.method == "POST":
            form = HistoryForm(request.POST, instance=p_history)
            if form.is_valid():
                p_history = form.save()
                return redirect('view_patientdetails', p_id=pid)
        else:
            form = HistoryForm(instance=p_history)
        ac = autocomplete()
        z = {'form': form, 'p_history': p_history}
        context = {**z, **ac}
        return render(request, 'history/EditHistory.html', context)
Exemple #10
0
def edit_prescription(request, p_id, number):
    pid = p_id
    if not Prescription.objects.filter(identity_fk=p_id, num=number).exists():
        return new_prescription(request, p_id)
    else:
        p_prescription = get_object_or_404(Prescription,
                                           identity_fk=p_id,
                                           num=number)
        if request.method == "POST":
            form = PrescriptionForm(request.POST, instance=p_prescription)
            if form.is_valid():
                p_investigations = form.save(
                )  # """ ekhane change kora lagte pare"""
                return redirect('view_patientdetails', p_id=pid)
        else:
            form = PrescriptionForm(instance=Prescription)
        ac = autocomplete()
        z = {'form': form, 'p_prescription': p_prescription}
        context = {**z, **ac}
        return render(request, 'patientbasicinfo/EditPrescription.html',
                      context)
Exemple #11
0
def edit_tki(request, p_id, tp_num):
    tp_fk = TreatmentPlan.objects.get(identity_fk=p_id, num=tp_num)
    if not Tki.objects.filter(tp_fk=tp_fk).exists():
        return new_tki(request, p_id, tp_num)
    else:
        p_targetedtherapy = get_object_or_404(Tki, tp_fk=tp_fk)
        if request.method == "POST":
            form = TkiForm(request.POST, instance=p_targetedtherapy)
            if form.is_valid():
                p_targetedtherapy = form.save()
                return redirect('pbi:view_treatmentplan', p_id, tp_num)
        else:
            form = TkiForm(instance=p_targetedtherapy)
        ac = autocomplete()
        z = {
            'form': form,
            'p_targetedtherapy': p_targetedtherapy,
            'type': 'TKI'
        }
        context = {**z, **ac}
        return render(request, 'targetedtherapy/EditTargetedTherapy.html',
                      context)
Exemple #12
0
def new_prescription(request, p_id):
    pid = p_id
    num = 1
    if request.method == "POST":
        form = PrescriptionForm(request.POST)
        if form.is_valid():
            data = form.save(commit=False)
            data.identity_fk = Identity.objects.get(pk=p_id)
            try:
                num = 1 + Prescription.objects.filter(
                    identity_fk=p_id).latest('num').num
            except:
                print("Exception! Shit!")
            data.num = num
            data.date = timezone.now()
            data.save()
        return redirect('view_patientdetails', p_id=pid)
    else:
        form = PrescriptionForm()
    ac = autocomplete()
    z = {'form': form}
    context = {**z, **ac}
    return render(request, 'patientbasicinfo/EditPrescription.html', context)