private Device initializeDevice(Patient p) { log("Initializing device"); Device d = newDevice(); d.setManufacturer(deviceInfo.getManufacturerName()); d.setModel(deviceInfo.getModelNumber()); d.setVersion(deviceInfo.getFirmwareRevision()); NarrativeDt n = getNarrative(d); n.setDiv( n.getDiv() .getValueAsString() .substring(5, n.getDiv().getValueAsString().length() - 6) .concat("<strong>Serial Number: </strong>") .concat(deviceInfo.getSerialNumber()) .concat("<br /><strong>Name: </strong>") .concat(deviceInfo.getName()) .concat("<br /><strong>MAC Address: </strong>") .concat(deviceInfo.getAddress())); d.setText(n); CodeableConceptDt type = new CodeableConceptDt(); // TODO find valid url type.addCoding() .setCode("15-102") .setDisplay("Glukose-Analysegerät") .setSystem("http://umdns.org"); d.setType(type); d.setPatient(newResourceReference(p.getId())); d.setIdentifier(Arrays.asList(getIdentifier("/devices/", "" + deviceInfo.getSysID()))); log("Initializing device done"); return d; }
private Observation initializeObservation( Patient p, DeviceMetric metric, GlucoseRecord r, QuantityDt qdt) { log("Initializing observation"); Observation o = newObservation(qdt); o.setCode(createCode(r.unit)); o.setSubject(newResourceReference(p.getId())); o.setDevice(newResourceReference(metric.getId())); // set date and time for observation DateTimeDt dt = new DateTimeDt(); dt.setValue(r.time.getTime()); o.setEffective(dt); o.setIdentifier( Arrays.asList( getIdentifier( "/devices/".concat("" + deviceInfo.getSysID()), "" + r.getSequenceNumber()))); // set narrative o.setText(getNarrative(o)); log("Initializing observation done"); return o; }