Professional Documents
Culture Documents
TheRADServerConnectedNursesStationSampleProjectcanbedownloadedviatheGetItPackage
Manager(Tools>GetItPackageManager)inRADStudio10.2Tokyo.
KeySetupSteps
1.SetupInterBasedatabase(EMSdatabase)
PutyourNURSESDB.IBInterBasedatabasehere:C:\NurseStation\Database\NURSESDB.IB
TheNursesDBonlyhasonetablecalledPatientthatlookslikethis,withnodatapre-loaded.
/*Table:PATIENT,Owner:SYSDBA*/
CREATETABLE"PATIENT"
(
"ID" VARCHAR(50)NOTNULL,
"HEART_RATE" VARCHAR(20),
"WEIGHT" VARCHAR(20),
CONSTRAINT"PK"PRIMARYKEY("ID"));
2.StartyourInterBaseXE7databaseserver.Note:MyInterBaseinstanceiscalledgds_db
UsingIBConsole(C:\ProgramFiles(x86)\Embarcadero\Studio\17.0\InterBaseXE7\bin\IBConsole.exe),
addtheNURSESDB.IBdatabase.Username=SYSDBA,Password=masterkey.
2.CreateandConfiguretheRADServerEMSServer
Note:IfyouhavenotrunEMSDevserver.exetocreatetheInterBaseEMSSERVER.IBdatabaseand
emsserver.ini,locatedatC:\Users\Public\Documents\Embarcadero\EMS,thenfirstrun
EMSDevserver.exe(fromC:\ProgramFiles(x86)\Embarcadero\Studio\19.0\bin).
ClickYES.
TotheEMSSetupWizard,NewDatabasepage,AddyourInterBaseServerInstance.Mineisgds_db
TocheckthatyourInterBaseinstanceisrunning(use"<Interbase>\bin\IBMgr.exe"gds_db)
ClickNext.
IMPORTANT:UN-checktheSampleusersandSampleusergroups(ReasonforthisisdefaultEMS
installcreatesaFieldNamecalleddescription.TheNursesStationDemoneedstheFieldNameisbe
DescriptionwithanuppercaseD.
ClickNexttocreatetheConsoleUserNameandPassword.(consoleuser,consolepass).
ClickFinish.
Ifyougetthiserror:
VerifyyourInterBaselicenseisinstalledand/oryourInterBaseServerinstanceisrunning.
Note:IfyougetWarningMessage,thatyouareusingInterBasewithoutanEMSLicense,thenits
OK.TheNursesStationapplicationwillrunOKwithoutneedinganEMSlicense.Youcanrunthe
applicationsusinganEMSDevelopmentServer.
ClickOK.
EMSDevserver.exewillcreatethesefiles:EMSSERVER.IBandemsserver.ini
Theemsserver.inifileislocatedhere:C:\Users\Public\Documents\Embarcadero\EMS
RunningEMSDevserver.exeagain,shouldnowstartyourEMSDevelopmentServer,likethis:
3.Partofthesetupistoaddanewusercallednurseuser.Foraninitialsetup,createafewnewUsers
andanewGroupforourRAD(EMS)Server.TheNursesApp(NurseApp_PatientVitals)expectsaUser
nurseuser.Withoutthisuser,youwillgetanerror.
TheNurseappexpectsthisLogin(nurseuser,nursepass):
procedureTForm23.FormShow(Sender:TObject);
begin
//EMSProcess
NurseStationClientModule.Login('nurseuser','nursepass');
PushRegister();
end;
Withoutthisnurseuseruser,youwillgetthiserror:
Toaddusers,useEMSManagementConsole.exeincludedwithRADStudio10.2TokyotoaddUser=
nurseuser,withPassword=nursepass
Fromtheemsserver.ini,wearerunninginSingleTenantmode,soweun-commentthe
DefaultTenantId=00000000-0000-0000-0000-000000000001
[Server.Tenants]
;#ThissectiondefinessettingsforSingleorMulti-Tenantmodes.
;#
;#TheMultiTenantModeoptionisusedtoturnontheMulti-Tenantmode.
;#IftheMulti-Tenantmodeisturnedon,thenTenantIdandTenantSecretisrequiredtoaccessEMS
Server.
;MultiTenantMode=1
;#
;#DefaultTenantisusedonlyintheSingleTenantmode.
DefaultTenantId=00000000-0000-0000-0000-000000000001;
#DefinecustomcookienametostoreTenantIdinEMSConsole.
;TenantIDCookieName=TenantID
First,usetheTenanttab,andenteryourDefaultTenantIDandTenantSecretpassword:secret
Next,usetheConnectiontabandEnteryourlocalHostIPaddressofyourrunningEMSServer.Port=
8080
ClickTestConnection,toverifyyoucanconnecttoEMS.
Enter:Username=nurseuser,Password=nursepass,FieldName=Description,FieldValue=Nancy
Nurse.
NOTE:ItisveryimportantthattheFieldNameDescriptionisspelledwithanuppercaseD.
ThePatientApp(PatientCheckIn2)looksforafieldvalueDescriptionwithanuppercaseD.
ClickOK,andyournewUsergetscreated:
ClickOK.
AndanotherUserthatyoucanuseasthePatient(test1,test1),withyournameAlMannarinoasthe
FieldValue.Note:DescriptionmustbeanuppercaseD.
Note:YoudoNOTneedtocreateanyGroups,InstallationsorPush.
Note:FortheInstallationstab,youdoNOTneedtoaddanything.Therunningappsthatconnectto
theEMSServerwillcreatetheInstallationsforyou.
CheckifyoucanAuthenticatewithUsersnurseuserandtest1.
SelectAuthenticatetab.EnterUsername=nurseuserandPassword=nursepass.
ClickLogin.VerifyyoucanLogin.ClickOK.ClickLogout.
DothesameforUsername(Test1,test1).
YoucannowCLOSEtheEMSManagementConsole.
4.InstallSSLlibraries.
WithRADStudio10.2Tokyo,EMS,BaaSandRESTclientsoniOS,Android,WindowsandMacnolonger
needtousetheOpenSSLlibraries.In10.2Tokyo,theywillusethenativelibraryoneachOS.
ButtheRAD(EMS)ServerrequirestheOpenSSLlibrariestosupportHTTPSrequestsandsendingpush
notificationstoiOSdevices.ThiswillrequiretheWindowsOpenSSLlibraries.
UsingthelatestWin32OpenSSLv1.0.2kLightandlettingtheinstalleraddthelibstomyWindowspath
workedOKforme.
Note:TosendEMSPushnotificationmessagestotheregistereddevicesinyourEMSServer,youneed
toinstalltheOpenSLLlibrariesinthesystemwheretheEMSServerruns.
Note:Youneedtoinstallthe32-bitor64-bitOpenSSLbinary,dependingonthetargetplatformofthe
EMSServer.
IfyoudonotinstalltheOpenSSLlibrariesandusetheEMSServertosendpushnotificationmessages
toyourregistereddevice,theEMSServershowsthefollowingerrorexceptionintheEMSServer
Windowlog:
{"Error":{"Type":"Other","Exception":"EIdOSSLCouldNotLoadSSLLibrary","Message":"Could
notloadSSLlibrary.","Thread":5576}}
3.SetupPushNotificationMessagingServiceforAndroidandiOSforEMSBackendService
TheRemoteNotificationsforEMSweareusingwiththeseapplicationsrequires:
ToallowyourapplicationstoreceiveRemoteNotifications,youneed:
ForAndroidapps,anewprojectonGoogleDeveloperConsole.
ForiOSapps,anewApp-IDonAppleDeveloperProgram.
ThecompletestepsareheretosetupthemessagingserviceforbothAndroidandiOSapps:
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Setting_Up_the_Messaging_Service
ForANDROID,
Followthesesteps:
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Setting_Up_the_Messaging_Service
CreateanewAndroidprojectandServerKeyintheGoogleDeveloperConsoleaccordingtothe
instructionsathttp://developer.android.com/google/gcm/gs.html
Note:FirebaseCloudMessaging(FCM)isthenewversionofGoogleCloudMessaging(GCM).Itinherits
thereliableandscalableGCMinfrastructure,plusnewfeatures!
ForAppleiOS:
Followthesesteps:
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Setting_Up_the_Messaging_Service
3.Add[Server.Push.GCM]and[Server.Push.APN]filestoemsserver.ini
EditC:\Users\Public\Documents\Embarcadero\EMS\emsserver.ini.
ForAndroid,addyourGCMAPIKeyfromtheServerKeyyoucreatedaboveforyourGoogleCloud
Messaging(GCM)/FCMimplementationin[Server.Push.GCM]
[Server.Push.GCM]
;#ThissectionisforGoogleCloudMessaging(GCM)settings.
;#ThesesettingsareneededtosendpushnotificationstoanAndroiddevice
ApiKey=BxyxxaSyABuQw4Pn0XABClZDiBxydqa
ForiOSyouwilladdyour.p12CertificateFileNametotheemsserver.inifileinsection
[Server.Push.APNS]:
4.SetupBeacons
Youneedtohavetwo(2)beacons.OnebeaconwillbetheNursesRoom,andtheotherbeaconwillbe
theHospitalorClinicHall.
ThePatientCheckIn2(PatientApp)definestwoBeaconUUIDsintheBeacon.MonitorizedRegions[]
property:
Forexample(adjusttheUIDandMinorvaluesforyourspecificbeacons):
HOSPITAL_HALL=30720;//Minor
NURSE_ROOM=30887; //Minor
TheOnBeaconProximityEventdefines:
HOSPITAL_HALL=30720;//Minor
NURSE_ROOM=30887; //Minor
IfABeacon.Minor=HOSPITAL_HALLthen'WelcometotheHospital';
ifABeacon.Minor=NURSE_ROOMthenNurseRoom
Note:EachBeaconhastheirownwebsiteandinstructionsonhowtochangetheUUID,Majorand
Minor.
Forexample,ImusingtwoBeaconsfromEMMicroelectronic
thathaveUUID=699EBC80-E1F3-11E3-9A0F-0CF3EE3BC012
AndMinor=30720(Hospital_Hall)andMinor=30887(NURSE_ROOM)
Fortestingthatyoucanconnecttothebeacons,youcanuseusetheRADStudiosample
BeaconsProximityDEMOapp,andaddyourUUID:
CheckManager;
ifFBeaconManager.RegisterBeacon(TGUID.Create('{699EBC80-E1F3-11E3-9A0F-0CF3EE3BC012}'))
then
RunningtheBeaconsProximityDemoappwillverifythatyoucandetectyourtwobeacons:
NurseProjectGroupSetup(usingRADStudio/Delphi10.2Tokyo)
OpentheNurseProjectGroupinDelphi10.2Tokyo:
1. ConfiguretheDatabasepropertyoftheTFDConnectionintheNurseStationStorageU(from
NurseStationResourcePackage)toC:\NurseStation\Database\NURSESDB.IB(thelocationon
diskforyourNURSESDB.IB).
2.Also,forWindows,addthedatabasepathincodetotheNurseStationStorageU.pas:
3.AddGCM/FCMProjectNumber(GCMAppID)toTEMSProvider
InthePatientCheckIn2project,theGCMProjectNumberistheGCMAppIDtoaddtoyour
TEMSProvidercomponentsAndroidPushGCMAppIDproperty,intheNurseStationClientModuleU,
shownonthisscreenshot:
4.AddURLHostandURLPortofEMSServerGCMtoTEMSProvider
OnthesameTEMSProvidercomponent,youwillneedtoaddyourIPaddressofyourrunningEMS
ServertotheTEMSProvidercomponentURLHostontheNurseStationClientModuleUandalso
verifyyouhaveyourGCMAppID(thatyouenteredabove).ThedefaultURLPortis8080,and
URLProtocolishttp.
WiththeNurseStationResourcePackage.bplrunning(EMSServerrunning),ontheObjectInspector,
clicktheTestConnectiontoverifyyoucanconnecttotherunningEMSServer.Ifyoucanconnect,the
versionendpointinformationgetsreturnedlikethis:
6.SettheVersioninfoforyourNurseApp_PatientVitalsproject.
UseProject|Options|VersionInfo|CFBundleIdentifier(forTarget:DebugconfigurationiOS
Device32bitplatform):
Formyapplication,IneedtosettheCFBundleIdentifiertocom.embarcadero.alpush1formy
NurseApp_PatientVitalsproject(youwillusetheIDthatgotassignedtoyou):
NursesStationDemoAppWalkthrough
1. OpentheNurseProjectGroupinDelphi10.2Tokyo:
PatientCheckinUnit2hasthreetabscreens:
---> --->
NurseStationClientModuleUhastheEMSandPushcomponents.TheNurseStationClientModuleU
issharedbybothPatientAppandNursesApp:
3.NurseApp_PatientVitalsprojectistheNursesapplication.Ithastwofiles;the
NurseAppMainForm.pasandtheSensorMonitorsU.pas
TheNurseAppMainFormhastwotabsscreens:
GetData StoredData
TheSensorMonitorsUisusedbytheNurseAppMainFormtoconnecttoaHeartRateService,and
displaytheCurrentPatientsHeartRate.
TheGetDatatabshowscurrentPatientName,andletsyoucollectPatientHeartRateandWeight
data.
TheStoredDatatabdisplaysPatientsHeartRateandWeightdata.
4.TheEMSServeristherunningNurseStationResourcePackage.bpl
TheNurseStationStorageUhastheFDConnectionandQuerySelect,InsertandUpdateforthe
Patienttable:
HighlightNurseStationResourcePackage.bpl|right-click|RunwithoutDebugging
TheEMSServerStarts:
Note:Asacheck,verifybothyourAndroidandiOSappcanconnecttotheWindowsEMSServerIP
andport.IuseaPingprogramfromAppStoreandGooglePlayStore,oropenabrowseronAndroid
oriOSandenterhttp://192.168.1.20:8080/versionandverifytheEMSversionJSONgetsreturned,like
this:
2.FromtheNursesRoom(beacon),onaniOSDevice(iPad)runtheNurseapplication
(NurseApp_PatientVitals):
WhentheNurseAppconnectstoEMS,thenyouwillseetheRecordPatientVitalsscreen.
EMSdisplays:
{"Request":{"Resource":"Users","Endpoint":"LoginUser","Method":"POST","User":"(blank)","Time":"
4/10/20156:29:46PM","Thread":6024}}
{"Request":{"Resource":"Installations","Endpoint":"AddInstallation","Method":"POST","User":"8B9
8E8C3-B8BF-4A93-95A0-53A064CAD6B2","Time":"4/10/20156:29:46PM","Thread":2996}}
Note:IftheNurseappcannotconnecttoEMS,itwillshutdownandexit.
TheBEACONattheNURSESROOMrepresentstheNURSESROOM.TurnONtheNurse'sRoom
BEACON,ifnotalreadyON.
3.Next,onANDROID(asthePatientapplication),adistanceawayfromtheHospitalHallbeacon,run
thePatientApplication(PatientCheckIn2).ThebeaconattheHospitalHallrepresentstheHospital
Hall.
ThePatientApp(Androidapp-PatientCheckIn2)startsandyougetthisscreen:
TheappsaysYouneedtobeinthewaitingroomtocheck-in.
4.WiththePatientApp,walkNEARtheHospitalHallbeacon.WhenyouareNEARtheHospitalHall,
thescreenwilldisplayWelcometoHospital
6.LoginwithUsernameandPasswordthatyoucreatedintheEMSServer(Test1,test1).
7.ClickLogin.
ThissendsanEMSPushNotificationtotheNursesApplication,andonyourPatientappyouseethis
screenwithyourPatientName:
TheAndroid(PatientApp)getsInstalled(shownfromEMSMANAGEMENTCONSOLE.exe):
EMSdisplaysthesemessages:
{"Request":{"Resource":"Users","Endpoint":"GetUsers","Method":"GET","User":"611F0317-23D2-48C
7-9D54-F4ED71665A52","Time":"4/10/20157:00:43PM","Thread":4380}}
{"Push":{"action":"Queued","type":"TApnsNotification","Thread":5592}}
{"Push":{"action":"Sent","type":"TApnsNotification","Thread":5360}}
{"Request":{"Resource":"Users","Endpoint":"GetUser","Method":"GET","User":"8B98E8C3-B8BF-4A93
-95A0-53A064CAD6B2","Time":"4/10/20157:00:47PM","Thread":5488}}
8.Next,leavingyourPatientappbytheHospitalHall,walkbacktotheNursesApplication.TheNurses
ApplicationshowsthatyouhavearrivedtotheHospital(withthePushNotification).
ImportantNote:ClickintheComboBoxabovetheCurrentPatientHeartrateboxtoactivatethe
PushNotificationpop-uplist,likethis:
SelectyourPatientName,clickDone.
YouPatientName(lDescription)getsaddedtotheComboBox,likethis:
9.WalkbacktotheHospitalHallandgetyourPatientApp.ThePatientAppnowsays:Youarenow
checkedin.Thenurseisreadytoseeyou.
10.WithyourPatientAppfromtheHospitalHall,walkbacktotheNurse'sRoom.
11.WhenyourPatientAppgetsNEARtotheNurse'sRoombeacon,theNursesAppwillgetthe
messageAlMannarinohasenteredtheroom.
12.IfyoudoNOThaveaBTLEWeightScale,youwillclickoneditboxCurrentPatientWeight,and
manuallyenterthePatientsweight.IfyouhavetheWeightScale,thenyoucanclicktheConnectto
DeviceforthePateintWeight.
ThenclickSaveDatafortheweight.ClickOK.
13.Next,usingyourBTLEHeartRateSensor,(IusedaZephyr,butmostBTLEHRMSensorsshould
work).Fordemopurposes,itsOKtousetwofingersovertheHRMcontactssotheHRMsendsBeats
PerMinute(BPM)Data.Forexample:
UsinganAppleiOSiPad,checkthatyouhaveBluetoothTurnedOn,andyourHRMisconnected:
ThisfirsttimeoniPad,youmaygetthismessageusingBluetooth:
ClickOK.
14.ClickonPatientHeartRateConnecttoDevice:
WaitafewsecondsfortheHRMtobedetected,andthenyouwillseeyourHRBPMgetdisplayedon
theNursesApp.ClickSaveData.ClickOK.
15.OntheEMSSERVER,youcanseealltheRESTAPIcalls.
{"Request":{"Resource":"Users","Endpoint":"GetUser","Method":"GET","User":"8B98E8C3-B8BF-4A93
-95A0-53A064CAD6B2","Time":"4/10/20158:24:11PM","Thread":7716}}
{"Request":{"Resource":"NurseStation","Endpoint":"PostAddPatientData","Method":"POST","User":"
8B98E8C3-B8BF-4A93-95A0-53A064CAD6B2","Time":"4/10/20158:34:39PM","Thread":6316}}
16.Lastly,usingtheInterBasedatabaseIBConsole,lookingintotheInterBasedatabase
NURSESDB.IB,youwillseeyourPatientID,Heart_RateandyourWeight,allsavedsecurelytodiskin
theInterBasedatabase!
ThisendstheNursesStationSetupandDemonstration!Congratulations!