Exemplo n.º 1
0
def do_first_visit(args):
    claim_id = args.claim_id
    description = args.description
    doctor_pkey = args.doctor_pkey

    url = _get_url(args)
    keyfile = _get_keyfile(args)
    auth_user, auth_password = _get_auth_info(args)

    client = HealthCareClient(base_url=url, keyfile=keyfile)

    if args.wait and args.wait > 0:
        response = client.first_visit(claim_id=claim_id,
                                      description=description,
                                      doctor_pkey=doctor_pkey,
                                      wait=args.wait,
                                      auth_user=auth_user,
                                      auth_password=auth_password)
    else:
        response = client.first_visit(claim_id=claim_id,
                                      description=description,
                                      doctor_pkey=doctor_pkey,
                                      auth_user=auth_user,
                                      auth_password=auth_password)

    print("Response: {}".format(response))
Exemplo n.º 2
0
def do_list_patients(args):
    url = _get_url(args)
    auth_user, auth_password = _get_auth_info(args)

    client = HealthCareClient(base_url=url, keyfile=None)

    patient_list = client.list_patients(auth_user=auth_user,
                                        auth_password=auth_password)

    if patient_list is not None:
        fmt = "%-15s %-15s %-15s %-15s"
        print(fmt % ('PATIENT HEX', 'NAME', 'SURNAME', 'PUBLIC_KEY'))
        for key, value in patient_list.items():
            print(fmt % (key, value.name, value.surname, value.public_key))
    else:
        raise HealthCareException("Could not retrieve patient listing.")
Exemplo n.º 3
0
def do_list_doctors(args):
    url = _get_url(args)
    auth_user, auth_password = _get_auth_info(args)

    client = HealthCareClient(base_url=url, keyfile=None)

    doctors_list = client.list_doctors(auth_user=auth_user,
                                       auth_password=auth_password)

    if doctors_list is not None:
        fmt = "%-15s %-15s %-15s"
        print(fmt % ('NAME', 'SURNAME', 'PUBLIC_KEY'))
        for doctor in doctors_list:
            print(fmt % (doctor.name, doctor.surname, doctor.public_key))
    else:
        raise HealthCareException("Could not retrieve doctors listing.")
Exemplo n.º 4
0
def do_list_claims(args):
    url = _get_url(args)
    auth_user, auth_password = _get_auth_info(args)

    client = HealthCareClient(base_url=url, keyfile=None)

    claims_list = client.list_claims(auth_user=auth_user,
                                     auth_password=auth_password)

    if claims_list is not None:
        fmt = "%-15s %-15s %-15s %-15s"
        print(fmt % ('CLAIM HEX', 'CLAIM ID', 'CLINIC PKEY', 'PATIENT PKEY'))
        for key, value in claims_list.items():
            print(fmt %
                  (key, value.claim_id, value.clinic_pkey, value.patient_pkey))
    else:
        raise HealthCareException("Could not retrieve claims listing.")
Exemplo n.º 5
0
def do_create_clinic(args):
    name = args.name

    url = _get_url(args)
    keyfile = _get_keyfile(args)
    auth_user, auth_password = _get_auth_info(args)

    client = HealthCareClient(base_url=url, keyfile=keyfile)

    if args.wait and args.wait > 0:
        response = client.create_clinic(name,
                                        wait=args.wait,
                                        auth_user=auth_user,
                                        auth_password=auth_password)
    else:
        response = client.create_clinic(name,
                                        auth_user=auth_user,
                                        auth_password=auth_password)

    print("Response: {}".format(response))
Exemplo n.º 6
0
def do_list_claim_details(args):
    clinic_pkey = args.clinic_pkey
    claim_id = args.claim_id
    url = _get_url(args)
    auth_user, auth_password = _get_auth_info(args)

    client = HealthCareClient(base_url=url, keyfile=None)

    claim_details_list = client.list_claim_details(claim_id,
                                                   clinic_pkey,
                                                   auth_user=auth_user,
                                                   auth_password=auth_password)

    if claim_details_list is not None:
        fmt = "%-15s %-15s %-15s %-15s %-15s %-15s"
        print(fmt % ('EVENT HEX', 'CLAIM ID', 'CLINIC PKEY', 'EVENT',
                     'DESCRIPTION', 'EVENT TIME'))
        for key, value in claim_details_list.items():
            print(fmt % (key, value.claim_id, value.clinic_pkey, value.event,
                         value.description, value.event_time))
    else:
        raise HealthCareException("Could not retrieve claim details listing.")
Exemplo n.º 7
0
def do_assign_doctor(args):
    claim_id = args.claim_id
    doctor_pkey = args.doctor_pkey

    url = _get_url(args)
    keyfile = _get_keyfile(args)
    auth_user, auth_password = _get_auth_info(args)

    client = HealthCareClient(base_url=url, keyfile=keyfile)

    if args.wait and args.wait > 0:
        response = client.assign_doctor(claim_id,
                                        doctor_pkey,
                                        wait=args.wait,
                                        auth_user=auth_user,
                                        auth_password=auth_password)
    else:
        response = client.assign_doctor(claim_id,
                                        doctor_pkey,
                                        auth_user=auth_user,
                                        auth_password=auth_password)

    print("Response: {}".format(response))
Exemplo n.º 8
0
def do_create_claim(args):
    claim_id = args.claim_id
    patient_pkey = args.patient_pkey

    url = _get_url(args)
    keyfile = _get_keyfile(args)
    auth_user, auth_password = _get_auth_info(args)

    client = HealthCareClient(base_url=url, keyfile=keyfile)

    if args.wait and args.wait > 0:
        response = client.add_claim(claim_id,
                                    patient_pkey,
                                    wait=args.wait,
                                    auth_user=auth_user,
                                    auth_password=auth_password)
    else:
        response = client.add_claim(claim_id,
                                    patient_pkey,
                                    auth_user=auth_user,
                                    auth_password=auth_password)

    print("Response: {}".format(response))
Exemplo n.º 9
0
def do_eat_pills(args):
    claim_id = args.claim_id
    description = args.description

    url = _get_url(args)
    keyfile = _get_keyfile(args)
    auth_user, auth_password = _get_auth_info(args)

    client = HealthCareClient(base_url=url, keyfile=keyfile)

    if args.wait and args.wait > 0:
        response = client.eat_pills(claim_id=claim_id,
                                    description=description,
                                    wait=args.wait,
                                    auth_user=auth_user,
                                    auth_password=auth_password)
    else:
        response = client.eat_pills(claim_id=claim_id,
                                    description=description,
                                    auth_user=auth_user,
                                    auth_password=auth_password)

    print("Response: {}".format(response))