From 4ffeb31181194ca6c17f44f7d51f7a7864e87ed8 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sat, 2 Jan 2021 19:15:37 +0200 Subject: [PATCH 01/11] update procedure fixes --- lib/config/config.dart | 1 + .../model/procedure/get_procedure_model.dart | 2 +- lib/core/model/search_drug_model.dart | 65 ++ lib/core/model/search_drug_request_model.dart | 18 + lib/core/service/prescription_service.dart | 21 + lib/core/service/procedure_service.dart | 4 +- .../viewModel/prescription_view_model.dart | 14 + .../prescription/add_prescription_form.dart | 605 ++++++++++-------- lib/screens/procedures/procedure_screen.dart | 15 +- .../subjective/update_allergies_widget.dart | 327 +++++----- 10 files changed, 621 insertions(+), 451 deletions(-) create mode 100644 lib/core/model/search_drug_model.dart create mode 100644 lib/core/model/search_drug_request_model.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index fc7edf42..8d7ce357 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -156,6 +156,7 @@ const GET_CATEGORISE_PROCEDURE = const UPDATE_PROCEDURE = 'Services/DoctorApplication.svc/REST/PatchProcedure'; const UPDATE_PRESCRIPTION = 'Services/DoctorApplication.svc/REST/PatchPrescription'; +const SEARCH_DRUG = 'Services/DoctorApplication.svc/REST/GetMedicationList'; const GET_MEDICAL_FILE = 'Services/DoctorApplication.svc/REST/GetMedicalFile'; diff --git a/lib/core/model/procedure/get_procedure_model.dart b/lib/core/model/procedure/get_procedure_model.dart index bdb69b1c..5c83b49b 100644 --- a/lib/core/model/procedure/get_procedure_model.dart +++ b/lib/core/model/procedure/get_procedure_model.dart @@ -34,7 +34,7 @@ class EntityList { String genderValidation; String group; String orderedValidation; - int price; + dynamic price; String procedureId; String procedureName; String specialPermission; diff --git a/lib/core/model/search_drug_model.dart b/lib/core/model/search_drug_model.dart new file mode 100644 index 00000000..396526c1 --- /dev/null +++ b/lib/core/model/search_drug_model.dart @@ -0,0 +1,65 @@ +class SearchDrugModel { + List entityList; + int rowcount; + dynamic statusMessage; + + SearchDrugModel({this.entityList, this.rowcount, this.statusMessage}); + + SearchDrugModel.fromJson(Map json) { + if (json['entityList'] != null) { + entityList = new List(); + json['entityList'].forEach((v) { + entityList.add(new EntityList.fromJson(v)); + }); + } + rowcount = json['rowcount']; + statusMessage = json['statusMessage']; + } + + Map toJson() { + final Map data = new Map(); + if (this.entityList != null) { + data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + } + data['rowcount'] = this.rowcount; + data['statusMessage'] = this.statusMessage; + return data; + } +} + +class EntityList { + dynamic description; + dynamic genericName; + dynamic itemId; + dynamic keywords; + dynamic price; + dynamic quantity; + + EntityList( + {this.description, + this.genericName, + this.itemId, + this.keywords, + this.price, + this.quantity}); + + EntityList.fromJson(Map json) { + description = json['Description']; + genericName = json['GenericName']; + itemId = json['ItemId']; + keywords = json['Keywords']; + price = json['Price']; + quantity = json['Quantity']; + } + + Map toJson() { + final Map data = new Map(); + data['Description'] = this.description; + data['GenericName'] = this.genericName; + data['ItemId'] = this.itemId; + data['Keywords'] = this.keywords; + data['Price'] = this.price; + data['Quantity'] = this.quantity; + return data; + } +} diff --git a/lib/core/model/search_drug_request_model.dart b/lib/core/model/search_drug_request_model.dart new file mode 100644 index 00000000..e1cccc43 --- /dev/null +++ b/lib/core/model/search_drug_request_model.dart @@ -0,0 +1,18 @@ +class SearchDrugRequestModel { + List search; + String vidaAuthTokenID; + + SearchDrugRequestModel({this.search, this.vidaAuthTokenID}); + + SearchDrugRequestModel.fromJson(Map json) { + search = json['Search'].cast(); + vidaAuthTokenID = json['VidaAuthTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['Search'] = this.search; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + return data; + } +} diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index ced17cd4..3ccdc23c 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -2,17 +2,26 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/Prescription_model.dart'; import 'package:doctor_app_flutter/core/model/prescription_req_model.dart'; import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug_request_model.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; class PrescriptionService extends BaseService { List _prescriptionList = List(); List get prescriptionList => _prescriptionList; + List _drugsList = List(); + List get drugsList => _drugsList; PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel( patientMRN: 3120877, vidaAuthTokenID: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiNzNiNmUyZDctMjA0ZC00NzAyLTkxMDYtODE3MzI3OTZkYzI5IiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NjIwOSIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgyMzY2MjAsImV4cCI6MTYwOTEwMDYyMCwiaWF0IjoxNjA4MjM2NjIwfQ.z4Lh0dCRr9GWXvaTo7x5GPV7R5z8ONyh3-0uk3PXMu8", ); + SearchDrugRequestModel _drugRequestModel = SearchDrugRequestModel( + search: ["panadol"], + vidaAuthTokenID: + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiY2QwOWU3MTEtZDEwYy00NjZhLWEwNDctMjc4MDBmNmRkMTYxIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYyMDMiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkhFQUQgTlVSU0VTIiwiRE9DVE9SUyIsIkhFQUQgRE9DVE9SUyIsIkFETUlOSVNUUkFUT1JTIiwiUkVDRVBUSU9OSVNUIiwiRVIgTlVSU0UiLCJJVkYgUkVDRVBUSU9OSVNUIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIklWRiBET0NUT1IiLCJJVkYgTlVSU0UiLCJJVkYgQ09PUkRJTkFUT1IiLCJJVkYgTEFCIFNUQUZGIiwiQ09OU0VOVCAiLCJNRURJQ0FMIFJFUE9SVCAtIFNJQ0sgTEVBVkUgTUFOQUdFUiJdLCJuYmYiOjE2MDkyNjQ2MTQsImV4cCI6MTYxMDEyODYxNCwiaWF0IjoxNjA5MjY0NjE0fQ.xCJ0jGtSFf36G8uZpdmHVoLfXDyP6e9mBpuOPSlzuio", + ); PostPrescriptionReqModel _postPrescriptionReqModel = PostPrescriptionReqModel(); @@ -30,6 +39,18 @@ class PrescriptionService extends BaseService { }, body: _prescriptionReqModel.toJson()); } + Future getDrugs() async { + hasError = false; + _drugsList.clear(); + await baseAppClient.post(SEARCH_DRUG, + onSuccess: (dynamic response, int statusCode) { + _drugsList.add(SearchDrugModel.fromJson(response['MedicationList'])); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _drugRequestModel.toJson()); + } + Future postPrescription( PostPrescriptionReqModel postProcedureReqModel) async { hasError = false; diff --git a/lib/core/service/procedure_service.dart b/lib/core/service/procedure_service.dart index 0152de24..8122f0a7 100644 --- a/lib/core/service/procedure_service.dart +++ b/lib/core/service/procedure_service.dart @@ -14,10 +14,10 @@ class ProcedureService extends BaseService { List procedureslist = List(); GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( - clinicId: 0, + clinicId: 17, pageSize: 10, pageIndex: 1, - patientMRN: 0, + patientMRN: 3120725, //categoryId: null, vidaAuthTokenID: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI", diff --git a/lib/core/viewModel/prescription_view_model.dart b/lib/core/viewModel/prescription_view_model.dart index 14684aeb..e5fa9a0f 100644 --- a/lib/core/viewModel/prescription_view_model.dart +++ b/lib/core/viewModel/prescription_view_model.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/Prescription_model.dart'; import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug_model.dart'; import 'package:doctor_app_flutter/core/service/prescription_service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; @@ -11,6 +12,7 @@ class PrescriptionViewModel extends BaseViewModel { List get prescriptionList => _prescriptionService.prescriptionList; + List get drugsList => _prescriptionService.drugsList; Future getPrescription() async { hasError = false; @@ -53,4 +55,16 @@ class PrescriptionViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + Future getDrugs() async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _prescriptionService.getDrugs(); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } } diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index ce58776d..e3ed71a9 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_screen.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; @@ -29,303 +30,341 @@ void addPrescriptionForm(context, PrescriptionViewModel model) { TextEditingController doseController = TextEditingController(); final GlobalKey formKey = GlobalKey(); final double spaceBetweenTextFileds = 12; + showModalBottomSheet( isScrollControlled: true, context: context, builder: (BuildContext bc) { - return DraggableScrollableSheet( - initialChildSize: 0.90, - maxChildSize: 0.90, - minChildSize: 0.9, - builder: (BuildContext context, ScrollController scrollController) { - return SingleChildScrollView( - child: Container( - height: 980, - child: Padding( - padding: - EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - //mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - AppText( - TranslationBase.of(context).medicines.toUpperCase(), - fontWeight: FontWeight.w900, - ), - SizedBox( - height: spaceBetweenTextFileds, - ), - Container( - child: Form( - key: formKey, - child: Column( - //mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context) - .searchMedicine, - controller: drugIdController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: spaceBetweenTextFileds, - ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).orderType, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).strength, - keyboardType: TextInputType.number, - controller: strengthController, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context).route, - controller: routeController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).frequency, - controller: frequencyController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).doseTime, - controller: doseController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).indication, - controller: indicationController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).fromDate, - keyboardType: TextInputType.datetime, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).duration, - // borderColor: Colors.white, - keyboardType: TextInputType.number, - controller: durationController, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).instruction, - controller: indicationController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context) - .addMedication, - onPressed: () { - formKey.currentState.save(); + return BaseView( + onModelReady: (model) => model.getDrugs(), + builder: (BuildContext context, PrescriptionViewModel model, + Widget child) => + DraggableScrollableSheet( + initialChildSize: 0.90, + maxChildSize: 0.90, + minChildSize: 0.9, + builder: (BuildContext context, + ScrollController scrollController) { + return SingleChildScrollView( + child: Container( + height: 980, + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 12.0, vertical: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + //mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + AppText( + TranslationBase.of(context) + .medicines + .toUpperCase(), + fontWeight: FontWeight.w900, + ), + SizedBox( + height: spaceBetweenTextFileds, + ), + Container( + child: Form( + key: formKey, + child: Column( + //mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: + TranslationBase.of(context) + .searchMedicine, + controller: drugIdController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of( + context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: spaceBetweenTextFileds, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .orderType, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .strength, + keyboardType: TextInputType.number, + controller: strengthController, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: + TranslationBase.of(context).route, + controller: routeController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .frequency, + controller: frequencyController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .doseTime, + controller: doseController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .indication, + controller: indicationController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .fromDate, + keyboardType: TextInputType.datetime, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: + TranslationBase.of(context) + .duration, + // borderColor: Colors.white, + keyboardType: TextInputType.number, + controller: durationController, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of( + context) + .emptyMessage; + else + return null; + }), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .instruction, + controller: indicationController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context) + .addMedication, + onPressed: () { + formKey.currentState.save(); - if (formKey.currentState.validate()) { - postProcedure( - model: model, - duration: durationController.text, - dose: doseController.text, - frequency: - frequencyController.text, - route: routeController.text, - drugId: drugIdController.text, - strength: strengthController.text, - indication: - indicationController.text, - instruction: - indicationController.text, - ); - Navigator.pop(context); - } - { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => - // NewPrescriptionScreen()), - // ); - } - }, + if (formKey.currentState + .validate()) { + postProcedure( + model: model, + duration: + durationController.text, + dose: doseController.text, + frequency: + frequencyController + .text, + route: routeController.text, + drugId: + drugIdController.text, + strength: + strengthController.text, + indication: + indicationController + .text, + instruction: + indicationController + .text, + ); + Navigator.pop(context); + } + { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => + // NewPrescriptionScreen()), + // ); + } + }, + ), + ], + ), ), ], ), ), - ], - ), + ), + ], ), ), - ], - ), - ), - ), - ); - }); + ), + ); + }), + ); }); } +// openAllergiesList(BuildContext context) { +// showModalBottomSheet( +// backgroundColor: Colors.white, +// isScrollControlled: true, +// context: context, +// builder: (context) { +// return AddAllergies( +// addAllergiesFun: (MySelectedAllergy mySelectedAllergy) { +// setState(() { +// widget.myAllergiesList.add(mySelectedAllergy); +// Navigator.of(context).pop(); +// }); +// }, +// ); +// }); +// } + postProcedure( {String duration, String dose, diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 8116f005..c0afe663 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -420,7 +420,7 @@ class _ProcedureScreenState extends State { } } -postProcedure({ProcedureViewModel model}) async { +postProcedure({ProcedureViewModel model, String remarks}) async { PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); List controls = List(); List controlsProcedure = List(); @@ -433,10 +433,10 @@ postProcedure({ProcedureViewModel model}) async { 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI'; controls.add( - Controls(code: 'Remarks', controlValue: 'Testing'), + Controls(code: remarks.isEmpty ? '' : remarks, controlValue: 'sssssssss'), ); controlsProcedure.add( - Procedures(category: "02", procedure: "02011002", controls: controls)); + Procedures(category: "02", procedure: "02011009", controls: controls)); postProcedureReqModel.procedures = controlsProcedure; await model.postProcedure(postProcedureReqModel); @@ -448,7 +448,8 @@ postProcedure({ProcedureViewModel model}) async { } } -updateProcedure({ProcedureViewModel model, String remarks}) async { +updateProcedure( + {ProcedureViewModel model, String remarks, String procedureId}) async { PostProcedureReqModel updateProcedureReqModel = new PostProcedureReqModel(); List controls = List(); List controlsProcedure = List(); @@ -500,6 +501,7 @@ class AddSelectedProcedure extends StatefulWidget { class _AddSelectedProcedureState extends State { TextEditingController procedureController = TextEditingController(); + TextEditingController remarksController = TextEditingController(); List entityList = List(); @override Widget build(BuildContext context) { @@ -559,6 +561,7 @@ class _AddSelectedProcedureState extends State { ), TextFields( hintText: 'Remarks', + controller: remarksController, minLines: 3, maxLines: 5, ), @@ -574,7 +577,9 @@ class _AddSelectedProcedureState extends State { title: 'add Selected Procedures'.toUpperCase(), onPressed: () { Navigator.pop(context); - postProcedure(model: widget.model); + postProcedure( + model: widget.model, + remarks: remarksController.text); }, ), ], diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart index fa6b8acb..77173034 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart @@ -28,7 +28,6 @@ class UpdateAllergiesWidget extends StatefulWidget { } class _UpdateAllergiesWidgetState extends State { - TextEditingController remarkController = TextEditingController(); @override @@ -53,9 +52,7 @@ class _UpdateAllergiesWidgetState extends State { // controller: messageController, validator: (value) { if (value == null) - return TranslationBase - .of(context) - .emptyMessage; + return TranslationBase.of(context).emptyMessage; else return null; }), @@ -64,17 +61,15 @@ class _UpdateAllergiesWidgetState extends State { height: 20, ), Container( - margin: - EdgeInsets.only(left: 15, right: 15, top: 15), + margin: EdgeInsets.only(left: 15, right: 15, top: 15), child: Column( children: widget.myAllergiesList.map((selectedAllergy) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ Texts(selectedAllergy.selectedAllergy.nameEn.toUpperCase(), variant: "bodyText", bold: true, color: Colors.black), Texts( @@ -126,10 +121,10 @@ class _UpdateAllergiesWidgetState extends State { widget.myAllergiesList.add(mySelectedAllergy); Navigator.of(context).pop(); }); - },); + }, + ); }); } - } class AddAllergies extends StatefulWidget { @@ -149,9 +144,9 @@ class _AddAllergiesState extends State { TextEditingController remarkController = TextEditingController(); GlobalKey key = new GlobalKey>(); - - InputDecoration textFieldSelectorDecoration(String hintText, - String selectedText, bool isDropDown,{IconData icon}) { + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {IconData icon}) { return InputDecoration( focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), @@ -177,9 +172,7 @@ class _AddAllergiesState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - final screenSize = MediaQuery - .of(context) - .size; + final screenSize = MediaQuery.of(context).size; return FractionallySizedBox( heightFactor: 0.7, child: BaseView( @@ -191,150 +184,164 @@ class _AddAllergiesState extends State { await model.getMasterLookup(MasterKeysService.AllergySeverity); } }, - builder: (_, model, w) => - AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: SingleChildScrollView( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - - SizedBox( - height: 16, - ), - AppText( - "Add Allergy", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.allergiesList != null - ? () { - setState(() { - _selectedAllergy = null; - }); - } - : null, - child: _selectedAllergy==null? AutoCompleteTextField( - decoration: textFieldSelectorDecoration("Select Allergy", _selectedAllergy != null ? _selectedAllergy.nameEn : null, true,icon: EvaIcons.search), - itemSubmitted: (item) => setState(() => _selectedAllergy = item), - key: key, - suggestions: model.allergiesList, - itemBuilder: (context, suggestion) => new Padding( - child:Texts( projectViewModel.isArabic? suggestion.nameAr: suggestion.nameEn), - padding: EdgeInsets.all(8.0)), - itemSorter: (a, b) => 1, - itemFilter: (suggestion, input) => - suggestion.nameAr.toLowerCase().startsWith(input.toLowerCase()) ||suggestion.nameEn.toLowerCase().startsWith(input.toLowerCase()), - ):TextField( - decoration: textFieldSelectorDecoration("Select Allergy", _selectedAllergy != null ? _selectedAllergy.nameEn : null, true,icon: EvaIcons.search), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.allergySeverityList != null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.allergySeverityList, - okText: TranslationBase - .of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - _selectedAllergySeverity = - selectedValue; - // model.getDoctorBranch().then((value) { - // _selectedBranch = value; - // if (_referTo['id'] == 1) { - // model.getClinics( - // _selectedBranch['ID']); - // } - // }); - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - "Select Severity", - _selectedAllergySeverity != null - ? _selectedAllergySeverity.nameEn - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - margin: EdgeInsets.only( - left: 0, right: 0, top: 15), - child: TextFields( - hintText: "Remarks", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 13, - controller: remarkController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), SizedBox( - height: 10, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + "Add Allergy", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.allergiesList != null + ? () { + setState(() { + _selectedAllergy = null; + }); + } + : null, + child: _selectedAllergy == null + ? AutoCompleteTextField( + decoration: textFieldSelectorDecoration( + "Select Allergy", + _selectedAllergy != null + ? _selectedAllergy.nameEn + : null, + true, + icon: EvaIcons.search), + itemSubmitted: (item) => + setState(() => _selectedAllergy = item), + key: key, + suggestions: model.allergiesList, + itemBuilder: (context, suggestion) => + new Padding( + child: Texts( + projectViewModel.isArabic + ? suggestion.nameAr + : suggestion.nameEn), + padding: EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.nameAr + .toLowerCase() + .startsWith(input.toLowerCase()) || + suggestion.nameEn + .toLowerCase() + .startsWith(input.toLowerCase()), + ) + : TextField( + decoration: textFieldSelectorDecoration( + "Select Allergy", + _selectedAllergy != null + ? _selectedAllergy.nameEn + : null, + true, + icon: EvaIcons.search), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.allergySeverityList != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.allergySeverityList, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedAllergySeverity = + selectedValue; + // model.getDoctorBranch().then((value) { + // _selectedBranch = value; + // if (_referTo['id'] == 1) { + // model.getClinics( + // _selectedBranch['ID']); + // } + // }); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + "Select Severity", + _selectedAllergySeverity != null + ? _selectedAllergySeverity.nameEn + : null, + true), + enabled: false, ), - AppButton( - title: "Add".toUpperCase(), - onPressed: () { - MySelectedAllergy mySelectedAllergy = new MySelectedAllergy( + ), + ), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 0, right: 0, top: 15), + child: TextFields( + hintText: "Remarks", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: remarkController, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 10, + ), + AppButton( + title: "Add".toUpperCase(), + onPressed: () { + MySelectedAllergy mySelectedAllergy = + new MySelectedAllergy( remark: remarkController.text, selectedAllergy: _selectedAllergy, - selectedAllergySeverity: _selectedAllergySeverity); - widget.addAllergiesFun(mySelectedAllergy); - }, - ), - ] - - ), - ), - ), - )), + selectedAllergySeverity: + _selectedAllergySeverity); + widget.addAllergiesFun(mySelectedAllergy); + }, + ), + ]), + ), + ), + )), ), ); } } - - - - - From 7d550ca15fd7c53b298ede6c6d7110d95627ac98 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 3 Jan 2021 00:32:59 +0200 Subject: [PATCH 02/11] prevent null --- .../soap_update/subjective/update_subjective_page.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart index b9315a28..98d1b7d0 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -166,8 +166,8 @@ class _UpdateSubjectivePageState extends State { MySelectedAllergy mySelectedAllergy = MySelectedAllergy( selectedAllergy: selectedAllergy, selectedAllergySeverity: selectedAllergySeverity); - - widget.myAllergiesList.add(mySelectedAllergy); + if (selectedAllergy != null && selectedAllergySeverity != null) + widget.myAllergiesList.add(mySelectedAllergy); }); } From 4b5bec8c506f7c5bdaa91bac5e60288cb5a38437 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sun, 3 Jan 2021 10:39:53 +0200 Subject: [PATCH 03/11] working on UCAF design --- lib/config/localized_values.dart | 2 + lib/routes.dart | 3 + .../profile/UCAF/UCAF-detail-screen.dart | 107 ++++++++++++++++++ .../profile/UCAF/UCAF-input-screen.dart | 76 +------------ .../referral/refer-patient-screen.dart | 2 +- lib/util/translations_delegate_base.dart | 2 + .../profile/PatientHeaderWidgetNoAvatar.dart | 73 ++++++++++++ pubspec.lock | 8 +- 8 files changed, 197 insertions(+), 76 deletions(-) create mode 100644 lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart create mode 100644 lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 85954bb0..31c15e11 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -431,4 +431,6 @@ const Map> localizedValues = { 'itemExist': {'en': "This item already exist", 'ar':"هذا العنصر موجود" }, 'selectAllergy': {'en': "Select Allergy", 'ar':"أختر الحساسية" }, 'selectSeverity': {'en': "Select Severity", 'ar':"أختر الدرجه" }, + 'medications': {'en': "Medications", 'ar':"الأدوية" }, + 'procedures': {'en': "Procedures", 'ar':"الإجراءات" }, }; diff --git a/lib/routes.dart b/lib/routes.dart index 962df032..e57b56a7 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/root_page.dart'; import 'package:doctor_app_flutter/screens/medical-file/medical_file_page.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-detail-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-input-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/insurance_approvals_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/patient_orders_screen.dart'; @@ -91,6 +92,7 @@ const String PATIENT_ADMISSION_REQUEST = 'patients/admission-request'; const String PATIENT_ADMISSION_REQUEST_2 = 'patients/admission-request-second'; const String PATIENT_ADMISSION_REQUEST_3 = 'patients/admission-request-third'; const String PATIENT_UCAF_REQUEST = 'patients/ucaf'; +const String PATIENT_UCAF_DETAIL = 'patients/ucaf/detail'; const String BODY_MEASUREMENTS = 'patients/body-measurements'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; @@ -155,4 +157,5 @@ var routes = { // LIVECARE_END_DIALOG: (_) => EndCallDialogBox() MY_REFERRAL_DETAIL: (_) => MyReferralDetailScreen(), PATIENT_UCAF_REQUEST: (_) => UCAFInputScreen(), + PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(), }; diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart new file mode 100644 index 00000000..7fc16bfb --- /dev/null +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -0,0 +1,107 @@ +import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class UcafDetailScreen extends StatefulWidget { + @override + _UcafDetailScreenState createState() => _UcafDetailScreenState(); +} + +class _UcafDetailScreenState extends State { + + int _activeTap = 1; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + final screenSize = MediaQuery.of(context).size; + + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).ucaf, + body: Container( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientHeaderWidgetNoAvatar(patient), + SizedBox( + height: 10, + ), + Container( + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Column( + children: [ + treatmentStepsBar(context, screenSize), + SizedBox( + height: 16, + ), + ], + ), + ), + ], + ), + ), + ), + )); + } + + Widget treatmentStepsBar(BuildContext _context, Size screenSize) { + List __treatmentSteps = [ + TranslationBase.of(context).diagnosis.toUpperCase(), + TranslationBase.of(context).medications.toUpperCase(), + TranslationBase.of(context).procedures.toUpperCase(), + ]; + return Container( + height: screenSize.height * 0.070, + decoration: + Helpers.containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)), + child: Row( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: __treatmentSteps.map((item) { + bool _isActive = __treatmentSteps[_activeTap] == item ? true : false; + return Expanded( + child: InkWell( + child: Center( + child: Container( + height: screenSize.height * 0.070, + decoration: Helpers.containerBorderDecoration( + _isActive ? HexColor("#B8382B") : Colors.white, + _isActive ? HexColor("#B8382B") : Colors.white), + child: Center( + child: Text( + item, + style: TextStyle( + fontSize: 12, + color: _isActive + ? Colors.white + : Colors.black, //Colors.black, + fontWeight: FontWeight.bold, + ), + ), + )), + ), + onTap: () { + print(__treatmentSteps.indexOf(item)); + setState(() { + _activeTap = __treatmentSteps.indexOf(item); + }); + }, + ), + ); + }).toList(), + ), + ); + } + +} diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index 82b01144..e0c2f9a7 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -12,6 +13,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; +import '../../../../routes.dart'; + class UCAFInputScreen extends StatefulWidget { @override _UCAFInputScreenState createState() => _UCAFInputScreenState(); @@ -58,7 +61,7 @@ class _UCAFInputScreenState extends State { body: SingleChildScrollView( child: Column( children: [ - PatientHeaderWidget(patient), + PatientHeaderWidgetNoAvatar(patient), Container( margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), child: Column( @@ -349,7 +352,7 @@ class _UCAFInputScreenState extends State { title: TranslationBase.of(context).next, color: HexColor("#B8382B"), onPressed: (){ - // Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: {'patient': patient}); + Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL, arguments: {'patient': patient}); }, ), ], @@ -362,72 +365,3 @@ class _UCAFInputScreenState extends State { ); } } - -class PatientHeaderWidget extends StatelessWidget { - final PatiantInformtion patient; - - PatientHeaderWidget(this.patient); - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Container( - margin: EdgeInsets.all(16), - child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - patient.firstName + ' ' + patient.lastName, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.2, - ), - Row( - children: [ - AppText( - "VIP", - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.2, - ), - SizedBox( - width: 8, - ), - AppText( - " ${patient.age}", - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - ], - ), - AppText( - "NEW VISIT", - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - AppText( - "${patient.companyName}", - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - ], - ), - ), - Icon( - Icons.info_outline, - color: Colors.black, - ), - ], - ), - ), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - ], - ); - } -} diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 7a210b98..3ca6c9b3 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -19,7 +19,7 @@ import 'package:hexcolor/hexcolor.dart'; import '../../../QR_reader_screen.dart'; class PatientMakeReferralScreen extends StatefulWidget { - // previous design page is: MyReferralPatient + // previous design page is: ReferPatientScreen @override _PatientMakeReferralScreenState createState() => _PatientMakeReferralScreenState(); diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index e928f521..e4243035 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -455,6 +455,8 @@ class TranslationBase { String get createNew => localizedValues['createNew'][locale.languageCode]; String get update => localizedValues['update'][locale.languageCode]; String get episode => localizedValues['episode'][locale.languageCode]; + String get medications => localizedValues['medications'][locale.languageCode]; + String get procedures => localizedValues['procedures'][locale.languageCode]; String get chiefComplaints=> localizedValues['chiefComplaints'][locale.languageCode]; diff --git a/lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart b/lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart new file mode 100644 index 00000000..25bc80e4 --- /dev/null +++ b/lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart @@ -0,0 +1,73 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class PatientHeaderWidgetNoAvatar extends StatelessWidget { + final PatiantInformtion patient; + + PatientHeaderWidgetNoAvatar(this.patient); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + margin: EdgeInsets.all(16), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + patient.firstName + ' ' + patient.lastName, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.2, + ), + Row( + children: [ + AppText( + "VIP", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.2, + ), + SizedBox( + width: 8, + ), + AppText( + " ${patient.age}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + AppText( + "NEW VISIT", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "${patient.companyName}", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + ), + Icon( + Icons.info_outline, + color: Colors.black, + ), + ], + ), + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + ], + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index 9cbacb6d..61cc667f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -454,7 +454,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3-nullsafety.1" + version: "0.6.2" json_annotation: dependency: transitive description: @@ -496,7 +496,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.4" + version: "1.3.0-nullsafety.3" mime: dependency: transitive description: @@ -753,7 +753,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.2" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: @@ -888,5 +888,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0 <=2.11.0-213.1.beta" + dart: ">=2.10.0 <2.11.0" flutter: ">=1.22.0 <2.0.0" From 0c39dc66936f721700b83389b74de1b07ac50a41 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sun, 3 Jan 2021 10:58:14 +0200 Subject: [PATCH 04/11] change on vital signs for uncoment the service --- lib/config/localized_values.dart | 1 + .../service/patient-vital-signs-service.dart | 11 ++++--- .../patient-vital-sign-viewmodel.dart | 27 ++++++---------- .../vital_sign/vital-signs-screen.dart | 32 +++++++++---------- lib/util/translations_delegate_base.dart | 1 + 5 files changed, 32 insertions(+), 40 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 31c15e11..e9b01caf 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -433,4 +433,5 @@ const Map> localizedValues = { 'selectSeverity': {'en': "Select Severity", 'ar':"أختر الدرجه" }, 'medications': {'en': "Medications", 'ar':"الأدوية" }, 'procedures': {'en': "Procedures", 'ar':"الإجراءات" }, + 'vitalSignEmptyMsg': {'en': "There is no vital signs for this patient", 'ar':"لا توجد علامات حيوية لهذا المريض" }, }; diff --git a/lib/core/service/patient-vital-signs-service.dart b/lib/core/service/patient-vital-signs-service.dart index d508fec6..31c8721d 100644 --- a/lib/core/service/patient-vital-signs-service.dart +++ b/lib/core/service/patient-vital-signs-service.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_model.dart'; @@ -46,18 +47,18 @@ class VitalSignsService extends BaseService{ ); } // Vit*/ - Future getPatientVitalSign(PatientArrivalEntity patientArrivalEntity) async { + Future getPatientVitalSign(PatiantInformtion patient) async { hasError = false; Map body = Map(); - body['PatientMRN'] = patientArrivalEntity.patientMRN; - body['AppointmentNo'] = patientArrivalEntity.appointmentNo; - body['EpisodeID'] = patientArrivalEntity.episodeNo; + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + body['EpisodeID'] = patient.episodeNo; await baseAppClient.post( GET_PATIENT_VITAL_SIGN_DATA, onSuccess: (dynamic response, int statusCode) { if(response['VitalSignsList'] != null){ - if(response['VitalSignsList']['entityList'] = null && (response['VitalSignsList']['entityList'] as List).length > 0){ + if(response['VitalSignsList']['entityList'] != null && (response['VitalSignsList']['entityList'] as List).length > 0){ patientVitalSigns = VitalSignData.fromJson(response['VitalSignsList']['entityList']['0']); } } diff --git a/lib/core/viewModel/patient-vital-sign-viewmodel.dart b/lib/core/viewModel/patient-vital-sign-viewmodel.dart index e58ad089..f53def7b 100644 --- a/lib/core/viewModel/patient-vital-sign-viewmodel.dart +++ b/lib/core/viewModel/patient-vital-sign-viewmodel.dart @@ -16,17 +16,17 @@ class VitalSignsViewModel extends BaseViewModel { VitalSignData get patientVitalSigns => _vitalSignService.patientVitalSigns; - Future getPatientArrivalList(String date, PatiantInformtion patient, + /*Future getPatientArrivalList(String date, PatiantInformtion patient, {String fromDate}) async { // TODO when arrival list work un comment below lines - /* setState(ViewState.Busy); + *//* setState(ViewState.Busy); await _vitalSignService.getPatientArrivalList(date, fromDate: fromDate); if (_vitalSignService.hasError) { error = _vitalSignService.error; setState(ViewState.Error); } else { await getPatientVitalSign(patient); - }*/ + }*//* makeVitalSignDemoData(); } @@ -43,27 +43,18 @@ class VitalSignsViewModel extends BaseViewModel { // print("patient index: $index"); } return null; - } + }*/ Future getPatientVitalSign(PatiantInformtion patient) async { setState(ViewState.Busy); - PatientArrivalEntity patientArrivalEntity = - getPatientAppointmentEntity(patient); - if (patientArrivalEntity == null) { - _vitalSignService.hasError = true; - error = "There is no appointments for this patient"; - setState(ViewState.Error); - return; - } - await _vitalSignService.getPatientVitalSign(patientArrivalEntity); - // TODO remove (not) from below condition - if (!_vitalSignService.hasError) { + await _vitalSignService.getPatientVitalSign(patient); + if (_vitalSignService.hasError) { error = _vitalSignService.error; setState(ViewState.Error); } else { - if (patientVitalSigns == null) { - makeVitalSignDemoData(); - } + // if (patientVitalSigns == null) { + // makeVitalSignDemoData(); + // } setState(ViewState.Idle); } } diff --git a/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart index 107e2e6b..c66555c1 100644 --- a/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart @@ -11,6 +11,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; class PatientVitalSignScreen extends StatelessWidget { @override @@ -19,10 +20,7 @@ class PatientVitalSignScreen extends StatelessWidget { PatiantInformtion patient = routeArgs['patient']; return BaseView( - onModelReady: (model) => model.getPatientArrivalList( - DateUtils.convertDateToFormat(DateTime.now(), "yyyy-MM-dd"), patient, - fromDate: DateUtils.convertDateToFormat( - DateTime.now().subtract(Duration(days: 500)), "yyyy-MM-dd")), + onModelReady: (model) => model.getPatientVitalSign(patient), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).vitalSign, @@ -213,10 +211,12 @@ class PatientVitalSignScreen extends StatelessWidget { Container( color: Colors.green, child: Padding( - padding: EdgeInsets.symmetric(vertical: 2, horizontal: 8), + padding: EdgeInsets.symmetric( + vertical: 2, horizontal: 8), child: AppText( "${model.getBMI(model.patientVitalSigns.bodyMassIndex)}", - fontSize: SizeConfig.textMultiplier * 2, + fontSize: + SizeConfig.textMultiplier * 2, color: Colors.white, fontWeight: FontWeight.bold, ), @@ -357,7 +357,14 @@ class PatientVitalSignScreen extends StatelessWidget { ), ), ) - : Container(), + : Center( + child: AppText( + "${TranslationBase.of(context).vitalSignEmptyMsg}", + fontSize: SizeConfig.textMultiplier * 2.5, + color: HexColor("#B8382B"), + fontWeight: FontWeight.normal, + ), + ), ), ); } @@ -485,7 +492,6 @@ class _TemperatureWidgetState extends State { } class PulseWidget extends StatefulWidget { - final VitalSignData vitalSign; PulseWidget(this.vitalSign); @@ -496,6 +502,7 @@ class PulseWidget extends StatefulWidget { class _PulseWidgetState extends State { bool isExpand = false; + @override Widget build(BuildContext context) { return Container( @@ -578,7 +585,6 @@ class _PulseWidgetState extends State { } class RespirationWidget extends StatefulWidget { - final VitalSignData vitalSign; RespirationWidget(this.vitalSign); @@ -672,7 +678,6 @@ class _RespirationWidgetState extends State { } class BloodPressureWidget extends StatefulWidget { - final VitalSignData vitalSign; BloodPressureWidget(this.vitalSign); @@ -812,7 +817,6 @@ class _BloodPressureWidgetState extends State { } class OxygenationWidget extends StatefulWidget { - final VitalSignData vitalSign; OxygenationWidget(this.vitalSign); @@ -906,7 +910,6 @@ class _OxygenationWidgetState extends State { } class PainScaleWidget extends StatefulWidget { - final VitalSignData vitalSign; PainScaleWidget(this.vitalSign); @@ -998,8 +1001,3 @@ class _PainScaleWidgetState extends State { ); } } - - - - - diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index e4243035..3b1950db 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -472,6 +472,7 @@ class TranslationBase { String get itemExist => localizedValues['itemExist'][locale.languageCode]; String get selectAllergy => localizedValues['selectAllergy'][locale.languageCode]; String get selectSeverity => localizedValues['selectSeverity'][locale.languageCode]; + String get vitalSignEmptyMsg => localizedValues['vitalSignEmptyMsg'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From e054c282342d8e5bf755ea7e97aea156721274d8 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 3 Jan 2021 11:27:03 +0200 Subject: [PATCH 05/11] hide text --- .../patients/profile/soap_update/update_assessment_page.dart | 1 + lib/widgets/patients/profile/soap_update/update_plan_page.dart | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart index 20684e19..3eec290c 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -130,6 +130,7 @@ class _UpdateAssessmentPageState extends State { ), Column( children: [ + if(model.patientAssessmentList.isEmpty) Container( margin: EdgeInsets.only(left: 5, right: 5, top: 15), diff --git a/lib/widgets/patients/profile/soap_update/update_plan_page.dart b/lib/widgets/patients/profile/soap_update/update_plan_page.dart index d5ad12e9..9c851cd5 100644 --- a/lib/widgets/patients/profile/soap_update/update_plan_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_plan_page.dart @@ -115,6 +115,7 @@ class _UpdatePlanPageState extends State { ), Column( children: [ + if(model.patientProgressNoteList.isEmpty) Container( margin: EdgeInsets.only(left: 10, right: 10, top: 15), From 16b949461d6cb5a2b1f050059b0ce5549c42e551 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 3 Jan 2021 11:35:36 +0200 Subject: [PATCH 06/11] prescription post --- lib/core/model/medical_file_model.dart | 412 ++++++++++--- .../prescription/add_prescription_form.dart | 552 +++++++++--------- 2 files changed, 607 insertions(+), 357 deletions(-) diff --git a/lib/core/model/medical_file_model.dart b/lib/core/model/medical_file_model.dart index eb88f0d4..0496d0eb 100644 --- a/lib/core/model/medical_file_model.dart +++ b/lib/core/model/medical_file_model.dart @@ -1,7 +1,7 @@ class MedicalFileModel { List entityList; int rowcount; - dynamic statusMessage; + Null statusMessage; MedicalFileModel({this.entityList, this.rowcount, this.statusMessage}); @@ -190,12 +190,12 @@ class LstDischargeDiag { projectName = json['ProjectName']; remarks = json['Remarks']; setupID = json['SetupID']; - // if (json['TimeLineEvents'] != null) { - // timeLineEvents = new List(); - // json['TimeLineEvents'].forEach((v) { - // timeLineEvents.add(new TimeLineEvents.fromJson(v)); - // }); - // } + if (json['TimeLineEvents'] != null) { + timeLineEvents = new List(); + json['TimeLineEvents'].forEach((v) { + timeLineEvents.add(new TimeLineEvents.fromJson(v)); + }); + } } Map toJson() { @@ -246,49 +246,49 @@ class TimeLineEvents { this.radReports, this.toolTip}); - // TimeLineEvents.fromJson(Map json) { - // if (json['Admissions'] != null) { - // admissions = new List(); - // json['Admissions'].forEach((v) { - // admissions.add(new Null.fromJson(v)); - // }); - // } - // colorClass = json['ColorClass']; - // if (json['Consulations'] != null) { - // consulations = new List(); - // json['Consulations'].forEach((v) { - // consulations.add(new Null.fromJson(v)); - // }); - // } - // disPlayName = json['DisPlayName']; - // doctorName = json['DoctorName']; - // eRData = - // json['ERData'] != null ? new ERData.fromJson(json['ERData']) : null; - // eventId = json['EventId']; - // fullName = json['FullName']; - // iconClass = json['IconClass']; - // isDisabled = json['IsDisabled']; - // if (json['LabOrders'] != null) { - // labOrders = new List(); - // json['LabOrders'].forEach((v) { - // labOrders.add(new Null.fromJson(v)); - // }); - // } - // if (json['RadReports'] != null) { - // radReports = new List(); - // json['RadReports'].forEach((v) { - // radReports.add(new Null.fromJson(v)); - // }); - // } - // toolTip = json['ToolTip']; - // } + TimeLineEvents.fromJson(Map json) { + // if (json['Admissions'] != null) { + // admissions = new List(); + // json['Admissions'].forEach((v) { + // admissions.add(new Null.fromJson(v)); + // }); + // } + // colorClass = json['ColorClass']; + // if (json['Consulations'] != null) { + // consulations = new List(); + // json['Consulations'].forEach((v) { + // consulations.add(new Null.fromJson(v)); + // }); + // } + disPlayName = json['DisPlayName']; + doctorName = json['DoctorName']; + eRData = + json['ERData'] != null ? new ERData.fromJson(json['ERData']) : null; + eventId = json['EventId']; + fullName = json['FullName']; + iconClass = json['IconClass']; + isDisabled = json['IsDisabled']; + // if (json['LabOrders'] != null) { + // labOrders = new List(); + // json['LabOrders'].forEach((v) { + // labOrders.add(new Null.fromJson(v)); + // }); + // } + // if (json['RadReports'] != null) { + // radReports = new List(); + // json['RadReports'].forEach((v) { + // radReports.add(new Null.fromJson(v)); + // }); + // } + toolTip = json['ToolTip']; + } Map toJson() { final Map data = new Map(); // if (this.admissions != null) { // data['Admissions'] = this.admissions.map((v) => v.toJson()).toList(); // } - data['ColorClass'] = this.colorClass; + // data['ColorClass'] = this.colorClass; // if (this.consulations != null) { // data['Consulations'] = this.consulations.map((v) => v.toJson()).toList(); // } @@ -326,38 +326,38 @@ class ERData { this.radReports, this.lstErDischargeSummary}); - // ERData.fromJson(Map json) { - // if (json['Admissions'] != null) { - // admissions = new List(); - // json['Admissions'].forEach((v) { - // admissions.add(new Null.fromJson(v)); - // }); - // } - // if (json['Consulations'] != null) { - // consulations = new List(); - // json['Consulations'].forEach((v) { - // consulations.add(new Null.fromJson(v)); - // }); - // } - // if (json['LabOrders'] != null) { - // labOrders = new List(); - // json['LabOrders'].forEach((v) { - // labOrders.add(new Null.fromJson(v)); - // }); - // } - // if (json['RadReports'] != null) { - // radReports = new List(); - // json['RadReports'].forEach((v) { - // radReports.add(new Null.fromJson(v)); - // }); - // } - // if (json['lstErDischargeSummary'] != null) { - // lstErDischargeSummary = new List(); - // json['lstErDischargeSummary'].forEach((v) { - // lstErDischargeSummary.add(new Null.fromJson(v)); - // }); - // } - // } + ERData.fromJson(Map json) { + // if (json['Admissions'] != null) { + // admissions = new List(); + // json['Admissions'].forEach((v) { + // admissions.add(new Null.fromJson(v)); + // }); + // } + // if (json['Consulations'] != null) { + // consulations = new List(); + // json['Consulations'].forEach((v) { + // consulations.add(new Null.fromJson(v)); + // }); + // } + // if (json['LabOrders'] != null) { + // labOrders = new List(); + // json['LabOrders'].forEach((v) { + // labOrders.add(new Null.fromJson(v)); + // }); + // } + // if (json['RadReports'] != null) { + // radReports = new List(); + // json['RadReports'].forEach((v) { + // radReports.add(new Null.fromJson(v)); + // }); + // } + // if (json['lstErDischargeSummary'] != null) { + // lstErDischargeSummary = new List(); + // json['lstErDischargeSummary'].forEach((v) { + // lstErDischargeSummary.add(new Null.fromJson(v)); + // }); + // } + } Map toJson() { final Map data = new Map(); @@ -827,6 +827,7 @@ class DoctorWisePatientEpisodes { String setupID; int doctorID; String doctorName; + List lstEpisodes; DoctorWisePatientEpisodes( {this.clinicName, @@ -835,7 +836,8 @@ class DoctorWisePatientEpisodes { this.projectName, this.setupID, this.doctorID, - this.doctorName}); + this.doctorName, + this.lstEpisodes}); DoctorWisePatientEpisodes.fromJson(Map json) { clinicName = json['ClinicName']; @@ -845,6 +847,12 @@ class DoctorWisePatientEpisodes { setupID = json['SetupID']; doctorID = json['doctorID']; doctorName = json['doctorName']; + if (json['lstEpisodes'] != null) { + lstEpisodes = new List(); + json['lstEpisodes'].forEach((v) { + lstEpisodes.add(new LstEpisodes.fromJson(v)); + }); + } } Map toJson() { @@ -856,6 +864,256 @@ class DoctorWisePatientEpisodes { data['SetupID'] = this.setupID; data['doctorID'] = this.doctorID; data['doctorName'] = this.doctorName; + if (this.lstEpisodes != null) { + data['lstEpisodes'] = this.lstEpisodes.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class LstEpisodes { + int admissionNo; + String appointmentDate; + int appointmentNo; + String appointmentType; + String clinicID; + String clinicName; + int doctorID; + String doctorName; + String endTime; + String episodeDate; + int episodeID; + int patientID; + int projectID; + String projectName; + String remarks; + String setupID; + String startTime; + String visitFor; + String visitType; + String dispalyName; + List lstAssessments; + List lstPhysicalExam; + + LstEpisodes( + {this.admissionNo, + this.appointmentDate, + this.appointmentNo, + this.appointmentType, + this.clinicID, + this.clinicName, + this.doctorID, + this.doctorName, + this.endTime, + this.episodeDate, + this.episodeID, + this.patientID, + this.projectID, + this.projectName, + this.remarks, + this.setupID, + this.startTime, + this.visitFor, + this.visitType, + this.dispalyName, + this.lstAssessments, + this.lstPhysicalExam}); + + LstEpisodes.fromJson(Map json) { + admissionNo = json['AdmissionNo']; + appointmentDate = json['AppointmentDate']; + appointmentNo = json['AppointmentNo']; + appointmentType = json['AppointmentType']; + clinicID = json['ClinicID']; + clinicName = json['ClinicName']; + doctorID = json['DoctorID']; + doctorName = json['DoctorName']; + endTime = json['EndTime']; + episodeDate = json['EpisodeDate']; + episodeID = json['EpisodeID']; + patientID = json['PatientID']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + remarks = json['Remarks']; + setupID = json['SetupID']; + startTime = json['StartTime']; + visitFor = json['VisitFor']; + visitType = json['VisitType']; + dispalyName = json['dispalyName']; + if (json['lstAssessments'] != null) { + lstAssessments = new List(); + json['lstAssessments'].forEach((v) { + lstAssessments.add(new LstAssessments.fromJson(v)); + }); + } + if (json['lstPhysicalExam'] != null) { + lstPhysicalExam = new List(); + json['lstPhysicalExam'].forEach((v) { + lstPhysicalExam.add(new LstPhysicalExam.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['AdmissionNo'] = this.admissionNo; + data['AppointmentDate'] = this.appointmentDate; + data['AppointmentNo'] = this.appointmentNo; + data['AppointmentType'] = this.appointmentType; + data['ClinicID'] = this.clinicID; + data['ClinicName'] = this.clinicName; + data['DoctorID'] = this.doctorID; + data['DoctorName'] = this.doctorName; + data['EndTime'] = this.endTime; + data['EpisodeDate'] = this.episodeDate; + data['EpisodeID'] = this.episodeID; + data['PatientID'] = this.patientID; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['Remarks'] = this.remarks; + data['SetupID'] = this.setupID; + data['StartTime'] = this.startTime; + data['VisitFor'] = this.visitFor; + data['VisitType'] = this.visitType; + data['dispalyName'] = this.dispalyName; + if (this.lstAssessments != null) { + data['lstAssessments'] = + this.lstAssessments.map((v) => v.toJson()).toList(); + } + if (this.lstPhysicalExam != null) { + data['lstPhysicalExam'] = + this.lstPhysicalExam.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class LstAssessments { + int appointmentNo; + String condition; + String description; + int episodeID; + String iCD10; + int patientID; + String patientType; + int projectID; + String projectName; + String remarks; + String setupID; + String type; + String dispalyName; + + LstAssessments( + {this.appointmentNo, + this.condition, + this.description, + this.episodeID, + this.iCD10, + this.patientID, + this.patientType, + this.projectID, + this.projectName, + this.remarks, + this.setupID, + this.type, + this.dispalyName}); + + LstAssessments.fromJson(Map json) { + appointmentNo = json['AppointmentNo']; + condition = json['Condition']; + description = json['Description']; + episodeID = json['EpisodeID']; + iCD10 = json['ICD10']; + patientID = json['PatientID']; + patientType = json['PatientType']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + remarks = json['Remarks']; + setupID = json['SetupID']; + type = json['Type']; + dispalyName = json['dispalyName']; + } + + Map toJson() { + final Map data = new Map(); + data['AppointmentNo'] = this.appointmentNo; + data['Condition'] = this.condition; + data['Description'] = this.description; + data['EpisodeID'] = this.episodeID; + data['ICD10'] = this.iCD10; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['Remarks'] = this.remarks; + data['SetupID'] = this.setupID; + data['Type'] = this.type; + data['dispalyName'] = this.dispalyName; + return data; + } +} + +class LstPhysicalExam { + String abnormal; + int appointmentNo; + int episodeID; + String examDesc; + String examID; + String examType; + int patientID; + String patientType; + int projectID; + String projectName; + String remarks; + String setupID; + String dispalyName; + + LstPhysicalExam( + {this.abnormal, + this.appointmentNo, + this.episodeID, + this.examDesc, + this.examID, + this.examType, + this.patientID, + this.patientType, + this.projectID, + this.projectName, + this.remarks, + this.setupID, + this.dispalyName}); + + LstPhysicalExam.fromJson(Map json) { + abnormal = json['Abnormal']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + examDesc = json['ExamDesc']; + examID = json['ExamID']; + examType = json['ExamType']; + patientID = json['PatientID']; + patientType = json['PatientType']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + remarks = json['Remarks']; + setupID = json['SetupID']; + dispalyName = json['dispalyName']; + } + + Map toJson() { + final Map data = new Map(); + data['Abnormal'] = this.abnormal; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['ExamDesc'] = this.examDesc; + data['ExamID'] = this.examID; + data['ExamType'] = this.examType; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['Remarks'] = this.remarks; + data['SetupID'] = this.setupID; + data['dispalyName'] = this.dispalyName; return data; } } diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index e3ed71a9..6d1d7cf3 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -35,316 +35,308 @@ void addPrescriptionForm(context, PrescriptionViewModel model) { isScrollControlled: true, context: context, builder: (BuildContext bc) { - return BaseView( - onModelReady: (model) => model.getDrugs(), - builder: (BuildContext context, PrescriptionViewModel model, - Widget child) => - DraggableScrollableSheet( - initialChildSize: 0.90, - maxChildSize: 0.90, - minChildSize: 0.9, - builder: (BuildContext context, - ScrollController scrollController) { - return SingleChildScrollView( - child: Container( - height: 980, - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 12.0, vertical: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - //mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - AppText( - TranslationBase.of(context) - .medicines - .toUpperCase(), - fontWeight: FontWeight.w900, - ), - SizedBox( - height: spaceBetweenTextFileds, - ), - Container( - child: Form( - key: formKey, - child: Column( - //mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context) - .searchMedicine, - controller: drugIdController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of( - context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: spaceBetweenTextFileds, - ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context) - .orderType, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( + return //BaseView( + //onModelReady: (model) => model.getDrugs(), + //builder: (BuildContext context, PrescriptionViewModel model, + //Widget child) => + DraggableScrollableSheet( + initialChildSize: 0.90, + maxChildSize: 0.90, + minChildSize: 0.9, + builder: + (BuildContext context, ScrollController scrollController) { + return SingleChildScrollView( + child: Container( + height: 980, + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 12.0, vertical: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + //mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + AppText( + TranslationBase.of(context) + .medicines + .toUpperCase(), + fontWeight: FontWeight.w900, + ), + SizedBox( + height: spaceBetweenTextFileds, + ), + Container( + child: Form( + key: formKey, + child: Column( + //mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( hintText: TranslationBase.of(context) - .strength, + .searchMedicine, + controller: drugIdController, keyboardType: TextInputType.number, - controller: strengthController, validator: (value) { if (value.isEmpty) return TranslationBase.of(context) .emptyMessage; else return null; - }, - ), + }), + ), + SizedBox( + height: spaceBetweenTextFileds, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .orderType, ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).route, - controller: routeController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .strength, + keyboardType: TextInputType.number, + controller: strengthController, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context) - .frequency, - controller: frequencyController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: + TranslationBase.of(context).route, + controller: routeController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context) - .doseTime, - controller: doseController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .frequency, + controller: frequencyController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context) - .indication, - controller: indicationController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .doseTime, + controller: doseController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context) - .fromDate, - keyboardType: TextInputType.datetime, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .indication, + controller: indicationController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context) - .duration, - // borderColor: Colors.white, - keyboardType: TextInputType.number, - controller: durationController, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of( - context) - .emptyMessage; - else - return null; - }), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .fromDate, + keyboardType: TextInputType.datetime, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( hintText: TranslationBase.of(context) - .instruction, - controller: indicationController, + .duration, + // borderColor: Colors.white, keyboardType: TextInputType.number, + controller: durationController, validator: (value) { if (value.isEmpty) return TranslationBase.of(context) .emptyMessage; else return null; - }, - ), + }), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .instruction, + controller: indicationController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, ), - SizedBox(height: spaceBetweenTextFileds), - Container( - margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context) - .addMedication, - onPressed: () { - formKey.currentState.save(); + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context) + .addMedication, + onPressed: () { + formKey.currentState.save(); - if (formKey.currentState - .validate()) { - postProcedure( - model: model, - duration: - durationController.text, - dose: doseController.text, - frequency: - frequencyController - .text, - route: routeController.text, - drugId: - drugIdController.text, - strength: - strengthController.text, - indication: - indicationController - .text, - instruction: - indicationController - .text, - ); - Navigator.pop(context); - } - { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => - // NewPrescriptionScreen()), - // ); - } - }, - ), - ], - ), + if (formKey.currentState + .validate()) { + postProcedure( + model: model, + duration: + durationController.text, + dose: doseController.text, + frequency: + frequencyController.text, + route: routeController.text, + drugId: drugIdController.text, + strength: + strengthController.text, + indication: + indicationController.text, + instruction: + indicationController.text, + ); + Navigator.pop(context); + } + { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => + // NewPrescriptionScreen()), + // ); + } + }, + ), + ], ), - ], - ), + ), + ], ), ), - ], - ), + ), + ], ), ), - ); - }), - ); + ), + ); + }); + //); }); } From ee9ca72057e852cf056a80ceec56af6e4fd1c705 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sun, 3 Jan 2021 11:45:46 +0200 Subject: [PATCH 07/11] change empty referral message --- lib/config/localized_values.dart | 2 ++ lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart | 7 ++++++- .../profile/referral/my-referral-patient-screen.dart | 2 +- .../patients/profile/referral/refer-patient-screen.dart | 5 ++++- .../patients/profile/referral/referred-patient-screen.dart | 6 +++--- lib/util/translations_delegate_base.dart | 2 ++ 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 1dc0216e..ef5aaaa5 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -507,4 +507,6 @@ const Map> localizedValues = { 'medications': {'en': "Medications", 'ar':"الأدوية" }, 'procedures': {'en': "Procedures", 'ar':"الإجراءات" }, 'vitalSignEmptyMsg': {'en': "There is no vital signs for this patient", 'ar':"لا توجد علامات حيوية لهذا المريض" }, + 'referralEmptyMsg': {'en': "There is no referral data", 'ar':"لا توجد بيانات إحالة" }, + 'referralSuccessMsg': {'en': "You make referral successfully", 'ar':"You make referral successfully" }, }; diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 7fc16bfb..302b77a8 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -15,7 +15,7 @@ class UcafDetailScreen extends StatefulWidget { class _UcafDetailScreenState extends State { - int _activeTap = 1; + int _activeTap = 0; @override Widget build(BuildContext context) { @@ -45,6 +45,7 @@ class _UcafDetailScreenState extends State { SizedBox( height: 16, ), + getSelectedTreatmentStepItem(context), ], ), ), @@ -104,4 +105,8 @@ class _UcafDetailScreenState extends State { ); } + Widget getSelectedTreatmentStepItem(BuildContext _context) { + return Container(); + } + } diff --git a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart index 7f11f35f..311e2f12 100644 --- a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart @@ -27,7 +27,7 @@ class MyReferralPatientScreen extends StatelessWidget { model.pendingReferral.length == 0 ? Center( child: AppText( - TranslationBase.of(context).errorNoSchedule, + TranslationBase.of(context).referralEmptyMsg, color: Theme.of(context).errorColor, ), ) diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 1ffd7150..69540176 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -339,7 +339,10 @@ class _PatientMakeReferralScreenState extends State { _selectedClinic['ClinicID'], _selectedDoctor['DoctorID'], _remarksController.text) - .then((_) => Navigator.pop(context)); + .then((_) { + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsg); + Navigator.pop(context); + }); }, ), ) diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index 1ba1f572..c1880908 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -19,7 +19,7 @@ class ReferredPatientScreen extends StatelessWidget { model.listMyReferredPatientModel.length == 0 ? Center( child: AppText( - TranslationBase.of(context).errorNoSchedule, + TranslationBase.of(context).referralEmptyMsg, color: Theme.of(context).errorColor, ), ) @@ -27,14 +27,14 @@ class ReferredPatientScreen extends StatelessWidget { child: Container( child: Column( children: [ - Container( + /*Container( height: 75, child: AppText( "This is where upper view for avatar.. etc placed", fontWeight: FontWeight.normal, fontSize: 16, ), - ), + ),*/ const Divider( color: Color(0xffCCCCCC), height: 1, diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 7070d252..5dee728a 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -533,6 +533,8 @@ class TranslationBase { String get selectSeverity => localizedValues['selectSeverity'][locale.languageCode]; String get vitalSignEmptyMsg => localizedValues['vitalSignEmptyMsg'][locale.languageCode]; + String get referralEmptyMsg => localizedValues['referralEmptyMsg'][locale.languageCode]; + String get referralSuccessMsg => localizedValues['referralSuccessMsg'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From 8284f1d475772be006da5e3ee5c5bbcb240775a9 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 3 Jan 2021 11:49:42 +0200 Subject: [PATCH 08/11] Fix profile widget --- .../profile/profile_medical_info_widget.dart | 146 +++++++++--------- 1 file changed, 70 insertions(+), 76 deletions(-) diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 016b5972..8860a7dc 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -1,14 +1,13 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/routes.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; + import '../../../config/size_config.dart'; import '../../shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; - -import 'PatientProfileButton.dart'; /* *@author: Elham Rababah @@ -45,16 +44,15 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine2: TranslationBase.of(context).episode, route: UPDATE_EPISODE, icon: 'modilfy-episode.png'), - Visibility( - visible: selectedPatientType == 6 || selectedPatientType == 7, - child: PatientProfileButton( - key: key, - patient: patient, - nameLine1: TranslationBase.of(context).vital, - nameLine2: TranslationBase.of(context).signs, - route: PATIENT_VITAL_SIGN, - icon: 'heartbeat.png'), - ), + if(selectedPatientType == 6 || selectedPatientType == 7) + PatientProfileButton( + key: key, + patient: patient, + nameLine1: TranslationBase.of(context).vital, + nameLine2: TranslationBase.of(context).signs, + route: PATIENT_VITAL_SIGN, + icon: 'heartbeat.png'), + if(selectedPatientType != 7) PatientProfileButton( key: key, patient: patient, @@ -62,13 +60,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).lab, nameLine2: TranslationBase.of(context).result, icon: 'lab.png'), - // PatientProfileButton( - // key: key, - // patient: patient, - // route: PRESCRIPTIONS, - // nameLine1: TranslationBase.of(context).medicines, - // nameLine2: TranslationBase.of(context).prescription, - // icon: 'note.png'), + PatientProfileButton( key: key, patient: patient, @@ -76,32 +68,22 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).previewHealth, nameLine2: TranslationBase.of(context).summaryReport, icon: 'radiology-1.png'), - Visibility( - visible: selectedPatientType != 0 && selectedPatientType != 5, - child: PatientProfileButton( - key: key, - patient: patient, - route: PROGRESS_NOTE, - nameLine1: TranslationBase.of(context).progress, - nameLine2: TranslationBase.of(context).note, - icon: 'heartbeat.png')), - Visibility( - visible: selectedPatientType == 6 || selectedPatientType == 7, - child: PatientProfileButton( + if (selectedPatientType != 0 && selectedPatientType != 5) + PatientProfileButton( + key: key, + patient: patient, + route: PROGRESS_NOTE, + nameLine1: TranslationBase.of(context).progress, + nameLine2: TranslationBase.of(context).note, + icon: 'heartbeat.png'), + if (selectedPatientType == 7) + PatientProfileButton( key: key, patient: patient, route: PATIENT_ADMISSION_REQUEST, nameLine1: TranslationBase.of(context).admission, nameLine2: TranslationBase.of(context).request, icon: 'heartbeat.png'), - ), - // PatientProfileButton( - // key: key, - // patient: patient, - // route: PATIENT_INSURANCE_APPROVALS, - // nameLine1: TranslationBase.of(context).insurance, - // nameLine2: TranslationBase.of(context).approvals, - // icon: 'lab.png'), PatientProfileButton( key: key, patient: patient, @@ -116,42 +98,54 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: 'Order Test', nameLine2: 'Or Procedures', icon: 'lab.png'), - Visibility( - visible: selectedPatientType == 6 || selectedPatientType == 7, - child: PatientProfileButton( - key: key, - patient: patient, - route: REFER_PATIENT_TO_DOCTOR, - nameLine1: TranslationBase.of(context).myReferral, - nameLine2: TranslationBase.of(context).patient, - icon: 'note.png')), - Visibility( - visible: selectedPatientType != 0 && selectedPatientType != 5, - child: PatientProfileButton( - key: key, - patient: patient, - route: PATIENT_ORDERS, - nameLine1: TranslationBase.of(context).orders, - nameLine2: TranslationBase.of(context).list, - icon: 'radiology-1.png')), - Visibility( - visible: selectedPatientType != 0 && selectedPatientType != 5, - child: PatientProfileButton( - key: key, - patient: patient, - route: ADD_SICKLEAVE, - nameLine1: TranslationBase.of(context).patientSick, - nameLine2: TranslationBase.of(context).leave, - icon: 'sick_leaves_icons.png')), - Visibility( - visible: selectedPatientType == 6 || selectedPatientType == 7, - child: PatientProfileButton( - key: key, - patient: patient, - route: PATIENT_UCAF_REQUEST, - nameLine1: TranslationBase.of(context).patient, - nameLine2: TranslationBase.of(context).ucaf, - icon: 'lab.png')), + if(selectedPatientType == 7) + PatientProfileButton( + key: key, + patient: patient, + route: REFER_PATIENT_TO_DOCTOR, + nameLine1: TranslationBase + .of(context) + .myReferral, + nameLine2: TranslationBase + .of(context) + .patient, + icon: 'note.png'), + if(selectedPatientType != 0 && selectedPatientType != 5) + PatientProfileButton( + key: key, + patient: patient, + route: PATIENT_ORDERS, + nameLine1: TranslationBase + .of(context) + .orders, + nameLine2: TranslationBase + .of(context) + .list, + icon: 'radiology-1.png'), + if(selectedPatientType != 0 && selectedPatientType != 5) + PatientProfileButton( + key: key, + patient: patient, + route: ADD_SICKLEAVE, + nameLine1: TranslationBase + .of(context) + .patientSick, + nameLine2: TranslationBase + .of(context) + .leave, + icon: 'sick_leaves_icons.png'), + if( selectedPatientType == 7) + PatientProfileButton( + key: key, + patient: patient, + route: PATIENT_UCAF_REQUEST, + nameLine1: TranslationBase + .of(context) + .patient, + nameLine2: TranslationBase + .of(context) + .ucaf, + icon: 'lab.png'), ]); } } From 88ee50f7cb467e2285a48aed8bb01e5a31c8426a Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sun, 3 Jan 2021 12:21:17 +0200 Subject: [PATCH 09/11] change make referral page loading behaviour --- .../viewModel/patient-referral-viewmodel.dart | 6 +++--- .../referral/refer-patient-screen.dart | 19 +++++++++++++++---- lib/widgets/shared/app_loader_widget.dart | 5 +++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index e5657883..251407ef 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -41,7 +41,7 @@ class PatientReferralViewModel extends BaseViewModel { } Future getBranches() async { - setState(ViewState.Busy); + setState(ViewState.BusyLocal); await _referralPatientService.getProjectsList(); if (_referralPatientService.hasError) { error = _referralPatientService.error; @@ -52,7 +52,7 @@ class PatientReferralViewModel extends BaseViewModel { } Future getClinics(int projectId) async { - setState(ViewState.Busy); + setState(ViewState.BusyLocal); await _referralPatientService.getClinicsList(projectId); await _referralPatientService.getProjectInfo(projectId); if (_referralPatientService.hasError) { @@ -63,7 +63,7 @@ class PatientReferralViewModel extends BaseViewModel { } Future getClinicDoctors(String clinicId) async { - setState(ViewState.Busy); + setState(ViewState.BusyLocal); await _referralPatientService.getDoctorsList(clinicId); if (_referralPatientService.hasError) { error = _referralPatientService.error; diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 69540176..e46ab6d5 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; @@ -55,7 +56,8 @@ class _PatientMakeReferralScreenState extends State { final screenSize = MediaQuery.of(context).size; return BaseView( - onModelReady: (model) => model.getMasterLookup(MasterKeysService.physiotherapyGoals), + onModelReady: (model) => + model.getMasterLookup(MasterKeysService.physiotherapyGoals), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).referPatient, @@ -64,6 +66,14 @@ class _PatientMakeReferralScreenState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ + if (model.state == ViewState.BusyLocal) + Container( + color: Colors.white, + width: 50, + height: 50, + child: AppLoaderWidget( + containerColor: Colors.white, + )), Column( children: [ PatientPageHeaderWidget(patient), @@ -333,14 +343,15 @@ class _PatientMakeReferralScreenState extends State { _remarksController.text == null) return; model .makeReferral( - patient, + patient, appointmentDate.toIso8601String(), _selectedBranch['ID'], _selectedClinic['ClinicID'], _selectedDoctor['DoctorID'], _remarksController.text) .then((_) { - DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsg); + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context).referralSuccessMsg); Navigator.pop(context); }); }, @@ -368,7 +379,7 @@ class _PatientMakeReferralScreenState extends State { setState(() { appointmentDate = picked; }); - /* model + /* model .getPatientArrivalList(DateUtils.convertStringToDateFormat( appointmentDate.toString(), "yyyy-MM-dd")) .then((_) { diff --git a/lib/widgets/shared/app_loader_widget.dart b/lib/widgets/shared/app_loader_widget.dart index aeb7f5b2..65a5f231 100644 --- a/lib/widgets/shared/app_loader_widget.dart +++ b/lib/widgets/shared/app_loader_widget.dart @@ -9,9 +9,10 @@ import 'package:progress_hud_v2/progress_hud.dart'; *@desc: AppLoaderWidget to create loader */ class AppLoaderWidget extends StatefulWidget { - AppLoaderWidget({Key key, this.title}) : super(key: key); + AppLoaderWidget({Key key, this.title, this.containerColor}) : super(key: key); final String title; + final Color containerColor; @override _AppLoaderWidgetState createState() => new _AppLoaderWidgetState(); @@ -30,7 +31,7 @@ class _AppLoaderWidgetState extends State { *@desc: create loader the desing */ _progressHUD = new ProgressHUD( - backgroundColor: Colors.black12, + backgroundColor: widget.containerColor == null ? Colors.black12 : widget.containerColor, color: Colors.black, // containerColor: Colors.blue, borderRadius: 5.0, From 9194d8a44b24a354041d26cca2efa2ae46ee55e0 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 3 Jan 2021 14:29:47 +0200 Subject: [PATCH 10/11] delete Allergy --- lib/models/SOAP/my_selected_allergy.dart | 5 +- .../profile/soap_update/steps_widget.dart | 14 ++-- .../subjective/update_allergies_widget.dart | 80 +++++++++++++------ .../subjective/update_subjective_page.dart | 5 ++ lib/widgets/shared/Text.dart | 7 +- 5 files changed, 78 insertions(+), 33 deletions(-) diff --git a/lib/models/SOAP/my_selected_allergy.dart b/lib/models/SOAP/my_selected_allergy.dart index 9996b65a..e5b45502 100644 --- a/lib/models/SOAP/my_selected_allergy.dart +++ b/lib/models/SOAP/my_selected_allergy.dart @@ -4,9 +4,10 @@ class MySelectedAllergy { MasterKeyModel selectedAllergySeverity; MasterKeyModel selectedAllergy; String remark; + bool isChecked; MySelectedAllergy( - {this.selectedAllergySeverity, this.selectedAllergy, this.remark}); + {this.selectedAllergySeverity, this.selectedAllergy, this.remark, this.isChecked}); MySelectedAllergy.fromJson(Map json) { selectedAllergySeverity = json['selectedAllergySeverity'] != null @@ -16,6 +17,7 @@ class MySelectedAllergy { ? new MasterKeyModel.fromJson(json['selectedAllergy']) : null; remark = json['remark']; + remark = json['isChecked']; } Map toJson() { @@ -27,6 +29,7 @@ class MySelectedAllergy { data['selectedAllergy'] = this.selectedAllergy.toJson(); } data['remark'] = this.remark; + data['isChecked'] = this.remark; return data; } } diff --git a/lib/widgets/patients/profile/soap_update/steps_widget.dart b/lib/widgets/patients/profile/soap_update/steps_widget.dart index 56f3435e..b7e9e837 100644 --- a/lib/widgets/patients/profile/soap_update/steps_widget.dart +++ b/lib/widgets/patients/profile/soap_update/steps_widget.dart @@ -34,7 +34,7 @@ class StepsWidget extends StatelessWidget { top: index == 0 ? 15 : 30, left: 0, child: InkWell( - //onTap: () => changeCurrentTab(0), + onTap: () => changeCurrentTab(0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -84,7 +84,7 @@ class StepsWidget extends StatelessWidget { top: index == 1 ? 15 : 30, left: MediaQuery.of(context).size.width * 0.28, child: InkWell( - //onTap: () => index >= 1 ? changeCurrentTab(1) : null, + onTap: () => index >= 1 ? changeCurrentTab(1) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -187,7 +187,7 @@ class StepsWidget extends StatelessWidget { top: index == 3 ? 15 : 30, right: 0, child: InkWell( - //onTap: () => index >= 3 ? changeCurrentTab(4) : null, + onTap: () => index >= 3 ? changeCurrentTab(4) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -257,7 +257,7 @@ class StepsWidget extends StatelessWidget { top: index == 0 ? 15 : 30, right: 0, child: InkWell( - //onTap: () => changeCurrentTab(0), + onTap: () => changeCurrentTab(0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -307,7 +307,7 @@ class StepsWidget extends StatelessWidget { top: index == 1 ? 15 : 30, right: MediaQuery.of(context).size.width * 0.28, child: InkWell( - //onTap: () => index >= 2 ? changeCurrentTab(1) : null, + onTap: () => index >= 2 ? changeCurrentTab(1) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -357,7 +357,7 @@ class StepsWidget extends StatelessWidget { top: index == 2 ? 15 : 30, right: MediaQuery.of(context).size.width * 0.52, child: InkWell( - //onTap: () => index >= 3 ? changeCurrentTab(2) : null, + onTap: () => index >= 3 ? changeCurrentTab(2) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -411,7 +411,7 @@ class StepsWidget extends StatelessWidget { top: index == 3 ? 15 : 30, left: 0, child: InkWell( - //onTap: () => index >= 3 ? changeCurrentTab(4) : null, + onTap: () => index >= 3 ? changeCurrentTab(4) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart index 5d54dfa5..2d1f66ea 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart @@ -80,10 +80,15 @@ class _UpdateAllergiesWidgetState extends State { Container( child: Expanded( - child: Texts(projectViewModel.isArabic ? selectedAllergy - .selectedAllergy.nameAr : selectedAllergy - .selectedAllergy.nameEn.toUpperCase(), + child: Texts( + projectViewModel.isArabic + ? selectedAllergy.selectedAllergy.nameAr + : selectedAllergy.selectedAllergy.nameEn + .toUpperCase(), variant: "bodyText", + textDecoration: selectedAllergy.isChecked + ? null + : TextDecoration.lineThrough, bold: true, color: Colors.black), ), @@ -95,17 +100,21 @@ class _UpdateAllergiesWidgetState extends State { .selectedAllergySeverity.nameEn .toUpperCase(), variant: "bodyText", + textDecoration: selectedAllergy.isChecked + ? null + : TextDecoration.lineThrough, bold: true, color: AppGlobal.appPrimaryColor), - InkWell( - child: Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ), - onTap: () => removeAllergy(selectedAllergy), - ) - ], + if(selectedAllergy.isChecked) + InkWell( + child: Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ), + onTap: () => removeAllergy(selectedAllergy), + ) + ], ), SizedBox( height: 10, @@ -119,13 +128,22 @@ class _UpdateAllergiesWidgetState extends State { } removeAllergy(MySelectedAllergy mySelectedAllergy) { - Iterable allergy = - widget.myAllergiesList.where((element) => mySelectedAllergy == element); + List allergy = + // ignore: missing_return + widget.myAllergiesList.where((element) => + mySelectedAllergy.selectedAllergySeverity.id == + element.selectedAllergySeverity.id && + mySelectedAllergy.selectedAllergy.id == element.selectedAllergy.id + ).toList(); - if (allergy.length > 0) + if (allergy.length > 0) { setState(() { - widget.myAllergiesList.remove(allergy.first); + allergy[0].isChecked = false; }); + } + + + print(allergy); } openAllergiesList(BuildContext context) { @@ -137,14 +155,29 @@ class _UpdateAllergiesWidgetState extends State { return AddAllergies( addAllergiesFun: (MySelectedAllergy mySelectedAllergy) { setState(() { - if (!widget.myAllergiesList.contains(mySelectedAllergy)) { + List allergy = + // ignore: missing_return + widget.myAllergiesList.where((element) => + mySelectedAllergy.selectedAllergy.id == + element.selectedAllergy.id + ).toList(); + if (allergy.isEmpty) { widget.myAllergiesList.add(mySelectedAllergy); Navigator.of(context).pop(); } else { - helpers.showErrorToast(TranslationBase - .of(context) - .itemExist); + allergy.first.selectedAllergy = + mySelectedAllergy.selectedAllergy; + allergy.first.selectedAllergySeverity = + mySelectedAllergy.selectedAllergySeverity; + allergy.first.remark = mySelectedAllergy.remark; + allergy.first.isChecked = mySelectedAllergy.isChecked; + + // helpers.showErrorToast(TranslationBase + // .of(context) + // .itemExist); } + + Navigator.of(context).pop(); }); },); }); @@ -353,9 +386,10 @@ class _AddAllergiesState extends State { title: "Add".toUpperCase(), onPressed: () { MySelectedAllergy mySelectedAllergy = new MySelectedAllergy( - remark: remarkController.text, - selectedAllergy: _selectedAllergy, - selectedAllergySeverity: _selectedAllergySeverity); + remark: remarkController.text, + selectedAllergy: _selectedAllergy, + isChecked: true, + selectedAllergySeverity: _selectedAllergySeverity,); widget.addAllergiesFun(mySelectedAllergy); }, ), diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart index 98d1b7d0..ddab4734 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -131,6 +131,10 @@ class _UpdateSubjectivePageState extends State { return BaseView( onModelReady: (model) async { + widget.myAllergiesList.clear(); + widget.myHistoryList.clear(); + + GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( patientMRN: widget.patientInfo.patientMRN, episodeId: widget.patientInfo.episodeNo, @@ -165,6 +169,7 @@ class _UpdateSubjectivePageState extends State { ); MySelectedAllergy mySelectedAllergy = MySelectedAllergy( selectedAllergy: selectedAllergy, + isChecked: element.isChecked, selectedAllergySeverity: selectedAllergySeverity); if (selectedAllergy != null && selectedAllergySeverity != null) widget.myAllergiesList.add(mySelectedAllergy); diff --git a/lib/widgets/shared/Text.dart b/lib/widgets/shared/Text.dart index 9f6dfdf1..f2e663bf 100644 --- a/lib/widgets/shared/Text.dart +++ b/lib/widgets/shared/Text.dart @@ -16,11 +16,12 @@ class Texts extends StatefulWidget { final bool readMore; final String style; final bool allowExpand; + final TextDecoration textDecoration; Texts(this.text, {Key key, this.variant, this.color, this.bold, this.regular, this.medium, this.allowExpand = true, this.italic:false, this.textAlign, this.maxLength=60, - this.maxLines, this.readMore=false, this.style + this.maxLines, this.readMore=false, this.style, this.textDecoration }) : super(key: key); @override @@ -192,6 +193,7 @@ class _TextsState extends State { fontSize: _getFontSize(), letterSpacing: widget.variant=="overline" ? 1.5 : null, fontWeight: _getFontWeight(), + decoration: widget.textDecoration//TextDecoration.lineThrough ) ), if (widget.readMore && text.length > widget.maxLength && hidden) @@ -228,7 +230,8 @@ class _TextsState extends State { style: _getFontStyle().copyWith( color: HexColor('#FF0000'), fontWeight: FontWeight.w800, - fontFamily: "WorkSans" + fontFamily: "WorkSans", + ) ), ), From 3dffd337288620eeb7d328840e4c0a6afa64b43b Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 3 Jan 2021 15:01:38 +0200 Subject: [PATCH 11/11] hot fix --- .../profile/soap_update/subjective/update_allergies_widget.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart index 2d1f66ea..1d143310 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart @@ -171,13 +171,13 @@ class _UpdateAllergiesWidgetState extends State { mySelectedAllergy.selectedAllergySeverity; allergy.first.remark = mySelectedAllergy.remark; allergy.first.isChecked = mySelectedAllergy.isChecked; + Navigator.of(context).pop(); // helpers.showErrorToast(TranslationBase // .of(context) // .itemExist); } - Navigator.of(context).pop(); }); },); });