Introduction
This sample will show how to update a FHIR Patient Resource using the FHIR RESTful API and the SMART on FHIR JavaScript Client.
FHIR RESTful API
Query to find the Patient
Given a patient id "UpdateExamplePatient", find the patient:
Query A Patient Resource and Update Last Name
Update a Resource
<script type="text/javascript"> ... var patient; // Read patient function readPatient() { smart.patient.read().then(function(pt) { patient = pt; }); } function updatePatient() { patient.name[0].family[0] = "NewName"; smart.api.update({type: patient.resourceType, data: JSON.stringify(patient), id: patient.id}).then(function(){ readPatient() }); ... </script>