diff --git a/app/assets/javascripts/core.js.coffee b/app/assets/javascripts/core.js.coffee index 4476c79..d4ca91e 100644 --- a/app/assets/javascripts/core.js.coffee +++ b/app/assets/javascripts/core.js.coffee @@ -272,6 +272,11 @@ class hQuery.Facility extends hQuery.CodedValue ### endDate: -> @_endDate + ###* + The length of stay in this facility in seconds + @returns {Integer} + ### + lengthOfStay: -> @json['end_time'] - @json['start_time'] ###* @returns {Array} an array of {@link hQuery.Address} objects associated with the facility diff --git a/app/assets/javascripts/medicalequipment.js.coffee b/app/assets/javascripts/medicalequipment.js.coffee index 9976ad3..57eee07 100644 --- a/app/assets/javascripts/medicalequipment.js.coffee +++ b/app/assets/javascripts/medicalequipment.js.coffee @@ -26,3 +26,9 @@ class hQuery.MedicalEquipment extends hQuery.CodedEntry @returns {CodedValue} ### anatomicalStructure: -> new hQuery.CodedValue @json['anatomicalStructure']['code'], @json['anatomicalStructure']['codeSystem'] + + ###* + Currently mapped to the end date for the medical equipment + @returns {Date} + ### + removalDateTime: -> @endDate() \ No newline at end of file diff --git a/app/assets/javascripts/procedure.js.coffee b/app/assets/javascripts/procedure.js.coffee index 7ae072c..489e12a 100644 --- a/app/assets/javascripts/procedure.js.coffee +++ b/app/assets/javascripts/procedure.js.coffee @@ -25,4 +25,9 @@ class hQuery.Procedure extends hQuery.CodedEntry @returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the procedure was performed ### - site: -> new hQuery.CodedValue @json['site']['code'], @json['site']['codeSystem'] \ No newline at end of file + site: -> new hQuery.CodedValue @json['site']['code'], @json['site']['codeSystem'] + + ###* + @returns {Date} Date/Time when the incision was made during a procedure, if applicable + ### + incisionDateTime: -> hQuery.dateFromUtcSeconds @json['incisionDateTime'] \ No newline at end of file diff --git a/test/fixtures/patient/barry_berry.json b/test/fixtures/patient/barry_berry.json index 8f97f14..43da9d2 100644 --- a/test/fixtures/patient/barry_berry.json +++ b/test/fixtures/patient/barry_berry.json @@ -77,6 +77,8 @@ }, "facility": { "name": "General Hospital", + "start_time": 1124956803, + "end_time": 1124957003, "code": { "code": "1155-1", "codeSystem": "HL7 Healthcare Service Location" @@ -217,7 +219,8 @@ "last": "Tables" } }, - "description": "Colonscopy" + "description": "Colonscopy", + "incisionDateTime": 1073238725 } ], "results": [ diff --git a/test/unit/patient_api_test.rb b/test/unit/patient_api_test.rb index 6ae2d67..e4df4af 100644 --- a/test/unit/patient_api_test.rb +++ b/test/unit/patient_api_test.rb @@ -51,6 +51,7 @@ def test_encounters assert_equal 'CPT', @context.eval('patient.encounters()[0].reasonForVisit().type()[0].codeSystemName()') assert_equal 'HL7 Healthcare Service Location', @context.eval('patient.encounters()[0].facility().codeSystemName()') assert_equal '1155-1', @context.eval('patient.encounters()[0].facility().code()') + assert_equal 200, @context.eval('patient.encounters()[0].facility().lengthOfStay()') assert_equal 'General Hospital', @context.eval('patient.encounters()[0].facility().name()') end @@ -66,6 +67,7 @@ def test_procedures assert_equal '71854001', @context.eval('patient.procedures()[0].site().code()') assert_equal 'Bobby', @context.eval('patient.procedures()[0].performer().person().given()') assert_equal 'Tables', @context.eval('patient.procedures()[0].performer().person().last()') + assert_equal 1073238725000, @context.eval('patient.procedures()[0].incisionDateTime().getTime()') end def test_vital_signs @@ -173,6 +175,7 @@ def test_functional_status def test_medical_equipment assert_equal 1, @context.eval('patient.medicalEquipment().length') assert_equal '13648007', @context.eval('patient.medicalEquipment()[0].anatomicalStructure().code()') + assert_equal 1269762693000, @context.eval('patient.medicalEquipment()[0].removalDateTime().getTime()') end end \ No newline at end of file