Appendix. salesforce Health Cloud
বিজ্ঞাপন
বিজ্ঞাপন
APPENDIX
Migrating More Data in the Patient Creation Job Flow
When patients are first imported into Health Cloud, the information required to identify and represent those patients is created. Historical medical information associated with patients is not imported into Health Cloud by default; however, you can choose to map more historical information, as needed. You can implement a custom integration to import historical medical records from the EHR system and append it to the default patient creation job flow.
Patient Creation Job Flow in Health Cloud
Each patient is initially represented in Health Cloud as a candidate for services that are managed in Health Cloud. As a result, each patient starts with a CandidatePatient__c record. When the candidate patient is converted, the patient creation process creates corresponding objects in Salesforce:
• An account and contact representing a patient
• A case representing a care plan
• A care team (case team) linked to the care plan coordinator user and the patient contact
The data copied to the Salesforce objects is based on mapping of fields between CandidatePatient__c and the appropriate Salesforce objects.
The candidate patient record (CandidatePatient__c) is a cross-reference between the representation of a patient in the EHR system and in Health Cloud. The records are linked through the medical record number, which is represented in Salesforce by the
SourceSystemId__c external ID field.
The following diagram shows the patient creation job flow. This flow consists of two jobs that perform the steps that occur when a candidate patient record is converted. The third job (Invoke Patient EHR Migration) is a custom integration that you can implement to migrate more data for that patient into Health Cloud.
42
Appendix Migrating More Data in the Patient Creation Job Flow
Extend or Override the Default Patient Creation Job Flow
import additional medical records. To migrate more data, append your custom integration as the last job in the patient creation job
and instead use a custom job flow that you create.
Your custom integration consists of an Apex class that extends a base class and implements an interface from the Health Cloud package.
The previous job passes your job relevant patient record information through a context parameter. By providing your own implementation for this custom job, you can choose which patient records you want to migrate to Health Cloud. These are some examples of useful data migrations after a candidate patient has been converted in Health Cloud.
• Import medical records for a patient from the EHR system, such as:
– The full patient record
– Encounters
– Conditions
– Observations
43
Appendix Create a Custom Apex Class for the Patient Creation Job
Flow
– Diagnosis
– Treatments
• Flag EHR patient data to be published to Health Cloud if it is changed or created.
• Establish cross-references of patient records between Health Cloud and the EHR system. This cross-reference linkage enables posting data back to the EHR system through another integration. For example, when one of the following records is created in Health Cloud, it can be updated in the EHR system later.
– Encounters: phone calls to the patient, emails, or Chatter messages
– Observations: Performed remotely by patient or caregivers, or performed by devices
Note: EHR systems can update only the records they create. If records were created in an external system and were migrated, they are viewable, but not editable in the current system.
Create a Custom Apex Class for the Patient Creation Job Flow
Create a custom Apex class that extends a base class and implements an interface from the Health Cloud package. The custom class overrides the methods in the base class and the interface.
Your Apex class extends the HealthCloudGA.MoiJobFlowFactory.MoiJobBase
base class and implements the
HealthCloudGA.MoiJobFlowFactory.MoiIJob
interface from the Health Cloud package. Your class signature looks as follows: public with sharing class InvokePatientDataMigrate extends HealthCloudGA.MoiJobFlowFactory.MoiJobBase
implements HealthCloudGA.MoiJobFlowFactory.MoiIJob { }
Your class overrides the following methods, which are in the base class.
boolean processJob(HealthCloudGA.MoiJobFlowFactory.MoiIJobContext flowCtxts)
Override this method to implement the logic of your data migration job that is part of the patient creation flow. In this method, you call another method to make a callout to the external EHR system to get more medical records for the patient.
The patient creation job flow runs all the jobs as a single Apex transaction. Partial data changes aren’t saved if an error occurs because all changes are rolled back in that transaction. Any callouts must be invoked from a future method so that the data from the first two jobs is saved even if the callout fails. Future methods are executed asynchronously, in the background. For example, this method signature represents the callout utility method in our sample.
@Future(callout=true) private static void invokeIntegration(String jsonPatientIds)
The type of the parameter passed to the processJob() method is the
HealthCloudGA.MoiJobFlowFactory.MoiIJobContext
class, installed from the Health Cloud package. The patient creation job flow uses this context object to pass information about the created objects to the next job. The jobs for creating a patient populate this context object with the account and contact. Next, the job for creating the care plan accesses the objects in the context to link the case (care plan record type) to CaseTeam members. You can use the objects in the context parameter to find out which objects have been created in Health Cloud and link them to the EHR system. The objects you can access from the flowCtxts parameter are:
• Account
• Contact
• CandidatePatient__c
• Case (CarePlan record type)
44
Appendix Create a Custom Apex Class for the Patient Creation Job
Flow
You can obtain these objects by calling getContextData()
on the flowCtxts
parameter. The getContextData() method returns a list of maps. Each map corresponds to the context of one patient and contains the objects related to that patient.
The map is keyed by the name of the object. For example, this snippet shows how to get the CandidatePatient__c object from a returned map object: for (Map<String, Object> flowCtxt : flowCtxts.getContextData()) {
HealthCloudGA__CandidatePatient__c candidatePatient =
(HealthCloudGA__CandidatePatient__c)flowCtxt.get('CandidatePatient__c'); }
HealthCloudGA.MoiJobFlowFactory.MoiIErrorHandler getErrorHandler()
Override this method to add error handling logic when an exception is thrown from processJob()
. This method returns an instance of a class that performs error handling. The class performing the error handling must implement the
HealthCloudGA.MoiJobFlowFactory.MoiIErrorHandler
interface and override its method: public void handleError(HealthCloudGA.MoiJobFlowFactory.MoiIJobContext context, Exception e)
We’ve provided a sample Apex class that you can copy and modify to suit your needs. The implementation of the callout in the invokeIntegration
helper method is not provided and is left for you to provide. Details of how to communicate with the service endpoint and fetch data differs based on what you want to accomplish. For information about how to make callouts from Apex, see
Invoking Callouts Using Apex in the Force.com Apex Code Developer's Guide .
You can create an Apex class by using various tools. This walkthrough uses the Developer Console.
1. From Setup, click
Your Name
and then click Developer Console to open the Developer Console.
2. Click File > New > Apex Class.
3. Enter InvokePatientDataMigrate for the class name, and then press OK.
4. Delete the auto-generated content and paste the following sample.
public with sharing class InvokePatientDataMigrate extends
HealthCloudGA.MoiJobFlowFactory.MoiJobBase
implements HealthCloudGA.MoiJobFlowFactory.MoiIJob { private static final String CTXTVAR_ACCOUNT = 'Account'; private static final String CTXTVAR_CONTACT = 'Contact'; private static final String CTXTVAR_CAREPLAN = 'CarePlan'; private static final String CTXTVAR_CANDIDIATEPATIENT = 'CandidatePatient__c'; public with sharing class IntegrationErrorHandler implements
HealthCloudGA.MoiJobFlowFactory.MoiIErrorHandler { public void handleError(HealthCloudGA.MoiJobFlowFactory.MoiIJobContext context,
}
Exception e) {
// Code can be placed here to address the failure
System.debug('Exception: '+e+' thrown on Job with context '+context);
//No Exception
}
{ public override HealthCloudGA.MoiJobFlowFactory.MoiIErrorHandler getErrorHandler() return (HealthCloudGA.MoiJobFlowFactory.MoiIErrorHandler) new IntegrationErrorHandler();
45
Appendix Create a Custom Apex Class for the Patient Creation Job
Flow
}
// Invokes asynchronous migration of patient data for list of patient identifiers
@Future(callout=true) private static void invokeIntegration(String jsonPatientIds){
String SalesforceOrgId = System.UserInfo.getOrganizationId();
////////////////////////////////////////////////////////////////////
// Make call to integration system passing patient Identifiers
// and organization Id.
// Integration System should respond asynchronously by push Patient
// EHR records to the org.
////////////////////////////////////////////////////////////////////
} private class PatientId{ public PatientId(String SourceSysId, Id accountId, Id contactId,
Id carePlanId){ this.SFDCSourceSysId = sourceSysId; this.SFDCAccountId = accountId; this.SFDCContactId = contactId; this.carePlanId = carePlanId; this.SFDCSourceSysIdType = 'MRN';
}
// Id of account created in CreateIndividual Job public Id SFDCAccountId;
// Id of contact created in CreateIndividual Job public Id SFDCContactId;
// Id of Careplan created in CreateCarePlan job public Id carePlanId;
// Medical Record Number of patient in external Electronic
// Health Record System public String SFDCSourceSysId;
// EMR ID Type - MRN in most cases public String SFDCSourceSysIdType;
}
// Override processJob method to be called when this job is invoked
// by MoiJobFlowManager.
public override boolean processJob(HealthCloudGA.MoiJobFlowFactory.MoiIJobContext
flowCtxts) {
System.debug('Entered InvokeIntegration.processJob');
// Compile List of strings with Patient Ids
// {CandidatePatient__c.SourceSystemId_c, Account.Id and Contact.Id}
// to pass to integration system to invoke asynchronous publish
// of patient EHR records.
List<PatientId> patientIds = new List<PatientId>(); for (Map<String, Object> flowCtxt : flowCtxts.getContextData()) {
HealthCloudGA__CandidatePatient__c candidatePatient =
(HealthCloudGA__CandidatePatient__c)flowCtxt.get(
46
Appendix Customize the Patient Conversion Process
CTXTVAR_CANDIDIATEPATIENT); if (candidatePatient == null || candidatePatient.HealthCloudGA__SourceSystemId__c == '') throw new IntegrationException(
'Failure: No CandidatePatient record set. ' + candidatePatient); patientIds.add( new PatientId(candidatePatient.HealthCloudGA__SourceSystemId__c,
((Account)flowCtxt.get(CTXTVAR_ACCOUNT)).Id,
((Contact)flowCtxt.get(CTXTVAR_CONTACT)).Id,
((Case)flowCtxt.get(CTXTVAR_CAREPLAN)).Id)
);
}/* for Flow Ctxts (on for each patient in creation flow */
System.debug('Calling future method InvokeIntegration('+patientIds+')'); invokeIntegration(JSON.serializePretty(patientIds)); return true;
} // processJob() class IntegrationException extends Exception{}
} //class InvokePatientDataMigrate
5. Click File > Save.
Register a Remote Site — Before the callout in this integration can be made, the service endpoint must be registered as a remote site in Salesforce. To register the remote site:
1. From Setup, enter Remote Site Settings in the Quick Find box, then select Remote Site Settings.
2. Click New Remote Site.
3. Enter a descriptive term for the
Remote Site Name
. For example,
ClinicalIntegrationEndPoint
.
4. Enter the URL for the remote site.
5. Optionally, enter a description of the site.
6. Click Save.
Customize the Patient Conversion Process
Patient creation includes two processes: a job flow that creates the patients and then a mapping group that maps data from the Candidate
Patient object to other patient objects.
The settings that control these processes are available for customization so that you can control how patient creation and data mapping occur in your org. From Setup, enter Custom metadata in the Quick Find box, then select Custom Metadata Types.
47
Appendix Override the Health Cloud Job Flows
• Health Cloud Setting (1) contains the configuration values for processes like the job flow that creates patients.
• Job Flow Data Mapping (2) holds the rules that determine which fields from the Candidate Patient object get mapped to patient objects like Account, Contact, and Case.
• Job Flow Setting (3) contains the actual job flows that execute in the patient creation process.
You can customize the delivered patient creation job flow by creating your own custom Apex class and adding your own job, changing the order in which the jobs run, or overriding the job entirely and using your own job flow. You can also change which fields are mapped during patient creation.
Health Cloud Settings
Health Cloud Settings contains a variety of key/value pairs of configuration settings for the Health Cloud application. This includes the two default settings that control which flow to use when creating patients. PatientCreateFlow_default controls which job flow to use when creating patients and
PatientCreateMappingGroup__default
controls which group of mappings is used.
You can deactivate either of these records and create your own patient creation flow or mapping group.
When creating your own job flows, you must rename the
Setting Name
and
Setting Value
fields. For readability, it’s helpful to make the object name and label of Health Cloud Setting record be a combination of the setting name and something about the new value. For example, you can rename PatientCreateFlow_default to PatientCreateFlow_mynewflow .
To learn more about overriding one of the Health Cloud job settings, see
Configure Health Cloud Custom Metadata Settings .
Patient Creation and Data Mapping Job Flows
the job flow, deselect the
Active
field for the record.
Override the Health Cloud Job Flows
You can override either of the delivered jobs in the default patient creation job flow and use your own custom job to create patients or to map patient data from the source record system.
You can deactivate the delivered jobs and use your own custom job when you create and activate a new record with the same job flow name. Since you’re not deleting the delivered setting, you can reactivate it and use it in the future.
1. From Setup, enter
Custom Metadata
in the
Quick Find
box, then select Custom Metadata Types.
2. Click Health Cloud Setting, then click Manage Health Cloud Settings.
48
Appendix Add Your Job to the Patient Creation Job Flow
3. Click name of the setting you want to change and click Edit.
• To override the delivered patient creation job, click PatientCreateFlow_default.
• To override the delivered patient data mapping job, click PatientCreateMappingGroup_default
4. Clear the Active checkbox and then click Save.
5. Navigate back to the Health Cloud Settings page, and click New, and fill out the information for your custom job and Apex class.
Make sure to use the same
Setting Name
as the default job flow that you are overriding. For example,
PatientCreateFlow
, if you are overriding the default patient creation job flow with your own entirely new job flow.
6. Select the Active checkbox to make the setting available.
Add Your Job to the Patient Creation Job Flow
Whether you have chosen to add a job to the existing patient creation job flow, or have defined an entirely new patient creation job flow, you must create a JobFlowSetting custom metadata record for every job that you want executed.
JobFlowSetting Custom Metadata
Job flows for Health Cloud consist of one or more jobs, each represented by a JobFlowSetting__mdt custom metadata record. Each record points to an Apex class that implements that job.
The settings for each job are defined as one row. You can insert custom metadata records the same way you'd create an instance of another sObject. You can also override any of the jobs within the Patient Create job flow by deselecting the Active field on the job.
The jobs that make up the default patient creation job flow are represented by these custom metadata records.
Label
Patient
Create
Care Plan
Create
Job Flow Name
Table 1: Default Patient Create Job Flow
Job Name defaultPatientCreate HcCreatePatientDefaultJobs.CreateIndividualJob
defaultPatientCreate HcCreatePatientDefaultJobs.CreateCarePlanJob
Job Order Active
1 true
2 true
Custom false false
The default Patient Create flow defines the steps for creating a patient record. The jobs in this flow create one Account record and one
Contact record, and a Case record for the patient’s care plan. This flow uses the JobFlowDataMapping__mdt custom metadata object to define the field mapping from the source CandidatePatient__c to the Account, Contact, and Case records.
The following are descriptions of the fields in the JobFlowSetting__mdt custom metadata type.
Master Label
The friendly name for the job flow entry.
Object Name
The API name of the job flow entry.
Job Flow Name
The name of the job flow. All jobs in the same flow share the job flow name.
Job Name
The name of the Apex class that implements the job. This class extends the
HealthCloudGA.MoiJobFlowFactory.MoiJobBase
class and overrides its processJob() method.
49
Appendix Data Mapping to Health Cloud Objects
Job Order
An integer number that specifies the order of the job in the job flow. Jobs in a job flow must have unique job order numbers, and their order must be linear.
Active
Indicates whether the job is used (true) or not (false).
Custom
False if provided by default in the Health Cloud package; otherwise true.
Protected Component
Specifies whether this Job Flow Setting component is hidden outside a managed package. This field is unchecked (false) in the
Health Cloud package as the component is accessible outside the package.
To register your custom integration job, insert a record to the JobFlowSetting__mdt custom metadata. To do so in the user interface:
Register Your Custom Integration Job
1. From Setup, enter Custom Metadata Types in the Quick Find box, then select Custom Metadata Types.
2. Click Job Flow Setting, then click Manage Job Flows Settings.
3. Click New, and fill out the information for your custom job and Apex class, including the job flow name, job name, and order in which it runs.
4. Ensure that the Active and Custom checkboxes are checked.
5. Click Save.
For example, to register the sample class that’s provided, enter the following information.
1. For Master Label, enter Create Patient: Invoke Integration .
2. For Object Name, enter
CreatePatientInvokeIntegration
.
3. For Job Flow Name, enter defaultPatientCreate to append your job to the existing job flow.
4. For Job Name, enter the class name
InvokePatientDataMigrate
.
5. For Job Order, enter 3 to ensure that Health Cloud invokes this job after the second default job for patient creation.
6. Ensure that the Active and Custom checkboxes are checked.
7. Click Save.
Data Mapping to Health Cloud Objects
When a patient is converted, Health Cloud copies patient data from CandidatePatient__c to the corresponding Account, Contact, and
Case (CarePlan record type) objects. A mapping defines how patient data maps to the fields in the destination Salesforce objects. This mapping is specified in the JobFlowDataMapping__mdt custom metadata object.
The following table shows the default mappings that are provided for CandidatePatient__c. These mappings can’t be changed or deleted.
To change the mappings in your org, create another mapping group and specify in the Health Cloud Settings to use that mapping group instead of the default mappings.
Table 2: JobFlowDataMapping__mdt
MappingGroupName SourceObject defaultPatientCreate CandidatePatient__c
SourceField
SourceSystemId__c
TargetObject
Account
TargetField
SourceSystemId__c
50
Appendix Data Mapping to Health Cloud Objects
MappingGroupName SourceObject defaultPatientCreate CandidatePatient__c defaultPatientCreate defaultPatientCreate defaultPatientCreate null
CandidatePatient__c
CandidatePatient__c defaultPatientCreate defaultPatientCreate defaultPatientCreate defaultPatientCreate defaultPatientCreate defaultPatientCreate defaultPatientCreate
CandidatePatient__c
CandidatePatient__c
CandidatePatient__c
CandidatePatient__c
CandidatePatient__c
CandidatePatient__c
CandidatePatient__c
SourceField
SourceSystemId__c
Health Cloud Care Plan
1
TargetObject
Account
Care Plan
2
SourceSystemId__c
Address1Line1__c
Contact
Contact
GivenName1__c
FamilyName1__c
BirthDate__c
Address1City__c
Contact
Contact
Contact
Contact
Address1Country__c
Telecom1Value__c
Contact
Contact
Address1PostalCode__c Contact
TargetField
Name
Subject
SourceSystemId__c
MailingStreet
FirstName
LastName
Birthdate
MailingCity
MailingCountry
Phone
MailingPostalCode
1
Because the source object for this record is null,
Health Cloud Care Plan
is a string literal and not a field name. This string value is applied to the target field, Subject.
2
Care Plan
is a string literal that corresponds to the object that represents a care plan, namely a Case whose record type is CarePlan.
The following is a description of the fields in the JobFlowDataMapping__mdt custom metadata type that’s used for mapping.
Mapping Group Name
The name of a mapping group, which represents a set of field mappings. The patient creation job flow uses only one mapping group named defaultPatientCreate.
Source Object
The API name of the sObject from which data is copied to the target object.
Source Field
The API name of the field that is copied to the target object.
Target Object
The API name of the sObject to copy the data to.
Target Field
The API name of the field to copy the data to.
Active
Indicates whether the job is used (true) or not (false).
Mapping Extra Fields
You can add new field mappings by inserting a record in the JobFlowDataMapping__mdt custom metadata object for each new mapping. Custom mappings can be changed and removed.
To add a mapping in the user interface:
1. From Setup, enter
Custom Metadata Types
in the
Quick Find
box, then select Custom Metadata Types.
2. Click Job Flow Data Mapping, then click Manage Job Flow Data Mappings.
51
Appendix Data Mapping to Health Cloud Objects
3. Click New, and fill out the information for the new mapping.
4. Click Save.
Note: You can also deactivate the delivered JobFlowDataMapping__mdt and
use your own custom set of mappings
when you create and activate a new record with the same setting name and setting value.
52
ডাউনলোড
বিজ্ঞাপন