Esempio n. 1
0
def __edit_if_post_method(context, request: HttpRequest, patient_id: int):
    if request.method == 'POST':
        try:
            patient = __get_edit_patient_dto_from_request(request, patient_id)
            work_service_provider.patient_management_service().edit_patient(patient_id, patient)
            context['saved'] = True
            return __get_patient_details_dto_or_rise_404(patient_id)
        except Exception as e:
            print(e)
            context['saved'] = False
Esempio n. 2
0
def __create_if_post_method(context, request):
    if request.method == 'POST':
        try:
            patient = __get_create_patient_dto_from_request(request)
            password = patient.password
            confirm_password = patient.confirm_password
            if password == confirm_password:
                work_service_provider.patient_management_service().create_patient(patient)
                context['saved'] = True
            else:
                context['saved'] = False
        except Exception as e:
            context['saved'] = False
Esempio n. 3
0
def list_patient_for_doctor(request):
    patients = work_service_provider.patient_management_service().list_patient()
    context = {
        "title": 'Patients',
        'patients': patients
    }
    return render(request, 'doctor/list_patient_for_doc.html', context)
Esempio n. 4
0
def search_patient(request):
    patient = work_service_provider.patient_management_service().search_patient(request.GET.get('patient_number', None))
    context = {
        'patient': patient,
        'patient_number': request.GET['patient_number']
    }
    return render(request, 'staff/search_patient.html', context)
Esempio n. 5
0
def create_appointment_for_staff(request):
    patients = work_service_provider.patient_management_service(
    ).get_all_for_select_list()
    doctors = work_service_provider.doctor_management_service(
    ).get_all_for_select_list_doc()
    context = {
        'appointment_number': str(uuid.uuid4()).replace("-", '')[0:10].upper(),
        'appointment_reference': uuid.uuid4(),
        'patients': patients,
        'doctors': doctors,
    }
    __create_if_post_method(request, context)
    if request.method == ['POST'] and context['saved']:
        return redirect('patient_home')
    return render(request, 'staff/appointment_for staff.html', context)
Esempio n. 6
0
def create_medical_record(request):
    patient = work_service_provider.patient_management_service(
    ).get_all_for_select_list()
    med_id = uuid.uuid4()
    id = request.user.staff.id
    doctor = work_service_provider.doctor_management_service().doctor_details(
        id)
    med_number = str(uuid.uuid4()).replace("-", '')[0:10].upper()
    context = {
        'patient': patient,
        'doctor': doctor,
        'med_id': med_id,
        'med_number': med_number
    }
    __create_if_post_method(request, context)
    if request.method == 'POST' and context['saved']:
        return redirect('doctor_home')
    return render(request, 'medical_record/create_med_red.html', context)
Esempio n. 7
0
def __get_patient_details_dto_or_rise_404(patient_id) -> PatientDetailsDto:
    try:
        patient = work_service_provider.patient_management_service().patient_details(patient_id)
    except Patient.DoesNotExist:
        raise Http404("requested patient dose not exit")
    return patient