Esempio n. 1
0
    def test_booking_as_provider(self):

        print("test_booking_as_provider")
        #create a patient to be dummy provider
        providerObj = system.get_patient("*****@*****.**")
        assert (providerObj.is_provider() == False)

        centreObj = system.get_centre("USYD Health Service")
        assert (centreObj.is_centre() == True)

        userObj = system.get_patient("*****@*****.**")
        assert (userObj.is_provider() == False)

        datetimeObj = datetime.datetime(2018, 1, 1, 10, 30)
        note = "I'm drowning, help me!"
        referral_id = 0

        try:
            apmt = system.add_current_appointment(userObj, providerObj,
                                                  centreObj, datetimeObj, note,
                                                  referral_id)
        except BookingError as be:
            print(be.msg)
            #assert(be.msg =="Booking error occured with fields: user")
            assert (True)
        else:
            assert (False)
        pass
Esempio n. 2
0
    def test_booking_same_appointment(self):
        print("test_booking_same_appointment")
        #add a new appointment with same detail from above
        providerObj = system.get_provider("*****@*****.**")
        assert (providerObj.is_provider() == True)

        centreObj = system.get_centre("USYD Health Service")
        assert (centreObj.is_centre() == True)

        userObj = system.get_patient("*****@*****.**")
        assert (userObj.is_provider() == False)

        datetimeObj = datetime.datetime(2018, 1, 1, 10, 30)
        note = "I'm dying, please help me doctor!"
        referral_id = 0

        try:
            apmt = system.add_current_appointment(userObj, providerObj,
                                                  centreObj, datetimeObj, note,
                                                  referral_id)
        except BookingError as be:
            print(be.msg)
            assert (be.msg ==
                    "Booking error occured with fields: double book warning")
            assert (True)
        else:
            assert (False)
        pass
Esempio n. 3
0
    def test_successful_appointment_2(self):
        print("test_successful_booking_appointment_2")

        providerObj = system.get_provider("*****@*****.**")
        assert (providerObj.is_provider() == True)

        centreObj = system.get_centre("USYD Health Service")
        assert (centreObj.is_centre() == True)

        userObj = system.get_patient("*****@*****.**")
        assert (userObj.is_provider() == False)

        datetimeObj = datetime.datetime(2018, 1, 1, 10, 30)
        note = "I'm dying, please help me doctor!"
        referral_id = 0

        apmt = system.add_current_appointment(userObj, providerObj, centreObj,
                                              datetimeObj, note, referral_id)
        assert (apmt.patient.full_name == userObj.full_name)
        assert (apmt.provider == providerObj)
        assert (apmt.healthcare_centre == centreObj)
        assert (apmt.datetime == datetimeObj)
        assert (apmt.patient_note == note)
        apmt.patient_note = None
        assert (apmt.patient_note == None)
Esempio n. 4
0
    def test_successful_appointment_with_specialist(self):
        print("test_booking_appointment_with_specialist")
        #add a new appointment with same detail from above
        providerObj = system.get_provider("*****@*****.**")
        assert (providerObj.is_provider() == True)
        assert (providerObj.is_specialist() == True)

        centreObj = system.get_centre("UNSW Health Service")
        assert (centreObj.is_centre() == True)

        userObj = system.get_patient("*****@*****.**")
        assert (userObj.is_provider() == False)

        datetimeObj = datetime.datetime(2018, 1, 1, 10, 30)
        note = "I'm has tumour, please help me doctor!"
        referral_id = 0

        try:
            apmt = system.add_current_appointment(userObj, providerObj,
                                                  centreObj, datetimeObj, note,
                                                  referral_id)
        except BookingError as be:
            assert (False)
        else:
            assert (apmt.patient.full_name == userObj.full_name)
            assert (apmt.provider == providerObj)
            assert (apmt.healthcare_centre == centreObj)
            assert (apmt.datetime == datetimeObj)
            assert (apmt.patient_note == note)
            apmt.patient_note = None
            assert (apmt.patient_note == None)
            pass
Esempio n. 5
0
    def test_successful_appointment_1(self):
        print("test_successful_booking_appointment_1")

        providerObj = system.get_provider("*****@*****.**")
        assert (providerObj.is_provider() == True)

        centreObj = system.get_centre("Sydney Children Hospital")
        assert (centreObj.is_centre() == True)

        userObj = system.get_patient("*****@*****.**")
        assert (userObj.is_provider() == False)

        datetimeObj = datetime.datetime(2018, 1, 1, 10, 30)
        note = "I'm very sick, please help me doctor!"
        referral_id = 0

        apmt = system.add_current_appointment(userObj, providerObj, centreObj,
                                              datetimeObj, note, referral_id)

        assert (apmt.patient.full_name == userObj.full_name)
        assert (apmt.provider == providerObj)
        assert (apmt.healthcare_centre == centreObj)
        assert (apmt.datetime == datetimeObj)
        assert (apmt.patient_note == note)
        apmt.patient_note = None
        assert (apmt.patient_note == None)
Esempio n. 6
0
    def test_provider_with_wrong_centre(self):

        print("test_booking_when_centre_not_exist")

        providerObj = system.get_provider("*****@*****.**")
        assert (providerObj.is_provider() == True)

        centreObj = system.get_centre("Prince of Wales Hospital")
        assert (centreObj.is_centre() == True)

        userObj = system.get_patient("*****@*****.**")
        assert (userObj.is_provider() == False)

        datetimeObj = datetime.datetime(2018, 1, 1, 10, 30)
        note = "I'm bleeding, help me!"
        referral_id = 0

        try:
            apmt = system.add_current_appointment(userObj, providerObj,
                                                  centreObj, datetimeObj, note,
                                                  referral_id)
        except BookingError as be:
            print(be.msg)
            #assert(be.msg =="Booking error occured with fields: user")
            assert (True)
        else:
            assert (False)
        pass
        pass
Esempio n. 7
0
def view_patient_history():
    patient_list = system.get_patient_list(current_user)
    if request.method == "POST":
        patient = system.get_patient(request.form['patient'])
        current_results = system.get_current_appointments(patient)
        past_results = system.get_past_appointments(patient)
        return render_template('patient_history.html', patient=patient, patient_list=patient_list, current_appointments=current_results, past_appointments=past_results)

    else:
        return render_template('patient_history.html', patient_list=patient_list)
Esempio n. 8
0
 def test_consult_messages(self):
     providerObj = system.get_provider("*****@*****.**")
     centreObj = system.get_centre("Sydney Children Hospital")
     userObj = system.get_patient("*****@*****.**")
     datetimeObj = datetime.datetime(2018, 1, 2, 10, 30)
     note = "I'm very sick, please help me doctor!"
     referral_id = 0
     apmt = system.add_current_appointment(userObj, providerObj, centreObj,
                                           datetimeObj, note, referral_id)
     medication = ""
     comment = ""
     apmt.document_consultation(medication, comment)
     assert apmt.provider_comment == comment
     assert apmt.provider_medication == medication
     medication_1 = "Panadol"
     comment_1 = "Fever"
     apmt.document_consultation(medication, comment)
     assert apmt.provider_comment == comment
     assert apmt.provider_medication == medication
Esempio n. 9
0
def confirm_booking():
    month = request.form['month']
    date = request.form['date']
    centre = request.form['centre']
    selected_time = request.form['time']
    referral = request.form['referral']
    hour, minute, tmp = request.form['time'].split(":")
    provider = system.get_provider(request.form['email'])
    centreObj = system.get_centre(centre)
    datetimeObj = datetime.datetime(2018,int(month),int(date),int(hour),int(minute))
    userObj = system.get_patient(current_user.email_address)
    note = None
    if 'note' in request.form:
        note = request.form['note']
    try:
        appointmentObj = system.add_appointment(userObj, provider, centreObj, datetimeObj, note, int(referral))
        return render_template('booking.html', appointmentObj=appointmentObj, confirm=True)
    except BookingError as be:
        dateObj = datetime.date(2018,int(month),int(date))
        tmp, days = calendar.monthrange(2018, int(month))
        times = provider.is_available(system.current_appointments(),month,date)
        tmp, days = calendar.monthrange(2018, int(month))
        dates = range(1, days+1)
        return render_template('booking.html', errors=be.errors, provider=provider, centre=centre, month=month, date=date, formatted_date=dateObj, times=times, dates=dates, referral = referral)