From 12b78d0a3b0c04903496c3fd906387a35bdbc455 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 23 Feb 2021 10:31:14 +0200 Subject: [PATCH 01/15] fix DA-391: return back my comment code in base app client --- lib/client/base_app_client.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 92c0735b..cd6b7137 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -83,7 +83,6 @@ class BaseAppClient { print("URL : $url"); print("Body : ${json.encode(body)}"); - var ee ={json.encode(body)}; if (await Helpers.checkConnection()) { final response = await http.post(url, From 3250f33b434aa81cd7175a26beb9025b5a37ce33 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 24 Feb 2021 16:32:50 +0200 Subject: [PATCH 02/15] jira bugs fix --- lib/config/config.dart | 3 + lib/core/model/prescription_model.dart | 7 +- .../procedure/procedure_valadate_model.dart | 51 ++++++ .../procedure_valadate_request_model.dart | 32 ++++ lib/core/service/procedure_service.dart | 18 ++ lib/core/viewModel/procedure_View_model.dart | 18 ++ .../prescription/prescription_screen.dart | 155 ++++++++++++++---- .../procedures/add-procedure-form.dart | 45 ++++- lib/screens/procedures/update-procedure.dart | 2 +- 9 files changed, 290 insertions(+), 41 deletions(-) create mode 100644 lib/core/model/procedure/procedure_valadate_model.dart create mode 100644 lib/core/model/procedure/procedure_valadate_request_model.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 6e7089c3..704dc7da 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -207,6 +207,9 @@ const POST_ADMISSION_REQUEST = const GET_ITEM_BY_MEDICINE = 'Services/DoctorApplication.svc/REST/GetItemByMedicineCode'; +const GET_PROCEDURE_VALIDATION = + 'Services/DoctorApplication.svc/REST/ValidateProcedures'; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/core/model/prescription_model.dart b/lib/core/model/prescription_model.dart index 49001673..2806f861 100644 --- a/lib/core/model/prescription_model.dart +++ b/lib/core/model/prescription_model.dart @@ -58,6 +58,7 @@ class EntityList { dynamic stopDate; dynamic uom; dynamic pharmacistRemarks; + dynamic pharmacyInervention; dynamic refill; EntityList( @@ -91,7 +92,8 @@ class EntityList { this.stopDate, this.uom, this.pharmacistRemarks, - this.refill}); + this.refill, + this.pharmacyInervention}); EntityList.fromJson(Map json) { appointmentNo = json['appointmentNo']; @@ -125,6 +127,7 @@ class EntityList { uom = json['uom']; pharmacistRemarks = json['pharmacistRemarks']; refill = json['refill']; + pharmacyInervention = json['interventionID']; } Map toJson() { @@ -160,6 +163,8 @@ class EntityList { data['uom'] = this.uom; data['pharmacistRemarks'] = this.pharmacistRemarks; data['refill'] = this.refill; + data['interventionID'] = this.pharmacyInervention; + return data; } } diff --git a/lib/core/model/procedure/procedure_valadate_model.dart b/lib/core/model/procedure/procedure_valadate_model.dart new file mode 100644 index 00000000..3a3e23cf --- /dev/null +++ b/lib/core/model/procedure/procedure_valadate_model.dart @@ -0,0 +1,51 @@ +class ProcedureValadteModel { + List entityList; + int rowcount; + dynamic statusMessage; + dynamic success; + + ProcedureValadteModel( + {this.entityList, this.rowcount, this.statusMessage, this.success}); + + ProcedureValadteModel.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']; + success = json['success']; + } + + 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; + data['success'] = this.success; + return data; + } +} + +class EntityList { + String procedureId; + List warringMessages; + + EntityList({this.procedureId, this.warringMessages}); + + EntityList.fromJson(Map json) { + procedureId = json['procedureId']; + warringMessages = json['warringMessages'].cast(); + } + + Map toJson() { + final Map data = new Map(); + data['procedureId'] = this.procedureId; + data['warringMessages'] = this.warringMessages; + return data; + } +} diff --git a/lib/core/model/procedure/procedure_valadate_request_model.dart b/lib/core/model/procedure/procedure_valadate_request_model.dart new file mode 100644 index 00000000..0b872b93 --- /dev/null +++ b/lib/core/model/procedure/procedure_valadate_request_model.dart @@ -0,0 +1,32 @@ +class ProcedureValadteRequestModel { + String vidaAuthTokenID; + int patientMRN; + int appointmentNo; + int episodeID; + List procedure; + + ProcedureValadteRequestModel( + {this.vidaAuthTokenID, + this.patientMRN, + this.appointmentNo, + this.episodeID, + this.procedure}); + + ProcedureValadteRequestModel.fromJson(Map json) { + vidaAuthTokenID = json['VidaAuthTokenID']; + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + procedure = json['Procedure'].cast(); + } + + Map toJson() { + final Map data = new Map(); + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['Procedure'] = this.procedure; + return data; + } +} diff --git a/lib/core/service/procedure_service.dart b/lib/core/service/procedure_service.dart index 98b1f36d..10b66d94 100644 --- a/lib/core/service/procedure_service.dart +++ b/lib/core/service/procedure_service.dart @@ -5,6 +5,8 @@ import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_re import 'package:doctor_app_flutter/core/model/procedure/get_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; @@ -13,6 +15,8 @@ import 'package:flutter/foundation.dart'; class ProcedureService extends BaseService { List _procedureList = List(); List get procedureList => _procedureList; + List _valadteProcedureList = List(); + List get valadteProcedureList => _valadteProcedureList; List _categoriesList = List(); List get categoriesList => _categoriesList; List procedureslist = List(); @@ -118,4 +122,18 @@ class ProcedureService extends BaseService { super.error = error; }, body: updateProcedureRequestModel.toJson()); } + + Future valadteProcedure( + ProcedureValadteRequestModel procedureValadteRequestModel) async { + hasError = false; + _valadteProcedureList.clear(); + await baseAppClient.post(GET_PROCEDURE_VALIDATION, + onSuccess: (dynamic response, int statusCode) { + _valadteProcedureList.add( + ProcedureValadteModel.fromJson(response['ValidateProcedureList'])); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: procedureValadteRequestModel.toJson()); + } } diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index a753052c..199fa308 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -3,6 +3,8 @@ import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dar import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; import 'package:doctor_app_flutter/core/service/procedure_service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; @@ -13,6 +15,8 @@ class ProcedureViewModel extends BaseViewModel { ProcedureService _procedureService = locator(); List get procedureList => _procedureService.procedureList; + List get valadteProcedureList => + _procedureService.valadteProcedureList; List get categoriesList => _procedureService.categoriesList; List get categoryList => _procedureService.categoryList; @@ -69,6 +73,20 @@ class ProcedureViewModel extends BaseViewModel { } } + Future valadteProcedure( + ProcedureValadteRequestModel procedureValadteRequestModel) async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _procedureService.valadteProcedure(procedureValadteRequestModel); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + Future updateProcedure( {UpdateProcedureRequestModel updateProcedureRequestModel, int mrn}) async { diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 4800c361..9f2f9aa1 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -10,6 +10,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/network_base_view.dart'; import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; class NewPrescriptionScreen extends StatefulWidget { @override @@ -208,30 +209,42 @@ class _NewPrescriptionScreenState extends State { 0.09, child: Column( children: [ - AppText( - (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) != - null - ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn).year) - .toString() - : DateTime.now() - .year) - .toString(), - color: Colors - .green, - fontSize: - 13.5, - ), - AppText( - Helpers.getMonth(model.prescriptionList[0].entityList[index].createdOn != - null - ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) - .month) - : DateTime.now() - .month) - .toUpperCase(), - color: Colors - .green, - ), + // AppText( + // (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) != + // null + // ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn).year) + // .toString() + // : DateTime.now() + // .year) + // .toString(), + // color: Colors + // .green, + // fontSize: + // 13.5, + // ), + // AppText( + // Helpers.getMonth(model.prescriptionList[0].entityList[index].createdOn != + // null + // ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) + // .month) + // : DateTime.now() + // .month) + // .toUpperCase(), + // color: Colors + // .green, + // ), + // AppText( + // DateTime.parse(model + // .prescriptionList[ + // 0] + // .entityList[ + // index] + // .createdOn) + // .day + // .toString(), + // color: Colors + // .green, + // ), AppText( DateTime.parse(model .prescriptionList[ @@ -239,7 +252,6 @@ class _NewPrescriptionScreenState extends State { .entityList[ index] .createdOn) - .day .toString(), color: Colors .green, @@ -273,14 +285,10 @@ class _NewPrescriptionScreenState extends State { Expanded( child: AppText( - model - .prescriptionList[ - 0] - .entityList[ - index] - .startDate - .replaceAll("-", - "/"), + Helpers.getDateFormatted(DateTime.parse(model + .prescriptionList[0] + .entityList[index] + .startDate)), fontSize: 12.0, ), @@ -381,6 +389,87 @@ class _NewPrescriptionScreenState extends State { ), ], ), + Row( + children: [ + AppText( + 'UOM: ', + fontWeight: + FontWeight + .w700, + fontSize: + 17.0, + ), + Expanded( + child: + RichText( + maxLines: + 3, + overflow: + TextOverflow.ellipsis, + strutStyle: + StrutStyle(fontSize: 12.0), + text: TextSpan( + style: + TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index].uom), + ), + ), + ], + ), + Row( + children: [ + AppText( + 'BOX Quantity: ', + fontWeight: + FontWeight + .w700, + fontSize: + 17.0, + ), + Expanded( + child: + RichText( + maxLines: + 3, + overflow: + TextOverflow.ellipsis, + strutStyle: + StrutStyle(fontSize: 12.0), + text: TextSpan( + style: + TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index].quantity.toString() == null ? "" : model.prescriptionList[0].entityList[index].quantity.toString()), + ), + ), + ], + ), + Row( + children: [ + AppText( + 'BOX Quantity: ', + fontWeight: + FontWeight + .w700, + fontSize: + 17.0, + ), + Expanded( + child: + RichText( + maxLines: + 3, + overflow: + TextOverflow.ellipsis, + strutStyle: + StrutStyle(fontSize: 12.0), + text: TextSpan( + style: + TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index].pharmacyInervention.toString() == null ? "" : model.prescriptionList[0].entityList[index].pharmacyInervention.toString()), + ), + ), + ], + ), SizedBox( height: 5.0), diff --git a/lib/screens/procedures/add-procedure-form.dart b/lib/screens/procedures/add-procedure-form.dart index 346de2db..071b4000 100644 --- a/lib/screens/procedures/add-procedure-form.dart +++ b/lib/screens/procedures/add-procedure-form.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -18,6 +19,16 @@ import 'package:flutter/material.dart'; import 'entity_list_checkbox_search_widget.dart'; +valdateProcedure(ProcedureViewModel model, PatiantInformtion patient, + List entityList) async { + ProcedureValadteRequestModel procedureValadteRequestModel = + new ProcedureValadteRequestModel(); + + procedureValadteRequestModel.patientMRN = patient.appointmentNo; + procedureValadteRequestModel.episodeID = patient.episodeNo; + procedureValadteRequestModel.appointmentNo = patient.appointmentNo; +} + postProcedure( {ProcedureViewModel model, String remarks, @@ -25,6 +36,12 @@ postProcedure( PatiantInformtion patient, List entityList}) async { PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); + ProcedureValadteRequestModel procedureValadteRequestModel = + new ProcedureValadteRequestModel(); + procedureValadteRequestModel.patientMRN = patient.patientMRN; + procedureValadteRequestModel.episodeID = patient.episodeNo; + procedureValadteRequestModel.appointmentNo = patient.appointmentNo; + List controlsProcedure = List(); postProcedureReqModel.appointmentNo = patient.appointmentNo; @@ -33,11 +50,12 @@ postProcedure( postProcedureReqModel.patientMRN = patient.patientMRN; entityList.forEach((element) { + procedureValadteRequestModel.procedure = [element.procedureId]; List controls = List(); controls.add( Controls( code: "remarks", - controlValue: element.remarks.isNotEmpty ? element.remarks : ""), + controlValue: element.remarks != null ? element.remarks : ""), ); controls.add( Controls(code: "ordertype", controlValue: element.type), @@ -49,13 +67,28 @@ postProcedure( }); postProcedureReqModel.procedures = controlsProcedure; - await model.postProcedure(postProcedureReqModel, patient.patientMRN); + await model.valadteProcedure(procedureValadteRequestModel); + if (model.state == ViewState.Idle) { + if (model.valadteProcedureList[0].entityList.length == 0) { + await model.postProcedure(postProcedureReqModel, patient.patientMRN); - if (model.state == ViewState.ErrorLocal) { + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + model.getProcedure(mrn: patient.patientMRN); + } else if (model.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast('procedure has been added'); + } + } else { + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + model.getProcedure(mrn: patient.patientMRN); + } else if (model.state == ViewState.Idle) { + helpers.showErrorToast( + model.valadteProcedureList[0].entityList[0].warringMessages); + } + } + } else { helpers.showErrorToast(model.error); - model.getProcedure(mrn: patient.patientMRN); - } else if (model.state == ViewState.Idle) { - DrAppToastMsg.showSuccesToast('procedure has been added'); } } diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index c6af1358..756696fe 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -324,7 +324,7 @@ class _UpdateProcedureWidgetState extends State { entityList.isNotEmpty ? entityList.forEach((element) { controlsProcedure.procedure = element.procedureId; - controlsProcedure.category = element.categoryID; + controlsProcedure.category = "0" + element.categoryID; controlsProcedure.controls = controls; }) : controlsProcedure.procedure = procedureId; From 066ac94d4a9bc38f135e92a0f72642f0d91ec339 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 24 Feb 2021 16:54:34 +0200 Subject: [PATCH 03/15] jira bugs --- .../prescription/prescription_screen.dart | 74 +++++++++---------- lib/util/helpers.dart | 8 ++ 2 files changed, 45 insertions(+), 37 deletions(-) diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 9f2f9aa1..9e3a5f04 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -209,42 +209,30 @@ class _NewPrescriptionScreenState extends State { 0.09, child: Column( children: [ - // AppText( - // (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) != - // null - // ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn).year) - // .toString() - // : DateTime.now() - // .year) - // .toString(), - // color: Colors - // .green, - // fontSize: - // 13.5, - // ), - // AppText( - // Helpers.getMonth(model.prescriptionList[0].entityList[index].createdOn != - // null - // ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) - // .month) - // : DateTime.now() - // .month) - // .toUpperCase(), - // color: Colors - // .green, - // ), - // AppText( - // DateTime.parse(model - // .prescriptionList[ - // 0] - // .entityList[ - // index] - // .createdOn) - // .day - // .toString(), - // color: Colors - // .green, - // ), + AppText( + (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) != + null + ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn).year) + .toString() + : DateTime.now() + .year) + .toString(), + color: Colors + .green, + fontSize: + 13.5, + ), + AppText( + Helpers.getMonth(model.prescriptionList[0].entityList[index].createdOn != + null + ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) + .month) + : DateTime.now() + .month) + .toUpperCase(), + color: Colors + .green, + ), AppText( DateTime.parse(model .prescriptionList[ @@ -252,6 +240,18 @@ class _NewPrescriptionScreenState extends State { .entityList[ index] .createdOn) + .day + .toString(), + color: Colors + .green, + ), + AppText( + Helpers.getTimeFormated(DateTime.parse(model + .prescriptionList[ + 0] + .entityList[ + index] + .createdOn)) .toString(), color: Colors .green, @@ -446,7 +446,7 @@ class _NewPrescriptionScreenState extends State { Row( children: [ AppText( - 'BOX Quantity: ', + 'pharmacy Intervention ', fontWeight: FontWeight .w700, diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 09bc8f50..4f9543c1 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -303,6 +303,14 @@ class Helpers { return ""; } + static String getTimeFormated(DateTime dateTime) { + print(dateTime); + if (dateTime != null) + return dateTime.hour.toString() + ":" + dateTime.minute.toString(); + else + return ""; + } + /* *@author: Mohammad Aljammal *@Date:26/5/2020 From bedf6e7bbefa966e3c24af8c83a485fab34ee54d Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 25 Feb 2021 10:31:47 +0200 Subject: [PATCH 04/15] fix DA-346 --- lib/config/localized_values.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 882de2e4..6bdca5c5 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -174,8 +174,8 @@ const Map> localizedValues = { 'ar': 'الرجاء ادخال الرمز' }, 'youDon\'tHaveAnyPatient': { - 'en': 'You don\'t have any patient', - 'ar': 'ليس لديك اي مرضى' + 'en': 'No data found for the selected search criteria', + 'ar': 'لا توجد بيانات لمعايير البحث المختارة' }, 'age': {'en': 'Age', 'ar': 'العمر'}, 'nationality': {'en': 'Nationality', 'ar': 'الجنسية'}, From eb88bea880fb13e562d8a099e925fe13cc247a69 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 25 Feb 2021 16:49:53 +0200 Subject: [PATCH 05/15] jira bug --- lib/screens/procedures/update-procedure.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index 756696fe..aebf2797 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -259,6 +259,11 @@ class _UpdateProcedureWidgetState extends State { .updateProcedure .toUpperCase(), onPressed: () { + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + "Fill the mandatory procedure details"); + return; + } Navigator.pop(context); updateProcedure( orderNo: widget.orderNo, From dc941b709ff573a7f73cbc29d098a929e3cc8ffe Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 25 Feb 2021 22:02:05 +0200 Subject: [PATCH 06/15] DA-396 --- .../model/get_medication_response_model.dart | 14 +++--- .../prescription/add_prescription_form.dart | 44 ++++++++++++------- .../update_prescription_form.dart | 10 ++--- 3 files changed, 42 insertions(+), 26 deletions(-) diff --git a/lib/core/model/get_medication_response_model.dart b/lib/core/model/get_medication_response_model.dart index f9df77a3..1f9597f5 100644 --- a/lib/core/model/get_medication_response_model.dart +++ b/lib/core/model/get_medication_response_model.dart @@ -5,14 +5,16 @@ class GetMedicationResponseModel { String keywords; dynamic price; dynamic quantity; + bool isNarcotic; GetMedicationResponseModel( {this.description, - this.genericName, - this.itemId, - this.keywords, - this.price, - this.quantity}); + this.genericName, + this.itemId, + this.keywords, + this.price, + this.quantity, + this.isNarcotic}); GetMedicationResponseModel.fromJson(Map json) { description = json['Description']; @@ -21,6 +23,7 @@ class GetMedicationResponseModel { keywords = json['Keywords']; price = json['Price']; quantity = json['Quantity']; + isNarcotic = json['isNarcotic']; } Map toJson() { @@ -31,6 +34,7 @@ class GetMedicationResponseModel { data['Keywords'] = this.keywords; data['Price'] = this.price; data['Quantity'] = this.quantity; + data['isNarcotic'] = this.isNarcotic; return data; } } diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 5ec6e240..b3398cb3 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -361,8 +361,8 @@ class _PrescriptionFormWidgetState extends State { 0.550, child: TextFields( inputFormatters: [ - // LengthLimitingTextInputFormatter( - // 4), + LengthLimitingTextInputFormatter( + 5), // WhitelistingTextInputFormatter // .digitsOnly ], @@ -378,9 +378,9 @@ class _PrescriptionFormWidgetState extends State { setState(() { strengthChar = value.length; }); - if (strengthChar >= 4) { + if (strengthChar >= 5) { DrAppToastMsg.showErrorToast( - "Only 4 Digits allowed for strength"); + "Only 5 Digits allowed for strength"); } }, // validator: (value) { @@ -757,6 +757,14 @@ class _PrescriptionFormWidgetState extends State { // formKey.currentState.save(); // Navigator.pop(context); // openDrugToDrug(); + if (_selectedMedication + .isNarcotic == + true) { + DrAppToastMsg.showErrorToast( + "Narcotic medicine can only be prescribed from VIDA"); + Navigator.pop(context); + return; + } if (route == null || frequency == null || doseTime == null || @@ -775,10 +783,10 @@ class _PrescriptionFormWidgetState extends State { return; } if (double.parse( - strengthController.text) == + strengthController.text) < 0.0) { DrAppToastMsg.showErrorToast( - "Streangth can't be zero"); + "strength can't be zero"); return; } @@ -794,16 +802,20 @@ class _PrescriptionFormWidgetState extends State { // .join(','); postProcedure( icdCode: model - .patientAssessmentList[ - 0] - .icdCode10ID - .isEmpty - ? "test" - : model - .patientAssessmentList[ - 0] - .icdCode10ID - .toString(), + .patientAssessmentList + .isNotEmpty + ? model + .patientAssessmentList[ + 0] + .icdCode10ID + .isEmpty + ? "test" + : model + .patientAssessmentList[ + 0] + .icdCode10ID + .toString() + : "TEST", // icdCode: model // .patientAssessmentList // .map((value) => value diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index 8ed5c79b..3420783e 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -256,7 +256,7 @@ class _UpdatePrescriptionFormState extends State { child: TextFields( inputFormatters: [ LengthLimitingTextInputFormatter( - 4), + 5), // WhitelistingTextInputFormatter // .digitsOnly ], @@ -272,9 +272,9 @@ class _UpdatePrescriptionFormState extends State { setState(() { strengthChar = value.length; }); - if (strengthChar >= 4) { + if (strengthChar >= 5) { DrAppToastMsg.showErrorToast( - "Only 4 Digits allowed for strength"); + "Only 5 Digits allowed for strength"); } }, // validator: (value) { @@ -715,14 +715,14 @@ class _UpdatePrescriptionFormState extends State { .text) == 0.0) { DrAppToastMsg.showErrorToast( - "Streangth can't be zero"); + "strength can't be zero"); return; } if (strengthController .text.length > 4) { DrAppToastMsg.showErrorToast( - "Streangth can't be zero"); + "strength can't be more then 4 digits "); return; } updatePrescription( From bfe73ebe1df6af781dcacb1f382e4790fa9efa8a Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Fri, 26 Feb 2021 01:09:33 +0200 Subject: [PATCH 07/15] DA-185 --- lib/core/viewModel/medicine_view_model.dart | 9 ++ lib/core/viewModel/procedure_View_model.dart | 2 +- .../update_prescription_form.dart | 83 ++++++++++--------- .../entity_list_checkbox_search_widget.dart | 5 ++ lib/screens/procedures/update-procedure.dart | 14 +--- lib/util/dr_app_toast_msg.dart | 2 +- 6 files changed, 66 insertions(+), 49 deletions(-) diff --git a/lib/core/viewModel/medicine_view_model.dart b/lib/core/viewModel/medicine_view_model.dart index ecb0a48a..9f446f46 100644 --- a/lib/core/viewModel/medicine_view_model.dart +++ b/lib/core/viewModel/medicine_view_model.dart @@ -167,4 +167,13 @@ class MedicineViewModel extends BaseViewModel { } return null; } + + dynamic getLookupByIdFilter(List list, String id) { + for (int i = 0; i < list.length; i++) { + if (list[i]['parameterCode'].toString() == id) { + return list[i]; + } + } + return null; + } } diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 199fa308..6af34f4d 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -99,6 +99,6 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); - await getProcedure(mrn: mrn); + //await getProcedure(mrn: mrn); } } diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index 3420783e..50406338 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -79,6 +79,7 @@ class _UpdatePrescriptionFormState extends State { @override void initState() { super.initState(); + strengthController.text = widget.doseStreangth; remarksController.text = widget.remarks; indicationList = List(); @@ -121,14 +122,16 @@ class _UpdatePrescriptionFormState extends State { await model.getMedicationRoute(); await model.getMedicationFrequency(); await model.getMedicationDoseTime(); + await model.getItem(itemID: widget.drugId); //await model.getMedicationIndications(); - route = model.getLookupById(model.medicationRouteList, widget.route); + route = model.getLookupByIdFilter( + model.itemMedicineListRoute, widget.route); doseTime = - model.getLookupById(model.medicationDoseTimeList, widget.dose); + model.getLookupByIdFilter(model.itemMedicineList, widget.dose); updatedDuration = model.getLookupById( model.medicationDurationList, widget.duration); - units = model.getLookupById( - model.medicationStrengthList, widget.doseUnit); + units = model.getLookupByIdFilter( + model.itemMedicineListUnit, widget.doseUnit); frequencyUpdate = model.getLookupById( model.medicationFrequencyList, widget.frequency); }, @@ -298,7 +301,7 @@ class _UpdatePrescriptionFormState extends State { 0.3700, child: InkWell( onTap: - model.medicationStrengthList != + model.itemMedicineListUnit != null ? () { Helpers.hideKeyboard( @@ -307,11 +310,11 @@ class _UpdatePrescriptionFormState extends State { dialog = ListSelectDialog( list: model - .medicationStrengthList, + .itemMedicineListUnit, attributeName: - 'nameEn', + 'description', attributeValueId: - 'id', + 'parameterCode', okText: TranslationBase.of( context) @@ -341,7 +344,8 @@ class _UpdatePrescriptionFormState extends State { textFieldSelectorDecoration( 'UNIT Type', units != null - ? units['nameEn'] + ? units[ + 'description'] : null, true), enabled: false, @@ -359,15 +363,17 @@ class _UpdatePrescriptionFormState extends State { MediaQuery.of(context).size.height * 0.070, child: InkWell( - onTap: model.medicationRouteList != null + onTap: model.itemMedicineListRoute != + null ? () { Helpers.hideKeyboard(context); ListSelectDialog dialog = ListSelectDialog( - list: - model.medicationRouteList, - attributeName: 'nameEn', - attributeValueId: 'id', + list: model + .itemMedicineListRoute, + attributeName: 'description', + attributeValueId: + 'parameterCode', okText: TranslationBase.of( context) .ok, @@ -395,7 +401,7 @@ class _UpdatePrescriptionFormState extends State { textFieldSelectorDecoration( 'Route', route != null - ? route['nameEn'] + ? route['description'] : null, true), enabled: false, @@ -410,16 +416,15 @@ class _UpdatePrescriptionFormState extends State { MediaQuery.of(context).size.height * 0.070, child: InkWell( - onTap: model.medicationDoseTimeList != - null + onTap: model.itemMedicineList != null ? () { Helpers.hideKeyboard(context); ListSelectDialog dialog = ListSelectDialog( - list: model - .medicationDoseTimeList, - attributeName: 'nameEn', - attributeValueId: 'id', + list: model.itemMedicineList, + attributeName: 'description', + attributeValueId: + 'parameterCode', okText: TranslationBase.of( context) .ok, @@ -445,7 +450,7 @@ class _UpdatePrescriptionFormState extends State { TranslationBase.of(context) .doseTime, doseTime != null - ? doseTime['nameEn'] + ? doseTime['description'] : null, true), enabled: false, @@ -735,7 +740,8 @@ class _UpdatePrescriptionFormState extends State { : widget .doseStreangth, newUnit: units != null - ? units['id'].toString() + ? units['parameterCode'] + .toString() : widget.doseUnit, doseUnit: widget.doseUnit, doseStreangth: @@ -747,24 +753,27 @@ class _UpdatePrescriptionFormState extends State { routeId: widget.route, patient: widget.patient, model: widget.model, - newDuration: updatedDuration != - null - ? updatedDuration['id'] - .toString() - : widget.duration, + newDuration: + updatedDuration != null + ? updatedDuration['id'] + .toString() + : widget.duration, drugId: widget.drugId, - remarks: - remarksController.text, + remarks: remarksController + .text, route: route != null - ? route['id'].toString() - : widget.route, - frequency: frequencyUpdate != - null - ? frequencyUpdate['id'] + ? route[ + 'parameterCode'] .toString() - : widget.frequency, + : widget.route, + frequency: + frequencyUpdate != + null + ? frequencyUpdate['id'] + .toString() + : widget.frequency, dose: doseTime != null - ? doseTime['id'] + ? doseTime['parameterCode'] .toString() : widget.dose, enteredRemarks: diff --git a/lib/screens/procedures/entity_list_checkbox_search_widget.dart b/lib/screens/procedures/entity_list_checkbox_search_widget.dart index f68b88cd..1c05af7e 100644 --- a/lib/screens/procedures/entity_list_checkbox_search_widget.dart +++ b/lib/screens/procedures/entity_list_checkbox_search_widget.dart @@ -41,6 +41,9 @@ class EntityListCheckboxSearchWidget extends StatefulWidget { class _EntityListCheckboxSearchWidgetState extends State { int selectedType = 1; + int typeUrgent; + int typeRegular; + setSelectedType(int val) { setState(() { selectedType = val; @@ -136,6 +139,7 @@ class _EntityListCheckboxSearchWidgetState historyInfo.type = setSelectedType(value) .toString(); + historyInfo.type = value.toString(); }, @@ -149,6 +153,7 @@ class _EntityListCheckboxSearchWidgetState historyInfo.type = setSelectedType(value) .toString(); + historyInfo.type = value.toString(); }, diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index aebf2797..445203a4 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -324,17 +324,11 @@ class _UpdateProcedureWidgetState extends State { controls.add( Controls(code: "ordertype", controlValue: '1'), ); - }); - entityList.isNotEmpty - ? entityList.forEach((element) { - controlsProcedure.procedure = element.procedureId; - controlsProcedure.category = "0" + element.categoryID; - controlsProcedure.controls = controls; - }) - : controlsProcedure.procedure = procedureId; - controlsProcedure.category = categorieId; - controlsProcedure.controls = controls; + controlsProcedure.procedure = element.procedureId; + controlsProcedure.category = element.categoryID; + controlsProcedure.controls = controls; + }); // controlsProcedure.add(ProcedureDetail( // category: categorieId, procedure: procedureId, controls: controls)); updateProcedureReqModel.procedureDetail = controlsProcedure; diff --git a/lib/util/dr_app_toast_msg.dart b/lib/util/dr_app_toast_msg.dart index e4cfa65b..bf91a11f 100644 --- a/lib/util/dr_app_toast_msg.dart +++ b/lib/util/dr_app_toast_msg.dart @@ -29,7 +29,7 @@ class DrAppToastMsg { icon: ICON.CLOSE, fontSize: 16, imageSize: 35, - timeInSeconds: 9000, + timeInSeconds: 912, textColor: Colors.white); } From 7063e924decdf1463c0b100fa8576a18bc8e8c58 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sat, 27 Feb 2021 20:56:55 +0200 Subject: [PATCH 08/15] update prescription --- .../update_prescription_form.dart | 83 +++++++++---------- 1 file changed, 38 insertions(+), 45 deletions(-) diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index 50406338..3c94aecb 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -122,16 +122,15 @@ class _UpdatePrescriptionFormState extends State { await model.getMedicationRoute(); await model.getMedicationFrequency(); await model.getMedicationDoseTime(); - await model.getItem(itemID: widget.drugId); + //await model.getItem(itemID: widget.drugId); //await model.getMedicationIndications(); - route = model.getLookupByIdFilter( - model.itemMedicineListRoute, widget.route); + route = model.getLookupById(model.medicationRouteList, widget.route); doseTime = - model.getLookupByIdFilter(model.itemMedicineList, widget.dose); + model.getLookupById(model.medicationDoseTimeList, widget.dose); updatedDuration = model.getLookupById( model.medicationDurationList, widget.duration); - units = model.getLookupByIdFilter( - model.itemMedicineListUnit, widget.doseUnit); + units = model.getLookupById( + model.medicationStrengthList, widget.doseUnit); frequencyUpdate = model.getLookupById( model.medicationFrequencyList, widget.frequency); }, @@ -301,7 +300,7 @@ class _UpdatePrescriptionFormState extends State { 0.3700, child: InkWell( onTap: - model.itemMedicineListUnit != + model.medicationStrengthList != null ? () { Helpers.hideKeyboard( @@ -310,11 +309,11 @@ class _UpdatePrescriptionFormState extends State { dialog = ListSelectDialog( list: model - .itemMedicineListUnit, + .medicationStrengthList, attributeName: - 'description', + 'nameEn', attributeValueId: - 'parameterCode', + 'id', okText: TranslationBase.of( context) @@ -344,8 +343,7 @@ class _UpdatePrescriptionFormState extends State { textFieldSelectorDecoration( 'UNIT Type', units != null - ? units[ - 'description'] + ? units['nameEn'] : null, true), enabled: false, @@ -363,17 +361,15 @@ class _UpdatePrescriptionFormState extends State { MediaQuery.of(context).size.height * 0.070, child: InkWell( - onTap: model.itemMedicineListRoute != - null + onTap: model.medicationRouteList != null ? () { Helpers.hideKeyboard(context); ListSelectDialog dialog = ListSelectDialog( - list: model - .itemMedicineListRoute, - attributeName: 'description', - attributeValueId: - 'parameterCode', + list: + model.medicationRouteList, + attributeName: 'nameEn', + attributeValueId: 'id', okText: TranslationBase.of( context) .ok, @@ -401,7 +397,7 @@ class _UpdatePrescriptionFormState extends State { textFieldSelectorDecoration( 'Route', route != null - ? route['description'] + ? route['nameEn'] : null, true), enabled: false, @@ -416,15 +412,16 @@ class _UpdatePrescriptionFormState extends State { MediaQuery.of(context).size.height * 0.070, child: InkWell( - onTap: model.itemMedicineList != null + onTap: model.medicationDoseTimeList != + null ? () { Helpers.hideKeyboard(context); ListSelectDialog dialog = ListSelectDialog( - list: model.itemMedicineList, - attributeName: 'description', - attributeValueId: - 'parameterCode', + list: model + .medicationDoseTimeList, + attributeName: 'nameEn', + attributeValueId: 'id', okText: TranslationBase.of( context) .ok, @@ -450,7 +447,7 @@ class _UpdatePrescriptionFormState extends State { TranslationBase.of(context) .doseTime, doseTime != null - ? doseTime['description'] + ? doseTime['nameEn'] : null, true), enabled: false, @@ -740,8 +737,7 @@ class _UpdatePrescriptionFormState extends State { : widget .doseStreangth, newUnit: units != null - ? units['parameterCode'] - .toString() + ? units['id'].toString() : widget.doseUnit, doseUnit: widget.doseUnit, doseStreangth: @@ -753,27 +749,24 @@ class _UpdatePrescriptionFormState extends State { routeId: widget.route, patient: widget.patient, model: widget.model, - newDuration: - updatedDuration != null - ? updatedDuration['id'] - .toString() - : widget.duration, + newDuration: updatedDuration != + null + ? updatedDuration['id'] + .toString() + : widget.duration, drugId: widget.drugId, - remarks: remarksController - .text, + remarks: + remarksController.text, route: route != null - ? route[ - 'parameterCode'] - .toString() + ? route['id'].toString() : widget.route, - frequency: - frequencyUpdate != - null - ? frequencyUpdate['id'] - .toString() - : widget.frequency, + frequency: frequencyUpdate != + null + ? frequencyUpdate['id'] + .toString() + : widget.frequency, dose: doseTime != null - ? doseTime['parameterCode'] + ? doseTime['id'] .toString() : widget.dose, enteredRemarks: From 8aeb7495966913afd9c95a409f2153ab54f53c16 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sat, 27 Feb 2021 22:06:56 +0200 Subject: [PATCH 09/15] prescription update --- lib/screens/prescription/prescription_screen.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 9e3a5f04..ab152bf1 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -206,7 +206,7 @@ class _NewPrescriptionScreenState extends State { context) .size .width * - 0.09, + 0.1, child: Column( children: [ AppText( @@ -290,7 +290,7 @@ class _NewPrescriptionScreenState extends State { .entityList[index] .startDate)), fontSize: - 12.0, + 13.5, ), ), SizedBox( @@ -465,7 +465,7 @@ class _NewPrescriptionScreenState extends State { text: TextSpan( style: TextStyle(color: Colors.black), - text: model.prescriptionList[0].entityList[index].pharmacyInervention.toString() == null ? "" : model.prescriptionList[0].entityList[index].pharmacyInervention.toString()), + text: model.prescriptionList[0].entityList[index].pharmacyInervention == null ? "" : model.prescriptionList[0].entityList[index].pharmacyInervention.toString()), ), ), ], From 4e01bcb75892a26579a77042f06daab9e4d86d24 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 28 Feb 2021 13:28:25 +0200 Subject: [PATCH 10/15] Prescription update filters --- .../prescription/add_prescription_form.dart | 5 ++ .../update_prescription_form.dart | 65 ++++++++++--------- 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index b3398cb3..81e85dfa 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -424,6 +424,8 @@ class _PrescriptionFormWidgetState extends State { (selectedValue) { setState(() { units = selectedValue; + units['isDefault'] = + true; }); }, ); @@ -472,6 +474,7 @@ class _PrescriptionFormWidgetState extends State { okFunction: (selectedValue) { setState(() { route = selectedValue; + route['isDefault'] = true; }); if (route == null) { helpers.showErrorToast( @@ -519,6 +522,8 @@ class _PrescriptionFormWidgetState extends State { okFunction: (selectedValue) { setState(() { frequency = selectedValue; + frequency['isDefault'] = + true; }); }, ); diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index 3c94aecb..67723cde 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -122,15 +122,16 @@ class _UpdatePrescriptionFormState extends State { await model.getMedicationRoute(); await model.getMedicationFrequency(); await model.getMedicationDoseTime(); - //await model.getItem(itemID: widget.drugId); + await model.getItem(itemID: widget.drugId); //await model.getMedicationIndications(); - route = model.getLookupById(model.medicationRouteList, widget.route); + route = model.getLookupByIdFilter( + model.itemMedicineListRoute, widget.route); doseTime = model.getLookupById(model.medicationDoseTimeList, widget.dose); updatedDuration = model.getLookupById( model.medicationDurationList, widget.duration); - units = model.getLookupById( - model.medicationStrengthList, widget.doseUnit); + units = model.getLookupByIdFilter( + model.itemMedicineListUnit, widget.doseUnit); frequencyUpdate = model.getLookupById( model.medicationFrequencyList, widget.frequency); }, @@ -300,7 +301,7 @@ class _UpdatePrescriptionFormState extends State { 0.3700, child: InkWell( onTap: - model.medicationStrengthList != + model.itemMedicineListUnit != null ? () { Helpers.hideKeyboard( @@ -309,11 +310,11 @@ class _UpdatePrescriptionFormState extends State { dialog = ListSelectDialog( list: model - .medicationStrengthList, + .itemMedicineListUnit, attributeName: - 'nameEn', + 'description', attributeValueId: - 'id', + 'parameterCode', okText: TranslationBase.of( context) @@ -343,7 +344,8 @@ class _UpdatePrescriptionFormState extends State { textFieldSelectorDecoration( 'UNIT Type', units != null - ? units['nameEn'] + ? units[ + 'description'] : null, true), enabled: false, @@ -361,15 +363,17 @@ class _UpdatePrescriptionFormState extends State { MediaQuery.of(context).size.height * 0.070, child: InkWell( - onTap: model.medicationRouteList != null + onTap: model.itemMedicineListRoute != + null ? () { Helpers.hideKeyboard(context); ListSelectDialog dialog = ListSelectDialog( - list: - model.medicationRouteList, - attributeName: 'nameEn', - attributeValueId: 'id', + list: model + .itemMedicineListRoute, + attributeName: 'description', + attributeValueId: + 'parameterCode', okText: TranslationBase.of( context) .ok, @@ -397,7 +401,7 @@ class _UpdatePrescriptionFormState extends State { textFieldSelectorDecoration( 'Route', route != null - ? route['nameEn'] + ? route['description'] : null, true), enabled: false, @@ -737,7 +741,8 @@ class _UpdatePrescriptionFormState extends State { : widget .doseStreangth, newUnit: units != null - ? units['id'].toString() + ? units['parameterCode'] + .toString() : widget.doseUnit, doseUnit: widget.doseUnit, doseStreangth: @@ -749,22 +754,24 @@ class _UpdatePrescriptionFormState extends State { routeId: widget.route, patient: widget.patient, model: widget.model, - newDuration: updatedDuration != - null - ? updatedDuration['id'] - .toString() - : widget.duration, + newDuration: + updatedDuration != null + ? updatedDuration['id'] + .toString() + : widget.duration, drugId: widget.drugId, - remarks: - remarksController.text, + remarks: remarksController + .text, route: route != null - ? route['id'].toString() - : widget.route, - frequency: frequencyUpdate != - null - ? frequencyUpdate['id'] + ? route['parameterCode'] .toString() - : widget.frequency, + : widget.route, + frequency: + frequencyUpdate != null + ? frequencyUpdate[ + 'id'] + .toString() + : widget.frequency, dose: doseTime != null ? doseTime['id'] .toString() From 6ae8cf80481730ab33d245ad94d6f295adf1378c Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 1 Mar 2021 16:38:44 +0200 Subject: [PATCH 11/15] procedure updates --- lib/core/service/procedure_service.dart | 2 +- .../procedures/add-procedure-form.dart | 81 ++++--- .../entity_list_checkbox_search_widget.dart | 6 +- .../entity_list_procedure_widget.dart | 171 ++++++++++++++ lib/screens/procedures/procedure_screen.dart | 101 +++++---- lib/screens/procedures/update-procedure.dart | 212 +++++++++++------- 6 files changed, 420 insertions(+), 153 deletions(-) create mode 100644 lib/screens/procedures/entity_list_procedure_widget.dart diff --git a/lib/core/service/procedure_service.dart b/lib/core/service/procedure_service.dart index 10b66d94..f61166b9 100644 --- a/lib/core/service/procedure_service.dart +++ b/lib/core/service/procedure_service.dart @@ -84,7 +84,7 @@ class ProcedureService extends BaseService { pageIndex: 0, clinicId: 0, pageSize: 0, - category: categoryID, + category: categoryID ?? "01", ); hasError = false; _categoriesList.clear(); diff --git a/lib/screens/procedures/add-procedure-form.dart b/lib/screens/procedures/add-procedure-form.dart index 071b4000..d6c1b419 100644 --- a/lib/screens/procedures/add-procedure-form.dart +++ b/lib/screens/procedures/add-procedure-form.dart @@ -18,6 +18,7 @@ import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; import 'entity_list_checkbox_search_widget.dart'; +import 'entity_list_procedure_widget.dart'; valdateProcedure(ProcedureViewModel model, PatiantInformtion patient, List entityList) async { @@ -58,7 +59,7 @@ postProcedure( controlValue: element.remarks != null ? element.remarks : ""), ); controls.add( - Controls(code: "ordertype", controlValue: element.type), + Controls(code: "ordertype", controlValue: "0"), ); controlsProcedure.add(Procedures( category: element.categoryID, @@ -124,7 +125,10 @@ class _AddSelectedProcedureState extends State { TextEditingController procedureController = TextEditingController(); TextEditingController remarksController = TextEditingController(); List entityList = List(); + List entityListProcedure = List(); + dynamic selectedCategory; + setSelectedType(int val) { setState(() { selectedType = val; @@ -153,10 +157,9 @@ class _AddSelectedProcedureState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .selectProcedures - .toUpperCase(), + 'Please Select Category', fontWeight: FontWeight.w900, + fontSize: 15.0, ), SizedBox( height: 10.0, @@ -219,29 +222,53 @@ class _AddSelectedProcedureState extends State { ), if (widget.model.categoriesList.length != 0) NetworkBaseView( - baseViewModel: model, - child: EntityListCheckboxSearchWidget( - model: widget.model, - masterList: - widget.model.categoriesList[0].entityList, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => - isEntityListSelected(master), - ), - ), + baseViewModel: model, + child: selectedCategory != null + ? selectedCategory['categoryId'] == 02 || + selectedCategory['categoryId'] == 03 + ? EntityListCheckboxSearchWidget( + model: widget.model, + masterList: widget.model + .categoriesList[0].entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + ) + : ProcedureListWidget( + model: widget.model, + masterList: widget.model + .categoriesList[0].entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + ) + : null), SizedBox( height: 15.0, ), diff --git a/lib/screens/procedures/entity_list_checkbox_search_widget.dart b/lib/screens/procedures/entity_list_checkbox_search_widget.dart index 1c05af7e..b36f11c4 100644 --- a/lib/screens/procedures/entity_list_checkbox_search_widget.dart +++ b/lib/screens/procedures/entity_list_checkbox_search_widget.dart @@ -40,7 +40,7 @@ class EntityListCheckboxSearchWidget extends StatefulWidget { class _EntityListCheckboxSearchWidgetState extends State { - int selectedType = 1; + int selectedType = 0; int typeUrgent; int typeRegular; @@ -133,7 +133,7 @@ class _EntityListCheckboxSearchWidgetState .orderType), Radio( activeColor: Color(0xFFB9382C), - value: 1, + value: 0, groupValue: selectedType, onChanged: (value) { historyInfo.type = @@ -148,7 +148,7 @@ class _EntityListCheckboxSearchWidgetState Radio( activeColor: Color(0xFFB9382C), groupValue: selectedType, - value: 0, + value: 1, onChanged: (value) { historyInfo.type = setSelectedType(value) diff --git a/lib/screens/procedures/entity_list_procedure_widget.dart b/lib/screens/procedures/entity_list_procedure_widget.dart new file mode 100644 index 00000000..2f5c6ea2 --- /dev/null +++ b/lib/screens/procedures/entity_list_procedure_widget.dart @@ -0,0 +1,171 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class ProcedureListWidget extends StatefulWidget { + final ProcedureViewModel model; + final Function addSelectedHistories; + final Function(EntityList) removeHistory; + final Function(EntityList) addHistory; + final Function(EntityList) addRemarks; + + final bool Function(EntityList) isEntityListSelected; + final List masterList; + + ProcedureListWidget( + {Key key, + this.model, + this.addSelectedHistories, + this.removeHistory, + this.masterList, + this.addHistory, + this.isEntityListSelected, + this.addRemarks}) + : super(key: key); + + @override + _ProcedureListWidgetState createState() => _ProcedureListWidgetState(); +} + +class _ProcedureListWidgetState extends State { + int selectedType = 0; + int typeUrgent; + int typeRegular; + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + List items = List(); + List remarksList = List(); + List typeList = List(); + + @override + void initState() { + items.addAll(widget.masterList); + super.initState(); + } + + TextEditingController remarksController = TextEditingController(); + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + NetworkBaseView( + baseViewModel: widget.model, + child: Container( + height: MediaQuery.of(context).size.height * 0.55, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: ListView( + children: [ + TextFields( + hintText: TranslationBase.of(context).searchProcedures, + suffixIcon: EvaIcons.search, + onChanged: (value) { + filterSearchResults(value); + }, + ), + SizedBox( + height: 15, + ), + items.length != 0 + ? Column( + children: items.map((historyInfo) { + return Column( + children: [ + Row( + children: [ + Checkbox( + value: widget.isEntityListSelected( + historyInfo), + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() { + if (widget.isEntityListSelected( + historyInfo)) { + widget + .removeHistory(historyInfo); + } else { + widget.addHistory(historyInfo); + } + }); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts( + historyInfo.procedureName, + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + ], + ); + }).toList(), + ) + : Center( + child: Container( + child: AppText( + "There's no procedures for this category", + color: Color(0xFFB9382C)), + ), + ) + ], + ), + )), + ), + ), + SizedBox( + height: 10, + ), + ], + ), + ); + } + + void filterSearchResults(String query) { + List dummySearchList = List(); + dummySearchList.addAll(widget.masterList); + if (query.isNotEmpty) { + List dummyListData = List(); + dummySearchList.forEach((item) { + if (item.procedureName.toLowerCase().contains(query.toLowerCase())) { + dummyListData.add(item); + } + }); + setState(() { + items.clear(); + items.addAll(dummyListData); + }); + return; + } else { + setState(() { + items.clear(); + items.addAll(widget.masterList); + }); + } + } +} diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index afe8a63e..f15e825d 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -235,7 +236,7 @@ class _ProcedureScreenState extends State { .entityList[ index] .orderType == - 0 + 1 ? Color( 0xFFB9382C) : Colors @@ -254,7 +255,7 @@ class _ProcedureScreenState extends State { .entityList[ index] .orderType == - 0 + 1 ? Color( 0xFFB9382C) : Colors @@ -274,7 +275,7 @@ class _ProcedureScreenState extends State { .entityList[ index] .orderType == - 0 + 1 ? Color( 0xFFB9382C) : Colors @@ -330,13 +331,13 @@ class _ProcedureScreenState extends State { Expanded( child: AppText( model.procedureList[0].entityList[index].orderType == - 1 + 0 ? 'Routine' : 'Urgent', fontSize: 13.5, color: model.procedureList[0].entityList[index].orderType == - 0 + 1 ? Color(0xFFB9382C) : Colors.green), ), @@ -459,43 +460,59 @@ class _ProcedureScreenState extends State { onTap: () { // model // .updateProcedure(); - updateProcedureForm( - context, - model: - model, - orderNo: model - .procedureList[ - 0] - .entityList[ - index] - .orderNo, - remarks: model - .procedureList[ - 0] - .entityList[ - index] - .remarks, - procedureName: model - .procedureList[ - 0] - .entityList[ - index] - .procedureName, - patient: - patient, - procedureId: model - .procedureList[ - 0] - .entityList[ - index] - .procedureId, - categoreId: model - .procedureList[ - 0] - .entityList[ - index] - .categoryID - .toString()); + if (model + .procedureList[ + 0] + .entityList[ + index] + .categoryID == + 02 || + model + .procedureList[0] + .entityList[index] + .categoryID == + 03) { + updateProcedureForm( + context, + model: + model, + orderNo: model + .procedureList[ + 0] + .entityList[ + index] + .orderNo, + remarks: model + .procedureList[ + 0] + .entityList[ + index] + .remarks, + procedureName: model + .procedureList[ + 0] + .entityList[ + index] + .procedureName, + patient: + patient, + procedureId: model + .procedureList[ + 0] + .entityList[ + index] + .procedureId, + categoreId: model + .procedureList[ + 0] + .entityList[ + index] + .categoryID + .toString()); + } else { + helpers.showErrorToast( + 'You cant Update this Procedure'); + } }, ) ], diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index 445203a4..9f5d7f45 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.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/screens/procedures/entity_list_checkbox_search_widget.dart'; +import 'package:doctor_app_flutter/screens/procedures/entity_list_procedure_widget.dart'; 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/shared/TextFields.dart'; @@ -79,6 +80,11 @@ class _UpdateProcedureWidgetState extends State { }); } + void initState() { + super.initState(); + widget.remarksController.text = widget.remarks; + } + List entityList = List(); dynamic selectedCategory; @override @@ -177,74 +183,108 @@ class _UpdateProcedureWidgetState extends State { ), if (widget.model.categoriesList.length != 0) NetworkBaseView( - baseViewModel: model, - child: EntityListCheckboxSearchWidget( - model: widget.model, - masterList: widget - .model.categoriesList[0].entityList, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => - isEntityListSelected(master), - ), + baseViewModel: model, + child: selectedCategory != null + ? selectedCategory['categoryId'] == + 02 || + selectedCategory[ + 'categoryId'] == + 03 + ? EntityListCheckboxSearchWidget( + model: widget.model, + masterList: widget + .model + .categoriesList[0] + .entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: + (master) => + isEntityListSelected( + master), + ) + : ProcedureListWidget( + model: widget.model, + masterList: widget + .model + .categoriesList[0] + .entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: + (master) => + isEntityListSelected( + master), + ) + : null), + Container( + child: Row( + children: [ + AppText( + TranslationBase.of(context).orderType), + Radio( + activeColor: Color(0xFFB9382C), + value: 0, + groupValue: selectedType, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text(TranslationBase.of(context).urgent), + Radio( + activeColor: Color(0xFFB9382C), + groupValue: selectedType, + value: 1, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text('routine'), + ], + ), + ), + SizedBox( + height: 12.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + fontSize: 15.0, + controller: widget.remarksController, + maxLines: 3, + minLines: 2, + onChanged: (value) {}, ), - // Container( - // child: Row( - // children: [ - // AppText( - // TranslationBase.of(context).orderType), - // Radio( - // activeColor: Color(0xFFB9382C), - // value: 0, - // groupValue: selectedType, - // onChanged: (value) { - // setSelectedType(value); - // }, - // ), - // Text(TranslationBase.of(context).urgent), - // Radio( - // activeColor: Color(0xFFB9382C), - // groupValue: selectedType, - // value: 1, - // onChanged: (value) { - // setSelectedType(value); - // }, - // ), - // Text('routine'), - // ], - // ), - // ), - // SizedBox( - // height: 12.0, - // ), - // Container( - // decoration: BoxDecoration( - // borderRadius: - // BorderRadius.all(Radius.circular(6.0)), - // border: Border.all( - // width: 1.0, - // color: HexColor("#CCCCCC"))), - // child: TextFields( - // hintText: widget.remarks, - // fontSize: 15.0, - // controller: widget.remarksController, - // maxLines: 3, - // minLines: 2, - // onChanged: (value) {}, - // ), - // ), + ), SizedBox( height: 50.0, ), @@ -259,11 +299,11 @@ class _UpdateProcedureWidgetState extends State { .updateProcedure .toUpperCase(), onPressed: () { - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - "Fill the mandatory procedure details"); - return; - } + // if (entityList.isEmpty == true) { + // DrAppToastMsg.showErrorToast( + // "Fill the mandatory procedure details"); + // return; + // } Navigator.pop(context); updateProcedure( orderNo: widget.orderNo, @@ -315,20 +355,32 @@ class _UpdateProcedureWidgetState extends State { updateProcedureReqModel.lineItemNo = 1; updateProcedureReqModel.orderNo = orderNo; - entityList.forEach((element) { + if (entityList.isNotEmpty) { + entityList.forEach((element) { + controls.add( + Controls(code: "remarks", controlValue: element.remarks ?? remarks), + ); + controls.add( + Controls(code: "ordertype", controlValue: '1'), + ); + + controlsProcedure.procedure = element.procedureId; + controlsProcedure.category = element.categoryID; + controlsProcedure.controls = controls; + }); + } else { controls.add( Controls( - code: "remarks", - controlValue: element.remarks.isNotEmpty ? element.remarks : ""), + code: "remarks", controlValue: remarks.isNotEmpty ? remarks : ""), ); controls.add( - Controls(code: "ordertype", controlValue: '1'), + Controls(code: "ordertype", controlValue: '0'), ); + } - controlsProcedure.procedure = element.procedureId; - controlsProcedure.category = element.categoryID; - controlsProcedure.controls = controls; - }); + controlsProcedure.procedure = procedureId; + controlsProcedure.category = categorieId; + controlsProcedure.controls = controls; // controlsProcedure.add(ProcedureDetail( // category: categorieId, procedure: procedureId, controls: controls)); updateProcedureReqModel.procedureDetail = controlsProcedure; From 24d13b06c50bf143129fe1737f18475e116a7bbe Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 2 Mar 2021 02:47:20 +0200 Subject: [PATCH 12/15] Procedure update valdation --- .../prescription/update_prescription_form.dart | 1 + lib/screens/procedures/add-procedure-form.dart | 7 +++++++ lib/screens/procedures/update-procedure.dart | 12 +++++++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index 67723cde..7892a1cd 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -731,6 +731,7 @@ class _UpdatePrescriptionFormState extends State { "strength can't be more then 4 digits "); return; } + // if(units==null&& updatedDuration==null&&frequencyUpdate==null&&) updatePrescription( newStartDate: selectedDate, newDoseStreangth: diff --git a/lib/screens/procedures/add-procedure-form.dart b/lib/screens/procedures/add-procedure-form.dart index d6c1b419..605bb61c 100644 --- a/lib/screens/procedures/add-procedure-form.dart +++ b/lib/screens/procedures/add-procedure-form.dart @@ -324,6 +324,13 @@ class _AddSelectedProcedureState extends State { .addSelectedProcedures, onPressed: () { //print(entityList.toString()); + onPressed: + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + "Fill the mandatory procedure details"); + return; + } + Navigator.pop(context); postProcedure( orderType: selectedType.toString(), diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index 9f5d7f45..6918d9a2 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -299,11 +299,13 @@ class _UpdateProcedureWidgetState extends State { .updateProcedure .toUpperCase(), onPressed: () { - // if (entityList.isEmpty == true) { - // DrAppToastMsg.showErrorToast( - // "Fill the mandatory procedure details"); - // return; - // } + if (entityList.isEmpty == true && + widget.remarksController.text == + widget.remarks) { + DrAppToastMsg.showErrorToast( + "Fill the mandatory procedure details"); + return; + } Navigator.pop(context); updateProcedure( orderNo: widget.orderNo, From b00b739e7928eb9b9d4b4a8b7c7713a657f53694 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 2 Mar 2021 13:55:15 +0200 Subject: [PATCH 13/15] categories that can update --- lib/screens/procedures/procedure_screen.dart | 7 ++++--- lib/screens/procedures/update-procedure.dart | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index f15e825d..92b286d8 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -460,18 +460,19 @@ class _ProcedureScreenState extends State { onTap: () { // model // .updateProcedure(); - if (model + if (model.procedureList[0].entityList[index].categoryID == 02 || + model .procedureList[ 0] .entityList[ index] .categoryID == - 02 || + 03 || model .procedureList[0] .entityList[index] .categoryID == - 03) { + 55) { updateProcedureForm( context, model: diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index 6918d9a2..752bda5d 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -189,7 +189,10 @@ class _UpdateProcedureWidgetState extends State { 02 || selectedCategory[ 'categoryId'] == - 03 + 03 || + selectedCategory[ + 'categoryId'] == + 55 ? EntityListCheckboxSearchWidget( model: widget.model, masterList: widget From 46b5f2a5f3fa88a6182c01a59c716b6b2ee13035 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 2 Mar 2021 14:57:35 +0200 Subject: [PATCH 14/15] update procedure for agreed categories --- lib/core/viewModel/procedure_View_model.dart | 2 +- lib/screens/procedures/procedure_screen.dart | 6 ++++++ lib/screens/procedures/update-procedure.dart | 20 +++++++++++++------- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 6af34f4d..199fa308 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -99,6 +99,6 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); - //await getProcedure(mrn: mrn); + await getProcedure(mrn: mrn); } } diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 92b286d8..c66b66a9 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -475,6 +475,12 @@ class _ProcedureScreenState extends State { 55) { updateProcedureForm( context, + limetNo: model + .procedureList[ + 0] + .entityList[ + index] + .lineItemNo, model: model, orderNo: model diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index 752bda5d..f09157a2 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -23,6 +23,7 @@ import 'package:hexcolor/hexcolor.dart'; void updateProcedureForm(context, {String procedureName, int orderNo, + int limetNo, PatiantInformtion patient, String orderType, String procedureId, @@ -45,6 +46,7 @@ void updateProcedureForm(context, procedureId: procedureId, categoryId: categoreId, orderNo: orderNo, + limetNo: limetNo, ); }); } @@ -58,6 +60,7 @@ class UpdateProcedureWidget extends StatefulWidget { final String procedureId; final String categoryId; final int orderNo; + final int limetNo; UpdateProcedureWidget( {this.model, @@ -67,7 +70,8 @@ class UpdateProcedureWidget extends StatefulWidget { this.patient, this.procedureId, this.categoryId, - this.orderNo}); + this.orderNo, + this.limetNo}); @override _UpdateProcedureWidgetState createState() => _UpdateProcedureWidgetState(); } @@ -257,7 +261,7 @@ class _UpdateProcedureWidgetState extends State { setSelectedType(value); }, ), - Text(TranslationBase.of(context).urgent), + Text('routine'), Radio( activeColor: Color(0xFFB9382C), groupValue: selectedType, @@ -266,7 +270,7 @@ class _UpdateProcedureWidgetState extends State { setSelectedType(value); }, ), - Text('routine'), + Text(TranslationBase.of(context).urgent), ], ), ), @@ -311,6 +315,7 @@ class _UpdateProcedureWidgetState extends State { } Navigator.pop(context); updateProcedure( + limetNO: widget.limetNo, orderNo: widget.orderNo, orderType: selectedType.toString(), categorieId: widget.categoryId, @@ -340,6 +345,7 @@ class _UpdateProcedureWidgetState extends State { updateProcedure( {ProcedureViewModel model, String remarks, + int limetNO, int orderNo, String newProcedureId, String newCategorieId, @@ -357,7 +363,7 @@ class _UpdateProcedureWidgetState extends State { updateProcedureReqModel.episodeID = patient.episodeNo; updateProcedureReqModel.patientMRN = patient.patientMRN; - updateProcedureReqModel.lineItemNo = 1; + updateProcedureReqModel.lineItemNo = limetNO; updateProcedureReqModel.orderNo = orderNo; if (entityList.isNotEmpty) { @@ -370,7 +376,7 @@ class _UpdateProcedureWidgetState extends State { ); controlsProcedure.procedure = element.procedureId; - controlsProcedure.category = element.categoryID; + controlsProcedure.category = '0' + element.categoryID; controlsProcedure.controls = controls; }); } else { @@ -379,12 +385,12 @@ class _UpdateProcedureWidgetState extends State { code: "remarks", controlValue: remarks.isNotEmpty ? remarks : ""), ); controls.add( - Controls(code: "ordertype", controlValue: '0'), + Controls(code: "ordertype", controlValue: orderType), ); } controlsProcedure.procedure = procedureId; - controlsProcedure.category = categorieId; + controlsProcedure.category = '0' + categorieId; controlsProcedure.controls = controls; // controlsProcedure.add(ProcedureDetail( // category: categorieId, procedure: procedureId, controls: controls)); From 04114623600a99b8dbd8ce8fdccc96660a2f011b Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 2 Mar 2021 15:42:13 +0200 Subject: [PATCH 15/15] update procedure for agreed categorise --- lib/core/viewModel/procedure_View_model.dart | 2 +- lib/screens/procedures/update-procedure.dart | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 199fa308..6af34f4d 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -99,6 +99,6 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); - await getProcedure(mrn: mrn); + //await getProcedure(mrn: mrn); } } diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index f09157a2..312bdfe1 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -369,14 +369,16 @@ class _UpdateProcedureWidgetState extends State { if (entityList.isNotEmpty) { entityList.forEach((element) { controls.add( - Controls(code: "remarks", controlValue: element.remarks ?? remarks), + Controls(code: "remarks", controlValue: element.remarks ?? ''), ); controls.add( Controls(code: "ordertype", controlValue: '1'), ); controlsProcedure.procedure = element.procedureId; - controlsProcedure.category = '0' + element.categoryID; + controlsProcedure.category = int.parse(element.categoryID) > 9 + ? element.categoryID + : "0" + element.categoryID; controlsProcedure.controls = controls; }); } else { @@ -387,11 +389,12 @@ class _UpdateProcedureWidgetState extends State { controls.add( Controls(code: "ordertype", controlValue: orderType), ); - } - controlsProcedure.procedure = procedureId; - controlsProcedure.category = '0' + categorieId; - controlsProcedure.controls = controls; + controlsProcedure.procedure = procedureId; + controlsProcedure.category = '0' + categorieId; + + controlsProcedure.controls = controls; + } // controlsProcedure.add(ProcedureDetail( // category: categorieId, procedure: procedureId, controls: controls)); updateProcedureReqModel.procedureDetail = controlsProcedure; @@ -405,6 +408,7 @@ class _UpdateProcedureWidgetState extends State { model.getProcedure(mrn: patient.patientMRN); } else if (model.state == ViewState.Idle) { DrAppToastMsg.showSuccesToast('procedure has been updated'); + model.getProcedure(mrn: patient.patientMRN); } }