From 9d8514c83ba2861862653f3123578079ad53aaea Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 30 Dec 2020 15:49:05 +0200 Subject: [PATCH 1/7] post prescription --- lib/config/config.dart | 2 +- .../model/post_prescrition_req_model.dart | 38 +++--- .../model/procedure/categories_procedure.dart | 86 +++++++++++- lib/core/service/prescription_service.dart | 9 +- lib/core/service/procedure_service.dart | 35 ++--- .../viewModel/prescription_view_model.dart | 5 +- .../prescription/add_prescription_form.dart | 67 +++++++++- .../prescription/prescription_screen.dart | 4 +- lib/screens/procedures/procedure_screen.dart | 125 ++++++++++-------- 9 files changed, 259 insertions(+), 112 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index d3728ddf..b8509f66 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -128,7 +128,7 @@ const POST_PROGRESS_NOTE = '/Services/DoctorApplication.svc/REST/PostProgressNote'; const GET_CATEGORISE_PROCEDURE = - 'Services/DoctorApplication.svc/REST/GetCategories'; + 'Services/DoctorApplication.svc/REST/GetProcedure'; var selectedPatientType = 1; diff --git a/lib/core/model/post_prescrition_req_model.dart b/lib/core/model/post_prescrition_req_model.dart index 892854aa..6fc71199 100644 --- a/lib/core/model/post_prescrition_req_model.dart +++ b/lib/core/model/post_prescrition_req_model.dart @@ -7,12 +7,11 @@ class PostPrescriptionReqModel { List prescriptionRequestModel; PostPrescriptionReqModel( - {this.vidaAuthTokenID = - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiYTYxZjAyZjItNzUwZS00MTZkLWEzOTQtZTRjZmViZGVjMDE5IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUzNTIiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODUzMDAyNywiZXhwIjoxNjA5Mzk0MDI3LCJpYXQiOjE2MDg1MzAwMjd9.M1NTREPgz5vQH_GTZ_KGb0xQW5HEDs47AtNR3jbqnms", - this.clinicID = 1, - this.episodeID = 200012117, - this.appointmentNo = 2016054573, - this.patientMRN = 3120690, + {this.vidaAuthTokenID, + this.clinicID, + this.episodeID, + this.appointmentNo, + this.patientMRN, this.prescriptionRequestModel}); PostPrescriptionReqModel.fromJson(Map json) { @@ -58,19 +57,20 @@ class PrescriptionRequestModel { String remarks; String icdcode10Id; - PrescriptionRequestModel( - {this.itemId = 4, - this.doseStartDate = "2020-12-20T13:07:41.769Z", - this.duration = 2, - this.dose = 1, - this.doseUnitId = 1, - this.route = 1, - this.frequency = 1, - this.doseTime = 1, - this.covered = true, - this.approvalRequired = true, - this.remarks = "test1", - this.icdcode10Id = "test3"}); + PrescriptionRequestModel({ + this.itemId, + this.doseStartDate, + this.duration, + this.dose, + this.doseUnitId, + this.route, + this.frequency, + this.doseTime, + this.covered, + this.approvalRequired, + this.remarks, + this.icdcode10Id, + }); PrescriptionRequestModel.fromJson(Map json) { itemId = json['itemId']; diff --git a/lib/core/model/procedure/categories_procedure.dart b/lib/core/model/procedure/categories_procedure.dart index e7a7fd40..074d8a1b 100644 --- a/lib/core/model/procedure/categories_procedure.dart +++ b/lib/core/model/procedure/categories_procedure.dart @@ -1,18 +1,90 @@ class CategoriseProcedureModel { - String categoryID; - String categoryName; + List entityList; + int rowcount; + dynamic statusMessage; - CategoriseProcedureModel({this.categoryID, this.categoryName}); + CategoriseProcedureModel( + {this.entityList, this.rowcount, this.statusMessage}); CategoriseProcedureModel.fromJson(Map json) { - categoryID = json['CategoryID']; - categoryName = json['CategoryName']; + 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 { + bool allowedClinic; + String category; + String categoryID; + String genderValidation; + String group; + String orderedValidation; + dynamic price; + String procedureId; + String procedureName; + String specialPermission; + String subGroup; + String template; + + EntityList( + {this.allowedClinic, + this.category, + this.categoryID, + this.genderValidation, + this.group, + this.orderedValidation, + this.price, + this.procedureId, + this.procedureName, + this.specialPermission, + this.subGroup, + this.template}); + + EntityList.fromJson(Map json) { + allowedClinic = json['allowedClinic']; + category = json['category']; + categoryID = json['categoryID']; + genderValidation = json['genderValidation']; + group = json['group']; + orderedValidation = json['orderedValidation']; + price = json['price']; + procedureId = json['procedureId']; + procedureName = json['procedureName']; + specialPermission = json['specialPermission']; + subGroup = json['subGroup']; + template = json['template']; } Map toJson() { final Map data = new Map(); - data['CategoryID'] = this.categoryID; - data['CategoryName'] = this.categoryName; + data['allowedClinic'] = this.allowedClinic; + data['category'] = this.category; + data['categoryID'] = this.categoryID; + data['genderValidation'] = this.genderValidation; + data['group'] = this.group; + data['orderedValidation'] = this.orderedValidation; + data['price'] = this.price; + data['procedureId'] = this.procedureId; + data['procedureName'] = this.procedureName; + data['specialPermission'] = this.specialPermission; + data['subGroup'] = this.subGroup; + data['template'] = this.template; return data; } } diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index d51fcc3e..65e74dda 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -30,19 +30,20 @@ class PrescriptionService extends BaseService { }, body: _prescriptionReqModel.toJson()); } - Future postPrescription() async { + Future postPrescription( + PostPrescriptionReqModel postProcedureReqModel) async { hasError = false; //_prescriptionList.clear(); await baseAppClient.post( - GET_CATEGORISE_PROCEDURE, + POST_PRESCRIPTION_LIST, onSuccess: (dynamic response, int statusCode) { - _prescriptionList - .add(PrescriptionModel.fromJson(response['PrescriptionList'])); + print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, + body: postProcedureReqModel.toJson(), ); } } diff --git a/lib/core/service/procedure_service.dart b/lib/core/service/procedure_service.dart index fdc18003..7ffd9310 100644 --- a/lib/core/service/procedure_service.dart +++ b/lib/core/service/procedure_service.dart @@ -13,11 +13,6 @@ class ProcedureService extends BaseService { List get categoriesList => _categoriesList; List procedureslist = List(); - Procedures t1 = Procedures( - category: '02', - procedure: '02011002', - ); - GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( clinicId: 0, pageSize: 10, @@ -29,8 +24,17 @@ class ProcedureService extends BaseService { search: ["lab"], ); + GetProcedureReqModel _getProcedureCategoriseReqModel = GetProcedureReqModel( + clinicId: 0, + pageSize: 100, + pageIndex: 1, + patientMRN: 0, + //categoryId: null, + vidaAuthTokenID: + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI", - PostProcedureReqModel _postProcedureReqModel = PostProcedureReqModel(); + search: ["lab"], + ); Future getProcedure() async { hasError = false; @@ -47,17 +51,14 @@ class ProcedureService extends BaseService { Future getCategories() async { hasError = false; _categoriesList.clear(); - await baseAppClient.post( - GET_CATEGORISE_PROCEDURE, - onSuccess: (dynamic response, int statusCode) { - _categoriesList - .add(CategoriseProcedureModel.fromJson(response['listCategories'])); - }, - onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, - ); + await baseAppClient.post(GET_CATEGORISE_PROCEDURE, + onSuccess: (dynamic response, int statusCode) { + _categoriesList + .add(CategoriseProcedureModel.fromJson(response['ProcedureList'])); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _getProcedureCategoriseReqModel.toJson()); } Future postProcedure(PostProcedureReqModel postProcedureReqModel) async { diff --git a/lib/core/viewModel/prescription_view_model.dart b/lib/core/viewModel/prescription_view_model.dart index 4ab4b3f7..6c3fe7b2 100644 --- a/lib/core/viewModel/prescription_view_model.dart +++ b/lib/core/viewModel/prescription_view_model.dart @@ -24,11 +24,12 @@ class PrescriptionViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future postPrescription() async { + Future postPrescription( + PostPrescriptionReqModel postProcedureReqModel) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _prescriptionService.postPrescription(); + await _prescriptionService.postPrescription(postProcedureReqModel); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.ErrorLocal); diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 40704009..5782a166 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -1,7 +1,12 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +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/prescription/prescription_warnings.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/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; @@ -10,6 +15,8 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; void addPrescriptionForm(context) { + TextEditingController durationController = TextEditingController(); + TextEditingController doseController = TextEditingController(); final GlobalKey _formKey = GlobalKey(); final double spaceBetweenTextFileds = 12; showModalBottomSheet( @@ -122,6 +129,7 @@ void addPrescriptionForm(context) { borderColor: Colors.white, textInputType: TextInputType.number, inputFormatter: ONLY_NUMBERS, + controller: doseController, ), ), SizedBox(height: spaceBetweenTextFileds), @@ -160,11 +168,18 @@ void addPrescriptionForm(context) { border: Border.all( width: 1.0, color: HexColor("#CCCCCC"))), child: AppTextFormField( - labelText: TranslationBase.of(context).duration, - borderColor: Colors.white, - textInputType: TextInputType.number, - inputFormatter: ONLY_NUMBERS, - ), + labelText: TranslationBase.of(context).duration, + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, + controller: durationController, + validator: (value) { + if (value == null || value == "") + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), ), SizedBox(height: spaceBetweenTextFileds), Container( @@ -192,8 +207,11 @@ void addPrescriptionForm(context) { title: TranslationBase.of(context).addMedication, onPressed: () { + //prescriptionWarning(context); + postProcedure( + duration: durationController.text, + dose: doseController.text); Navigator.pop(context); - prescriptionWarning(context); }, ), ], @@ -210,3 +228,40 @@ void addPrescriptionForm(context) { ); }); } + +postProcedure({String duration, String dose}) async { + PrescriptionViewModel model = new PrescriptionViewModel(); + PostPrescriptionReqModel postProcedureReqModel = + new PostPrescriptionReqModel(); + List sss = List(); + + postProcedureReqModel.appointmentNo = 2016055175; + postProcedureReqModel.clinicID = 1; + postProcedureReqModel.episodeID = 200012335; + postProcedureReqModel.patientMRN = 1234; + postProcedureReqModel.vidaAuthTokenID = + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiOGFjNDRjZGQtOWE0Mi00M2YxLWE2YTQtMWQ4NzBmZmYwNTUyIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTU2NDkiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA4NzM2NjY5LCJleHAiOjE2MDk2MDA2NjksImlhdCI6MTYwODczNjY2OX0.9EDgYrbe5fQA2CvgLdFT4s_PL7hD5R_Qggfpv4lDtUY"; + sss.add(PrescriptionRequestModel( + covered: true, + dose: int.parse(dose), + itemId: 8, + doseUnitId: 1, + route: 1, + frequency: 1, + remarks: "test2", + approvalRequired: true, + icdcode10Id: "test2", + doseTime: 1, + duration: int.parse(duration), + doseStartDate: "2020-12-20T13:07:41.769Z")); + postProcedureReqModel.prescriptionRequestModel = sss; + //postProcedureReqModel.procedures = controlsProcedure; + + await model.postPrescription(postProcedureReqModel); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast('Medication has been added'); + } +} diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index e29bcefc..742cfad8 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -111,7 +111,7 @@ class _NewPrescriptionScreenState extends State { InkWell( onTap: () { addPrescriptionForm(context); - model.postPrescription(); + //model.postPrescription(); }, child: CircleAvatar( radius: 65, @@ -195,7 +195,7 @@ class _NewPrescriptionScreenState extends State { ), onTap: () { addPrescriptionForm(context); - model.postPrescription(); + //model.postPrescription(); }, ), SizedBox( diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 59cf5bdf..5b6b10f3 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -414,65 +414,82 @@ void addSelectedProcedure(context) { context: context, builder: (BuildContext bc) { return BaseView( - //onModelReady: (model) => model.getCategories(), + onModelReady: (model) => model.getCategories(), builder: (BuildContext context, ProcedureViewModel model, Widget child) => - SingleChildScrollView( - child: Container( - height: 490, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'Select Procedure'.toUpperCase(), - fontWeight: FontWeight.w900, - ), - // Text(model.categoriesList[0].categoryName), - SizedBox( - height: 9.0, - ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Container( + height: 490, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'Select Procedure'.toUpperCase(), + fontWeight: FontWeight.w900, + ), + if (model.categoriesList.length != 0) Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: AppTextFormField( - labelText: 'Add Delected Procedures'.toUpperCase(), - borderColor: Colors.white, - textInputType: TextInputType.text, - inputFormatter: ONLY_LETTERS, - controller: procedureController, - ), + height: 120.0, + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model.categoriesList[0].rowcount, + itemBuilder: (BuildContext ctxt, int index) { + return Container( + child: AppText(model.categoriesList[0] + .entityList[index].procedureName), + ); + }), ), - SizedBox( - height: 280.0, - ), - Container( - margin: - EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: - TranslationBase.of(context).addMedication, - onPressed: () { - Navigator.pop(context); - postProcedure(); - }, - ), - ], + SizedBox( + height: 0.0, + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: + 'Add Delected Procedures'.toUpperCase(), + borderColor: Colors.white, + textInputType: TextInputType.text, + inputFormatter: ONLY_LETTERS, + controller: procedureController, + ), ), - ), - ], - ) - ], + SizedBox( + height: 80.0, + ), + Container( + margin: + EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: + TranslationBase.of(context).addMedication, + onPressed: () { + Navigator.pop(context); + postProcedure(); + }, + ), + ], + ), + ), + ], + ) + ], + ), ), ), ), From b3345a86eff841653202d045fdca6432c82dc1ad Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 31 Dec 2020 12:39:34 +0200 Subject: [PATCH 2/7] post prescription --- lib/core/service/prescription_service.dart | 2 +- .../viewModel/prescription_view_model.dart | 4 +- lib/core/viewModel/procedure_View_model.dart | 4 +- .../patients/patient_search_screen.dart | 18 +- .../prescription/add_prescription_form.dart | 525 +++++++++++------- .../prescription/prescription_screen.dart | 139 +++-- lib/screens/procedures/procedure_screen.dart | 327 ++++++++--- .../SOAP/subjective/subjective_page.dart | 70 +-- 8 files changed, 699 insertions(+), 390 deletions(-) diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index 65e74dda..9d1cb102 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -9,7 +9,7 @@ class PrescriptionService extends BaseService { List get prescriptionList => _prescriptionList; PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel( - patientMRN: 1231755, + patientMRN: 3120877, vidaAuthTokenID: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiNzNiNmUyZDctMjA0ZC00NzAyLTkxMDYtODE3MzI3OTZkYzI5IiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NjIwOSIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgyMzY2MjAsImV4cCI6MTYwOTEwMDYyMCwiaWF0IjoxNjA4MjM2NjIwfQ.z4Lh0dCRr9GWXvaTo7x5GPV7R5z8ONyh3-0uk3PXMu8", ); diff --git a/lib/core/viewModel/prescription_view_model.dart b/lib/core/viewModel/prescription_view_model.dart index 6c3fe7b2..7923c3d7 100644 --- a/lib/core/viewModel/prescription_view_model.dart +++ b/lib/core/viewModel/prescription_view_model.dart @@ -33,7 +33,9 @@ class PrescriptionViewModel extends BaseViewModel { if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.ErrorLocal); - } else + } else { + await getPrescription(); setState(ViewState.Idle); + } } } diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 13e18ed3..b051d04d 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -45,7 +45,9 @@ class ProcedureViewModel extends BaseViewModel { if (_procedureService.hasError) { error = _procedureService.error; setState(ViewState.ErrorLocal); - } else + } else { + await getProcedure(); setState(ViewState.Idle); + } } } diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 9de384b6..f64a43f5 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -72,9 +72,9 @@ class _PatientSearchScreenState extends State { //_selectedType=='3'? //===================== - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = - new DoctorProfileModel.fromJson(profile); + //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + // DoctorProfileModel doctorProfile = + // new DoctorProfileModel.fromJson(profile); if (_formKey.currentState.validate()) { _formKey.currentState.save(); @@ -83,16 +83,16 @@ class _PatientSearchScreenState extends State { print('_selectedType${_selectedType}'); String token = await sharedPref.getString(TOKEN); - _patientSearchFormValues.TokenID = token; - _patientSearchFormValues.ProjectID = doctorProfile.projectID; //15 - _patientSearchFormValues.DoctorID = doctorProfile.doctorID; - _patientSearchFormValues.ClinicID = doctorProfile.clinicID; + // _patientSearchFormValues.TokenID = token; + // _patientSearchFormValues.ProjectID = doctorProfile.projectID; //15 + // _patientSearchFormValues.DoctorID = doctorProfile.doctorID; + // _patientSearchFormValues.ClinicID = doctorProfile.clinicID; //===================== // _patientSearchFormValues. //===================== - print("=============doctorProfile.clinicID=" + - doctorProfile.clinicID.toString()); + // print("=============doctorProfile.clinicID=" + + // doctorProfile.clinicID.toString()); Navigator.of(context).pushNamed(PATIENTS, arguments: { "patientSearchForm": _patientSearchFormValues, diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 5782a166..a988b61c 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -5,250 +5,355 @@ 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/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'; import 'package:doctor_app_flutter/util/translations_delegate_base.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_text_form_field.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:hexcolor/hexcolor.dart'; -void addPrescriptionForm(context) { +void addPrescriptionForm(context, PrescriptionViewModel model) { TextEditingController durationController = TextEditingController(); + TextEditingController strengthController = TextEditingController(); + TextEditingController routeController = TextEditingController(); + TextEditingController frequencyController = TextEditingController(); + TextEditingController indicationController = TextEditingController(); + TextEditingController instructions = TextEditingController(); + + TextEditingController drugIdController = TextEditingController(); TextEditingController doseController = TextEditingController(); - final GlobalKey _formKey = GlobalKey(); + final GlobalKey formKey = GlobalKey(); final double spaceBetweenTextFileds = 12; showModalBottomSheet( isScrollControlled: true, context: context, builder: (BuildContext bc) { - return SingleChildScrollView( - child: Container( - height: 700, - 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: AppTextFormField( - labelText: - TranslationBase.of(context).searchMedicine, - borderColor: Colors.white, - textInputType: TextInputType.text, - inputFormatter: ONLY_LETTERS, - ), - ), - SizedBox( - height: spaceBetweenTextFileds, - ), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: AppTextFormField( - labelText: TranslationBase.of(context).orderType, - borderColor: Colors.white, - textInputType: TextInputType.number, - inputFormatter: ONLY_NUMBERS, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: AppTextFormField( - labelText: TranslationBase.of(context).strength, - borderColor: Colors.white, - textInputType: TextInputType.number, - inputFormatter: ONLY_NUMBERS, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: AppTextFormField( - labelText: TranslationBase.of(context).route, - borderColor: Colors.white, - textInputType: TextInputType.number, - inputFormatter: ONLY_NUMBERS, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: AppTextFormField( - labelText: TranslationBase.of(context).frequency, - borderColor: Colors.white, - textInputType: TextInputType.number, - inputFormatter: ONLY_NUMBERS, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: AppTextFormField( - labelText: TranslationBase.of(context).doseTime, - borderColor: Colors.white, - textInputType: TextInputType.number, - inputFormatter: ONLY_NUMBERS, - controller: doseController, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: AppTextFormField( - labelText: TranslationBase.of(context).indication, - borderColor: Colors.white, - textInputType: TextInputType.number, - inputFormatter: ONLY_NUMBERS, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: AppTextFormField( - labelText: TranslationBase.of(context).fromDate, - borderColor: Colors.white, - textInputType: TextInputType.number, - inputFormatter: ONLY_NUMBERS, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: AppTextFormField( - labelText: TranslationBase.of(context).duration, - borderColor: Colors.white, - textInputType: TextInputType.number, - inputFormatter: ONLY_NUMBERS, - controller: durationController, - validator: (value) { - if (value == null || value == "") - 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: AppTextFormField( - labelText: - TranslationBase.of(context).instruction, - borderColor: Colors.white, - textInputType: TextInputType.number, - inputFormatter: ONLY_NUMBERS, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - margin: - EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: - TranslationBase.of(context).addMedication, - onPressed: () { - //prescriptionWarning(context); - postProcedure( - duration: durationController.text, - dose: doseController.text); - Navigator.pop(context); - }, + 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(); + + if (formKey.currentState.validate()) { + postPrescription( + 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()), + // ); + } + }, + ), + ], + ), ), ], ), ), - ], - ), + ), + ], ), ), - ], - ), - ), - ), - ); + ), + ); + }); }); } -postProcedure({String duration, String dose}) async { - PrescriptionViewModel model = new PrescriptionViewModel(); +postPrescription( + {String duration, + String dose, + String drugId, + String strength, + String route, + String frequency, + String indication, + String instruction, + PrescriptionViewModel model}) async { PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel(); List sss = List(); - postProcedureReqModel.appointmentNo = 2016055175; - postProcedureReqModel.clinicID = 1; - postProcedureReqModel.episodeID = 200012335; - postProcedureReqModel.patientMRN = 1234; + postProcedureReqModel.appointmentNo = 2016055159; + postProcedureReqModel.clinicID = 17; + postProcedureReqModel.episodeID = 200012330; + postProcedureReqModel.patientMRN = 3120877; postProcedureReqModel.vidaAuthTokenID = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiOGFjNDRjZGQtOWE0Mi00M2YxLWE2YTQtMWQ4NzBmZmYwNTUyIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTU2NDkiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA4NzM2NjY5LCJleHAiOjE2MDk2MDA2NjksImlhdCI6MTYwODczNjY2OX0.9EDgYrbe5fQA2CvgLdFT4s_PL7hD5R_Qggfpv4lDtUY"; sss.add(PrescriptionRequestModel( covered: true, dose: int.parse(dose), - itemId: 8, + itemId: int.parse(drugId), doseUnitId: 1, - route: 1, - frequency: 1, - remarks: "test2", + route: int.parse(route), + frequency: int.parse(frequency), + remarks: instruction, approvalRequired: true, icdcode10Id: "test2", doseTime: 1, @@ -261,7 +366,7 @@ postProcedure({String duration, String dose}) async { if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); - } else { + } else if (model.state == ViewState.Idle) { DrAppToastMsg.showSuccesToast('Medication has been added'); } } diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 742cfad8..4f6fe133 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -110,7 +110,7 @@ class _NewPrescriptionScreenState extends State { children: [ InkWell( onTap: () { - addPrescriptionForm(context); + addPrescriptionForm(context, model); //model.postPrescription(); }, child: CircleAvatar( @@ -156,7 +156,7 @@ class _NewPrescriptionScreenState extends State { ], ) : Padding( - padding: EdgeInsets.all(12.0), + padding: EdgeInsets.all(14.0), child: NetworkBaseView( baseViewModel: model, child: Column( @@ -194,7 +194,7 @@ class _NewPrescriptionScreenState extends State { ), ), onTap: () { - addPrescriptionForm(context); + addPrescriptionForm(context, model); //model.postPrescription(); }, ), @@ -204,19 +204,22 @@ class _NewPrescriptionScreenState extends State { ...List.generate( model.prescriptionList[0].rowcount, (index) => Container( + //height: 240, child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment .spaceBetween, + // crossAxisAlignment: + // CrossAxisAlignment.start, children: [ Container( height: MediaQuery.of(context) .size .height * - 0.2, + 0.23, width: MediaQuery.of(context) .size @@ -236,12 +239,12 @@ class _NewPrescriptionScreenState extends State { MediaQuery.of(context) .size .height * - 0.24, + 0.282, width: MediaQuery.of(context) .size .width * - 0.81, + 0.77, child: Column( children: [ Row( @@ -250,17 +253,20 @@ class _NewPrescriptionScreenState extends State { 'Start Date:', fontWeight: FontWeight - .w900, - fontSize: 15.0, + .w700, + fontSize: 14.0, ), - AppText( - model - .prescriptionList[ - 0] - .entityList[ - index] - .startDate, - fontSize: 11.0, + Expanded( + child: AppText( + model + .prescriptionList[ + 0] + .entityList[ + index] + .startDate, + fontSize: + 12.0, + ), ), SizedBox( width: 6.0, @@ -269,22 +275,25 @@ class _NewPrescriptionScreenState extends State { 'Order Type:', fontWeight: FontWeight - .w900, - fontSize: 15.0, + .w700, + fontSize: 14.0, ), - AppText( - model - .prescriptionList[ - 0] - .entityList[ - index] - .orderTypeDescription, - fontSize: 13.0, + Expanded( + child: AppText( + model + .prescriptionList[ + 0] + .entityList[ + index] + .orderTypeDescription, + fontSize: + 13.0, + ), ), ], ), SizedBox( - height: 2.5, + height: 5.5, ), Row( children: [ @@ -298,11 +307,19 @@ class _NewPrescriptionScreenState extends State { .entityList[ index] .medicationName, + fontWeight: + FontWeight + .w700, + fontSize: + 15.0, ), ), ) ], ), + SizedBox( + height: 5.5, + ), Row( children: [ Expanded( @@ -314,7 +331,7 @@ class _NewPrescriptionScreenState extends State { index] .doseDetail, fontSize: - 13.0, + 15.0, ), ) ], @@ -328,7 +345,8 @@ class _NewPrescriptionScreenState extends State { 'Indication: ', fontWeight: FontWeight - .w900, + .w700, + fontSize: 17.0, ), Expanded( child: AppText( @@ -339,40 +357,48 @@ class _NewPrescriptionScreenState extends State { index] .indication, fontSize: - 12.9), + 15.0), ) ], ), SizedBox( - height: 15.0, + height: 18.0, ), Row( children: [ - AppText( - model - .prescriptionList[ - 0] - .entityList[ - index] - .doctorName, - fontWeight: - FontWeight - .w900, + Expanded( + child: AppText( + model + .prescriptionList[ + 0] + .entityList[ + index] + .doctorName, + fontWeight: + FontWeight + .w700, + ), ) ], ), Row( children: [ - AppText(model - .prescriptionList[ - 0] - .entityList[ - index] - .remarks), + Expanded( + child: AppText( + model + .prescriptionList[ + 0] + .entityList[ + index] + .remarks, + fontSize: + 14.0, + ), + ), ], ), SizedBox( - height: 15.0, + height: 10.0, ), Divider( @@ -386,6 +412,23 @@ class _NewPrescriptionScreenState extends State { ], ), ), + Container( + height: + MediaQuery.of(context) + .size + .height * + 0.05, + width: + MediaQuery.of(context) + .size + .width * + 0.06, + child: Column( + children: [ + Icon(Icons.edit) + ], + ), + ), ], ), ], diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 5b6b10f3..2bdb7f78 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -111,7 +111,10 @@ class _ProcedureScreenState extends State { children: [ InkWell( onTap: () { - addSelectedProcedure(context); + model.getCategories().then((value) { + addSelectedProcedure(context, model); + }); + //model.postPrescription(); }, child: CircleAvatar( @@ -149,7 +152,7 @@ class _ProcedureScreenState extends State { AppText( TranslationBase.of(context).addNow, color: Color(0XFFB8382C), - fontWeight: FontWeight.w900, + fontWeight: FontWeight.w700, ), ], ), @@ -194,7 +197,12 @@ class _ProcedureScreenState extends State { ), ), onTap: () { - addSelectedProcedure(context); + model.getCategories().then((value) { + addSelectedProcedure( + context, model); + }); + + //model.postPrescription(); }, ), // Container( @@ -252,7 +260,7 @@ class _ProcedureScreenState extends State { 'Code #: ', fontWeight: FontWeight - .w900, + .w700, fontSize: 15.0, ), AppText( @@ -272,7 +280,7 @@ class _ProcedureScreenState extends State { 'Order Type: ', fontWeight: FontWeight - .w900, + .w700, fontSize: 15.0, ), AppText( @@ -310,7 +318,7 @@ class _ProcedureScreenState extends State { 'Price: ', fontWeight: FontWeight - .w900, + .w700, ), Expanded( child: AppText( @@ -382,7 +390,6 @@ class _ProcedureScreenState extends State { } postProcedure({ProcedureViewModel model}) async { - model = new ProcedureViewModel(); PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); List controls = List(); List controlsProcedure = List(); @@ -402,98 +409,248 @@ postProcedure({ProcedureViewModel model}) async { postProcedureReqModel.procedures = controlsProcedure; await model.postProcedure(postProcedureReqModel); - DrAppToastMsg.showSuccesToast('Procedure had been added'); + if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); + } else if (model.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast('procedure has been added'); } } -void addSelectedProcedure(context) { +void addSelectedProcedure(context, ProcedureViewModel model) { + showModalBottomSheet( + context: context, + builder: (BuildContext bc) { + return AddSelectedProcedure( + model: model, + ); + }); +} + +class AddSelectedProcedure extends StatefulWidget { + final ProcedureViewModel model; + + const AddSelectedProcedure({Key key, this.model}) : super(key: key); + @override + _AddSelectedProcedureState createState() => _AddSelectedProcedureState(); +} + +class _AddSelectedProcedureState extends State { TextEditingController procedureController = TextEditingController(); + + @override + Widget build(BuildContext context) { + return NetworkBaseView( + baseViewModel: widget.model, + child: SingleChildScrollView( + child: Container( + height: 490, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'Select Procedure'.toUpperCase(), + fontWeight: FontWeight.w900, + ), + if (widget.model.categoriesList.length != 0) + Container( + // child: ListView( + // children: [ + // Column( + // children: model.historyFamilyList + // .map((historyInfo) { + // return Column( + // children: [ + // Row( + // children: [ + // Checkbox( + // value: isServiceSelected( + // historyInfo), + // activeColor: + // Colors.red[800], + // onChanged: + // (bool newValue) { + // setState(() { + // if (isServiceSelected( + // historyInfo + // )) { + // widget + // .removeHistory( + // historyInfo + // ); + // } + // else { + // widget + // .myHistoryList + // .add( + // historyInfo); + // } + // }); + // }), + // Expanded( + // child: Padding( + // padding: + // const EdgeInsets + // .symmetric( + // horizontal: 10, + // vertical: 0), + // child: Texts( + // historyInfo.nameEn, + // variant: "bodyText", + // bold: true, + // color: + // Colors.black), + // ), + // ), + // ], + // ), + // DividerWithSpacesAround(), + // ], + // ); + // }).toList(), + // ), + // ], + // ), + height: 120.0, + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: widget.model.categoriesList[0].rowcount, + itemBuilder: (BuildContext ctxt, int index) { + return Container( + child: AppText(widget.model.categoriesList[0] + .entityList[index].procedureName), + ); + }), + ), + SizedBox( + height: 0.0, + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: 'Add Delected Procedures'.toUpperCase(), + borderColor: Colors.white, + textInputType: TextInputType.text, + inputFormatter: ONLY_LETTERS, + controller: procedureController, + ), + ), + SizedBox( + height: 80.0, + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context).addMedication, + onPressed: () { + Navigator.pop(context); + postProcedure(model: widget.model); + }, + ), + ], + ), + ), + ], + ) + ], + ), + ), + ), + ), + ); + } +} + +// isServiceSelected(ProcedureViewModel masterKey) { +// Iterable history = widget.myHistoryList.where((element) => +// masterKey.id == element.id && masterKey.typeId == element.typeId); +// if (history.length > 0) { +// return true; +// } +// return false; +// } + +void updateProcedureForm(context) { showModalBottomSheet( context: context, + isScrollControlled: true, builder: (BuildContext bc) { - return BaseView( - onModelReady: (model) => model.getCategories(), - builder: - (BuildContext context, ProcedureViewModel model, Widget child) => - NetworkBaseView( - baseViewModel: model, - child: SingleChildScrollView( - child: Container( - height: 490, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'Select Procedure'.toUpperCase(), - fontWeight: FontWeight.w900, + return Container( + height: 500, + child: Form( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'Procedure Name'.toUpperCase(), + fontWeight: FontWeight.w900, + ), + SizedBox( + height: 30.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: 'Order ', + borderColor: Colors.white, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS, ), - if (model.categoriesList.length != 0) - Container( - height: 120.0, - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: model.categoriesList[0].rowcount, - itemBuilder: (BuildContext ctxt, int index) { - return Container( - child: AppText(model.categoriesList[0] - .entityList[index].procedureName), - ); - }), - ), - SizedBox( - height: 0.0, + ), + SizedBox( + height: 12.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: AppTextFormField( + labelText: 'Password', + borderColor: Colors.white, + textInputType: TextInputType.text, + inputFormatter: ONLY_LETTERS, + obscureText: true, ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: AppTextFormField( - labelText: - 'Add Delected Procedures'.toUpperCase(), - borderColor: Colors.white, - textInputType: TextInputType.text, - inputFormatter: ONLY_LETTERS, - controller: procedureController, - ), - ), - SizedBox( - height: 80.0, - ), - Container( - margin: - EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: - TranslationBase.of(context).addMedication, - onPressed: () { - Navigator.pop(context); - postProcedure(); - }, - ), - ], - ), + ), + SizedBox( + height: 190.0, + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: 'CONTINUE', + onPressed: () { + Navigator.pop(context); + // authorizationForm(context); + }, ), ], - ) - ], - ), + ), + ), + ], ), ), - ), - ), - ); + )); }); } diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index d4ed9c86..20833a02 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -24,9 +24,13 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class SubjectivePage extends StatefulWidget { final Function changePageViewIndex; final List myAllergiesList; - final List myHistoryList ; + final List myHistoryList; - SubjectivePage({Key key, this.changePageViewIndex, this.myAllergiesList, this.myHistoryList}); + SubjectivePage( + {Key key, + this.changePageViewIndex, + this.myAllergiesList, + this.myHistoryList}); @override _SubjectivePageState createState() => _SubjectivePageState(); @@ -102,15 +106,13 @@ class _SubjectivePageState extends State { minLines: 13, controller: complaintsController, validator: (value) { - if (value == null || value =="") - return TranslationBase - .of(context) + if (value == null || value == "") + return TranslationBase.of(context) .emptyMessage; else if (value.length < 25) - return TranslationBase - .of(context) + return TranslationBase.of(context) .chiefComplaintLength; - //""; + //""; else return null; }), @@ -129,9 +131,8 @@ class _SubjectivePageState extends State { minLines: 13, controller: illnessController, validator: (value) { - if (value == null || value =="") - return TranslationBase - .of(context) + if (value == null || value == "") + return TranslationBase.of(context) .emptyMessage; else return null; @@ -146,7 +147,6 @@ class _SubjectivePageState extends State { ), isExpand: isChiefExpand, ), - SizedBox( height: 30, ), @@ -222,15 +222,16 @@ class _SubjectivePageState extends State { : EvaIcons.plus)) ], ), - bodyWidget:Column( + bodyWidget: Column( children: [ - AddAllergiesWidget(myAllergiesList: widget.myAllergiesList,), + AddAllergiesWidget( + myAllergiesList: widget.myAllergiesList, + ), SizedBox( height: 30, ), ], - ) - , + ), isExpand: isAllergiesExpand, ), SizedBox( @@ -308,7 +309,6 @@ class _SubjectivePageState extends State { // } else { // helpers.showErrorToast('Please add required field correctly'); // } - } postAllergy( @@ -320,8 +320,8 @@ class _SubjectivePageState extends State { null) postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; //TODO: make static value dynamic - postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM - .add(ListHisProgNotePatientAllergyDiseaseVM( + postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add( + ListHisProgNotePatientAllergyDiseaseVM( allergyDiseaseId: allergy.selectedAllergy.id, allergyDiseaseType: allergy.selectedAllergy.typeId, patientMRN: 3120690, @@ -331,9 +331,11 @@ class _SubjectivePageState extends State { remarks: allergy.remark, createdBy: 1485, // - createdOn: DateTime.now().toIso8601String(),//"2020-08-14T20:37:22.780Z", + createdOn: DateTime.now() + .toIso8601String(), //"2020-08-14T20:37:22.780Z", editedBy: 1485, - editedOn: DateTime.now().toIso8601String(),//"2020-08-14T20:37:22.780Z", + editedOn: DateTime.now() + .toIso8601String(), //"2020-08-14T20:37:22.780Z", isChecked: false, isUpdatedByNurse: false)); }); @@ -371,23 +373,21 @@ class _SubjectivePageState extends State { postChiefComplaint({SOAPViewModel model}) async { formKey.currentState.save(); - if(formKey.currentState.validate()){ + if (formKey.currentState.validate()) { PostChiefComplaintRequestModel postChiefComplaintRequestModel = - //TODO: make static value dynamic - new PostChiefComplaintRequestModel( - patientMRN: 3120690, - episodeID: 200012117, - appointmentNo: 2016054573, - chiefComplaint: complaintsController.text, - currentMedication: "currentMedication", - hopi: illnessController.text, - isLactation: false, - ispregnant: false, - numberOfWeeks: 22); + //TODO: make static value dynamic + new PostChiefComplaintRequestModel( + patientMRN: 3120690, + episodeID: 200012117, + appointmentNo: 2016054573, + chiefComplaint: complaintsController.text, + currentMedication: "currentMedication", + hopi: illnessController.text, + isLactation: false, + ispregnant: false, + numberOfWeeks: 22); await model.postChiefComplaint(postChiefComplaintRequestModel); - } - } } From 93bece09d72e8201ce5509dd8cdf62926d606d9b Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Thu, 31 Dec 2020 16:28:15 +0200 Subject: [PATCH 3/7] add search in SOAP --- .../profile/SOAP/assessment_page.dart | 62 ++-- .../patients/profile/SOAP/objective_page.dart | 112 ++---- .../SOAP/subjective/add_allergies_widget.dart | 56 ++- .../SOAP/subjective/add_history_widget.dart | 326 +++--------------- .../master_key_checkbox_search_widget.dart | 149 ++++++++ pubspec.lock | 7 + pubspec.yaml | 3 + 7 files changed, 292 insertions(+), 423 deletions(-) create mode 100644 lib/widgets/shared/master_key_checkbox_search_widget.dart diff --git a/lib/widgets/patients/profile/SOAP/assessment_page.dart b/lib/widgets/patients/profile/SOAP/assessment_page.dart index 22778913..eadc327b 100644 --- a/lib/widgets/patients/profile/SOAP/assessment_page.dart +++ b/lib/widgets/patients/profile/SOAP/assessment_page.dart @@ -1,8 +1,10 @@ +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart'; @@ -19,6 +21,7 @@ import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body. import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; class AssessmentPage extends StatefulWidget { final Function changePageViewIndex; @@ -375,15 +378,17 @@ class _AddAssessmentDetailsState extends State { TextEditingController remarkController = TextEditingController(); TextEditingController appointmentIdController = TextEditingController( text: "234567"); + GlobalKey key = new GlobalKey>(); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); remarkController.text = widget.mySelectedAssessment.remark??""; final screenSize = MediaQuery .of(context) .size; InputDecoration textFieldSelectorDecoration(String hintText, - String selectedText, bool isDropDown) { + String selectedText, bool isDropDown,{IconData icon}) { //TODO: make one Input InputDecoration for all return InputDecoration( focusedBorder: OutlineInputBorder( @@ -399,7 +404,7 @@ class _AddAssessmentDetailsState extends State { borderRadius: BorderRadius.circular(8), ), hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, + suffixIcon: isDropDown ? Icon(icon??Icons.arrow_drop_down) : null, hintStyle: TextStyle( fontSize: 14, color: Colors.grey.shade600, @@ -470,43 +475,28 @@ class _AddAssessmentDetailsState extends State { child: InkWell( onTap: model.listOfICD10 != null ? () { - MasterKeyDailog dialog = MasterKeyDailog( - isICD: true, - list: model.listOfICD10, - selectedValue: widget - .mySelectedAssessment - .selectedICD, - okText: TranslationBase - .of(context) - .ok, - okFunction: - (MasterKeyModel selectedValue) { - setState(() { - widget.mySelectedAssessment - .selectedICD = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); + setState(() { + widget.mySelectedAssessment.selectedICD = null; + }); } : null, - child: TextField( + child:widget.mySelectedAssessment.selectedICD == null ? AutoCompleteTextField( + decoration: textFieldSelectorDecoration("Name or ICD", widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.nameEn : null, true,icon: EvaIcons.search), + itemSubmitted: (item) => setState(() => widget.mySelectedAssessment.selectedICD = item), + key: key, + suggestions: model.listOfICD10, + itemBuilder: (context, suggestion) => new Padding( + child:Texts( suggestion.description +" / "+ suggestion.code.toString()), + padding: EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.description.toLowerCase().startsWith(input.toLowerCase()) ||suggestion.description.toLowerCase().startsWith(input.toLowerCase()) + ||suggestion.code.toLowerCase().startsWith(input.toLowerCase()) + , + ): TextField( decoration: textFieldSelectorDecoration( - "Name / ICD", - widget.mySelectedAssessment - .selectedICD != - null - ? widget.mySelectedAssessment - .selectedICD.nameEn - : null, - true), + widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.code :"Name or ICD", + widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.nameEn : null, true,icon: EvaIcons.search), enabled: false, ), ), diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index 8d12e1c9..a4d94279 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_widget.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'; @@ -469,98 +470,35 @@ class _AddExaminationDailogState extends State { SizedBox( height: 16, ), + NetworkBaseView( baseViewModel: model, - child: Container( - height: - MediaQuery - .of(context) - .size - .height * 0.5, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - borderRadius: BorderRadius - .circular(12), - color: Colors.white), - child: ListView( - children: [ - Column( - children: model - .physicalExaminationList - .map((examinationInfo) { - return Column( - children: [ - Row( - children: [ - Checkbox( - value: isServiceSelected( - examinationInfo), - activeColor: - Colors.red[800], - onChanged: - ( - bool newValue) { - setState(() { - if (isServiceSelected( - examinationInfo - )) { - widget - .removeExamination( - examinationInfo - ); - } - else { - MySelectedExamination mySelectedExamination = new MySelectedExamination( - selectedExamination: examinationInfo - ); - widget - .mySelectedExamination - .add( - mySelectedExamination); - } - }); - }), - Expanded( - child: Padding( - padding: - const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Texts( - examinationInfo - .nameEn, - variant: "bodyText", - bold: true, - color: - Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - ], - ); - }).toList(), - ), - ], - ), - )), - ), - ), - SizedBox( - height: 10, - ), - if (model.state == ViewState.Idle) - AppButton( - title: "Add SELECTED Examinations" - .toUpperCase(), - onPressed: () { + child: MasterKeyCheckboxSearchWidget( + model: model, + masterList: model.physicalExaminationList, + removeHistory: (history){ + setState(() { + widget.removeExamination(history); + }); + }, + addHistory: (history){ + setState(() { + MySelectedExamination mySelectedExamination = new MySelectedExamination( + selectedExamination: history + ); + widget + .mySelectedExamination + .add( + mySelectedExamination); + }); + }, + addSelectedHistories: (){ widget.addSelectedExamination(); }, + isServiceSelected: (master) =>isServiceSelected(master), ), + ), + ]), ))), )), diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart index 7f764a0d..fd3cb917 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart @@ -1,6 +1,8 @@ +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -14,6 +16,7 @@ import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; class AddAllergiesWidget extends StatefulWidget { final List myAllergiesList; @@ -43,11 +46,9 @@ class _AddAllergiesWidgetState extends State { openAllergiesList(context); }, readOnly: true, - // hintColor: Colors.black, suffixIcon: EvaIcons.plusCircleOutline, suffixIconColor: AppGlobal.appPrimaryColor, fontWeight: FontWeight.w600, - // controller: messageController, validator: (value) { if (value == null) return TranslationBase @@ -147,7 +148,7 @@ class _AddAllergiesState extends State { InputDecoration textFieldSelectorDecoration(String hintText, - String selectedText, bool isDropDown) { + String selectedText, bool isDropDown,{IconData icon}) { return InputDecoration( focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), @@ -162,16 +163,19 @@ class _AddAllergiesState extends State { borderRadius: BorderRadius.circular(8), ), hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, + suffixIcon: isDropDown ? Icon(icon?? Icons.arrow_drop_down) : null, hintStyle: TextStyle( fontSize: 14, color: Colors.grey.shade600, ), ); } + bool _isShowSearch = false; + GlobalKey key = new GlobalKey>(); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); final screenSize = MediaQuery .of(context) .size; @@ -209,38 +213,30 @@ class _AddAllergiesState extends State { SizedBox( height: 16, ), + Container( height: screenSize.height * 0.070, child: InkWell( onTap: model.listOfAllergies != null ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.listOfAllergies, - okText: TranslationBase - .of(context) - .ok, - okFunction: (MasterKeyModel selectedValue) { - setState(() { - _selectedAllergy = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } + setState(() { + _selectedAllergy = null; + }); + } : null, - child: TextField( - decoration: textFieldSelectorDecoration( - "Select Allergy", - _selectedAllergy != null - ? _selectedAllergy.nameEn - : null, - true), + 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.listOfAllergies, + 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, ), ), diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart index 1907453d..6e7bbe00 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart @@ -16,6 +16,8 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:hexcolor/hexcolor.dart'; +import '../../../../shared/master_key_checkbox_search_widget.dart'; + class AddHistoryWidget extends StatefulWidget { final List myHistoryList; @@ -280,273 +282,59 @@ class _AddHistoryDialogState extends State { }, scrollDirection: Axis.horizontal, children: [ - Container( - child: Column( - children: [ - NetworkBaseView( - baseViewModel: model, - child: Container( - height: - MediaQuery.of(context).size.height * 0.5, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: ListView( - children: [ - Column( - children: model.historyFamilyList - .map((historyInfo) { - return Column( - children: [ - Row( - children: [ - Checkbox( - value: isServiceSelected( - historyInfo), - activeColor: - Colors.red[800], - onChanged: - (bool newValue) { - setState(() { - if (isServiceSelected( - historyInfo - )) { - widget - .removeHistory( - historyInfo - ); - } - else { - widget - .myHistoryList - .add( - historyInfo); - } - }); - }), - Expanded( - child: Padding( - padding: - const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Texts( - historyInfo.nameEn, - variant: "bodyText", - bold: true, - color: - Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - ], - ); - }).toList(), - ), - ], - ), - )), - ), - ), - SizedBox( - height: 10, - ), - if (model.state == ViewState.Idle) - AppButton( - title: "Add SELECTED HISTORIES" - .toUpperCase(), - onPressed: () { - widget.addSelectedHistories(); - }, - ), - ], - ), + MasterKeyCheckboxSearchWidget( + model: model, + masterList: model.historyFamilyList, + removeHistory: (history){ + setState(() { + widget.removeHistory(history); + }); + }, + addHistory: (history){ + setState(() { + widget.myHistoryList.add(history); + }); + }, + addSelectedHistories: (){ + widget.addSelectedHistories(); + }, + isServiceSelected: (master) =>isServiceSelected(master), ), - Container( - child: Column( - children: [ - NetworkBaseView( - baseViewModel: model, - child: Container( - height: - MediaQuery.of(context).size.height * 0.5, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: ListView( - children: [ - Column( - children: model.mergeHistorySurgicalWithHistorySportList - .map((historyInfo) { - return Column( - children: [ - Row( - children: [ - Checkbox( - value: isServiceSelected( - historyInfo), - activeColor: - Colors.red[800], - onChanged: - ( - bool newValue) { - setState(() { - if (isServiceSelected( - historyInfo - )) { - widget - .removeHistory( - historyInfo - ); - } - else { - widget - .myHistoryList - .add( - historyInfo); - } - }); - }), - Expanded( - child: Padding( - padding: - const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Texts( - historyInfo.nameEn, - variant: "bodyText", - bold: true, - color: - Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - ], - ); - }).toList(), - ), - ], - ), - )), - ), - ), - SizedBox( - height: 10, - ), - if (model.state == ViewState.Idle) - AppButton( - title: "Add SELECTED HISTORIES" - .toUpperCase(), - onPressed: () { - widget.addSelectedHistories(); - }, - ), - ], - ), + MasterKeyCheckboxSearchWidget( + model: model, + masterList: model.mergeHistorySurgicalWithHistorySportList, + removeHistory: (history){ + setState(() { + widget.removeHistory(history); + }); + }, + addHistory: (history){ + setState(() { + widget.myHistoryList.add(history); + }); + }, + addSelectedHistories: (){ + widget.addSelectedHistories(); + }, + isServiceSelected: (master) =>isServiceSelected(master), ), - Container( - child: Column( - children: [ - NetworkBaseView( - baseViewModel: model, - child: Container( - height: - MediaQuery.of(context).size.height * 0.5, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: ListView( - children: [ - Column( - children: model.historyMedicalList - .map((historyInfo) { - return Column( - children: [ - Row( - children: [ - Checkbox( - value: isServiceSelected( - historyInfo), - activeColor: - Colors.red[800], - onChanged: - ( - bool newValue) { - setState(() { - if (isServiceSelected( - historyInfo - )) { - widget - .removeHistory( - historyInfo - ); - } - else { - widget - .myHistoryList - .add( - historyInfo); - } - }); - }), - Expanded( - child: Padding( - padding: - const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Texts( - historyInfo.nameEn, - variant: "bodyText", - bold: true, - color: - Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - ], - ); - }).toList(), - ), - ], - ), - )), - ), - ), - SizedBox( - height: 10, - ), - if (model.state == ViewState.Idle) - AppButton( - title: "Add SELECTED HISTORIES" - .toUpperCase(), - onPressed: () { - setState(() { - widget.addSelectedHistories(); - }); - }, - ), - ], - ), + MasterKeyCheckboxSearchWidget( + model: model, + masterList: model.historyMedicalList, + removeHistory: (history){ + setState(() { + widget.removeHistory(history); + }); + }, + addHistory: (history){ + setState(() { + widget.myHistoryList.add(history); + }); + }, + addSelectedHistories: (){ + widget.addSelectedHistories(); + }, + isServiceSelected: (master) =>isServiceSelected(master), ), ], ), @@ -559,12 +347,10 @@ class _AddHistoryDialogState extends State { )); } - isServiceSelected(MasterKeyModel masterKey) { + bool isServiceSelected(MasterKeyModel masterKey) { Iterable history = - widget - .myHistoryList - .where((element) => - masterKey.id == element.id && masterKey.typeId == element.typeId); + widget.myHistoryList.where((element) => masterKey.id == element.id && masterKey.typeId == element.typeId); + if (history.length > 0) { return true; } diff --git a/lib/widgets/shared/master_key_checkbox_search_widget.dart b/lib/widgets/shared/master_key_checkbox_search_widget.dart new file mode 100644 index 00000000..550d3127 --- /dev/null +++ b/lib/widgets/shared/master_key_checkbox_search_widget.dart @@ -0,0 +1,149 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.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/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 MasterKeyCheckboxSearchWidget extends StatefulWidget { + final SOAPViewModel model; + final Function addSelectedHistories; + final Function(MasterKeyModel) removeHistory; + final Function(MasterKeyModel) addHistory; + final bool Function(MasterKeyModel) isServiceSelected; + final List masterList; + + MasterKeyCheckboxSearchWidget( + {Key key, + this.model, + this.addSelectedHistories, + this.removeHistory, + this.masterList, + this.addHistory, + this.isServiceSelected}) + : super(key: key); + + @override + _MasterKeyCheckboxSearchWidgetState createState() => _MasterKeyCheckboxSearchWidgetState(); +} + +class _MasterKeyCheckboxSearchWidgetState extends State { + List items = List(); + + @override + void initState() { + items.addAll(widget.masterList); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + NetworkBaseView( + baseViewModel: widget.model, + child: Container( + height: MediaQuery.of(context).size.height * 0.5, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: ListView( + children: [ + TextFields( + hintText: 'Search history', + suffixIcon: EvaIcons.search, + onChanged: (value) { + filterSearchResults(value); + }, + ), + SizedBox(height: 15,), + Column( + children: items.map((historyInfo) { + return Column( + children: [ + Row( + children: [ + Checkbox( + value: + widget.isServiceSelected(historyInfo), + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() { + if (widget + .isServiceSelected(historyInfo)) { + widget.removeHistory(historyInfo); + } else { + widget.addHistory(historyInfo); + } + }); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts(historyInfo.nameEn, + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + ], + ); + }).toList(), + ), + ], + ), + )), + ), + ), + SizedBox( + height: 10, + ), + if (widget.model.state == ViewState.Idle) + AppButton( + title: "Add SELECTED HISTORIES".toUpperCase(), + onPressed: () { + widget.addSelectedHistories(); + }, + ), + ], + ), + ); + } + + void filterSearchResults(String query) { + List dummySearchList = List(); + dummySearchList.addAll(widget.masterList); + if (query.isNotEmpty) { + List dummyListData = List(); + dummySearchList.forEach((item) { + if (item.nameAr.toLowerCase().contains(query.toLowerCase()) || + item.nameEn.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/pubspec.lock b/pubspec.lock index 17f02b95..c6829dad 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -36,6 +36,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.5.0-nullsafety.1" + autocomplete_textfield: + dependency: "direct main" + description: + name: autocomplete_textfield + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.3" barcode_scan: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index aa7499d5..e15a7182 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -60,6 +60,9 @@ dependencies: get_it: ^4.0.2 + #Autocomplete TextField + autocomplete_textfield: ^1.7.3 + #speech to text From 45edddb49ff06a5f14b2529c27557cf94962214e Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Thu, 31 Dec 2020 17:19:35 +0200 Subject: [PATCH 4/7] Add search in Procedure Screen --- .../entity_list_checkbox_search_widget.dart | 148 ++++++++ lib/screens/procedures/procedure_screen.dart | 334 ++++++++---------- 2 files changed, 294 insertions(+), 188 deletions(-) create mode 100644 lib/screens/procedures/entity_list_checkbox_search_widget.dart diff --git a/lib/screens/procedures/entity_list_checkbox_search_widget.dart b/lib/screens/procedures/entity_list_checkbox_search_widget.dart new file mode 100644 index 00000000..b9962d27 --- /dev/null +++ b/lib/screens/procedures/entity_list_checkbox_search_widget.dart @@ -0,0 +1,148 @@ +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/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/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 EntityListCheckboxSearchWidget extends StatefulWidget { + final ProcedureViewModel model; + final Function addSelectedHistories; + final Function(EntityList) removeHistory; + final Function(EntityList) addHistory; + final bool Function(EntityList) isEntityListSelected; + final List masterList; + + EntityListCheckboxSearchWidget( + {Key key, + this.model, + this.addSelectedHistories, + this.removeHistory, + this.masterList, + this.addHistory, + this.isEntityListSelected}) + : super(key: key); + + @override + _EntityListCheckboxSearchWidgetState createState() => _EntityListCheckboxSearchWidgetState(); +} + +class _EntityListCheckboxSearchWidgetState extends State { + List items = List(); + + @override + void initState() { + items.addAll(widget.masterList); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + NetworkBaseView( + baseViewModel: widget.model, + child: Container( + height: MediaQuery.of(context).size.height * 0.5, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: ListView( + children: [ + TextFields( + hintText: 'Search ', + suffixIcon: EvaIcons.search, + onChanged: (value) { + filterSearchResults(value); + }, + ), + SizedBox(height: 15,), + 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(), + ), + ], + ), + )), + ), + ), + SizedBox( + height: 10, + ), + if (widget.model.state == ViewState.Idle) + AppButton(//TODO change the button name + title: "Add ".toUpperCase(), + onPressed: () { + widget.addSelectedHistories(); + }, + ), + ], + ), + ); + } + + 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); + }); + } + } +} \ No newline at end of file diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 2bdb7f78..97ac65dd 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -2,21 +2,27 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; 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/model/procedure/post_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/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_profile_widget.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_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.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/master_key_checkbox_search_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -249,121 +255,121 @@ class _ProcedureScreenState extends State { ], ), ), - Container( - height: 120, - width: 325.0, - child: Column( - children: [ - Row( - children: [ - AppText( - 'Code #: ', - fontWeight: - FontWeight - .w700, - fontSize: 15.0, - ), - AppText( - model - .procedureList[ - 0] - .entityList[ - index] - .procedureId - .toString(), - fontSize: 13.0, - ), - SizedBox( - width: 12.0, - ), - AppText( - 'Order Type: ', - fontWeight: - FontWeight - .w700, - fontSize: 15.0, - ), - AppText( - 'Urgent', - fontSize: 13.0, - color: - Colors.red, - ), - ], - ), - Row( - children: [ - Container( - child: Expanded( - child: - AppText( - model - .procedureList[ - 0] - .entityList[ - index] - .procedureName, - fontWeight: - FontWeight - .w800, - ), + Expanded( + child: Container( + height: 120, + width: 325.0, + child: Column( + children: [ + Row( + children: [ + AppText( + 'Code #: ', + fontWeight: + FontWeight + .w700, + fontSize: 15.0, + ), + AppText( + model + .procedureList[ + 0] + .entityList[ + index] + .procedureId + .toString(), + fontSize: 13.0, ), - ) - ], - ), + SizedBox( + width: 12.0, + ), + AppText( + 'Order Type: ', + fontWeight: + FontWeight + .w700, + fontSize: 15.0, + ), + AppText( + 'Urgent', + fontSize: 13.0, + color: + Colors.red, + ), + ], + ), + Row( + children: [ + Container( + child: Expanded( + child: + AppText( + model + .procedureList[ + 0] + .entityList[ + index] + .procedureName, + fontWeight: + FontWeight + .w800, + ), + ), + ) + ], + ), - Row( - children: [ - AppText( - 'Price: ', - fontWeight: - FontWeight - .w700, - ), - Expanded( - child: AppText( - model - .procedureList[ - 0] - .entityList[ - index] - .price - .toString(), - fontSize: - 13.0), - ) - ], - ), - SizedBox( - height: 10.0, - ), + Row( + children: [ + AppText( + 'Price: ', + fontWeight: + FontWeight + .w700, + ), + Expanded( + child: AppText( + model + .procedureList[ + 0] + .entityList[ + index] + .price + .toString(), + fontSize: + 13.0), + ) + ], + ), + SizedBox( + height: 10.0, + ), - Row( - children: [ - AppText( - 'Some short remark about the procedure', - fontSize: 13.5, - ), - ], - ), - SizedBox( - height: 10.0, - ), + Row( + children: [ + AppText( + 'Some short remark about the procedure', + fontSize: 13.5, + ), + ], + ), + SizedBox( + height: 10.0, + ), - Divider( - height: 5.0, - thickness: 1.0, - color: Colors.grey, - ) - // SizedBox( - // height: 40, - // ), - ], + Divider( + height: 5.0, + thickness: 1.0, + color: Colors.grey, + ) + // SizedBox( + // height: 40, + // ), + ], + ), ), ), Container( - width: 30, - height: 120, child: Column( children: [ Icon(Icons.edit) @@ -420,6 +426,7 @@ postProcedure({ProcedureViewModel model}) async { void addSelectedProcedure(context, ProcedureViewModel model) { showModalBottomSheet( context: context, + isScrollControlled: true, builder: (BuildContext bc) { return AddSelectedProcedure( model: model, @@ -437,14 +444,14 @@ class AddSelectedProcedure extends StatefulWidget { class _AddSelectedProcedureState extends State { TextEditingController procedureController = TextEditingController(); - + List entityList= List(); @override Widget build(BuildContext context) { return NetworkBaseView( baseViewModel: widget.model, child: SingleChildScrollView( child: Container( - height: 490, + //height: 490, child: Padding( padding: EdgeInsets.all(12.0), child: Column( @@ -455,76 +462,26 @@ class _AddSelectedProcedureState extends State { fontWeight: FontWeight.w900, ), if (widget.model.categoriesList.length != 0) - Container( - // child: ListView( - // children: [ - // Column( - // children: model.historyFamilyList - // .map((historyInfo) { - // return Column( - // children: [ - // Row( - // children: [ - // Checkbox( - // value: isServiceSelected( - // historyInfo), - // activeColor: - // Colors.red[800], - // onChanged: - // (bool newValue) { - // setState(() { - // if (isServiceSelected( - // historyInfo - // )) { - // widget - // .removeHistory( - // historyInfo - // ); - // } - // else { - // widget - // .myHistoryList - // .add( - // historyInfo); - // } - // }); - // }), - // Expanded( - // child: Padding( - // padding: - // const EdgeInsets - // .symmetric( - // horizontal: 10, - // vertical: 0), - // child: Texts( - // historyInfo.nameEn, - // variant: "bodyText", - // bold: true, - // color: - // Colors.black), - // ), - // ), - // ], - // ), - // DividerWithSpacesAround(), - // ], - // ); - // }).toList(), - // ), - // ], - // ), - height: 120.0, - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: widget.model.categoriesList[0].rowcount, - itemBuilder: (BuildContext ctxt, int index) { - return Container( - child: AppText(widget.model.categoriesList[0] - .entityList[index].procedureName), - ); - }), - ), + 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), + ), + SizedBox( height: 0.0, ), @@ -571,16 +528,17 @@ class _AddSelectedProcedureState extends State { ), ); } + bool isEntityListSelected(EntityList masterKey) { + Iterable history = + entityList.where((element) => masterKey.procedureId == element.procedureId); + if (history.length > 0) { + return true; + } + return false; + } } -// isServiceSelected(ProcedureViewModel masterKey) { -// Iterable history = widget.myHistoryList.where((element) => -// masterKey.id == element.id && masterKey.typeId == element.typeId); -// if (history.length > 0) { -// return true; -// } -// return false; -// } + void updateProcedureForm(context) { showModalBottomSheet( From 9bf08e81dab7ba6eea875cea1d90aa7001034d55 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Thu, 31 Dec 2020 17:34:23 +0200 Subject: [PATCH 5/7] Add search button name and hint search text in MasterKeyCheckboxSearchWidget --- lib/widgets/shared/master_key_checkbox_search_widget.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/widgets/shared/master_key_checkbox_search_widget.dart b/lib/widgets/shared/master_key_checkbox_search_widget.dart index 550d3127..f164be4b 100644 --- a/lib/widgets/shared/master_key_checkbox_search_widget.dart +++ b/lib/widgets/shared/master_key_checkbox_search_widget.dart @@ -17,6 +17,8 @@ class MasterKeyCheckboxSearchWidget extends StatefulWidget { final Function(MasterKeyModel) addHistory; final bool Function(MasterKeyModel) isServiceSelected; final List masterList; + final String buttonName; + final String hintSearchText; MasterKeyCheckboxSearchWidget( {Key key, @@ -25,7 +27,7 @@ class MasterKeyCheckboxSearchWidget extends StatefulWidget { this.removeHistory, this.masterList, this.addHistory, - this.isServiceSelected}) + this.isServiceSelected, this.buttonName, this.hintSearchText}) : super(key: key); @override @@ -59,7 +61,7 @@ class _MasterKeyCheckboxSearchWidgetState extends State Date: Thu, 31 Dec 2020 17:45:18 +0200 Subject: [PATCH 6/7] fix merger --- lib/screens/patients/patients_screen.dart | 184 +++++++++--------- .../profile/SOAP/assessment_page.dart | 3 +- .../SOAP/subjective/add_allergies_widget.dart | 6 +- 3 files changed, 98 insertions(+), 95 deletions(-) diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index cb0c7248..74c9234c 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -569,100 +569,102 @@ class _PatientsScreenState extends State { ), ], ), - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - // mainAxisAlignment: - // MainAxisAlignment - // .spaceBetween, - children: < - Widget>[ - SizedBox( - height: - 0.5, - ), - SizedBox( - height: - 0, - ), - Wrap( - children: [ - AppText( - TranslationBase.of(context).age2, - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - AppText( - item.age.toString(), - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - backGroundcolor: Colors.white, - ), - ], - ), - SizedBox( - height: - 2.5, - ), - Wrap( - children: [ - AppText( - TranslationBase.of(context).gender2, - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - AppText( - item.gender.toString() == '1' ? 'Male' : 'Female', - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - backGroundcolor: Colors.white, - ), - ], - ), - SizedBox( - height: - 8, - ), - SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient" - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - height: 15, - width: 60, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25), - color: HexColor("#20A169"), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + // mainAxisAlignment: + // MainAxisAlignment + // .spaceBetween, + children: < + Widget>[ + SizedBox( + height: + 0.5, + ), + SizedBox( + height: + 0, + ), + Wrap( + children: [ + AppText( + TranslationBase.of(context).age2, + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + ), + AppText( + item.age.toString(), + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + backGroundcolor: Colors.white, + ), + ], + ), + SizedBox( + height: + 2.5, + ), + Wrap( + children: [ + AppText( + TranslationBase.of(context).gender2, + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + ), + AppText( + item.gender.toString() == '1' ? 'Male' : 'Female', + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + backGroundcolor: Colors.white, + ), + ], + ), + SizedBox( + height: + 8, + ), + SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient" + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + height: 15, + width: 60, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(25), + color: HexColor("#20A169"), + ), + child: AppText( + item.startTime, + color: Colors.white, + fontSize: 1.5 * SizeConfig.textMultiplier, + textAlign: TextAlign.center, + fontWeight: FontWeight.bold, + ), ), - child: AppText( - item.startTime, - color: Colors.white, - fontSize: 1.5 * SizeConfig.textMultiplier, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, + SizedBox( + width: 3.5, ), - ), - SizedBox( - width: 3.5, - ), - Container( - child: AppText( - convertDateFormat2(item.appointmentDate.toString()), - fontSize: 1.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, + Container( + child: AppText( + convertDateFormat2(item.appointmentDate.toString()), + fontSize: 1.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), ), - ), - SizedBox( - height: 25.5, - ), - ], - ) - : SizedBox( - height: 15, - ), - ], + SizedBox( + height: 25.5, + ), + ], + ) + : SizedBox( + height: 15, + ), + ], + ), ), ], ), diff --git a/lib/widgets/patients/profile/SOAP/assessment_page.dart b/lib/widgets/patients/profile/SOAP/assessment_page.dart index 1527d46b..0f7a8e31 100644 --- a/lib/widgets/patients/profile/SOAP/assessment_page.dart +++ b/lib/widgets/patients/profile/SOAP/assessment_page.dart @@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_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/util/helpers.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'; @@ -43,7 +44,7 @@ class _AssessmentPageState extends State { dynamic _referTo; TextEditingController remarksController = TextEditingController(); - + Helpers helpers = Helpers(); @override Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart index 446df7ee..0a4ce08e 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart @@ -183,7 +183,7 @@ class _AddAllergiesState extends State { heightFactor: 0.7, child: BaseView( onModelReady: (model) async { - if (model.listOfAllergies.length == 0) { + if (model.allergiesList.length == 0) { await model.getMasterLookup(MasterKeysService.Allergies); } if (model.allergySeverityList.length == 0) { @@ -216,7 +216,7 @@ class _AddAllergiesState extends State { Container( height: screenSize.height * 0.070, child: InkWell( - onTap: model.listOfAllergies != null + onTap: model.allergiesList != null ? () { setState(() { _selectedAllergy = null; @@ -227,7 +227,7 @@ class _AddAllergiesState extends State { decoration: textFieldSelectorDecoration("Select Allergy", _selectedAllergy != null ? _selectedAllergy.nameEn : null, true,icon: EvaIcons.search), itemSubmitted: (item) => setState(() => _selectedAllergy = item), key: key, - suggestions: model.listOfAllergies, + suggestions: model.allergiesList, itemBuilder: (context, suggestion) => new Padding( child:Texts( projectViewModel.isArabic? suggestion.nameAr: suggestion.nameEn), padding: EdgeInsets.all(8.0)), From 3578c82f629d04704f8a37eb44e2c37e8162e35e Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 31 Dec 2020 18:20:10 +0200 Subject: [PATCH 7/7] solve hacking patient screen --- lib/screens/patients/patient_search_screen.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index ba32fbe1..61eb5fcf 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -69,19 +69,19 @@ class _PatientSearchScreenState extends State { try { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + /* Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = - new DoctorProfileModel.fromJson(profile); + new DoctorProfileModel.fromJson(profile)*/; if (_formKey.currentState.validate()) { _formKey.currentState.save(); - sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType); + /* sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType); String token = await sharedPref.getString(TOKEN); _patientSearchFormValues.TokenID = token; _patientSearchFormValues.ProjectID = doctorProfile.projectID; //15 _patientSearchFormValues.DoctorID = doctorProfile.doctorID; - _patientSearchFormValues.ClinicID = doctorProfile.clinicID; + _patientSearchFormValues.ClinicID = doctorProfile.clinicID;*/ if ((_patientSearchFormValues.From == "0" || _patientSearchFormValues.To == "0") &&