示例#1
0
def get_patient(id):
    try:
        db = Database(config)
        row = db.read_patient(id)
        p = Patient()
        p.name=[HumanName(), HumanName()]
        p.name[0].family = [row['achternaam']]
        p.name[0].prefix = [row['tussenvoegsel']]
        p.name[1].family = [row['partnerachternaam']]
        p.name[1].prefix = [row['partnertussenvoegsel']]
        p.gender = str(row['geslacht']).lower().replace('m', 'male').replace('v', 'female')
        p.birthDate = FHIRDate(row['geboortedatum'][:10])
        p.identifier = [Identifier(), Identifier()]
        p.identifier[0].value = row['patientid']
        p.identifier[0].use = 'usual'
        p.identifier[0].system = 'https://www.promedico-asp.nl/his/'
        p.identifier[1].value = row['bsn']
        p.identifier[1].use = 'official'
        p.identifier[1].system = 'http://fhir.nl/fhir/NamingSystem/bsn'
        json = p.as_json()
        if not json:
            return "niet gevonden", 404
        return jsonify(json)
    except Exception as ex:
        print(ex.args[0])
        return 'Er is een fout: ' + ex.args[0], 500
示例#2
0
def get_patient(id):
    try:
        db = Database(config)
        row = db.read_patient(id)
        p = Patient()
        p.name = [HumanName()]
        p.name[0].family = [row['achternaam']]
        # p.address = [Address()]
        # p.address[0].city = row['plaats']
        # p.address[0].country = row['land']
        # p.address[0].line = [row['straat'] ]

        json = p.as_json()
        if not json:
            return "niet gevonden", 404
        return jsonify(json)
    except Exception as ex:
        print(ex.args[0])
        return 'Er is een fout' + ex.args[0], 500
示例#3
0
from models.patient import Patient

p = Patient()
p.name = [HumanName()]
p.name[0].use = 'official'
p.name[0].familyname = ['Reenen']
p.name[0].given = ['Hendrikus', 'Herman', 'Johannes']
p.name[0].extension = [Extension()] #niet zeker van juistheid hiervan
p.name[0].extension[0].url = 'http://nictiz.org/huham_name_def_nl/prefix'
p.name[0].extension[0].valueString = 'van'
p.name[0].text = 'Hendrikus Herman Johannes van Reenen'
, 'H', 'H', 'J']
p.active = True
p.address = [Address.from_str("Reigersberg 10, 6865NL, Doorwerth, NL")]

json = p.as_json()
print(json)
import json
s = """{'name': [{'given': ['Pieter', 'H', 'H', 'J']}], 'resourceType': 'Patient'}"""
json_acceptable_string = s.replace("'", "\"")
d = json.loads(json_acceptable_string)

p2 = Patient(d)
json = p2.as_json()
print(json)

p4 = Patient({'resourceType': 'Patient', 'name': [{'given': ['Henk-Jan', 'H', 'H', 'J']}]})

module = __import__('models.patient')
module = getattr(module, "patient")
cls = getattr(module, "Patient")