From c5eac7952211521377bb0413309b8d0bb7929785 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 9 Sep 2021 09:21:30 +0300 Subject: [PATCH 1/4] dilog list & procedure changes --- lib/config/config.dart | 4 +- .../get_ordered_procedure_request_model.dart | 6 +- .../procedure/procedure_service.dart | 76 +++++++----------- lib/core/viewModel/procedure_View_model.dart | 36 +++------ lib/screens/procedures/procedure_screen.dart | 66 ++++++---------- .../shared/dialogs/dailog-list-select.dart | 77 ++++++++++--------- 6 files changed, 109 insertions(+), 156 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 407d4ff6..b8e34330 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -// const BASE_URL = 'https://hmgwebservices.com/'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; diff --git a/lib/core/model/procedure/get_ordered_procedure_request_model.dart b/lib/core/model/procedure/get_ordered_procedure_request_model.dart index dfbd444c..5178ab14 100644 --- a/lib/core/model/procedure/get_ordered_procedure_request_model.dart +++ b/lib/core/model/procedure/get_ordered_procedure_request_model.dart @@ -1,18 +1,22 @@ class GetOrderedProcedureRequestModel { String vidaAuthTokenID; int patientMRN; + int appointmentNo; - GetOrderedProcedureRequestModel({this.vidaAuthTokenID, this.patientMRN}); + GetOrderedProcedureRequestModel({this.vidaAuthTokenID, this.patientMRN, this.appointmentNo}); GetOrderedProcedureRequestModel.fromJson(Map json) { vidaAuthTokenID = json['VidaAuthTokenID']; patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; } Map toJson() { final Map data = new Map(); data['VidaAuthTokenID'] = this.vidaAuthTokenID; data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + return data; } } diff --git a/lib/core/service/patient_medical_file/procedure/procedure_service.dart b/lib/core/service/patient_medical_file/procedure/procedure_service.dart index 526b2b3e..16ed67fa 100644 --- a/lib/core/service/patient_medical_file/procedure/procedure_service.dart +++ b/lib/core/service/patient_medical_file/procedure/procedure_service.dart @@ -28,16 +28,12 @@ class ProcedureService extends BaseService { List templateList = List(); List _templateDetailsList = List(); - List get templateDetailsList => - _templateDetailsList; + List get templateDetailsList => _templateDetailsList; - GetOrderedProcedureRequestModel _getOrderedProcedureRequestModel = - GetOrderedProcedureRequestModel(); + GetOrderedProcedureRequestModel _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel(); - ProcedureTempleteRequestModel _procedureTempleteRequestModel = - ProcedureTempleteRequestModel(); - ProcedureTempleteDetailsRequestModel _procedureTempleteDetailsRequestModel = - ProcedureTempleteDetailsRequestModel(); + ProcedureTempleteRequestModel _procedureTempleteRequestModel = ProcedureTempleteRequestModel(); + ProcedureTempleteDetailsRequestModel _procedureTempleteDetailsRequestModel = ProcedureTempleteDetailsRequestModel(); GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( // clinicId: 17, @@ -63,8 +59,7 @@ class ProcedureService extends BaseService { //search: ["DENTAL"], ); - Future getProcedureTemplate( - {int doctorId, int projectId, int clinicId, String categoryID}) async { + Future getProcedureTemplate({int doctorId, int projectId, int clinicId, String categoryID}) async { _procedureTempleteRequestModel = ProcedureTempleteRequestModel( // tokenID: "@dm!n", patientID: 0, @@ -72,19 +67,18 @@ class ProcedureService extends BaseService { ); hasError = false; - await baseAppClient.post(GET_TEMPLETE_LIST/*GET_PROCEDURE_TEMPLETE*/, + await baseAppClient.post(GET_TEMPLETE_LIST /*GET_PROCEDURE_TEMPLETE*/, onSuccess: (dynamic response, int statusCode) { - templateList.clear(); + templateList.clear(); response['DAPP_TemplateGetList'].forEach((template) { ProcedureTempleteDetailsModel templateElement = ProcedureTempleteDetailsModel.fromJson(template); - if(categoryID != null){ - if(categoryID == templateElement.categoryID){ + if (categoryID != null) { + if (categoryID == templateElement.categoryID) { templateList.add(templateElement); } } else { templateList.add(templateElement); } - }); // response['HIS_ProcedureTemplateList'].forEach((template) { // _templateList.add(ProcedureTempleteModel.fromJson(template)); @@ -95,21 +89,17 @@ class ProcedureService extends BaseService { }, body: _procedureTempleteRequestModel.toJson()); } - Future getProcedureTemplateDetails( - {int doctorId, int projectId, int clinicId, int templateId}) async { + Future getProcedureTemplateDetails({int doctorId, int projectId, int clinicId, int templateId}) async { _procedureTempleteDetailsRequestModel = - ProcedureTempleteDetailsRequestModel( - templateID: templateId, searchType: 1, patientID: 0); + ProcedureTempleteDetailsRequestModel(templateID: templateId, searchType: 1, patientID: 0); hasError = false; //insuranceApprovalInPatient.clear(); _templateDetailsList.clear(); - await baseAppClient.post(GET_PROCEDURE_TEMPLETE_DETAILS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_PROCEDURE_TEMPLETE_DETAILS, onSuccess: (dynamic response, int statusCode) { //prescriptionsList.clear(); response['HIS_ProcedureTemplateDetailsList'].forEach((template) { - _templateDetailsList - .add(ProcedureTempleteDetailsModel.fromJson(template)); + _templateDetailsList.add(ProcedureTempleteDetailsModel.fromJson(template)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -117,15 +107,12 @@ class ProcedureService extends BaseService { }, body: _procedureTempleteDetailsRequestModel.toJson()); } - Future getProcedure({int mrn}) async { - _getOrderedProcedureRequestModel = - GetOrderedProcedureRequestModel(patientMRN: mrn); + Future getProcedure({int mrn, int appointmentNo}) async { + _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel(patientMRN: mrn, appointmentNo: appointmentNo); hasError = false; _procedureList.clear(); - await baseAppClient.post(GET_PROCEDURE_LIST, - onSuccess: (dynamic response, int statusCode) { - _procedureList.add( - GetOrderedProcedureModel.fromJson(response['OrderedProcedureList'])); + await baseAppClient.post(GET_PROCEDURE_LIST, onSuccess: (dynamic response, int statusCode) { + _procedureList.add(GetOrderedProcedureModel.fromJson(response['OrderedProcedureList'])); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -135,8 +122,7 @@ class ProcedureService extends BaseService { Future getCategory() async { hasError = false; - await baseAppClient.post(GET_LIST_CATEGORISE, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_LIST_CATEGORISE, onSuccess: (dynamic response, int statusCode) { categoryList = []; categoryList = response['listProcedureCategories']['entityList']; }, onFailure: (String error, int statusCode) { @@ -145,7 +131,7 @@ class ProcedureService extends BaseService { }, body: Map()); } - Future getProcedureCategory({String categoryName, String categoryID,patientId}) async { + Future getProcedureCategory({String categoryName, String categoryID, patientId}) async { _getProcedureCategoriseReqModel = GetProcedureReqModel( search: ["$categoryName"], patientMRN: patientId, @@ -156,10 +142,8 @@ class ProcedureService extends BaseService { ); hasError = false; _categoriesList.clear(); - await baseAppClient.post(GET_CATEGORISE_PROCEDURE, - onSuccess: (dynamic response, int statusCode) { - _categoriesList - .add(CategoriseProcedureModel.fromJson(response['ProcedureList'])); + 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; @@ -169,8 +153,7 @@ class ProcedureService extends BaseService { Future postProcedure(PostProcedureReqModel postProcedureReqModel) async { hasError = false; _procedureList.clear(); - await baseAppClient.post(POST_PROCEDURE_LIST, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(POST_PROCEDURE_LIST, onSuccess: (dynamic response, int statusCode) { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; @@ -178,12 +161,10 @@ class ProcedureService extends BaseService { }, body: postProcedureReqModel.toJson()); } - Future updateProcedure( - UpdateProcedureRequestModel updateProcedureRequestModel) async { + Future updateProcedure(UpdateProcedureRequestModel updateProcedureRequestModel) async { hasError = false; _procedureList.clear(); - await baseAppClient.post(UPDATE_PROCEDURE, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(UPDATE_PROCEDURE, onSuccess: (dynamic response, int statusCode) { print("ACCEPTED"); }, onFailure: (String error, int statusCode) { hasError = true; @@ -191,14 +172,11 @@ class ProcedureService extends BaseService { }, body: updateProcedureRequestModel.toJson()); } - Future valadteProcedure( - ProcedureValadteRequestModel procedureValadteRequestModel) async { + Future valadteProcedure(ProcedureValadteRequestModel procedureValadteRequestModel) async { hasError = false; _valadteProcedureList.clear(); - await baseAppClient.post(GET_PROCEDURE_VALIDATION, - onSuccess: (dynamic response, int statusCode) { - _valadteProcedureList.add( - ProcedureValadteModel.fromJson(response['ValidateProcedureList'])); + await baseAppClient.post(GET_PROCEDURE_VALIDATION, onSuccess: (dynamic response, int statusCode) { + _valadteProcedureList.add(ProcedureValadteModel.fromJson(response['ValidateProcedureList'])); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index fb96a61a..b576b7a4 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -23,8 +23,7 @@ import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:flutter/cupertino.dart'; -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' - as cpe; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' as cpe; class ProcedureViewModel extends BaseViewModel { //TODO Hussam clean it @@ -61,13 +60,13 @@ class ProcedureViewModel extends BaseViewModel { List _patientLabOrdersListClinic = List(); List _patientLabOrdersListHospital = List(); - Future getProcedure({int mrn, String patientType}) async { + Future getProcedure({int mrn, String patientType, int appointmentNo}) async { hasError = false; await getDoctorProfile(); //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _procedureService.getProcedure(mrn: mrn); + await _procedureService.getProcedure(mrn: mrn, appointmentNo: appointmentNo); if (_procedureService.hasError) { error = _procedureService.error; if (patientType == "7") @@ -78,15 +77,12 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getProcedureCategory( - {String categoryName, String categoryID, patientId}) async { + Future getProcedureCategory({String categoryName, String categoryID, patientId}) async { if (categoryName == null) return; hasError = false; setState(ViewState.Busy); await _procedureService.getProcedureCategory( - categoryName: categoryName, - categoryID: categoryID, - patientId: patientId); + categoryName: categoryName, categoryID: categoryID, patientId: patientId); if (_procedureService.hasError) { error = _procedureService.error; setState(ViewState.ErrorLocal); @@ -321,8 +317,7 @@ class ProcedureViewModel extends BaseViewModel { List entityList, ProcedureType procedureType}) async { PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); + ProcedureValadteRequestModel procedureValadteRequestModel = new ProcedureValadteRequestModel(); procedureValadteRequestModel.patientMRN = patient.patientMRN; procedureValadteRequestModel.episodeID = patient.episodeNo; procedureValadteRequestModel.appointmentNo = patient.appointmentNo; @@ -337,21 +332,13 @@ class ProcedureViewModel extends BaseViewModel { procedureValadteRequestModel.procedure = [element.procedureId]; List controls = List(); controls.add( - Controls( - code: "remarks", - controlValue: element.remarks != null ? element.remarks : ""), + Controls(code: "remarks", controlValue: element.remarks != null ? element.remarks : ""), ); controls.add( - Controls( - code: "ordertype", - controlValue: procedureType == ProcedureType.PROCEDURE - ? element.type ?? "1" - : "0"), + Controls(code: "ordertype", controlValue: procedureType == ProcedureType.PROCEDURE ? element.type ?? "1" : "0"), ); - controlsProcedure.add(Procedures( - category: element.categoryID, - procedure: element.procedureId, - controls: controls)); + controlsProcedure + .add(Procedures(category: element.categoryID, procedure: element.procedureId, controls: controls)); }); postProcedureReqModel.procedures = controlsProcedure; @@ -371,8 +358,7 @@ class ProcedureViewModel extends BaseViewModel { Helpers.showErrorToast(error); getProcedure(mrn: patient.patientMRN); } else if (state == ViewState.Idle) { - Helpers.showErrorToast( - valadteProcedureList[0].entityList[0].warringMessages); + Helpers.showErrorToast(valadteProcedureList[0].entityList[0].warringMessages); } } } else { diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 3ca6d25d..de356935 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -35,12 +35,9 @@ class ProcedureScreen extends StatelessWidget { bool isFromLiveCare = routeArgs['isFromLiveCare']; bool isInpatient = routeArgs['isInpatient']; return BaseView( - onModelReady: (model) => model.getProcedure( - mrn: patient.patientId, - patientType: patientType, - ), - builder: (BuildContext context, ProcedureViewModel model, Widget child) => - AppScaffold( + onModelReady: (model) => + model.getProcedure(mrn: patient.patientId, patientType: patientType, appointmentNo: patient.appointmentNo), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( isShowAppBar: true, backgroundColor: Colors.grey[100], baseViewModel: model, @@ -56,8 +53,7 @@ class ProcedureScreen extends StatelessWidget { SizedBox( height: 12, ), - if (model.procedureList.length == 0 && - patient.patientStatusType != 43) + if (model.procedureList.length == 0 && patient.patientStatusType != 43) Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -77,8 +73,7 @@ class ProcedureScreen extends StatelessWidget { ], ), ), - if (patient.patientStatusType != null && - patient.patientStatusType == 43) + if (patient.patientStatusType != null && patient.patientStatusType == 43) Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -98,20 +93,19 @@ class ProcedureScreen extends StatelessWidget { ], ), ), - if ((patient.patientStatusType != null && - patient.patientStatusType == 43) || + if ((patient.patientStatusType != null && patient.patientStatusType == 43) || (isFromLiveCare && patient.appointmentNo != null)) InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( - builder: (context) => BaseAddProcedureTabPage( - patient: patient, - model: model, - procedureType: ProcedureType.PROCEDURE, - ), settings: RouteSettings(name: 'AddProcedureTabPage') - ), + builder: (context) => BaseAddProcedureTabPage( + patient: patient, + model: model, + procedureType: ProcedureType.PROCEDURE, + ), + settings: RouteSettings(name: 'AddProcedureTabPage')), ); }, child: Container( @@ -159,32 +153,21 @@ class ProcedureScreen extends StatelessWidget { ...List.generate( model.procedureList[0].rowcount, (index) => ProcedureCard( - categoryID: - model.procedureList[0].entityList[index].categoryID, + categoryID: model.procedureList[0].entityList[index].categoryID, entityList: model.procedureList[0].entityList[index], onTap: () { - if (model.procedureList[0].entityList[index].categoryID == - 2 || + if (model.procedureList[0].entityList[index].categoryID == 2 || model.procedureList[0].entityList[index].categoryID == 4) updateProcedureForm(context, model: model, patient: patient, - remarks: model - .procedureList[0].entityList[index].remarks, - orderType: model - .procedureList[0].entityList[index].orderType - .toString(), - orderNo: model - .procedureList[0].entityList[index].orderNo, - procedureName: model.procedureList[0] - .entityList[index].procedureName, - categoreId: model - .procedureList[0].entityList[index].categoryID - .toString(), - procedureId: model.procedureList[0] - .entityList[index].procedureId, - limetNo: model.procedureList[0].entityList[index] - .lineItemNo); + remarks: model.procedureList[0].entityList[index].remarks, + orderType: model.procedureList[0].entityList[index].orderType.toString(), + orderNo: model.procedureList[0].entityList[index].orderNo, + procedureName: model.procedureList[0].entityList[index].procedureName, + categoreId: model.procedureList[0].entityList[index].categoryID.toString(), + procedureId: model.procedureList[0].entityList[index].procedureId, + limetNo: model.procedureList[0].entityList[index].lineItemNo); // } else // Helpers.showErrorToast( // 'You Cant Update This Procedure'); @@ -194,8 +177,7 @@ class ProcedureScreen extends StatelessWidget { ), ), if (model.state == ViewState.ErrorLocal || - (model.procedureList.isNotEmpty && - model.procedureList[0].entityList.isEmpty)) + (model.procedureList.isNotEmpty && model.procedureList[0].entityList.isEmpty)) Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -206,9 +188,7 @@ class ProcedureScreen extends StatelessWidget { Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(22.0), - child: AppText(model.procedureList.isEmpty - ? model.error - : 'No Procedure Found '), + child: AppText(model.procedureList.isEmpty ? model.error : 'No Procedure Found '), ) ], ), diff --git a/lib/widgets/shared/dialogs/dailog-list-select.dart b/lib/widgets/shared/dialogs/dailog-list-select.dart index 76932ecd..dfaf9143 100644 --- a/lib/widgets/shared/dialogs/dailog-list-select.dart +++ b/lib/widgets/shared/dialogs/dailog-list-select.dart @@ -71,43 +71,48 @@ class _ListSelectDialogState extends State { Widget createDialogList() { return Container( height: MediaQuery.of(context).size.height * 0.5, - child: SingleChildScrollView( - child: Column( - children: [ - if (widget.searchWidget != null) widget.searchWidget, - if(widget.usingSearch) - Container( + child: Column( + children: [ + if (widget.searchWidget != null) widget.searchWidget, + if (widget.usingSearch) + Container( height: MediaQuery.of(context).size.height * 0.070, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - widget.hintSearchText ?? TranslationBase - .of(context) - .search, null, false, suffixIcon: Icon(Icons.search,)), - enabled: true, - keyboardType: TextInputType.text, - onChanged: (value) { - filterSearchResults(value); - }, - )), - ...items - .map((item) => RadioListTile( - title: Text("${item[widget.attributeName].toString()}"), - groupValue: widget.selectedValue[widget.attributeValueId] - .toString(), - value: item[widget.attributeValueId].toString(), - activeColor: Colors.blue.shade700, - selected: item[widget.attributeValueId].toString() == - widget.selectedValue[widget.attributeValueId] - .toString(), - onChanged: (val) { - setState(() { - widget.selectedValue = item; - }); - }, - )) - .toList() - ], - ), + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + widget.hintSearchText ?? TranslationBase.of(context).search, null, false, + suffixIcon: Icon( + Icons.search, + )), + enabled: true, + keyboardType: TextInputType.text, + onChanged: (value) { + filterSearchResults(value); + }, + )), + Expanded( + child: SingleChildScrollView( + child: Column( + children: [ + ...items + .map((item) => RadioListTile( + title: Text("${item[widget.attributeName].toString()}"), + groupValue: widget.selectedValue[widget.attributeValueId].toString(), + value: item[widget.attributeValueId].toString(), + activeColor: Colors.blue.shade700, + selected: item[widget.attributeValueId].toString() == + widget.selectedValue[widget.attributeValueId].toString(), + onChanged: (val) { + setState(() { + widget.selectedValue = item; + }); + }, + )) + .toList() + ], + ), + ), + ), + ], ), ); } From 763686fc76d65bb481a89b163e630887a53abd1b Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 9 Sep 2021 11:04:19 +0300 Subject: [PATCH 2/4] adding missing fields for medication --- .../get_medication_for_inpatient_model.dart | 23 ++++++++++++++- .../procedure/procedure_service.dart | 4 ++- .../prescription_item_in_patient_page.dart | 29 ++++++++++--------- .../prescription/prescriptions_page.dart | 2 +- 4 files changed, 41 insertions(+), 17 deletions(-) diff --git a/lib/core/model/Prescriptions/get_medication_for_inpatient_model.dart b/lib/core/model/Prescriptions/get_medication_for_inpatient_model.dart index 7c6d0db5..8ba07f2a 100644 --- a/lib/core/model/Prescriptions/get_medication_for_inpatient_model.dart +++ b/lib/core/model/Prescriptions/get_medication_for_inpatient_model.dart @@ -30,6 +30,11 @@ class GetMedicationForInPatientModel { dynamic strength; String pHRItemDescription; String pHRItemDescriptionN; + String doctorName; + String uomDescription; + String routeDescription; + String directionDescription; + String refillDescription; GetMedicationForInPatientModel( {this.setupID, @@ -62,11 +67,22 @@ class GetMedicationForInPatientModel { this.editedOn, this.strength, this.pHRItemDescription, - this.pHRItemDescriptionN}); + this.pHRItemDescriptionN, + this.doctorName, + this.uomDescription, + this.routeDescription, + this.directionDescription, + this.refillDescription}); GetMedicationForInPatientModel.fromJson(Map json) { setupID = json['SetupID']; projectID = json['ProjectID']; + doctorName = json['DoctorName']; + refillDescription = json['RefillDescription']; + directionDescription = json['DirectionDescription']; + routeDescription = json['RouteDescription']; + + uomDescription = json['UOMDescription']; admissionNo = json['AdmissionNo']; patientID = json['PatientID']; orderNo = json['OrderNo']; @@ -101,6 +117,11 @@ class GetMedicationForInPatientModel { Map toJson() { final Map data = new Map(); data['SetupID'] = this.setupID; + data['DoctorName'] = this.doctorName; + data['RefillDescription'] = this.refillDescription; + data['RouteDescription'] = this.routeDescription; + data['DirectionDescription'] = this.directionDescription; + data['UOMDescription'] = this.uomDescription; data['ProjectID'] = this.projectID; data['AdmissionNo'] = this.admissionNo; data['PatientID'] = this.patientID; diff --git a/lib/core/service/patient_medical_file/procedure/procedure_service.dart b/lib/core/service/patient_medical_file/procedure/procedure_service.dart index 16ed67fa..56a92de5 100644 --- a/lib/core/service/patient_medical_file/procedure/procedure_service.dart +++ b/lib/core/service/patient_medical_file/procedure/procedure_service.dart @@ -108,7 +108,9 @@ class ProcedureService extends BaseService { } Future getProcedure({int mrn, int appointmentNo}) async { - _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel(patientMRN: mrn, appointmentNo: appointmentNo); + _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel( + patientMRN: mrn, + ); hasError = false; _procedureList.clear(); await baseAppClient.post(GET_PROCEDURE_LIST, onSuccess: (dynamic response, int statusCode) { diff --git a/lib/screens/prescription/prescription_item_in_patient_page.dart b/lib/screens/prescription/prescription_item_in_patient_page.dart index fce49f77..84f38748 100644 --- a/lib/screens/prescription/prescription_item_in_patient_page.dart +++ b/lib/screens/prescription/prescription_item_in_patient_page.dart @@ -91,7 +91,8 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).direction, color: Colors.grey, ), - Expanded(child: AppText(" " + prescriptions.directionID.toString() ?? '')), + Expanded( + child: AppText(" " + prescriptions.directionDescription.toString() ?? '')), ], ), Row( @@ -100,7 +101,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).route, color: Colors.grey, ), - AppText(" " + prescriptions.routeId.toString() ?? ''), + AppText(" " + prescriptions.routeDescription.toString() ?? ''), ], ), Row( @@ -109,7 +110,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).refill, color: Colors.grey, ), - Expanded(child: AppText(" " + prescriptions.refillID.toString() ?? '')), + Expanded(child: AppText(" " + prescriptions.refillDescription.toString() ?? '')), ], ), Row( @@ -150,7 +151,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { 'UOM', color: Colors.grey, ), - AppText(" " + prescriptions.unitofMeasurement.toString() ?? ''), + AppText(" " + prescriptions.uomDescription.toString() ?? ''), ], ), Row( @@ -177,18 +178,18 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { TranslationBase.of(context).processed, color: Colors.grey, ), - // AppText(" " + prescriptions.editedBy.toString() ?? ''), - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context).dailyDoses, - color: Colors.grey, - ), - AppText(" " + prescriptions.dose.toString() ?? ''), + AppText(" " + prescriptions.doctorName.toString() ?? ''), ], ), + // Row( + // children: [ + // AppText( + // TranslationBase.of(context).num, + // color: Colors.grey, + // ), + // AppText(" " + prescriptions.dose.toString() ?? ''), + // ], + // ), SizedBox( height: 12, ), diff --git a/lib/screens/prescription/prescriptions_page.dart b/lib/screens/prescription/prescriptions_page.dart index e7225e9a..0c3c5123 100644 --- a/lib/screens/prescription/prescriptions_page.dart +++ b/lib/screens/prescription/prescriptions_page.dart @@ -196,7 +196,7 @@ class PrescriptionsPage extends StatelessWidget { appointmentDate: AppDateUtils.getDateTimeFromServerFormat( model.medicationForInPatient[index].prescriptionDatetime, ), - createdBy: model.medicationForInPatient[index].createdBy.toString(), + createdBy: model.medicationForInPatient[index].doctorName.toString(), )); }), if (model.medicationForInPatient.length == 0) From 6a96a9cb283195b001908d6589e952a31a42358b Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 9 Sep 2021 12:08:10 +0300 Subject: [PATCH 3/4] fix bug sick leave --- lib/screens/patients/InPatientPage.dart | 0 lib/screens/sick-leave/add-sickleave.dart | 124 ++++++++++++++++------ 2 files changed, 89 insertions(+), 35 deletions(-) delete mode 100644 lib/screens/patients/InPatientPage.dart diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart index db8dd3c2..3cdeb180 100644 --- a/lib/screens/sick-leave/add-sickleave.dart +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -22,6 +22,7 @@ import 'package:provider/provider.dart'; class AddSickLeavScreen extends StatelessWidget { PatiantInformtion patient; + @override Widget build(BuildContext context) { ProjectViewModel projectsProvider = Provider.of(context); @@ -31,8 +32,10 @@ class AddSickLeavScreen extends StatelessWidget { bool isInpatient = routeArgs['isInpatient']; return BaseView( onModelReady: (model) async { - await model.getSickLeavePatient(patient.patientMRN ?? patient.patientId); - await model.getSickLeaveDoctor(patient.patientMRN ?? patient.patientId); + await model + .getSickLeavePatient(patient.patientMRN ?? patient.patientId); + await model + .getSickLeaveDoctor(patient.patientMRN ?? patient.patientId); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, @@ -79,17 +82,21 @@ class AddSickLeavScreen extends StatelessWidget { }, child: Container( width: SizeConfig.screenWidth, - margin: EdgeInsets.only(left: 20, right: 20, top: 10, bottom: 10), + margin: EdgeInsets.only( + left: 20, right: 20, top: 10, bottom: 10), padding: EdgeInsets.all(20), - decoration: - BoxDecoration(borderRadius: BorderRadius.circular(10), color: HexColor('#EAEAEA')), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: HexColor('#EAEAEA')), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ Container( child: Container( - decoration: - BoxDecoration(color: Colors.grey, borderRadius: BorderRadius.circular(10)), + decoration: BoxDecoration( + color: Colors.grey, + borderRadius: + BorderRadius.circular(10)), padding: EdgeInsets.all(3), child: IconButton( icon: Icon( @@ -106,7 +113,9 @@ class AddSickLeavScreen extends StatelessWidget { ), )), Padding( - child: AppText(TranslationBase.of(context).noSickLeaveApplied, + child: AppText( + TranslationBase.of(context) + .noSickLeaveApplied, fontWeight: FontWeight.bold, fontFamily: 'Poppins', fontSize: 16, @@ -122,7 +131,8 @@ class AddSickLeavScreen extends StatelessWidget { : SizedBox(), model.getAllSIckLeavePatient.length > 0 ? Column( - children: model.getAllSIckLeavePatient.map((SickLeavePatientModel item) { + children: model.getAllSIckLeavePatient + .map((SickLeavePatientModel item) { return RoundedContainer( margin: EdgeInsets.all(10), child: Column( @@ -141,7 +151,8 @@ class AddSickLeavScreen extends StatelessWidget { // ))), padding: EdgeInsets.all(10), child: Row( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, children: [ Expanded( flex: 4, @@ -150,7 +161,8 @@ class AddSickLeavScreen extends StatelessWidget { // MainAxisAlignment.start, children: [ Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Container( padding: EdgeInsets.all(3), @@ -168,7 +180,8 @@ class AddSickLeavScreen extends StatelessWidget { // : TranslationBase // .of(context) // .all, - fontWeight: FontWeight.bold, + fontWeight: + FontWeight.bold, // color: item.status == 1 // ? Colors.yellow[800] // : item.status == 2 @@ -179,25 +192,48 @@ class AddSickLeavScreen extends StatelessWidget { ), Row( children: [ - AppText(TranslationBase.of(context).daysSickleave + ": "), + AppText(TranslationBase + .of(context) + .daysSickleave + + ": "), AppText( - item.sickLeaveDays.toString() ?? item.noOfDays.toString(), - fontWeight: FontWeight.bold, + (item.sickLeaveDays + .toString() != + null && + item.sickLeaveDays + .toString() != + "null") + ? item.sickLeaveDays + .toString() + : item.noOfDays + .toString(), + fontWeight: + FontWeight.bold, ), ], ), Row( children: [ AppText( - TranslationBase.of(context).startDate + ' ' ?? "", + TranslationBase.of( + context) + .startDate + + ' ' ?? + "", ), Flexible( child: AppText( - AppDateUtils.getDayMonthYearDateFormatted( - item.startDate.contains("/Date(") - ? AppDateUtils.convertStringToDate(item.startDate) - : DateTime.parse(item.startDate)), - fontWeight: FontWeight.bold, + AppDateUtils.getDayMonthYearDateFormatted(item + .startDate + .contains( + "/Date(") + ? AppDateUtils + .convertStringToDate(item + .startDate) + : DateTime.parse( + item.startDate)), + fontWeight: + FontWeight.bold, ), ) ], @@ -205,18 +241,30 @@ class AddSickLeavScreen extends StatelessWidget { Row( children: [ AppText( - TranslationBase.of(context).endDate + ' ' ?? "", + TranslationBase.of( + context) + .endDate + + ' ' ?? + "", ), Flexible( child: AppText( - AppDateUtils.getDayMonthYearDateFormatted( - item.startDate.contains("/Date(") - ? AppDateUtils.convertStringToDate(item.endDate ?? "") - .add(Duration( - days: item.noOfDays ?? item.sickLeaveDays)) - : DateTime.parse(item.startDate ?? "") - .add(Duration(days: item.noOfDays ?? ""))), - fontWeight: FontWeight.bold, + AppDateUtils.getDayMonthYearDateFormatted(item + .startDate + .contains( + "/Date(") + ? AppDateUtils.convertStringToDate( + item.endDate ?? + "") + .add(Duration( + days: item.noOfDays ?? + item + .sickLeaveDays)) + : DateTime.parse( + item.startDate ?? "") + .add(Duration(days: item.noOfDays ?? ""))), + fontWeight: + FontWeight.bold, ), ) ], @@ -246,7 +294,8 @@ class AddSickLeavScreen extends StatelessWidget { Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), - child: AppText(TranslationBase.of(context).noSickLeave), + child: AppText( + TranslationBase.of(context).noSickLeave), ) ], ), @@ -255,7 +304,8 @@ class AddSickLeavScreen extends StatelessWidget { ])))); } - openSickLeave(BuildContext context, isExtend, {GetAllSickLeaveResponse extendedData}) { + openSickLeave(BuildContext context, isExtend, + {GetAllSickLeaveResponse extendedData}) { // showModalBottomSheet( // context: context, // builder: (context) { @@ -265,9 +315,13 @@ class AddSickLeavScreen extends StatelessWidget { context, FadePage( page: SickLeaveScreen( - appointmentNo: - isExtend == true ? extendedData.appointmentNo : patient.appointmentNo, //extendedData.appointmentNo, - patientMRN: isExtend == true ? extendedData.patientMRN : patient.patientMRN, + appointmentNo: isExtend == true + ? extendedData.appointmentNo + : patient.appointmentNo, + //extendedData.appointmentNo, + patientMRN: isExtend == true + ? extendedData.patientMRN + : patient.patientMRN, isExtended: isExtend, extendedData: extendedData, patient: patient))); From 9598c09ea265028baa7355d4da7c0b77556195bd Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 9 Sep 2021 13:11:25 +0300 Subject: [PATCH 4/4] scroll problem --- .../In_patient/in_patient_list_page.dart | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart index 80acb88d..c7b99200 100644 --- a/lib/screens/patients/In_patient/in_patient_list_page.dart +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -32,13 +32,21 @@ class _InPatientListPageState extends State { bool isAllClinic = true; bool showBottomSheet = false; String selectedClinicName; + ScrollController _scrollController; @override void dispose() { _searchController.dispose(); + _scrollController.dispose(); super.dispose(); } + @override + void initState() { + _scrollController = new ScrollController(); + super.initState(); + } + @override Widget build(BuildContext context) { return AppScaffold( @@ -167,13 +175,14 @@ class _InPatientListPageState extends State { : Expanded( child: Container( margin: EdgeInsets.symmetric(horizontal: 16.0), - child: NotificationListener( + child: NotificationListener( child: ListView.builder( itemCount: widget.patientSearchViewModel .filteredInPatientItems.length, scrollDirection: Axis.vertical, // physics: ScrollPhysics(), shrinkWrap: true, + controller: _scrollController, itemBuilder: (context, index) { if (!widget.isMyInPatient) return PatientCard( @@ -276,14 +285,19 @@ class _InPatientListPageState extends State { else return SizedBox(); }), - onNotification: (t) { - if (isAllClinic) if (t + onNotification: (notification) { + if (isAllClinic) if (notification is ScrollUpdateNotification && - t.metrics.pixels >= - t.metrics.maxScrollExtent - 50) { + notification.metrics.pixels >= + notification.metrics.maxScrollExtent - 50) { widget.patientSearchViewModel .addOnFilteredList(); } + // print("scroll position scroll ${_scrollController.position.pixels}"); + // if(_scrollController.position.pixels > widget.patientSearchViewModel + // .filteredInPatientItems.length / 4){ + // _scrollController.jumpTo(0); + // } return; }, ),