diff --git a/rescueapp/lib/main.dart b/rescueapp/lib/main.dart index 9b73427b26ee5712b88432f7edd4f4939f3596d8..ec669a6a61424acd3b7068646cc692f720eaecb3 100644 --- a/rescueapp/lib/main.dart +++ b/rescueapp/lib/main.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:rescueapp/start_triage_system/startTriage.dart'; import 'start_triage_system/ambulatory.dart'; void main() { @@ -44,7 +45,7 @@ class MyHomePage extends StatelessWidget { onPressed: () { Navigator.push( context, - MaterialPageRoute(builder: (context) => Ambulatory()), + MaterialPageRoute(builder: (context) => Ambulatory(new StartTriage())), ); }, ))), diff --git a/rescueapp/lib/start_triage_system/after_opening_airways.dart b/rescueapp/lib/start_triage_system/after_opening_airways.dart index 55f05386b5fab9e36d39eef87dc7dbaf712102bf..ccb76d1388e0af66b9bd4f883d03e8642f1a4683 100644 --- a/rescueapp/lib/start_triage_system/after_opening_airways.dart +++ b/rescueapp/lib/start_triage_system/after_opening_airways.dart @@ -1,10 +1,16 @@ import 'package:flutter/material.dart'; - +import 'package:rescueapp/start_triage_system/startTriage.dart'; import 'camera_access.dart'; class AfterOpeningAirways extends StatefulWidget { - AfterOpeningAirways({Key key, this.title}) : super(key: key); final String title; + StartTriage startTriage; + AfterOpeningAirways(StartTriage startTriage, {Key key, this.title}) + : super(key: key) { + startTriage.setState(this); + + this.startTriage = startTriage; + } @override _AfterOpeningAirwaysState createState() => _AfterOpeningAirwaysState(); @@ -34,7 +40,8 @@ class _AfterOpeningAirwaysState extends State<AfterOpeningAirways> { child: Container( decoration: BoxDecoration(color: Colors.grey[500]), alignment: Alignment.center, - child: Text('Nein', + child: new Text( + widget.startTriage.getIsAmbulatory() ? 'Ja' : 'Nein', style: TextStyle( fontSize: 20, color: Colors.blue[900], @@ -56,7 +63,10 @@ class _AfterOpeningAirwaysState extends State<AfterOpeningAirways> { child: Container( decoration: BoxDecoration(color: Colors.grey[500]), alignment: Alignment.center, - child: Text('Nein', + child: new Text( + widget.startTriage.getIsSpontaneousBreathingPresent() + ? 'Ja' + : 'Nein', style: TextStyle( fontSize: 20, color: Colors.blue[900], @@ -117,11 +127,14 @@ class _AfterOpeningAirwaysState extends State<AfterOpeningAirways> { color: Colors.blue[900])), color: Colors.blue, onPressed: () { + setState(() { + widget.startTriage.setIsAfterOpeningAirways(true); + }); Navigator.push( - context, - MaterialPageRoute( - builder: (context) => CameraAccess()), - ); + context, + MaterialPageRoute( + builder: (context) => + CameraAccess(widget.startTriage))); }))), SizedBox( height: 10, @@ -138,11 +151,14 @@ class _AfterOpeningAirwaysState extends State<AfterOpeningAirways> { color: Colors.blue[900])), color: Colors.blue, onPressed: () { + setState(() { + widget.startTriage.setIsAfterOpeningAirways(false); + }); Navigator.push( - context, - MaterialPageRoute( - builder: (context) => CameraAccess()), - ); + context, + MaterialPageRoute( + builder: (context) => + CameraAccess(widget.startTriage))); }))), SizedBox( height: 50, diff --git a/rescueapp/lib/start_triage_system/ambulatory.dart b/rescueapp/lib/start_triage_system/ambulatory.dart index 29d975a482b0de6187898e6d12de403f9500e613..89de82f565edf1046a894829ec54dac41dd721d9 100644 --- a/rescueapp/lib/start_triage_system/ambulatory.dart +++ b/rescueapp/lib/start_triage_system/ambulatory.dart @@ -1,11 +1,19 @@ +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; +import 'package:rescueapp/start_triage_system/startTriage.dart'; import 'camera_access.dart'; import 'spontaneous_breathing_present.dart'; class Ambulatory extends StatefulWidget { - Ambulatory({Key key, this.title}) : super(key: key); final String title; - + StartTriage startTriage; + TriageCategory triageCategory; + Ambulatory(StartTriage startTriage, + {Key key, this.title, this.triageCategory}) + : super(key: key) { + startTriage.setState(this); + this.startTriage = startTriage; + } @override _AmbulatoryState createState() => _AmbulatoryState(); } @@ -58,13 +66,17 @@ class _AmbulatoryState extends State<Ambulatory> { color: Colors.blue[900])), color: Colors.blue, onPressed: () { + setState(() { + widget.startTriage.setIsAmbulatory(true); + }); Navigator.push( context, MaterialPageRoute( - builder: (context) => - CameraAccess()), + builder: (context) => + CameraAccess(widget.startTriage), + ), ); - } ))), + }))), SizedBox( height: 10, ), @@ -80,11 +92,16 @@ class _AmbulatoryState extends State<Ambulatory> { color: Colors.blue[900])), color: Colors.blue, onPressed: () { + setState(() { + widget.startTriage.setIsAmbulatory(false); + }); + Navigator.push( context, MaterialPageRoute( - builder: (context) => - SpontaneousBreathingPresent()), + builder: (context) => SpontaneousBreathingPresent( + widget.startTriage), + ), ); }))), SizedBox( diff --git a/rescueapp/lib/start_triage_system/breathing_frequency_per_minute.dart b/rescueapp/lib/start_triage_system/breathing_frequency_per_minute.dart index a7df8916816bd9d2a18e8ca2a72d7e2314d2eed2..aec8be7a69428739199f5a2be05124746321396a 100644 --- a/rescueapp/lib/start_triage_system/breathing_frequency_per_minute.dart +++ b/rescueapp/lib/start_triage_system/breathing_frequency_per_minute.dart @@ -1,9 +1,18 @@ import 'package:flutter/material.dart'; +import 'package:rescueapp/start_triage_system/startTriage.dart'; +import 'camera_access.dart'; + import 'circulation.dart'; class BreathingFrequencyPerMinute extends StatefulWidget { - BreathingFrequencyPerMinute({Key key, this.title}) : super(key: key); final String title; + StartTriage startTriage; + BreathingFrequencyPerMinute(StartTriage startTriage, {Key key, this.title}) + : super(key: key) { + startTriage.setState(this); + this.startTriage = startTriage; + } + @override _BreathingFrequencyPerMinuteState createState() => _BreathingFrequencyPerMinuteState(); @@ -34,7 +43,8 @@ class _BreathingFrequencyPerMinuteState child: Container( decoration: BoxDecoration(color: Colors.grey[500]), alignment: Alignment.center, - child: Text('Nein', + child: new Text( + widget.startTriage.getIsAmbulatory() ? 'Ja' : 'Nein', style: TextStyle( fontSize: 20, color: Colors.blue[900], @@ -53,7 +63,10 @@ class _BreathingFrequencyPerMinuteState child: Container( decoration: BoxDecoration(color: Colors.grey[500]), alignment: Alignment.center, - child: Text('Ja', + child: new Text( + widget.startTriage.getIsSpontaneousBreathingPresent() + ? 'Ja' + : 'Nein', style: TextStyle( fontSize: 20, color: Colors.blue[900], @@ -113,7 +126,18 @@ class _BreathingFrequencyPerMinuteState fontWeight: FontWeight.w600, color: Colors.blue[900])), color: Colors.blue, - onPressed: null))), + onPressed: () { + setState(() { + widget.startTriage + .setBreathingFrequencyPerMinute(true); + }); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + CameraAccess(widget.startTriage)) + ); + }))), SizedBox( height: 10, ), @@ -129,10 +153,15 @@ class _BreathingFrequencyPerMinuteState color: Colors.blue[900])), color: Colors.blue, onPressed: () { + setState(() { + widget.startTriage + .setBreathingFrequencyPerMinute(false); + }); Navigator.push( context, MaterialPageRoute( - builder: (context) => CapillaryFillingTime()), + builder: (context) => + CapillaryFillingTime(widget.startTriage)), ); }))), SizedBox( diff --git a/rescueapp/lib/start_triage_system/camera_access.dart b/rescueapp/lib/start_triage_system/camera_access.dart index c35c347216fed764a7930d0427425f538e5f11da..7052fb770b02b65e3366154e330adf93421363a9 100644 --- a/rescueapp/lib/start_triage_system/camera_access.dart +++ b/rescueapp/lib/start_triage_system/camera_access.dart @@ -1,25 +1,30 @@ import 'package:flutter/material.dart'; - +import 'package:rescueapp/start_triage_system/startTriage.dart'; import 'lock_screen.dart'; class CameraAccess extends StatefulWidget { - - CameraAccess({Key key, this.title}) : super(key: key); final String title; + StartTriage startTriage; + TriageCategory triageCategory; + + CameraAccess(StartTriage startTriage, + {Key key, this.title, }) : super(key: key){ + startTriage.setState(this); + this.startTriage = startTriage; + } @override _CameraAccessState createState() => _CameraAccessState(); } class _CameraAccessState extends State<CameraAccess> { - @override - void initState() { - super.initState(); - } + @override Widget build(BuildContext context) { + body(){ + } return Scaffold( appBar: AppBar( title: Text("KatApp"), @@ -49,12 +54,11 @@ class _CameraAccessState extends State<CameraAccess> { height: 250, width: 250, child: RaisedButton( - child: - Icon(Icons.photo_library, color: Colors.black, size: 35), + child: Icon(Icons.photo_library, + color: Colors.black, size: 35), color: Colors.grey, onPressed: null), ), - SizedBox( height: 50, ), @@ -62,18 +66,17 @@ class _CameraAccessState extends State<CameraAccess> { height: 50, width: 200, child: RaisedButton( - child: Text('Absenden', - style: TextStyle(color: Colors.white, fontSize: 20)), - color: Colors.red, - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - LockScreen()), - ); - }, - ), + child: Text('Absenden', + style: TextStyle(color: Colors.white, fontSize: 20)), + color: Colors.red, + onPressed: () { + widget.startTriage.getTriageCategory(); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LockScreen(widget.startTriage)), + ); + }), ), SizedBox( height: 20, diff --git a/rescueapp/lib/start_triage_system/circulation.dart b/rescueapp/lib/start_triage_system/circulation.dart index 15394d13e1f3cb1b64b56539d6112a143c4fb8d1..cb5c2c849eab4d3f1fb3ab7e0e413f3e4140f26b 100644 --- a/rescueapp/lib/start_triage_system/circulation.dart +++ b/rescueapp/lib/start_triage_system/circulation.dart @@ -1,14 +1,22 @@ import 'package:flutter/material.dart'; +import 'package:rescueapp/start_triage_system/startTriage.dart'; +import 'camera_access.dart'; import 'neurology.dart'; class CapillaryFillingTime extends StatefulWidget { - CapillaryFillingTime({Key key, this.title}) : super(key: key); final String title; + StartTriage startTriage; + CapillaryFillingTime(StartTriage startTriage, {Key key, this.title}) : super(key: key){ + startTriage.setState(this); + this.startTriage = startTriage; + } + @override _CapillaryFillingTimeState createState() => _CapillaryFillingTimeState(); } class _CapillaryFillingTimeState extends State<CapillaryFillingTime> { + @override Widget build(BuildContext context) { return Scaffold( @@ -32,7 +40,7 @@ class _CapillaryFillingTimeState extends State<CapillaryFillingTime> { child: Container( decoration: BoxDecoration(color: Colors.grey[500]), alignment: Alignment.center, - child: Text('Nein', + child: new Text (widget.startTriage.getIsAmbulatory() ? 'Ja': 'Nein', style: TextStyle( fontSize: 20, color: Colors.blue[900], @@ -51,7 +59,7 @@ class _CapillaryFillingTimeState extends State<CapillaryFillingTime> { child: Container( decoration: BoxDecoration(color: Colors.grey[500]), alignment: Alignment.center, - child: Text('Ja', + child:new Text (widget.startTriage.getIsSpontaneousBreathingPresent() ? 'Ja': 'Nein', style: TextStyle( fontSize: 20, color: Colors.blue[900], @@ -70,14 +78,14 @@ class _CapillaryFillingTimeState extends State<CapillaryFillingTime> { child: Container( decoration: BoxDecoration(color: Colors.grey[500]), alignment: Alignment.center, - child: Text('≤ 30', + child: new Text (widget.startTriage.getIsBreathingFrequencyPerMinute() ? '> 30': '≤ 30', style: TextStyle( fontSize: 20, color: Colors.blue[900], backgroundColor: Colors.grey[500])), )), SizedBox( - height: 150, + height: 70, ), SizedBox( height: 50, @@ -130,7 +138,17 @@ class _CapillaryFillingTimeState extends State<CapillaryFillingTime> { fontWeight: FontWeight.w600, color: Colors.blue[900])), color: Colors.blue, - onPressed: null))), + onPressed: () { + setState(() { + widget.startTriage.setIsCirculation(true); + }); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CameraAccess(widget.startTriage)) + //widget.startTriage.isCirculation)), + ); + }))), SizedBox( height: 10, ), @@ -146,10 +164,15 @@ class _CapillaryFillingTimeState extends State<CapillaryFillingTime> { color: Colors.blue[900])), color: Colors.blue, onPressed: () { + setState(() { + widget.startTriage.setIsCirculation(false); + }); Navigator.push( context, MaterialPageRoute( - builder: (context) => Neurology()), + builder: (context) => Neurology( + widget.startTriage + )), ); }))), SizedBox( diff --git a/rescueapp/lib/start_triage_system/invalid_triage_state_exception.dart b/rescueapp/lib/start_triage_system/invalid_triage_state_exception.dart new file mode 100644 index 0000000000000000000000000000000000000000..fccd2fc918ac17c91729d1de2dc7b2ab0b1bf764 --- /dev/null +++ b/rescueapp/lib/start_triage_system/invalid_triage_state_exception.dart @@ -0,0 +1 @@ +class InvalidTriageStateException implements Exception { } \ No newline at end of file diff --git a/rescueapp/lib/start_triage_system/lock_screen.dart b/rescueapp/lib/start_triage_system/lock_screen.dart index 0d6c18afc24b0d4ccbeb4d99b2a8f61e5133b124..09e2e25369686dc80f92b742643f7d627d181c50 100644 --- a/rescueapp/lib/start_triage_system/lock_screen.dart +++ b/rescueapp/lib/start_triage_system/lock_screen.dart @@ -1,8 +1,16 @@ import 'package:flutter/material.dart'; +import 'package:rescueapp/start_triage_system/startTriage.dart'; class LockScreen extends StatefulWidget { - LockScreen({Key key, this.title}) : super(key: key); final String title; + StartTriage startTriage; + TriageCategory triageCategory; + + LockScreen(StartTriage startTriage, {Key key, this.title}) : super(key: key) { + startTriage.setState(this); + this.startTriage = startTriage; + } + @override _LockScreenState createState() => _LockScreenState(); } @@ -11,7 +19,7 @@ class _LockScreenState extends State<LockScreen> { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Colors.green, + backgroundColor: widget.startTriage.getTriageCategory().getColor(), appBar: AppBar( title: Text('KatApp'), ), @@ -23,11 +31,12 @@ class _LockScreenState extends State<LockScreen> { height: 200, child: Container( alignment: Alignment.center, - child: Text('Kategorie T3', + child: Text( + widget.startTriage.getTriageCategory().getCategory(), style: TextStyle( fontSize: 50, fontWeight: FontWeight.w900, - color: Colors.blue[1000])), + color: Colors.white)), )), SizedBox( width: 250, @@ -53,7 +62,8 @@ class _LockScreenState extends State<LockScreen> { )), SizedBox( height: 20, - ), SizedBox( + ), + SizedBox( width: 250, height: 40, child: Container( @@ -66,7 +76,8 @@ class _LockScreenState extends State<LockScreen> { height: 90, child: Container( alignment: Alignment.centerLeft, - child: Text('Hochschule Reutlingen \nAlteburgstraße 150 \n72762 Reutlingen', + child: Text( + 'Hochschule Reutlingen \nAlteburgstraße 150 \n72762 Reutlingen', style: TextStyle( fontSize: 20, color: Colors.blue[900], @@ -88,7 +99,7 @@ class _LockScreenState extends State<LockScreen> { height: 50, child: Container( alignment: Alignment.centerLeft, - child: Text('15.07.2020/11:13', + child: Text(widget.startTriage.getDateTime(), style: TextStyle( fontSize: 20, color: Colors.blue[900], diff --git a/rescueapp/lib/start_triage_system/neurology.dart b/rescueapp/lib/start_triage_system/neurology.dart index 5a4aa1623f6c859db1083c05385f7fd2fbf1763d..4557bf67f4b50c0f70613a5680560e4e1968a615 100644 --- a/rescueapp/lib/start_triage_system/neurology.dart +++ b/rescueapp/lib/start_triage_system/neurology.dart @@ -1,8 +1,17 @@ import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:rescueapp/start_triage_system/startTriage.dart'; +import 'camera_access.dart'; class Neurology extends StatefulWidget { - Neurology({Key key, this.title}) : super(key: key); final String title; + StartTriage startTriage; + + Neurology(StartTriage startTriage, {Key key, this.title}) : super(key: key) { + startTriage.setState(this); + this.startTriage = startTriage; + } + @override _NeurologyState createState() => _NeurologyState(); } @@ -31,7 +40,8 @@ class _NeurologyState extends State<Neurology> { child: Container( decoration: BoxDecoration(color: Colors.grey[500]), alignment: Alignment.center, - child: Text('Nein', + child: new Text( + widget.startTriage.getIsAmbulatory() ? 'Ja' : 'Nein', style: TextStyle( fontSize: 20, color: Colors.blue[900], @@ -50,7 +60,10 @@ class _NeurologyState extends State<Neurology> { child: Container( decoration: BoxDecoration(color: Colors.grey[500]), alignment: Alignment.center, - child: Text('Ja', + child: new Text( + widget.startTriage.getIsSpontaneousBreathingPresent() + ? 'Ja' + : 'Nein', style: TextStyle( fontSize: 20, color: Colors.blue[900], @@ -69,7 +82,10 @@ class _NeurologyState extends State<Neurology> { child: Container( decoration: BoxDecoration(color: Colors.grey[500]), alignment: Alignment.center, - child: Text('≤ 30', + child: new Text( + widget.startTriage.getIsBreathingFrequencyPerMinute() + ? '>30' + : '≤ 30', style: TextStyle( fontSize: 20, color: Colors.blue[900], @@ -91,7 +107,10 @@ class _NeurologyState extends State<Neurology> { child: Container( decoration: BoxDecoration(color: Colors.grey[500]), alignment: Alignment.center, - child: Text('Kapilläre Füllungszeit <= 2s ', + child: new Text( + widget.startTriage.getIsCirculation() + ? 'Kapilläre Füllungszeit > 2s' + : 'Kapilläre Füllungszeit ≤ 2s', textAlign: TextAlign.right, style: TextStyle( fontSize: 20, @@ -154,7 +173,17 @@ class _NeurologyState extends State<Neurology> { fontWeight: FontWeight.w600, color: Colors.blue[900])), color: Colors.blue, - onPressed: null))), + onPressed: () { + setState(() { + widget.startTriage.setIsNeurology(true); + }); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + CameraAccess(widget.startTriage)) + ); + }))), SizedBox( height: 10, ), @@ -169,7 +198,17 @@ class _NeurologyState extends State<Neurology> { fontWeight: FontWeight.w600, color: Colors.blue[900])), color: Colors.blue, - onPressed: null))), + onPressed: () { + setState(() { + widget.startTriage.setIsNeurology(false); + }); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + CameraAccess(widget.startTriage)) + ); + }))), SizedBox( height: 20, ), diff --git a/rescueapp/lib/start_triage_system/spontaneous_breathing_present.dart b/rescueapp/lib/start_triage_system/spontaneous_breathing_present.dart index 75b3fe827f7b16d98f1ad325f908b8bca849fc32..658f5397144ff70c0cdf20ff66d7c9c2d1cb8539 100644 --- a/rescueapp/lib/start_triage_system/spontaneous_breathing_present.dart +++ b/rescueapp/lib/start_triage_system/spontaneous_breathing_present.dart @@ -1,10 +1,21 @@ import 'package:flutter/material.dart'; +import 'startTriage.dart'; + import 'after_opening_airways.dart'; import 'breathing_frequency_per_minute.dart'; class SpontaneousBreathingPresent extends StatefulWidget { - SpontaneousBreathingPresent({Key key, this.title}) : super(key: key); final String title; + StartTriage startTriage; + + SpontaneousBreathingPresent( + StartTriage startTriage, { + Key key, + this.title, + }) : super(key: key) { + startTriage.setState(this); + this.startTriage = startTriage; + } @override _SpontaneousBreathingPresentState createState() => _SpontaneousBreathingPresentState(); @@ -12,6 +23,11 @@ class SpontaneousBreathingPresent extends StatefulWidget { class _SpontaneousBreathingPresentState extends State<SpontaneousBreathingPresent> { + @override + void initState() { + super.initState(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -35,7 +51,8 @@ class _SpontaneousBreathingPresentState child: Container( decoration: BoxDecoration(color: Colors.grey[500]), alignment: Alignment.center, - child: Text('Nein', + child: new Text( + widget.startTriage.getIsAmbulatory() ? 'Ja' : 'Nein', style: TextStyle( fontSize: 20, color: Colors.blue[900], @@ -96,12 +113,20 @@ class _SpontaneousBreathingPresentState color: Colors.blue[900])), color: Colors.blue, onPressed: () { + setState(() { + widget.startTriage + .setIsSpontaneousBreathingPresent(true); + print('testSPON'); + print(widget.startTriage + .getIsSpontaneousBreathingPresent()); + }); Navigator.push( - context, - MaterialPageRoute( - builder: (context) => BreathingFrequencyPerMinute()), - ); - } ))), + context, + MaterialPageRoute( + builder: (context) => + BreathingFrequencyPerMinute( + widget.startTriage))); + }))), SizedBox( height: 10, ), @@ -117,11 +142,18 @@ class _SpontaneousBreathingPresentState color: Colors.blue[900])), color: Colors.blue, onPressed: () { + setState(() { + widget.startTriage + .setIsSpontaneousBreathingPresent(false); + }); Navigator.push( - context, - MaterialPageRoute( - builder: (context) => AfterOpeningAirways()), - ); + context, + MaterialPageRoute( + builder: (context) => + AfterOpeningAirways(widget.startTriage))); + print('testAFTER2'); + print(widget.startTriage + .getIsSpontaneousBreathingPresent()); }))), SizedBox( height: 70, diff --git a/rescueapp/lib/start_triage_system/startTriage.dart b/rescueapp/lib/start_triage_system/startTriage.dart new file mode 100644 index 0000000000000000000000000000000000000000..9b931801eaa25fb50da4f872783c22497b2dcf53 --- /dev/null +++ b/rescueapp/lib/start_triage_system/startTriage.dart @@ -0,0 +1,227 @@ +import 'package:flutter/material.dart'; +import 'package:rescueapp/start_triage_system/after_opening_airways.dart'; +import 'package:rescueapp/start_triage_system/ambulatory.dart'; +import 'package:rescueapp/start_triage_system/camera_access.dart'; +import 'package:rescueapp/start_triage_system/lock_screen.dart'; +import 'package:rescueapp/start_triage_system/spontaneous_breathing_present.dart'; + +import 'breathing_frequency_per_minute.dart'; +import 'circulation.dart'; +import 'invalid_triage_state_exception.dart'; +import 'neurology.dart'; + +class StartTriage { + bool _isAmbulatory; + bool _isSpontaneousBreathingPresent; + bool _isAfterOpeningAirways; + bool _isBreathingFrequencyPerMinute; + bool _isCirculation; + bool _isNeurology; + + Object _state; + + TriageCategory _triageCategory = new TriageCategory(); + + String getDateTime() { + DateTime now = DateTime.now(); + String currentTime = + "${now.day.toString()}-${now.month.toString().padLeft(2, '0')}" + "-${now.year.toString().padLeft(2, '0')}/" + " ${now.hour.toString()}:${now.minute.toString()}:${now.second.toString()}"; + return currentTime; + } + + bool getIsAmbulatory() { + return _isAmbulatory; + } + + bool getIsSpontaneousBreathingPresent() { + return _isSpontaneousBreathingPresent; + } + + bool getIsAfterOpeningAirways() { + return _isAfterOpeningAirways; + } + + bool getIsBreathingFrequencyPerMinute() { + return _isBreathingFrequencyPerMinute; + } + + bool getIsCirculation() { + return _isCirculation; + } + + bool getIsNeurology() { + return _isNeurology; + } + + void setIsAmbulatory(bool isAmbulatory) { + if (_state is Ambulatory || + _state is LockScreen || + _state is CameraAccess || + _state is SpontaneousBreathingPresent || + _state is AfterOpeningAirways || + _state is BreathingFrequencyPerMinute || + _state is CapillaryFillingTime || + _state is Neurology) { + this._isAmbulatory = isAmbulatory; + } else { + throw new InvalidTriageStateException(); + } + } + + void setIsSpontaneousBreathingPresent(bool isSpontaneousBreathingPresent) { + if (_state is Ambulatory || + _state is LockScreen || + _state is CameraAccess || + _state is SpontaneousBreathingPresent || + _state is AfterOpeningAirways || + _state is BreathingFrequencyPerMinute || + _state is CapillaryFillingTime || + _state is Neurology) { + this._isSpontaneousBreathingPresent = isSpontaneousBreathingPresent; + } else { + throw new InvalidTriageStateException(); + } + } + + void setIsAfterOpeningAirways(bool isAfterOpeningAirways) { + if (_state is Ambulatory || + _state is CameraAccess || + _state is LockScreen || + _state is AfterOpeningAirways || + _state is SpontaneousBreathingPresent) { + this._isAfterOpeningAirways = isAfterOpeningAirways; + } else { + throw new InvalidTriageStateException(); + } + } + + void setBreathingFrequencyPerMinute(bool isBreathingFrequencyPerMinute) { + if (_state is Ambulatory || + _state is CameraAccess || + _state is LockScreen || + _state is BreathingFrequencyPerMinute || + _state is SpontaneousBreathingPresent || + _state is CapillaryFillingTime || + _state is Neurology) { + this._isBreathingFrequencyPerMinute = isBreathingFrequencyPerMinute; + } else { + throw new InvalidTriageStateException(); + } + } + + void setIsNeurology(bool isNeurology) { + if (_state is Ambulatory || + _state is CameraAccess || + _state is LockScreen || + _state is BreathingFrequencyPerMinute || + _state is SpontaneousBreathingPresent || + _state is CapillaryFillingTime || + _state is Neurology) { + this._isNeurology = isNeurology; + } else { + throw new InvalidTriageStateException(); + } + } + + void setIsCirculation(bool isCirculation) { + if (_state is Ambulatory || + _state is LockScreen || + _state is CameraAccess || + _state is BreathingFrequencyPerMinute || + _state is SpontaneousBreathingPresent || + _state is CapillaryFillingTime || + _state is Neurology) { + this._isCirculation = isCirculation; + } else { + throw new InvalidTriageStateException(); + } + } + + void setState(Object state) { + _state = state; + String categoryName; + Color color; + if (_state is Ambulatory || + _state is AfterOpeningAirways || + _state is BreathingFrequencyPerMinute || + _state is SpontaneousBreathingPresent || + _state is CapillaryFillingTime || + _state is Neurology || + _state is CameraAccess) { + categoryName = ""; + } else if (_state is LockScreen) { + if ((this._isAmbulatory == true)) { + categoryName = 'Kategorie T3'; + color = Colors.green; + } else if (this._isAmbulatory == false && + this._isSpontaneousBreathingPresent == false && + this._isAfterOpeningAirways == false) { + categoryName = "Kategorie T4"; + color = Colors.black; + } else if (this._isAmbulatory == false && + this._isSpontaneousBreathingPresent == false && + this._isAfterOpeningAirways == true) { + categoryName = "Kategorie T1A"; + color = Colors.red; + } else if (this._isAmbulatory == false && + this._isSpontaneousBreathingPresent == true && + this._isBreathingFrequencyPerMinute == true) { + categoryName = "Kategorie T1B"; + color = Colors.red; + } else if (this._isAmbulatory == false && + this._isSpontaneousBreathingPresent == true && + this._isBreathingFrequencyPerMinute == false && + this._isCirculation == true) { + categoryName = "Kategorie T1C"; + color = Colors.red; + } else if (this._isAmbulatory == false && + this._isSpontaneousBreathingPresent == true && + this._isBreathingFrequencyPerMinute == false && + this._isCirculation == false && + this._isNeurology == false) { + categoryName = "Kategorie T1D"; + color = Colors.red; + } else if (this._isAmbulatory == false && + this._isSpontaneousBreathingPresent == true && + this._isBreathingFrequencyPerMinute == false && + this._isCirculation == false && + this._isNeurology == true) { + categoryName = "Kategorie T2"; + color = Colors.yellow; + } + } + if (categoryName != null) { + _triageCategory.setCategory(categoryName); + _triageCategory.setColor(color); + } else { + throw new InvalidTriageStateException(); + } + } + + TriageCategory getTriageCategory() { + return _triageCategory; + } +} + +class TriageCategory { + String _category; + Color _color; + + String getCategory() { + return _category; + } + + void setCategory(String category) { + this._category = category; + } + + Color getColor() { + return _color; + } + + void setColor(Color color) { + this._color = color; + } +} diff --git a/rescueapp/lib/start_triage_system/triage_data.dart b/rescueapp/lib/start_triage_system/triage_data.dart deleted file mode 100644 index 77c135e3b9ed85b05b8e0ddc6543fa293ce28661..0000000000000000000000000000000000000000 --- a/rescueapp/lib/start_triage_system/triage_data.dart +++ /dev/null @@ -1,56 +0,0 @@ -// Superclasses ---------------------------------------------------------------- - -class Category { - bool isAmbulatory; - bool isSpontaneousBreathingPresent; - - Category(this.isAmbulatory, this.isSpontaneousBreathingPresent); -} - -class Category2 extends Category { - bool isBreathingFrequencyPerMinute; - bool isCirculation; - - Category2(this.isBreathingFrequencyPerMinute, this.isCirculation) - : super(false, true); -} - -// Subclasses ------------------------------------------------------------------ - -class CategoryT1A extends Category { - bool isAfterOpeningAirways = true; - - CategoryT1A(this.isAfterOpeningAirways) : super(false, false); -} - -class CategoryT1B extends Category { - bool isBreathingFrequencyPerMinute = true; - - CategoryT1B( - this.isBreathingFrequencyPerMinute, - ) : super(false, true); -} - -class CategoryT1C extends Category2 { - CategoryT1C() : super(false, true); -} - -class CategoryT1D extends Category2 { - bool isNeurology = false; - CategoryT1D(this.isNeurology) : super(false, false); -} - -class CategoryT2 extends Category2 { - bool isNeurology = true; - CategoryT2(this.isNeurology) : super(false, false); -} - -class CategoryT3 extends Category { - CategoryT3() : super(true, null); -} - -class CategoryT4 extends Category { - bool isAfterOpeningAirways = false; - - CategoryT4(this.isAfterOpeningAirways) : super(false, false); -}