Transfers Of Care module

Transfers Of Care List

Transfers Of Care list view
Transfers Of Care List
API URL
  /api/patients/{patientId}/events/toc
GET response
  {
    from:"Oxford NHS Trust"
    source:"qewdDB"
    sourceId:"cabab978-2e21-46e8-9e00-88d5e885effe"
    to:"Kings Hospital"
    transferDateTime:"2017-05-26T14:12:48.260Z"
  }
Component structure
  //component template
  let templateTransferOfCareList = require('./transfer-of-care-list.html');

  //controller init
  class TransferOfCareListController {
    constructor($scope, $state, $stateParams, $ngRedux, transferOfCareActions, serviceRequests, usSpinnerService, serviceFormatted) {
    }

  //component init
  const TransferOfCareListComponent = {
    template: templateTransferOfCareList,
    controller: TransferOfCareListController
  };

  //inject services/modules to controller
  EventsListController.$inject = ['$scope', '$state', '$stateParams', '$ngRedux', 'transferOfCareActions', 'serviceRequests', 'usSpinnerService', 'serviceFormatted'];
  //es6 export for component
  export default TransferOfCareListComponent;

Transfers Of Care Detail

Transfers Of Care Detail
Transfers Of Care Detail
API URL
  /api/patients/{patientId}/events/toc/{sourceId}
GET response
  {
    clinicalSummary:"Review"
    dateCreated:1495704408641
    from:"Worcester Trust"
    reasonForContact:"Testing TOC"
    records:[
      {
        date:"17-Jul-1984"
        name:"asthma"
        source:"ethercis"
        sourceId:"08fd487b-765a-41b4-9501-334d48dc2b00"
        type:"diagnosis"
        typeTitle:"Problems / Diagnosis"
      }, {
        date:"24-Oct-2016"
        name:"24-Oct-2016 Dr Adams CXH"
        source:"marand"
        sourceId:"9d19b534-9324-418f-a6b7-4cffbf73f879"
        type:"referrals"
        typeTitle:"Referrals"
      }
      ...
    ]
    source:"qewdDB"
    to:"Oxford NHS Trust"
    transferDateTime:"2017-05-25T09:25:33.026Z"
  }
Component structure
  //component template
  let templateTransferOfCareDetail= require('./transfer-of-care-detail.html');

  //controller init
  class TransferOfCareDetailController {
    constructor($scope, $state, $stateParams, $ngRedux, transferOfCareActions, usSpinnerService, serviceRequests, serviceTransferOfCare, $window) {}


  //component init
  const TransferOfCareDetailComponent = {
    template: templateTransferOfCareDetail,
    controller: TransferOfCareDetailController
  };

  //inject services/modules to controller
  TransferOfCareDetailController.$inject = ['$scope', '$state', '$stateParams', '$ngRedux', 'transferOfCareActions', 'usSpinnerService', 'serviceRequests', 'serviceTransferOfCare', '$window'];
  //es6 export for component
  export default TransferOfCareDetailComponent;

Transfers Of Care Create

Transfers Of Care Create
Transfers Of Care Create
API URL
  /api/patients/{patientId}/events/toc/
POST data
  {
    clinicalSummary:"Text"
    from:"Worcester Trust"
    reasonForContact:"Text"
    records:[
      {
	      date"11-Feb-2015"
	      name"Care Service Team 444"
	      source"marand"
	      sourceId"3a994bec-2f41-4dc0-aae6-f7e69e573f7a"
	      type"events"
	      typeTitle"Events"
      }, {
        date:"11-Oct-2016"
        name:"11-Oct-2016 Gareth Crooks Calderdale"
        source:"ethercis"
        sourceId:"61c03547-e756-4b39-9fcd-bd9cffacde75"
        type:"referrals"
        typeTitle:"Referrals"
      }
      ...
    ]
    to:"Oxford NHS Trust"
    transferDateTime:"2017-06-09T14:39:39.155Z"
  }
API URL for GET lists
  /api/patients/{patientId}/{recordType}/
GET response recordType - problems
  [
    {
      dateOfOnset:1491861600000
      problem:"Cholecystectomy"
      source:"ethercis"
      sourceId:"0318e94e-1803-46fe-a92a-647eca029323"
    }
  ]
GET response recordType - medications
  [
    {
      dateCreated1484778901000
      doseAmount10
      name"vbcvb"
      source"ethercis"
      sourceId"da5b4b98-1916-41dd-8fe4-9df7c34ba319"
    }
  ]
GET response recordType - referrals
  [
    {
      dateOfReferral:1458792662000
      referralFrom:"Tony Shannon"
      referralTo:"Ripplefields Optometry service"
      source:"ethercis"
      sourceId:"94133578-f505-4e76-b4ed-762462508801"
    }
  ]
GET response recordType - appointments
  [
    {
      dateOfAppointment:1486684800000
      serviceTeam:"test"
      source:"marand"
      sourceId:"8c93a4a9-0197-449a-b832-ea3b42e289cf"
      timeOfAppointment:50400000
    }
  ]
GET response recordType - vitalsigns
  [
    {
      author:"Test02071516"
      dateCreated:1486509378000
      diastolicBP:"60.0"
      heartRate:"45.0"
      levelOfConsciousness:"Pain"
      newsScore:3
      oxygenSaturation:"97.0"
      oxygenSupplemental:"true"
      respirationRate:"25.0"
      source:"ethercis"
      sourceId:"7252ff75-b9aa-4080-8447-4744da72ea59"
      systolicBP:"90.0"
      temperature:35.4
    }
  ]
Component structure
    //component template
    let templateCreate = require('./transfer-of-care-create.html');

    //controller init
    class TransferOfCareCreateController {
      constructor($scope, $state, $stateParams, $ngRedux, transferOfCareActions, serviceRequests, serviceTransferOfCare, serviceFormatted, usSpinnerService, $window) {}


    //component init
    const TransferOfCareCreateComponent = {
      template: templateCreate,
      controller: TransferOfCareCreateController
    };

    //inject services/modules to controller
    TransferOfCareCreateController.$inject = ['$scope', '$state', '$stateParams', '$ngRedux', 'transferOfCareActions', 'serviceRequests', 'serviceTransferOfCare', 'serviceFormatted', 'usSpinnerService', '$window'];
    //es6 export for component
    export default TransferOfCareCreateComponent;

Transfers Of Care Popover

Transfers Of Care Popover
Transfers Of Care Popover
API URL
    /api/patients/{patientId}/{recordType}/{sourceId}
GET response recordType - problems
    {
        author:"Dr Tony Shannon"
        code:"00001"
        dateCreated:1491914001000
        dateOfOnset:1491861600000
        description:"Working"
        originalComposition:""
        originalSource:""
        problem:"Cholecystectomy"
        source:"ethercis"
        sourceId:"0318e94e-1803-46fe-a92a-647eca029323"
        terminology:"local"
    }
GET response recordType - medications
    {
        author:"Dr Tony Shannon"
        dateCreated:1484785264000
        doseAmount:12
        doseDirections:"sdfd"
        doseTiming:1
        medicationCode:123456789
        medicationTerminology:""
        name:123456
        route:"IV Intra Venous"
        source:"ethercis"
        sourceId:"9302be50-97a2-4771-aa0a-d825787ec445"
        startDate:1485392400000
        startTime:3600000
    }
GET response recordType - referrals
    {
        author:"Dr Jekyll"
        dateCreated:1477332394832
        dateOfReferral:1477332394832
        referralCareFlow:"Service request sent"
        referralFrom:"Dr Adams"
        referralOutcome:""
        referralReason:"REason ffield"
        referralRef:"1c88ef4d-dd31-4ecf-9b1e-aaf334830152"
        referralServiceName:"Referral Type field"
        referralState:"planned"
        referralStateCode:526
        referralStateDate:1476835200000
        referralSummary:"not populated"
        referralTo:"CXH"
        referralType:"Referral Type field"
        source:"marand"
        sourceId:"9d19b534-9324-418f-a6b7-4cffbf73f879"
    }
GET response recordType - appointments
    {
        author:"c4h_ripple_osi"
        dateCreated:1456328221375
        dateOfAppointment:1423612800000
        location:"Leeds General"
        serviceTeam:"Care Service Team 444"
        source:"marand"
        sourceId:"3a994bec-2f41-4dc0-aae6-f7e69e573f7a"
        status:"Scheduled"
        timeOfAppointment:28800000
    }
GET response recordType - vitalsigns
    {
        author:"bob.smith@gmail.com"
        dateCreated:1495194453000
        diastolicBP:"50.0"
        heartRate:"40.0"
        levelOfConsciousness:"Pain"
        newsScore:15
        oxygenSaturation:"30.0"
        oxygenSupplemental:"true"
        respirationRate:"10.0"
        source:"ethercis"
        sourceId:"9b77a7b6-187b-4fa5-8d81-3acba3bae37d"
        systolicBP:"20.0"
        temperature:"60.0"
    }
Component structure
    //component template
    let transferOfCarePopoverTemplate = require('./transfer-of-care-popover.html');

    //controller init
    class TransferOfCarePopover {
      constructor($scope, $state, $stateParams, $ngRedux, serviceRequests, serviceTransferOfCare, usSpinnerService, serviceVitalsSigns, $window) {}


    //component init
    const TransferOfCarePopoverComponent = {
      template: transferOfCarePopoverTemplate,
      controller: TransferOfCarePopover
    };

    //inject services/modules to controller
    TransferOfCarePopover.$inject = ['$scope', '$state', '$stateParams', '$ngRedux', 'serviceRequests', 'serviceTransferOfCare', 'usSpinnerService', 'serviceVitalsSigns', '$window'];
    //es6 export for component
    export default TransferOfCarePopoverComponent;

Transfers Of Care Service

Component structure
    //service init
    class serviceTransferOfCare {
      constructor (diagnosesActions, eventsActions, vitalsActions, referralsActions, medicationsActions, serviceFormatted) {
      }

    //inject services/modules to service
    serviceTransferOfCare.$inject = ['diagnosesActions', 'eventsActions', 'vitalsActions', 'referralsActions', 'medicationsActions', 'serviceFormatted'];
    //es6 export function
    export default serviceTransferOfCare;

Transfers Of Care Actions

Component structure
    //es6 import modules
    import {bindActionCreators} from 'redux';
    import * as types from '../../../constants/ActionTypes';

    //es6 export function
    export function all(patientId) {
      return {
        types: [types.TRANSFEROFCARE, types.TRANSFEROFCARE_SUCCESS, types.TRANSFEROFCARE_ERROR],

        shouldCallAPI: (state) => !state.transferOfCare.response,

        config: {
          method: 'get',
          url: '/api/patients/' + patientId + '/events/toc'
        },

        d: {
          timestamp: Date.now()
        }
      };
    }

Transfers Of Care Reducer

Component structure
    //es6 import modules
    import * as types from '../../../constants/ActionTypes';

    const INITIAL_STATE = {
      isFetching: false,
      error: false,
      data: null,
      dataGet: null,
      dataCreate: null,
      dataUpdate: null
    };

    //es6 export function
    export default function transferOfCare(state = INITIAL_STATE, action) {
      const {payload} = action;

    //redux action for Events requests
      var actions = {
        [types.TRANSFEROFCARE]: (state) => {
          state.dataCreate = null;
          state.dataUpdate = null;
          return Object.assign({}, state, {
            isFetching: true,
            error: false
          });
        }