import { Component, OnInit, NgZone } from '@angular/core'; import { NavController, NavParams, LoadingController, ToastController, Platform } from "@ionic/angular"; import { NumPadComponent } from "../components/num-pad/num-pad.component" /*import { CasualtyDetailsPage } from "../casualty-details/casualty-details"; import { HistoryPage } from "../history/history";*/ import { ViewChild } from "@angular/core"; import { IonSlides } from "@ionic/angular"; import { DatabaseService } from "../services/database/database.service"; import { AlertController } from "@ionic/angular"; import { AppVersion } from "@ionic-native/app-version/ngx"; import { GetlocationService } from "../services/getlocation/getlocation.service"; import { JwtService } from "../services/jwt/jwt.service"; import { File } from "@ionic-native/file/ngx"; import { FileTransfer, FileUploadOptions, FileTransferObject } from "@ionic-native/file-transfer/ngx"; @Component({ selector: 'app-main', templateUrl: './main.page.html', styleUrls: ['./main.page.scss'], }) export class MainPage implements OnInit { @ViewChild("fasSlider") fasSlides: IonSlides; stuff: any; idToken: any; thePath: string = ""; numTaps: number = 0; modalVis: string = "hideModal"; avpuControlsVis: string = "showModal"; sandsVis: string = "showModal"; treatmentVis: string = "hideModal"; reportWindowVis: string = "hideModal"; ionSpinner: string = "hideModal"; systemTime: String = new Date() .toISOString() .substring(11) .replace("Z", ""); cpr1: string = "cprButton"; cpr2: string = "cprButton"; cpr3: string = "cprButton"; cpr4: string = "cprButton"; cpr5: string = "cprButton"; cpr6: string = "cprButton"; end1: string = "endButton"; end2: string = "endButton"; end2a: string = "endButton"; end2b: string = "endButton"; end3: string = "endButton"; end4: string = "endButton"; end5: string = "endButton"; end5a: string = "endButton"; end5b: string = "endButton"; end6: string = "endButton"; footerZ: string = "footerZFront"; unresponsiveFlag: boolean = true; cdFlag: boolean = false; burnFlag: boolean = false; adultChokingFlag: boolean = false; //ATMIST variables atmistAge: number; atmistAgeString: string; atmistTOI: string = ""; atmistNLGTOI: string = ""; atmistInitialAVPU: string = ""; atmistInitialAirway: string = ""; atmistInitialBreathing: string = ""; atmistInitialCirculation: string = ""; atmistInitialConsciousness: string = ""; atmistMechanism: string = ""; atmistInjuries: string = ""; atmistInjuriesData = []; atmistSignsAndSymptoms = []; atmistObservations = []; atmistTreatment = []; atmistFullName: string = ""; atmistFirstName: string = ""; atmistLastName: string = ""; atmistGender: string = ""; atmistHomeAddress: string = ""; atmistDOB: string = ""; atmistAlcohol: string = ""; atmistAllergyAnswer: string = ""; atmistAllergyDetails: string = ""; atmistMedicine: string = ""; atmistMedicalHistory: string = ""; atmistFlight: string = ""; atmistSeat: string = ""; atmistAirport: string = ""; atmistLastMeal: string = ""; atmistComplaint: string = ""; atmistPP: string = ""; atmistPPP: string = ""; atmistPPLC: string = ""; atmistPPPLC: string = ""; atmistAVPUPrefix: string = ""; casualtyDetails = []; atmistNormalObs: string = ""; atmistNormalSigns: string = ""; atmistNormalTreatment: string = ""; //MODAL pop-up windows visibility flags avpuVis: string = "hideModal"; consciousnessVis: string = "hideModal"; aedVis: string = "hideModal"; cprVis: string = "hideModal"; endVis: string = "hideModal"; subVis: string = "hideModal"; ecgVis: string = "hideModal"; consciousnessConfirmState: string = "SELECT"; consciousnessStateColour: string = ""; consciousnessSelectYes: string = "consciousnessEmpty"; consciousnessSelectNo: string = "consciousnessEmpty"; consciousnessSpacing: string = ""; consciousnessMinutes: string = ""; showInputBox: string = "disableDiv"; minutesUnconscious: number = 0; greyMeOut: string = ""; historyOfIncident: string = ""; endWitnessed: string = "hideModal"; endDoc: string = "hideModal"; witnessed: string = ""; witnessedBy: string = ""; assistanceRequired: string = ""; docRequested: string = ""; docRequestResponse: string = ""; padVisible: boolean = false; vitalRequested: string = ""; vitalValue: string = ""; hrImage: string = "hrOK"; hrValue: string = "--"; hrTextClass: string = "OK"; hrBT: string = "hideModal"; brImage: string = "brOK"; brValue: string = "--"; brTextClass: string = "OK"; satsImage: string = "satsOK"; satsValue: string = "--"; satsTextClass: string = "OK"; bpImage: string = "bpOK"; bpSysValue: string = "--"; bpDiaValue: string = "--"; bpSysTextClass: string = "OK"; bpDiaTextClass: string = "OK"; bpUnitTextClass: string = "OK"; tempImage: string = "tempOK"; tempValue: string = "--"; tempTextClass: string = "OK"; avpuClass: string = ""; avpuState: string = ""; airwayClass: string = ""; airwayState: string = ""; breathingClass: string = ""; breathingState: string = ""; circulationClass: string = ""; circulationState: string = ""; consciousnessClass: string = ""; consciousnessState: string = ""; //Vital Signs Highlight class variables hrActive: string = "col"; brActive: string = "col"; satsActive: string = "col"; bpActive: string = "col"; tempActive: string = "col"; // SIGNS AND SYMPTOMS BUTTON CLASSES AND TEXT VARIABLES sAndSClammy: string = "sasOK"; sandsClammy: string = "CLAMMY
NO"; sAndSBleeding: string = "sasOK"; sandsBleeding: string = "BLEEDING
NO"; sAndSPain: string = "sasOK"; sandsPain: string = "PAIN
NO"; sAndSChoking: string = "sasOK"; sandsChoking: string = "CHOKING
NO"; sAndSNauseated: string = "sasOK"; sandsNauseated: string = "NAUSEATED
NO"; sAndSSweating: string = "sasOK"; sandsSweating: string = "SWEATING
NO"; sAndSHeadache: string = "sasOK"; sandsHeadache: string = "HEADACHE
NO"; sAndSIncontinent: string = "sasOK"; sandsIncontinent: string = "INCONTINENT
NO"; sAndSVomited: string = "sasOK"; sandsVomited: string = "VOMITED
NO"; sAndSFitting: string = "sasOK"; sandsFitting: string = "FITTING
NO"; sAndSTalkedSince: string = "sasOK"; sandsTalkedSince: string = "TALKED SINCE
YES"; sAndSUnconscious: string = "sasOK"; //sandsUnconscious: string = "UNCONSCIOUS
NO"; // TREATMENT GIVEN BUTTON CLASSES treatmentAED: string = "tgUnselected"; treatmentOxygen: string = "tgUnselected"; treatmentBagValveMask: string = "tgUnselected"; treatmentClearAirway: string = "tgUnselected"; treatmentControlBleeding: string = "tgUnselected"; treatmentCPR: string = "tgUnselected"; treatmentHeadTiltChinLift: string = "tgUnselected"; treatmentJawThrust: string = "tgUnselected"; treatmentMedicineGiven: string = "tgUnselected"; treatmentMovePatient: string = "tgUnselected"; treatmentOroAirway: string = "tgUnselected"; treatmentSuction: string = "tgUnselected"; currVal: string = ""; nlgATMIST: string = ""; gpsLat: string = ""; gpsLong: string = ""; sJSON: string = ""; oldHR: string = ""; // MBS Variables scanList = []; scanType = "SCAN"; serviceID = ""; calls = 0; watchID = ""; deviceList: any; supportedDevices: any; deviceBattery: any; btCounter: number = 1; lastHR: string = "empty"; lastBR: string = "empty"; lastSATS: string = "empty"; lastSYSBP: string = "empty"; lastDIABP: string = "empty"; lastTEMP: string = "empty"; lastECG: string = "empty"; historyVis: string = "showModal"; chatVis: string = "hideModal"; chatStartVis: string = "showModal"; chatDemoVis: string = "hideModal"; chatText: string = ""; chatAnimation: string = ""; ecgBefore: string = "showModal"; ecgAfter: string = "hideModal"; ecgInProgress: boolean = false; ecgShortHolder: string = ""; finishWindow: string = "hideModal"; endQuestions: string = "endModal3"; constructor( public navCtrl: NavController, public navParams: NavParams, public numPad: NumPadComponent, private database: DatabaseService, public alertCtrl: AlertController, //private spinnerDialog: SpinnerDialog, private appVersion: AppVersion, public getLocation: GetlocationService, public jwt: JwtService, public file: File, private transfer: FileTransfer, public loadingCtrl: LoadingController, public zone: NgZone, public platform: Platform ) { this.platform.ready().then(() => { //this.callMBSMimeBridge(); console.warn("Called MBSMimeBridge()"); this.platform.resume.subscribe(result => { //App returned to Foreground if (this.ecgInProgress) { //Log that an ECG trace has been performed console.log("App returned to foreground (ECG)"); this.ecgBefore = "hideModal"; this.ecgAfter = "showModal"; this.ecgShortHolder = "ecgShortModal"; } }); this.platform.pause.subscribe(result => { //App into Background if (this.ecgInProgress) { console.log("App placed in background (ECG)"); } }); }); } ngOnInit() { console.log("Main page loaded and running"); this.avpuState = this.navParams.get("avpuState"); this.airwayState = this.navParams.get("airwayState"); this.breathingState = this.navParams.get("breathingState"); this.circulationState = this.navParams.get("circulationState"); this.consciousnessState = this.navParams.get("consciousnessState"); //Set initial states //AVPU if (this.avpuState === "") { this.avpuState = "ALERT"; } if (this.avpuState === "ALERT") { this.avpuClass = "sasOK oneLine"; } else { this.avpuClass = "sasNotOK"; if (this.avpuState === "UNRESPONSIVE") { this.avpuClass += " oneLine"; } } //Airway if (this.airwayState === "clear") { this.airwayClass = "sasOK"; this.airwayState = "AIRWAY
CLEAR"; } else { this.airwayClass = "sasNotOK"; this.airwayState = "AIRWAY
BLOCKED"; } //Breathing if (this.breathingState === "regular") { this.breathingClass = "sasOK"; this.breathingState = "BREATHING
REGULAR"; } else { this.breathingClass = "sasNotOK"; this.breathingState = "BREATHING
IRREGULAR"; } //Circulation if (this.circulationState === "pale") { this.circulationClass = "sasOK"; this.circulationState = "CIRCULATION
PALE"; } else { this.circulationClass = "sasNotOK"; this.circulationState = "CIRCULATION
FLUSHED"; } //Consciousness if (this.consciousnessState === "no") { this.consciousnessClass = "sasOK"; this.consciousnessState = "UNCONSCIOUS
NO"; } else { this.consciousnessClass = "sasNotOK"; this.consciousnessState = "UNCONSCIOUS
" + this.consciousnessState .replace(" secs", "s") .replace(" mins", "m") .replace("hr", " hour"); //if (this.consciousnessState.indexOf("over") === -1) { // this.consciousnessSpacing = ""; //} else { this.consciousnessSpacing = "narrowerText"; //} } } ionViewDidEnter() { if (this.avpuControlsVis === "hideModal") { //Report window must be visible; re-run this.showReport(); } } ProcessBluetoothHR(hr: string) { if (hr !== "" && hr !== "0") { this.hrBT = ""; let vitalColour = ""; //this.vitalRequested = "BPM"; this.vitalValue = hr; this.hrValue = this.vitalValue; this.hrCapture(hr); } } hrCapture(hrInput: string) { //this.padVisible = false; let vitalColour = ""; //this.vitalValue = hrInput; this.hrValue = hrInput; //Check HR and set colours vitalColour = this.checkVitals("hr", this.hrValue); this.hrImage = "hr" + vitalColour; this.hrTextClass = vitalColour; this.btCounter--; if (this.btCounter === 0) { if (this.oldHR !== this.hrValue) { this.database.saveVital("Heart Rate", this.hrValue + " BPM"); this.oldHR = this.hrValue; this.lastHR = this.hrValue + "/" + this.hrImage; } this.btCounter = 5; } //this.clearVitals(); if (this.avpuControlsVis === "hideModal") { //Report window must be visible; re-run //this.showReport(); } } updateTaps() { this.numTaps++; if (this.numTaps > 5) { this.appVersion.getVersionNumber().then(version => { alert("MIME Pro Version: " + version); }); this.numTaps = 0; } } reloadAVPU(avpu) { this.avpuState = avpu; if (this.avpuState === "ALERT") { this.avpuClass = "sasOK oneLine"; } else { this.avpuClass = "sasNotOK"; if (this.avpuState === "UNRESPONSIVE") { this.avpuClass += " oneLine"; } } this.database.saveAVPU(this.avpuState); this.avpuVis = "hideModal"; } toggleChatWindow() { if (this.chatVis === "hideModal") { this.chatVis = "showModal"; this.historyVis = "hideModal"; } else { this.chatVis = "hideModal"; this.historyVis = "showModal"; } } startChat() { //This is a timed demo; nothing more... this.chatDemoVis = "showModal"; this.chatStartVis = "hideModal"; } openCasualtyDetails() { //this.navCtrl.push(CasualtyDetailsPage); } myCallbackFunction = _params => { return new Promise((resolve, reject) => { this.historyOfIncident = _params; console.log("Returned: " + _params); this.database.saveHistory(_params); resolve(); }); }; openHistory() { /*this.navCtrl.push(HistoryPage, { incoming: this.historyOfIncident, callback: this.myCallbackFunction });*/ } checkVitals(vitalSign: string, vitalValue: string) { //let numVitalValue = parseFloat(vitalValue); switch (vitalSign) { case "hr": let myHR = parseFloat(vitalValue); if (myHR <= 39 || myHR >= 130) { //make colour red return "NotOK"; } else if ((myHR >= 40 && myHR <= 49) || (myHR >= 110 && myHR <= 129)) { //make colour amber return "Warn"; } else if (myHR >= 50 && myHR <= 109) { //make colour green return "OK"; } break; case "br": let myBR = parseFloat(vitalValue); if ((myBR >= 0 && myBR <= 8) || (myBR >= 25 && myBR <= 99)) { //make colour red return "NotOK"; } else if (myBR >= 21 && myBR <= 24) { //make colour amber return "Warn"; } else if (myBR >= 9 && myBR <= 20) { //make colour green return "OK"; } break; //Updated with Tim's SATS values from email 13/04/2019 case "sats": let mySATS = parseFloat(vitalValue); if (mySATS >= 50 && mySATS <= 91) { //make colour red return "NotOK"; } else if (mySATS >= 92 && mySATS <= 95) { //make colour amber return "Warn"; } else if (mySATS >= 96 && mySATS <= 100) { //make colour green return "OK"; } break; case "bpSys": let mySys = parseFloat(vitalValue); if ((mySys >= 40 && mySys <= 89) || (mySys >= 221 && mySys <= 300)) { //make colour red return "NotOK"; } else if (mySys >= 90 && mySys <= 99) { //make colour amber return "Warn"; } else if (mySys >= 100 && mySys <= 220) { //make colour green return "OK"; } break; case "bpDia": let myDia = parseFloat(vitalValue); //Diastolic if (myDia >= 100 && myDia <= 200) { //make colour red return "NotOK"; } else if (myDia >= 81 && myDia <= 99) { //make colour amber return "Warn"; } else if (myDia >= 20 && myDia <= 80) { //make colour green return "OK"; } break; //Updated with Tim's TEMP values from email 13/04/2019 case "temp": let myTEMP = parseFloat(vitalValue); if ((myTEMP >= 18 && myTEMP <= 35) || myTEMP >= 39.1) { //make colour red return "NotOK"; } else if ( (myTEMP >= 35.1 && myTEMP <= 36) || (myTEMP >= 38.1 && myTEMP <= 39) ) { //make colour amber return "Warn"; } else if (myTEMP >= 36.1 && myTEMP <= 38) { //make colour green return "OK"; } break; } } getSystemTime() { var d = new Date(); var hours = this.addZero(d.getHours()); var mins = this.addZero(d.getMinutes()); var secs = this.addZero(d.getSeconds()); var theTime = hours + ":" + mins + ":" + secs; this.systemTime = theTime; return this.systemTime; } addZero(i) { if (i < 10) { i = "0" + i; } return i; } vitalCapture(event) { let vitalColour = ""; if (event !== "closePad") { this.vitalValue = event; switch (this.vitalRequested) { case "BPM": this.hrValue = this.vitalValue; //Check HR and set colours vitalColour = this.checkVitals("hr", this.hrValue); this.hrImage = "hr" + vitalColour; this.hrTextClass = vitalColour; this.lastHR = this.hrValue + "/" + this.hrImage + "/" + this.getSystemTime(); this.database.saveVital("Heart Rate", this.hrValue + " BPM"); break; case "BrPM": this.padVisible = false; this.brValue = this.vitalValue; vitalColour = this.checkVitals("br", this.brValue); this.brImage = "br" + vitalColour; this.brTextClass = vitalColour; this.lastBR = this.brValue + "/" + this.brImage + "/" + this.getSystemTime(); this.database.saveVital("Respiratory Rate", this.brValue + " BrPM"); break; case "%": this.padVisible = false; this.satsValue = this.vitalValue; vitalColour = this.checkVitals("sats", this.satsValue); this.satsImage = "sats" + vitalColour; this.satsTextClass = vitalColour; this.lastSATS = this.satsValue + "/" + this.satsImage + "/" + this.getSystemTime(); this.database.saveVital("Oxygen Saturation", this.satsValue + " %"); break; case "mmHg": //BP comes in as 120/79, so need to split the values by the / this.padVisible = false; let bp = this.vitalValue.split("/"); this.bpSysValue = bp[0]; this.bpDiaValue = bp[1]; this.bpSysTextClass = this.checkVitals("bpSys", this.bpSysValue); this.bpDiaTextClass = this.checkVitals("bpDia", this.bpDiaValue); this.lastSYSBP = this.bpSysValue + "/" + this.bpSysTextClass + "/" + this.getSystemTime(); this.lastDIABP = this.bpDiaValue + "/" + this.bpDiaTextClass; if (this.bpSysTextClass !== "OK" || this.bpDiaTextClass !== "OK") { //one of the BP values is not OK, colour text and image //to follow suit let theMix = this.bpSysTextClass + this.bpDiaTextClass; if (theMix.indexOf("NotOK") !== -1) { this.bpUnitTextClass = "NotOK"; this.bpImage = "bpNotOK"; } else if (theMix.indexOf("Warn") !== -1) { this.bpUnitTextClass = "Warn"; this.bpImage = "bpWarn"; } } else { this.bpImage = "bpOK"; this.bpUnitTextClass = "OK"; } this.database.saveVital( "Blood Pressure", this.bpSysValue + "/" + this.bpDiaValue + " mmHg" + "/" + this.getSystemTime() ); break; case "oC": this.padVisible = false; this.tempValue = this.vitalValue; vitalColour = this.checkVitals("temp", this.tempValue); this.tempImage = "temp" + vitalColour; this.tempTextClass = vitalColour; this.lastTEMP = this.tempValue + "/" + this.tempImage + "/" + this.getSystemTime(); this.database.saveVital("Temperature", this.tempValue + " C"); break; } } this.clearVitals(); if (this.avpuControlsVis === "hideModal") { //Report window must be visible; re-run this.showReport(); } } changeHR() { this.clearVitals(); this.vitalRequested = "BPM"; this.padVisible = true; this.hrActive = "col vitalToFront"; } changeBR() { this.clearVitals(); this.vitalRequested = "BrPM"; this.padVisible = true; this.brActive = "col vitalToFront"; } changeSats() { this.clearVitals(); this.vitalRequested = "%"; this.padVisible = true; this.satsActive = "col vitalToFront"; } changeBP() { this.clearVitals(); this.vitalRequested = "mmHg"; this.padVisible = true; this.bpActive = "col vitalToFront"; } changeTemp() { this.clearVitals(); this.vitalRequested = "oC"; this.padVisible = true; this.tempActive = "col vitalToFront"; } clearVitals() { this.padVisible = false; this.hrActive = "col"; this.brActive = "col"; this.satsActive = "col"; this.bpActive = "col"; this.tempActive = "col"; } airwayToggle() { if (this.airwayState === "AIRWAY
BLOCKED") { this.airwayClass = "sasOK"; this.airwayState = "AIRWAY
CLEAR"; } else { this.airwayClass = "sasNotOK"; this.airwayState = "AIRWAY
BLOCKED"; } this.database.saveABC("Airway", this.airwayState); } breathingToggle() { if (this.breathingState === "BREATHING
IRREGULAR") { this.breathingClass = "sasOK"; this.breathingState = "BREATHING
REGULAR"; } else { this.breathingClass = "sasNotOK"; this.breathingState = "BREATHING
IRREGULAR"; } this.database.saveABC("Breathing", this.breathingState); } circulationToggle() { if (this.circulationState === "CIRCULATION
FLUSHED") { this.circulationClass = "sasOK"; this.circulationState = "CIRCULATION
PALE"; } else { this.circulationClass = "sasNotOK"; this.circulationState = "CIRCULATION
FLUSHED"; } this.database.saveABC("Circulation", this.circulationState); } toggleTreatment(x) { switch (x) { case "aed": if (this.treatmentAED === "tgUnselected") { this.treatmentAED = "tgSelected"; //Only show shocks dialog if treatment is being added this.aedVis = "showModal"; } else { this.treatmentAED = "tgUnselected"; } this.database.saveTreatment("AED", this.treatmentAED); break; case "oxygen": if (this.treatmentOxygen === "tgUnselected") { this.treatmentOxygen = "tgSelected"; } else { this.treatmentOxygen = "tgUnselected"; } this.database.saveTreatment("OXYGEN", this.treatmentOxygen); break; case "bagvalvemask": if (this.treatmentBagValveMask === "tgUnselected") { this.treatmentBagValveMask = "tgSelected"; } else { this.treatmentBagValveMask = "tgUnselected"; } this.database.saveTreatment( "BAG VALVE MASK", this.treatmentBagValveMask ); break; case "clearairway": if (this.treatmentClearAirway === "tgUnselected") { this.treatmentClearAirway = "tgSelected"; } else { this.treatmentClearAirway = "tgUnselected"; } this.database.saveTreatment("CLEAR AIRWAY", this.treatmentClearAirway); break; case "controlofbleeding": if (this.treatmentControlBleeding === "tgUnselected") { this.treatmentControlBleeding = "tgSelected"; } else { this.treatmentControlBleeding = "tgUnselected"; } this.database.saveTreatment( "CONTROL OF BLEEDING", this.treatmentControlBleeding ); break; case "cpr": if (this.treatmentCPR === "tgUnselected") { this.treatmentCPR = "tgSelected"; //Show CPR dialog if CPR being selected this.cprVis = "showModal"; } else { this.treatmentCPR = "tgUnselected"; this.cpr1 = "cprButton"; this.cpr2 = "cprButton"; this.cpr3 = "cprButton"; this.cpr4 = "cprButton"; this.cpr5 = "cprButton"; this.cpr6 = "cprButton"; } this.database.saveTreatment("CPR", this.treatmentCPR); break; case "headtiltchinlift": if (this.treatmentHeadTiltChinLift === "tgUnselected") { this.treatmentHeadTiltChinLift = "tgSelected"; } else { this.treatmentHeadTiltChinLift = "tgUnselected"; } this.database.saveTreatment( "HEAD TILT/CHIN LIFT", this.treatmentHeadTiltChinLift ); break; case "jawthrust": if (this.treatmentJawThrust === "tgUnselected") { this.treatmentJawThrust = "tgSelected"; } else { this.treatmentJawThrust = "tgUnselected"; } this.database.saveTreatment("JAW THRUST", this.treatmentJawThrust); break; case "medicinegiven": if (this.treatmentMedicineGiven === "tgUnselected") { this.treatmentMedicineGiven = "tgSelected"; } else { this.treatmentMedicineGiven = "tgUnselected"; } this.database.saveTreatment( "MEDICINE GIVEN", this.treatmentMedicineGiven ); break; case "movepatient": if (this.treatmentMovePatient === "tgUnselected") { this.treatmentMovePatient = "tgSelected"; } else { this.treatmentMovePatient = "tgUnselected"; } this.database.saveTreatment("MOVE PATIENT", this.treatmentMovePatient); break; case "opa": if (this.treatmentOroAirway === "tgUnselected") { this.treatmentOroAirway = "tgSelected"; } else { this.treatmentOroAirway = "tgUnselected"; } this.database.saveTreatment( "OROPHARYNGEAL AIRWAY", this.treatmentOroAirway ); break; case "suction": if (this.treatmentSuction === "tgUnselected") { this.treatmentSuction = "tgSelected"; } else { this.treatmentSuction = "tgUnselected"; } this.database.saveTreatment("SUCTION", this.treatmentSuction); break; } } sAndSToggle(x) { //console.log(this.clammy.nativeElement.innerText); switch (x) { case "clammy": if (this.sandsClammy === "CLAMMY
NO") { this.sandsClammy = "CLAMMY
YES"; this.sAndSClammy = "bgNotOK"; } else { this.sandsClammy = "CLAMMY
NO"; this.sAndSClammy = "bgOK"; } this.database.saveSandS("CLAMMY", this.sandsClammy); break; case "bleeding": if (this.sandsBleeding === "BLEEDING
NO") { this.sandsBleeding = "BLEEDING
YES"; this.sAndSBleeding = "bgNotOK"; } else { this.sandsBleeding = "BLEEDING
NO"; this.sAndSBleeding = "bgOK"; } this.database.saveSandS("BLEEDING", this.sandsBleeding); break; case "pain": if (this.sandsPain === "PAIN
NO") { this.sandsPain = "PAIN
YES"; this.sAndSPain = "bgNotOK"; } else { this.sandsPain = "PAIN
NO"; this.sAndSPain = "bgOK"; } this.database.saveSandS("PAIN", this.sandsPain); break; case "choking": if (this.sandsChoking === "CHOKING
NO") { this.sandsChoking = "CHOKING
YES"; this.sAndSChoking = "bgNotOK"; } else { this.sandsChoking = "CHOKING
NO"; this.sAndSChoking = "bgOK"; } this.database.saveSandS("CHOKING", this.sandsChoking); break; case "nauseated": if (this.sandsNauseated === "NAUSEATED
NO") { this.sandsNauseated = "NAUSEATED
YES"; this.sAndSNauseated = "bgNotOK"; } else { this.sandsNauseated = "NAUSEATED
NO"; this.sAndSNauseated = "bgOK"; } this.database.saveSandS("NAUSEATED", this.sandsNauseated); break; case "sweating": if (this.sandsSweating === "SWEATING
NO") { this.sandsSweating = "SWEATING
YES"; this.sAndSSweating = "bgNotOK"; } else { this.sandsSweating = "SWEATING
NO"; this.sAndSSweating = "bgOK"; } this.database.saveSandS("SWEATING", this.sandsSweating); break; case "headache": if (this.sandsHeadache === "HEADACHE
NO") { this.sandsHeadache = "HEADACHE
YES"; this.sAndSHeadache = "bgNotOK"; } else { this.sandsHeadache = "HEADACHE
NO"; this.sAndSHeadache = "bgOK"; } this.database.saveSandS("HEADACHE", this.sandsHeadache); break; case "incontinent": if (this.sandsIncontinent === "INCONTINENT
NO") { this.sandsIncontinent = "INCONTINENT
YES"; this.sAndSIncontinent = "bgNotOK"; } else { this.sandsIncontinent = "INCONTINENT
NO"; this.sAndSIncontinent = "bgOK"; } this.database.saveSandS("INCONTINENT", this.sandsIncontinent); break; case "vomited": if (this.sandsVomited === "VOMITED
NO") { this.sandsVomited = "VOMITED
YES"; this.sAndSVomited = "bgNotOK"; } else { this.sandsVomited = "VOMITED
NO"; this.sAndSVomited = "bgOK"; } this.database.saveSandS("VOMITED", this.sandsVomited); break; case "fitting": if (this.sandsFitting === "FITTING
NO") { this.sandsFitting = "FITTING
YES"; this.sAndSFitting = "bgNotOK"; } else { this.sandsFitting = "FITTING
NO"; this.sAndSFitting = "bgOK"; } this.database.saveSandS("FITTING", this.sandsFitting); break; case "talkedsince": if (this.sandsTalkedSince === "TALKED SINCE
NO") { this.sandsTalkedSince = "TALKED SINCE
YES"; this.sAndSTalkedSince = "bgOK"; } else { this.sandsTalkedSince = "TALKED SINCE
NO"; this.sAndSTalkedSince = "bgNotOK"; } this.database.saveSandS("TALKED SINCE", this.sandsTalkedSince); break; /*case "consciousness": console.log("Heard consciousness tap", this.consciousnessState); if (this.consciousnessState.indexOf("YES") === -1) { console.log("Getting to 302"); this.consciousnessState = "UNCONSCIOUS
YES"; this.consciousnessClass = "bgNotOK"; } else { console.log("Getting to 308"); this.consciousnessState = "UNCONSCIOUS
NO"; this.consciousnessClass = "bgOK"; } break;*/ } } selectConsciousness() { //This is responsible for displaying the consciousness modal if (this.consciousnessClass === "bgNotOK") { //Enable numbers this.showInputBox = ""; this.greyMeOut = ""; } else { //Disable numbers this.showInputBox = "disableDiv"; this.greyMeOut = "greyedOut"; } this.consciousnessVis = "showModal"; } setConsciousness(consciousnessState) { //This is responsible for showing the "how many minutes?" box if "Yes" selected switch (consciousnessState) { case "yes": this.showInputBox = ""; this.greyMeOut = ""; //this.consciousnessState = consciousnessState; this.consciousnessClass = "bgNotOK"; this.consciousnessSelectYes = "bgNotOK"; this.consciousnessSelectNo = "consciousnessEmpty"; break; case "no": this.consciousnessState = "UNCONSCIOUS
NO"; this.showInputBox = "disableDiv"; this.greyMeOut = "greyedOut"; this.consciousnessConfirmState = "NO"; this.consciousnessClass = "bgOK"; this.consciousnessSelectYes = "consciousnessEmpty"; this.consciousnessSelectNo = "bgOK"; this.toggleConsciousness(); this.consciousnessStateColour = "consciousnessOK"; this.database.saveSandS("UNCONSCIOUS", "NO"); this.consciousnessMinutes = ""; break; } } setWitnessed(witnessedState) { switch (witnessedState) { case "yes": this.endWitnessed = "showModal"; this.endQuestions = "endModal4"; //this.database.saveWitnessed("YES"); this.end1 = "endSelected"; this.end2 = "endButton"; break; case "no": //this.endVis = "hideModal"; this.endWitnessed = "hideModal"; this.endQuestions = "endModal3"; //this.database.saveWitnessed("NO"); this.end1 = "endButton"; this.end2 = "endSelected"; break; } } setWitnessedBy(witnessedByState) { switch (witnessedByState) { case "crew": //this.database.saveWitnessed("YES"); this.end2a = "endSelected"; this.end2b = "endButton"; break; case "pax": //this.database.saveWitnessed("NO"); this.end2a = "endButton"; this.end2b = "endSelected"; break; } } setAssistanceOnLanding(aolState) { switch (aolState) { case "yes": //this.database.saveWitnessed("YES"); this.end3 = "endSelected"; this.end4 = "endButton"; break; case "no": //this.database.saveWitnessed("NO"); this.end3 = "endButton"; this.end4 = "endSelected"; break; } } setDocCalledOnAircraft(docCalledState) { switch (docCalledState) { case "yes": this.endQuestions = "endModal5"; this.endDoc = "showModal"; //this.database.saveWitnessed("YES"); this.end5 = "endSelected"; this.end6 = "endButton"; break; case "no": if (this.endQuestions !== "endModal3") { this.endQuestions = "endModal4"; } else { this.endQuestions = "endModal3"; } this.endDoc = "hideModal"; //this.database.saveWitnessed("NO"); this.end5 = "endButton"; this.end6 = "endSelected"; //If this button is pushed, this should save all and initiate send to //cloud dashboard //hide the finish window //this.finishSessionReal(); this.showReport(1); break; } } setDocResponse(docResponseState) { switch (docResponseState) { case "yes": //this.database.saveWitnessed("YES"); this.end5a = "endSelected"; this.end5b = "endButton"; //this.finishSessionReal(); this.showReport(1); break; case "no": //this.database.saveWitnessed("NO"); this.end5a = "endButton"; this.end5b = "endSelected"; //this.finishSessionReal(); //this.generateReport(); this.showReport(1); break; } } finishSessionReal() { this.endVis = "hideModal"; this.subVis = "showModal"; } generateReport() { this.jwt.login().subscribe( res => { this.stuff = res; console.log(res.token); console.log("line 1306: " + JSON.stringify(this.stuff)); console.log("line 1307: " + this.stuff); this.createFile(res.token); }, err => { console.log("Error: " + err); } ); //temporarily remove the popup //this.subVis = "hideModal"; //this.navCtrl.pop(); } createFile(theToken: string) { //write the file this.file .writeFile( this.file.dataDirectory, this.database.theSessionID.toString() + ".json", this.sJSON, { append: false, replace: true } ) .then(result => { console.log(this.sJSON); console.log("File created OK"); console.log(JSON.stringify(result)); this.thePath = result.nativeURL; //let thePath = "/" + this.database.theSessionID.toString() + ".json"; //Upload file this.uploadFile(theToken, this.thePath); }) .catch(error => { console.log("File creation error"); console.log(error); }); } uploadFile(theToken: string, thePath: string) { console.log("The Token: Bearer " + theToken); console.log("The Path: " + thePath); /*let loader = this.loadingCtrl.create({ content: "Generating Report - please wait" }); loader.present();*/ const fileTransfer: FileTransferObject = this.transfer.create(); let options: FileUploadOptions = { fileKey: "files", fileName: this.database.theSessionID + ".json", chunkedMode: false, mimeType: "application/json", headers: { Authorization: "Bearer " + theToken } }; fileTransfer .upload( thePath, "https://mimeapi.azurewebsites.net/v1/api/incidents/UploadFiles", options ) .then( data => { console.log("File uploaded successfully"); console.log(JSON.stringify(data)); //loader.dismiss(); //this.submitReport(); //Remove all records from the database after submission this.database.clearDatabase(); this.endVis = "hideModal"; this.subVis = "showModal"; }, err => { console.log("File upload error"); console.log(JSON.stringify(err)); //loader.dismiss(); this.endVis = "hideModal"; this.subVis = "showModal"; } ); //After 3 seconds, confirm successful upload and ask them to tap OK //loader.dismiss(); //this.finishWindow = "showModal"; //this.endVis = "hideModal"; //this.subVis = "showModal"; } submitReport() { //Hide the modal this.subVis = "hideModal"; //clear events and start again! this.database.clearSession(); this.navCtrl.pop(); } setAED(aedState) { switch (aedState) { case "yes": this.database.saveAEDShocks("yes"); break; case "no": this.database.saveAEDShocks("no"); break; } this.aedVis = "hideModal"; } setPulse(pulseState) { switch (pulseState) { case "yes": this.cpr1 = "cprSelected cprOK"; this.cpr2 = "cprButton"; this.database.savePulseRestored("yes"); break; case "no": this.cpr1 = "cprButton"; this.cpr2 = "cprSelected cprNotOK"; this.database.savePulseRestored("no"); break; } } setRespiration(respState) { switch (respState) { case "yes": this.cpr3 = "cprSelected cprOK"; this.cpr4 = "cprButton"; this.database.saveRespirationRestored("yes"); break; case "no": this.cpr3 = "cprButton"; this.cpr4 = "cprSelected cprNotOK"; this.database.saveRespirationRestored("no"); break; } } setConsciousnessRegained(concState) { switch (concState) { case "yes": this.cpr5 = "cprSelected cprOK"; this.cpr6 = "cprButton"; this.database.saveConsciousnessRegained("yes"); break; case "no": this.cpr5 = "cprButton"; this.cpr6 = "cprSelected cprNotOK"; this.database.saveConsciousnessRegained("no"); break; } this.cprVis = "hideModal"; } saveMinutes(minutesUnconscious) { /*if (minutesUnconscious === 0) { alert("Must be more than zero minutes, otherwise select 'No'"); } else {*/ let uncUnit = ""; //alert(minutesUnconscious.indexOf("m")); if (minutesUnconscious.indexOf("m") !== -1) { //This is minutes uncUnit = "m"; minutesUnconscious = minutesUnconscious.slice(0, -1); } else { //This is seconds uncUnit = "s"; minutesUnconscious = minutesUnconscious.slice(0, -1); } this.showInputBox = "hideModal"; if (minutesUnconscious.indexOf("+") === -1) { this.consciousnessSpacing = "narrowerText"; this.consciousnessConfirmState = "UNCONSCIOUS
YES (under " + minutesUnconscious + uncUnit + ")"; } else { this.consciousnessSpacing = "narrowerText"; var finalMinutes: string = ""; switch (minutesUnconscious) { case "+30": finalMinutes = "over 30m"; break; case "+60": finalMinutes = "over 1 hour"; break; } this.consciousnessConfirmState = "UNCONSCIOUS
YES (" + finalMinutes + ")"; } this.consciousnessMinutes = minutesUnconscious; this.consciousnessState = this.consciousnessConfirmState; this.consciousnessStateColour = "consciousnessNotOK"; this.consciousnessClass = "bgNotOK"; this.toggleConsciousness(); this.database.saveSandS("UNCONSCIOUS", this.consciousnessState); //} } showTreatment() { this.avpuControlsVis = "showModal"; this.treatmentVis = "showModal"; this.sandsVis = "hideModal"; this.reportWindowVis = "hideModal"; } showSigns() { this.avpuControlsVis = "showModal"; this.sandsVis = "showModal"; this.treatmentVis = "hideModal"; this.reportWindowVis = "hideModal"; } showReport(final?) { console.log("SessionID: " + this.database.theSessionID); this.sandsVis = "showModal"; this.treatmentVis = "hideModal"; this.avpuControlsVis = "hideModal"; this.reportWindowVis = "showModal"; //clear window and show spinner this.atmistAge = null; this.nlgATMIST = ""; this.atmistTOI = ""; this.atmistMechanism = "Mechanism of Injury/Medical Complaint not yet specified"; this.atmistInjuries = "No injuries/information relating to complaint reported at this point"; this.atmistSignsAndSymptoms = []; this.atmistTreatment = []; this.atmistPP = "They"; this.atmistPPLC = "they"; this.atmistPPP = "Their"; this.atmistPPPLC = "their"; //Get report details from database //Age this.database.getCasualtyAge().then(getAtmistAge => { for (var atmist of getAtmistAge) { console.log("ATMIST AGE: " + atmist.casAge); this.atmistAge = parseInt(atmist.casAge); this.atmistFirstName = atmist.casFirstName; this.atmistLastName = atmist.casLastName; this.atmistFullName = atmist.casFullName; this.atmistGender = atmist.casGender; console.log("Gender: " + this.atmistGender); switch (this.atmistGender) { case "male": this.atmistPP = "He"; this.atmistPPLC = "he"; this.atmistPPP = "His"; this.atmistPPPLC = "his"; break; case "female": this.atmistPP = "She"; this.atmistPPLC = "she"; this.atmistPPP = "Her"; this.atmistPPPLC = "her"; break; case "other": this.atmistPP = "They"; this.atmistPPLC = "they"; this.atmistPPP = "Their"; this.atmistPPPLC = "their"; break; default: this.atmistPP = "They"; this.atmistPPLC = "they"; this.atmistPPP = "Their"; this.atmistPPPLC = "their"; break; } } //Initial AVPU this.database.getATMISTAVPU().then(atmistAVPUData => { for (var atmistData of atmistAVPUData) { this.atmistInitialAVPU = atmistData.atmistAVPU; switch (this.atmistInitialAVPU) { case "ALERT": this.atmistAVPUPrefix = "was"; break; case "RESPONDS TO VOICE": this.atmistAVPUPrefix = ""; break; case "RESPONDS TO PAIN": this.atmistAVPUPrefix = ""; break; case "UNRESPONSIVE": this.atmistAVPUPrefix = "was"; break; } this.atmistInitialAirway = atmistData.atmistA; this.atmistInitialBreathing = atmistData.atmistB; this.atmistInitialCirculation = atmistData.atmistC; this.atmistInitialConsciousness = atmistData.atmistCons; if (this.atmistInitialConsciousness === "NO") { this.atmistInitialConsciousness = "HAD NOT BEEN UNCONSCIOUS"; } else { var testbed = this.atmistInitialConsciousness; testbed = testbed.replace("YES (", ""); testbed = testbed.replace(")", ""); testbed = testbed.replace(" MINS)", ""); if (this.atmistInitialConsciousness.indexOf("OVER") === -1) { this.atmistInitialConsciousness = "HAD BEEN UNCONSCIOUS FOR " + testbed.replace("MINS", " MINUTES").replace("SECS", " SECONDS"); } else { this.atmistInitialConsciousness = "HAD BEEN UNCONSCIOUS FOR " + testbed.replace("HR", "HOUR").replace("MINS", " MINUTES"); } } } //Get GPS let gpsCoords = this.getLocation.myCoords; //this.gpsLat = "57.69778"; //this.gpsLong = "-3.987871"; this.gpsLat = gpsCoords.theLAT; this.gpsLong = gpsCoords.theLONG; console.log("Coords - Lat: " + this.gpsLat + ", Long: " + this.gpsLong); //alert("Coords - Lat: " + this.gpsLat + ", Long: " + this.gpsLong); //Time of Incident (TOI) this.database.getATMISTTOI().then(atmistTOI => { for (var atmist of atmistTOI) { this.atmistTOI = atmist.atmistTOI; this.atmistNLGTOI = atmist.atmistNLGTOI; this.atmistMechanism = atmist.atmistComplaint; if (this.atmistMechanism && this.atmistMechanism !== "") { this.atmistMechanism = this.atmistMechanism.toUpperCase(); } else { this.atmistMechanism = "Mechanism of Injury/Medical Complaint not yet specified"; } this.atmistInjuries = atmist.atmistInjuries; if (!this.atmistInjuries || this.atmistInjuries === "") { this.atmistInjuries = "No injuries/information relating to complaint reported at this point"; } } //Injuries this.database.getATMISTInjuries().then(atmistInjuriesData => { this.atmistInjuriesData = atmistInjuriesData; //Obs this.database.getATMISTObs().then(atmistObsData => { this.atmistObservations = atmistObsData; //Signs this.database.getATMISTSigns().then(atmistSignsData => { this.atmistSignsAndSymptoms = atmistSignsData; //Treatment this.database.getATMISTTreatment().then(atmistTreatmentData => { this.atmistTreatment = atmistTreatmentData; //Casualty Details this.database .getCasualtyDetails() .then(atmistCasualtyDetails => { this.casualtyDetails = atmistCasualtyDetails; for (var cas of this.casualtyDetails) { this.atmistHomeAddress = cas.casHomeAddress; this.atmistDOB = cas.casDOB; this.atmistAge = cas.casAge; this.atmistAlcohol = cas.casAlcohol; this.atmistAllergyAnswer = cas.casAllergyAnswer; this.atmistAllergyDetails = cas.casAllergyDetails; this.atmistMedicine = cas.casMedicine; this.atmistMedicalHistory = cas.casMedicalHistory; this.atmistFlight = cas.casFlight; this.atmistSeat = cas.casSeat; this.atmistAirport = cas.casAirport; this.atmistLastMeal = cas.casLastMeal; this.atmistComplaint = cas.casComplaint; } //set NLG ATMIST String //No name, but has an age if ( this.atmistFullName.trim() === "" && this.atmistAge !== null && !isNaN(this.atmistAge) ) { this.nlgATMIST = "This casualty is " + this.atmistAge + " years of age.

"; } //No name, no age if ( this.atmistFullName.trim() === "" && (this.atmistAge === null || isNaN(this.atmistAge)) ) { this.nlgATMIST = "This is a casualty with no specified age.

"; } if ( this.atmistFullName.trim() !== "" && this.atmistAge !== null && !isNaN(this.atmistAge) ) { this.nlgATMIST = "This is " + this.atmistFullName + ". " + this.atmistPP + " is " + this.atmistAge + " years of age.

"; } //TOI this.nlgATMIST += "The time of incident was " + this.atmistNLGTOI + ". "; //Mechanism of injury if ( this.atmistMechanism.indexOf("Mechanism of Injury/") !== -1 ) { //no mechanism if (this.atmistFirstName === "") { //no name this.nlgATMIST += this.atmistPP + " first presented with an unspecified injury/medical complaint "; } else { //Got name this.nlgATMIST += this.atmistFirstName + " first presented with an unspecified injury/medical complaint "; } } else { //Got mechanism if (this.atmistFirstName === "") { //no name this.nlgATMIST += this.atmistPP + " first presented with " + this.atmistMechanism + " "; } else { //Got name this.nlgATMIST += this.atmistFirstName + " first presented with " + this.atmistMechanism + " "; } } //AVPU //Check possessive pronoun before changing AVPU prefix if ( this.atmistPPPLC === "their" && this.atmistAVPUPrefix === "was" ) { //Prefix should be 'were' this.atmistAVPUPrefix = "were"; } this.nlgATMIST += "and " + this.atmistAVPUPrefix + " " + this.atmistInitialAVPU + ". "; //Airway this.nlgATMIST += this.atmistPPP + " airway was " + this.atmistInitialAirway + ", " + this.atmistPPPLC + " breathing was " + this.atmistInitialBreathing + ", " + this.atmistPPPLC + " circulation was " + this.atmistInitialCirculation + " and " + this.atmistPPLC + " " + this.atmistInitialConsciousness + ".

"; //Finally set age appropriately if (this.atmistAge === null || isNaN(this.atmistAge)) { this.atmistAgeString = "No age specified"; } else { this.atmistAgeString = this.atmistAge.toString(); } if (final === 1) { //This is the end of the session. Generate JSON and submit to dashboard this.sJSON = ""; this.sJSON = '{"file":{"id": "' + this.database.theSessionID + '", "generated": "' + this.atmistTOI + '", "casualty":{"firstname": "' + this.atmistFirstName + '", "lastname": "' + this.atmistLastName + '", "postal": "' + this.atmistHomeAddress + '", "gender": "' + this.atmistGender + '", "flight": "' + this.atmistFlight + '", "seatno": "' + this.atmistSeat + '", "destairport": "' + this.atmistAirport + '", "lastmealfluidintake": "' + this.atmistLastMeal + '", "alcohol": "' + this.atmistAlcohol + '", "allergies": "' + this.atmistAllergyAnswer + '", "allergydetails": "' + this.atmistAllergyDetails + '", "medicinetaken": "' + this.atmistMedicine + '", "pastmedicalhistory": "' + this.atmistMedicalHistory + '"}, "agedob":{"age": "' + this.atmistAge + '", "dob": "' + this.atmistDOB + '"}, "timeofincident": "' + this.atmistTOI + '", "mechanismofinjury": "' + this.atmistMechanism + '", "injuries": ['; //Add variable to detect no injuries var injuryCount = 0; for (var atsands of this.atmistInjuriesData) { this.sJSON += '{"logtime":"' + atsands.atmistEntryLogged + '", "detail":"' + atsands.atmistSign + ": " + atsands.atmistValue + '"},'; this.atmistNormalSigns += atsands.atmistEntryLogged + " " + atsands.atmistSign + ": " + atsands.atmistValue + "
"; injuryCount++; } if (injuryCount !== 0) { this.sJSON = this.sJSON.substr( 0, this.sJSON.length - 1 ); } this.sJSON += '], "observations": ['; //Add variable to detect no observations var sandsCount = 0; for (atsands of this.atmistObservations) { this.sJSON += '{"logtime":"' + atsands.atmistEntryLogged + '", "detail":"' + atsands.atmistSign + ": " + atsands.atmistValue + '"},'; this.atmistNormalObs += atsands.atmistEntryLogged + " " + atsands.atmistSign + ": " + atsands.atmistValue + "
"; sandsCount++; } if (sandsCount !== 0) { this.sJSON = this.sJSON.substr( 0, this.sJSON.length - 1 ); } this.sJSON += '], "signsandsymptoms": ['; //Add variable to detect no signsandsymptoms var sandsCount = 0; for (atsands of this.atmistSignsAndSymptoms) { this.sJSON += '{"logtime":"' + atsands.atmistEntryLogged + '", "detail":"' + atsands.atmistSign + ": " + atsands.atmistValue + '"},'; this.atmistNormalSigns += atsands.atmistEntryLogged + " " + atsands.atmistSign + ": " + atsands.atmistValue + "
"; sandsCount++; } if (sandsCount !== 0) { this.sJSON = this.sJSON.substr( 0, this.sJSON.length - 1 ); } this.sJSON += '], "treatmentgiven": ['; //Add variable to detect no treatmentgiven var treatCount = 0; for (atsands of this.atmistTreatment) { this.sJSON += '{"logtime":"' + atsands.atmistEntryLogged + '", "detail":"' + atsands.atmistTreatment + ": " + atsands.atmistValue + '"},'; this.atmistNormalTreatment += atsands.atmistEntryLogged + " " + atsands.atmistTreatment + ": " + atsands.atmistValue + "
"; treatCount++; } if (treatCount !== 0) { this.sJSON = this.sJSON.substr( 0, this.sJSON.length - 1 ); } //Add NLG ATMIST this.sJSON += '], "nlgatmist": "' + this.nlgATMIST + '",'; //Add Ordinary ATMIST this.sJSON += '"atmist": "Age
' + this.atmistAge + "

"; this.sJSON += "Time of Incident
" + this.atmistTOI + "

"; this.sJSON += "Mechanism of Injry/Medical Complaint
" + this.atmistMechanism + "

"; this.sJSON += "Injuries/Information relating to complaint
" + this.atmistInjuries + "

"; this.sJSON += "Observations
" + this.atmistNormalObs + "

"; this.sJSON += "Signs
" + this.atmistNormalSigns + "

"; this.sJSON += "Treatement Given
" + this.atmistNormalTreatment + '"'; this.sJSON += "},"; this.sJSON += '"gpslat":"' + this.gpsLat + '",'; this.sJSON += '"gpslong":"' + this.gpsLong + '",'; this.sJSON += '"lastHR":"' + this.lastHR + '",'; this.sJSON += '"lastBR":"' + this.lastBR + '",'; this.sJSON += '"lastSATS":"' + this.lastSATS + '",'; this.sJSON += '"lastSYSBP":"' + this.lastSYSBP + '",'; this.sJSON += '"lastDIABP":"' + this.lastDIABP + '",'; this.sJSON += '"lastTEMP":"' + this.lastTEMP + '",'; this.sJSON += '"lastECG":"' + this.lastECG + '",'; this.sJSON += '"battery":"' + this.deviceBattery + '"}'; console.log("sJSON: " + this.sJSON); this.generateReport(); } }); }); }); }); }); }); }); }); //End of getCasualtyAge() } toggleFAS() { if (this.modalVis === "showModal") { this.modalVis = "hideModal"; } else { if (this.consciousnessVis === "hideModal") { this.modalVis = "showModal"; } } this.fasSlides.update(); this.fasSlides.slideTo(0); this.fasSlides.lockSwipes(true); this.fasSlides.update(); } openECGRecord() { if (this.ecgVis === "showModal") { this.ecgVis = "hideModal"; this.ecgInProgress = false; this.ecgBefore = "showModal"; this.ecgAfter = "hideModal"; this.ecgShortHolder = ""; } else { if (this.consciousnessVis === "hideModal") { this.ecgInProgress = true; this.ecgVis = "showModal"; //launcher.packageLaunch("com.qtmedical"); } } } saveECGRecord() { if (this.ecgVis === "showModal") { this.database.logECG(); this.lastECG = " /ecgOK/" + this.getSystemTime(); this.ecgVis = "hideModal"; this.ecgInProgress = false; this.ecgBefore = "showModal"; this.ecgAfter = "hideModal"; this.ecgShortHolder = ""; } else { if (this.consciousnessVis === "hideModal") { this.ecgInProgress = true; this.ecgVis = "showModal"; //launcher.packageLaunch("com.qtmedical"); } } } showUnresponsive() { this.cdFlag = false; this.burnFlag = false; this.adultChokingFlag = false; this.unresponsiveFlag = true; this.fasSlides.lockSwipes(false); this.fasSlides.slideNext(); } showCDHolder() { this.cdFlag = true; this.adultChokingFlag = false; this.burnFlag = false; this.unresponsiveFlag = false; this.fasSlides.lockSwipes(false); this.fasSlides.slideNext(); this.fasSlides.lockSwipeToNext(true); } showBurns() { this.cdFlag = false; this.adultChokingFlag = false; this.burnFlag = true; this.unresponsiveFlag = false; this.fasSlides.lockSwipes(false); this.fasSlides.slideNext(); this.fasSlides.lockSwipeToNext(false); } showAdultChoking() { this.cdFlag = false; this.adultChokingFlag = true; this.burnFlag = false; this.unresponsiveFlag = false; this.fasSlides.lockSwipes(false); this.fasSlides.slideNext(); this.fasSlides.lockSwipeToNext(false); } openUANB() { this.cdFlag = false; this.adultChokingFlag = false; this.burnFlag = false; this.unresponsiveFlag = true; this.fasSlides.slideTo(2); } fasLockSwipes() { if (this.fasSlides.isBeginning()) setTimeout(() => { this.fasSlides.lockSwipes(true); }, 500); } toggleConsciousness() { if (this.consciousnessVis === "showModal") { this.consciousnessVis = "hideModal"; } else { this.consciousnessVis = "showModal"; } } toggleFinish() { if (this.endVis === "showModal") { this.endVis = "hideModal"; } else { this.endVis = "showModal"; } } avpuChange() { if (this.avpuVis === "showModal") { this.avpuVis = "hideModal"; } else { this.avpuVis = "showModal"; } } goBack() { this.navCtrl.pop(); } finishSession() { console.log("Tapped finish"); console.log("endVis: " + this.endVis); //open "End" screen //this.endVis = "showModal"; if (this.endVis === "showModal") { this.endVis = "hideModal"; this.footerZ = "footerZFront"; } else { this.endVis = "showModal"; this.footerZ = "footerZBehind"; } } }