From 50d7f733b638cf7c351a89e14f08f32c11963882 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Tue, 5 Jan 2021 16:25:05 +0200 Subject: [PATCH 1/2] working on UCAF datails and add patient procedure list and diagnosis --- lib/config/config.dart | 1 + lib/core/service/patient-ucaf-service.dart | 48 +++++++- .../viewModel/patient-ucaf-viewmodel.dart | 94 ++++++++++++++- lib/models/SOAP/order-procedure.dart | 110 ++++++++++++++++++ .../profile/UCAF/UCAF-detail-screen.dart | 101 +++++++++++++--- 5 files changed, 332 insertions(+), 22 deletions(-) create mode 100644 lib/models/SOAP/order-procedure.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index e3163bb2..1ac3c517 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -160,6 +160,7 @@ const GET_CHIEF_COMPLAINT = const GET_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/GetPhysicalExam'; const GET_PROGRESS_NOTE = 'Services/DoctorApplication.svc/REST/GetProgressNote'; const GET_ASSESSMENT = 'Services/DoctorApplication.svc/REST/GetAssessment'; +const GET_ORDER_PROCEDURE = 'Services/DoctorApplication.svc/REST/GetOrderedProcedure'; const GET_CATEGORISE_PROCEDURE = 'Services/DoctorApplication.svc/REST/GetProcedure'; diff --git a/lib/core/service/patient-ucaf-service.dart b/lib/core/service/patient-ucaf-service.dart index 06fbce41..ac8ff300 100644 --- a/lib/core/service/patient-ucaf-service.dart +++ b/lib/core/service/patient-ucaf-service.dart @@ -1,14 +1,19 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/core/service/base/lookup-service.dart'; import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/order-procedure.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; -class UcafService extends BaseService { +class UcafService extends LookupService { List patientChiefComplaintList = []; VitalSignData patientVitalSigns; + List patientAssessmentList = []; + List orderProcedureList = []; Future getPatientChiefComplaint(PatiantInformtion patient) async { hasError = false; @@ -55,4 +60,45 @@ class UcafService extends BaseService { body: body, ); } + + Future getPatientAssessment(PatiantInformtion patient) async { + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + body['EpisodeID'] = patient.episodeNo; + + await baseAppClient.post (GET_ASSESSMENT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + patientAssessmentList.clear(); + response['AssessmentList']['entityList'].forEach((v) { + patientAssessmentList.add(GetAssessmentResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getOrderProcedures(PatiantInformtion patient) async { + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + // body['AppointmentNo'] = patient.appointmentNo; + // body['EpisodeID'] = patient.episodeNo; + + await baseAppClient.post (GET_ORDER_PROCEDURE, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + orderProcedureList.clear(); + response['OrderedProcedureList']['entityList'].forEach((v) { + orderProcedureList.add(OrderProcedure.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + } \ No newline at end of file diff --git a/lib/core/viewModel/patient-ucaf-viewmodel.dart b/lib/core/viewModel/patient-ucaf-viewmodel.dart index c120e2ab..5586e711 100644 --- a/lib/core/viewModel/patient-ucaf-viewmodel.dart +++ b/lib/core/viewModel/patient-ucaf-viewmodel.dart @@ -1,19 +1,42 @@ +import 'package:doctor_app_flutter/config/shared_pref_kay.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/service/patient-ucaf-service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/order-procedure.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:flutter/material.dart'; import '../../locator.dart'; class UcafViewModel extends BaseViewModel { - UcafService _ucafService = locator(); - List get patientChiefComplaintList => _ucafService.patientChiefComplaintList; + List get patientChiefComplaintList => + _ucafService.patientChiefComplaintList; + VitalSignData get patientVitalSigns => _ucafService.patientVitalSigns; + List get patientAssessmentList => + _ucafService.patientAssessmentList; + + List get diagnosisTypes => _ucafService.listOfDiagnosisType; + + List get diagnosisConditions => + _ucafService.listOfDiagnosisCondition; + + List get orderProcedures => _ucafService.orderProcedureList; + + String selectedLanguage; + + Future getLanguage() async { + selectedLanguage = await sharedPref.getString(APP_Language); + } + Future getUCAFData(PatiantInformtion patient) async { setState(ViewState.Busy); await _ucafService.getPatientVitalSign(patient); @@ -27,4 +50,69 @@ class UcafViewModel extends BaseViewModel { } } -} \ No newline at end of file + Future getPatientAssessment(PatiantInformtion patient) async { + if (patientAssessmentList.isEmpty) { + setState(ViewState.Busy); + await _ucafService.getPatientAssessment(patient); + if (_ucafService.hasError) { + error = _ucafService.error; + setState(ViewState.Error); + } else { + if (patientAssessmentList.isNotEmpty) { + if (diagnosisConditions.length == 0) { + await _ucafService + .getMasterLookup(MasterKeysService.DiagnosisCondition); + } + if (diagnosisTypes.length == 0) { + await _ucafService.getMasterLookup(MasterKeysService.DiagnosisType); + } + if (_ucafService.hasError) { + error = _ucafService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } else + setState(ViewState.Idle); // but with empty list + } + } + } + + Future getOrderProcedures(PatiantInformtion patient) async { + if (orderProcedures.isEmpty) { + setState(ViewState.Busy); + await _ucafService.getOrderProcedures(patient); + if (_ucafService.hasError) { + error = _ucafService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + } + + MasterKeyModel findMasterDataById( + {@required MasterKeysService masterKeys, dynamic id}) { + switch (masterKeys) { + case MasterKeysService.DiagnosisCondition: + List result = diagnosisConditions.where((element) { + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + return null; + case MasterKeysService.DiagnosisType: + List result = diagnosisTypes.where((element) { + return element.id == id && + element.typeId == masterKeys.getMasterKeyService(); + }).toList(); + if (result.isNotEmpty) { + return result.first; + } + return null; + default: + return null; + } + } +} diff --git a/lib/models/SOAP/order-procedure.dart b/lib/models/SOAP/order-procedure.dart new file mode 100644 index 00000000..4e134a07 --- /dev/null +++ b/lib/models/SOAP/order-procedure.dart @@ -0,0 +1,110 @@ +class OrderProcedure { + + String achiCode; + String appointmentDate; + int appointmentNo; + int categoryID; + String clinicDescription; + String cptCode; + int createdBy; + String createdOn; + String doctorName; + bool isApprovalCreated; + bool isApprovalRequired; + bool isCovered; + bool isInvoiced; + bool isReferralInvoiced; + bool isUncoveredByDoctor; + int lineItemNo; + String orderDate; + int orderNo; + int orderType; + String procedureId; + String procedureName; + String remarks; + String status; + String template; + + OrderProcedure( + {this.achiCode, + this.appointmentDate, + this.appointmentNo, + this.categoryID, + this.clinicDescription, + this.cptCode, + this.createdBy, + this.createdOn, + this.doctorName, + this.isApprovalCreated, + this.isApprovalRequired, + this.isCovered, + this.isInvoiced, + this.isReferralInvoiced, + this.isUncoveredByDoctor, + this.lineItemNo, + this.orderDate, + this.orderNo, + this.orderType, + this.procedureId, + this.procedureName, + this.remarks, + this.status, + this.template}); + + OrderProcedure.fromJson(Map json) { + achiCode = json['achiCode']; + appointmentDate = json['appointmentDate']; + appointmentNo = json['appointmentNo']; + categoryID = json['categoryID']; + clinicDescription = json['clinicDescription']; + cptCode = json['cptCode']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + doctorName = json['doctorName']; + isApprovalCreated = json['isApprovalCreated']; + isApprovalRequired = json['isApprovalRequired']; + isCovered = json['isCovered']; + isInvoiced = json['isInvoiced']; + isReferralInvoiced = json['isReferralInvoiced']; + isUncoveredByDoctor = json['isUncoveredByDoctor']; + lineItemNo = json['lineItemNo']; + orderDate = json['orderDate']; + orderNo = json['orderNo']; + orderType = json['orderType']; + procedureId = json['procedureId']; + procedureName = json['procedureName']; + remarks = json['remarks']; + status = json['status']; + template = json['template']; + } + + Map toJson() { + final Map data = new Map(); + data['achiCode'] = this.achiCode; + data['appointmentDate'] = this.appointmentDate; + data['appointmentNo'] = this.appointmentNo; + data['categoryID'] = this.categoryID; + data['clinicDescription'] = this.clinicDescription; + data['cptCode'] = this.cptCode; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['doctorName'] = this.doctorName; + data['isApprovalCreated'] = this.isApprovalCreated; + data['isApprovalRequired'] = this.isApprovalRequired; + data['isCovered'] = this.isCovered; + data['isInvoiced'] = this.isInvoiced; + data['isReferralInvoiced'] = this.isReferralInvoiced; + data['isUncoveredByDoctor'] = this.isUncoveredByDoctor; + data['lineItemNo'] = this.lineItemNo; + data['orderDate'] = this.orderDate; + data['orderNo'] = this.orderNo; + data['orderType'] = this.orderType; + data['procedureId'] = this.procedureId; + data['procedureName'] = this.procedureName; + data['remarks'] = this.remarks; + data['status'] = this.status; + data['template'] = this.template; + return data; + } + +} \ No newline at end of file diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index f9c2470a..4428da8d 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -1,5 +1,9 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/order-procedure.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'; @@ -25,6 +29,10 @@ class _UcafDetailScreenState extends State { final screenSize = MediaQuery.of(context).size; return BaseView( + onModelReady: (model) async { + await model.getLanguage(); + await model.getPatientAssessment(patient); + }, builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).ucaf, @@ -42,11 +50,12 @@ class _UcafDetailScreenState extends State { EdgeInsets.symmetric(vertical: 16, horizontal: 16), child: Column( children: [ - treatmentStepsBar(context, screenSize), + treatmentStepsBar( + context, model, screenSize, patient), SizedBox( height: 16, ), - ...getSelectedTreatmentStepItem(context), + ...getSelectedTreatmentStepItem(context, model), ], ), ), @@ -57,7 +66,8 @@ class _UcafDetailScreenState extends State { )); } - Widget treatmentStepsBar(BuildContext _context, Size screenSize) { + Widget treatmentStepsBar(BuildContext _context, UcafViewModel model, + Size screenSize, PatiantInformtion patient) { List __treatmentSteps = [ TranslationBase.of(context).diagnosis.toUpperCase(), TranslationBase.of(context).medications.toUpperCase(), @@ -93,8 +103,16 @@ class _UcafDetailScreenState extends State { ), )), ), - onTap: () { + onTap: () async { print(__treatmentSteps.indexOf(item)); + if (__treatmentSteps.indexOf(item) == 0) { + await model.getPatientAssessment(patient); + } else if (__treatmentSteps.indexOf(item) == 1) { + print("call Medications"); + } + if (__treatmentSteps.indexOf(item) == 2) { + await model.getOrderProcedures(patient); + } setState(() { _activeTap = __treatmentSteps.indexOf(item); }); @@ -106,14 +124,41 @@ class _UcafDetailScreenState extends State { ); } - List getSelectedTreatmentStepItem(BuildContext _context) { + List getSelectedTreatmentStepItem( + BuildContext _context, UcafViewModel model) { switch (_activeTap) { case 0: - return [...List.generate(2, (index) => DiagnosisWidget()).toList()]; + if (model.patientAssessmentList != null) { + return [ + ...List.generate( + model.patientAssessmentList.length, + (index) => DiagnosisWidget( + model, model.patientAssessmentList[index])).toList() + ]; + } else { + return [ + Container(), + ]; + } + break; case 1: return [...List.generate(2, (index) => MedicationWidget()).toList()]; + break; case 2: - return [...List.generate(2, (index) => ProceduresWidget()).toList()]; + if (model.orderProcedures != null) { + return [ + ...List.generate( + model.orderProcedures.length, + (index) => + ProceduresWidget(model, model.orderProcedures[index])) + .toList() + ]; + } else { + return [ + Container(), + ]; + } + break; default: return [ Container(), @@ -123,8 +168,20 @@ class _UcafDetailScreenState extends State { } class DiagnosisWidget extends StatelessWidget { + final UcafViewModel model; + final GetAssessmentResModel diagnosis; + + DiagnosisWidget(this.model, this.diagnosis); + @override Widget build(BuildContext context) { + MasterKeyModel diagnosisType = model.findMasterDataById( + masterKeys: MasterKeysService.DiagnosisType, + id: diagnosis.diagnosisTypeID); + MasterKeyModel diagnosisCondition = model.findMasterDataById( + masterKeys: MasterKeysService.DiagnosisCondition, + id: diagnosis.conditionID); + return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -136,7 +193,11 @@ class DiagnosisWidget extends StatelessWidget { fontSize: SizeConfig.textMultiplier * 2.0, ), AppText( - "Preliminary Diagnosis", + diagnosisType != null + ? model.selectedLanguage == 'ar' + ? diagnosisType.nameAr + : diagnosisType.nameEn + : "-", fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 2.0, ), @@ -149,7 +210,7 @@ class DiagnosisWidget extends StatelessWidget { children: [ Expanded( child: AppText( - "B34.2 | CORONA VIRUS INFECTION, UNSPECIFIED SITE", + diagnosis.asciiDesc, fontWeight: FontWeight.bold, fontSize: SizeConfig.textMultiplier * 2.0, ), @@ -167,7 +228,7 @@ class DiagnosisWidget extends StatelessWidget { fontSize: SizeConfig.textMultiplier * 2.0, ), AppText( - "174.00 Same", + "${diagnosis.icdCode10ID} ${diagnosisCondition != null ? model.selectedLanguage == 'ar' ? diagnosisCondition.nameAr : diagnosisCondition.nameEn : "-"}", fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 2.0, ), @@ -284,6 +345,11 @@ class MedicationWidget extends StatelessWidget { } class ProceduresWidget extends StatelessWidget { + final UcafViewModel model; + final OrderProcedure procedure; + + ProceduresWidget(this.model, this.procedure); + @override Widget build(BuildContext context) { return Column( @@ -296,7 +362,7 @@ class ProceduresWidget extends StatelessWidget { fontSize: SizeConfig.textMultiplier * 2.0, ), AppText( - "019054846", + procedure.achiCode, fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 2.0, ), @@ -310,14 +376,13 @@ class ProceduresWidget extends StatelessWidget { fontSize: SizeConfig.textMultiplier * 2.0, ), AppText( - "1", + "${procedure.lineItemNo}", fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 2.0, ), ], ), ), - ], ), SizedBox( @@ -327,7 +392,7 @@ class ProceduresWidget extends StatelessWidget { children: [ Expanded( child: AppText( - "SCAN - RENAL MASS PROTOCOL", + procedure.procedureName, fontWeight: FontWeight.bold, fontSize: SizeConfig.textMultiplier * 2.0, ), @@ -345,9 +410,9 @@ class ProceduresWidget extends StatelessWidget { fontSize: SizeConfig.textMultiplier * 2.0, ), AppText( - "Yes", + "${procedure.isCovered}", fontWeight: FontWeight.normal, - color: Colors.green, + color: procedure.isCovered ? Colors.green : Colors.red, fontSize: SizeConfig.textMultiplier * 2.0, ), SizedBox( @@ -359,7 +424,7 @@ class ProceduresWidget extends StatelessWidget { fontSize: SizeConfig.textMultiplier * 2.0, ), AppText( - "Yes", + "${procedure.isApprovalRequired}", fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 2.0, ), @@ -376,7 +441,7 @@ class ProceduresWidget extends StatelessWidget { fontSize: SizeConfig.textMultiplier * 2.0, ), AppText( - "Yes", + "${procedure.isUncoveredByDoctor}", fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 2.0, ), From 9a5cafaaf5d3cdc16357bad16bd32c3da8b982b9 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 6 Jan 2021 15:11:36 +0200 Subject: [PATCH 2/2] working on UCAF detail screen , and some cahgnes on referral list --- lib/core/service/base/base_service.dart | 8 +- .../viewModel/patient-referral-viewmodel.dart | 15 ++++ .../patient-vital-sign-viewmodel.dart | 29 ------- .../profile/UCAF/UCAF-detail-screen.dart | 80 ++++++++++++++----- .../referral/my-referral-detail-screen.dart | 32 ++++++-- .../profile/profile_medical_info_widget.dart | 3 +- 6 files changed, 109 insertions(+), 58 deletions(-) diff --git a/lib/core/service/base/base_service.dart b/lib/core/service/base/base_service.dart index d2c4eb1f..32edf34f 100644 --- a/lib/core/service/base/base_service.dart +++ b/lib/core/service/base/base_service.dart @@ -30,13 +30,19 @@ class BaseService { } } - Future getPatientArrivalList(String date,{String fromDate}) async{ + Future getPatientArrivalList(String date,{String fromDate, int patientMrn = -1, int appointmentNo = -1}) async{ hasError = false; Map body = Map(); body['From'] = fromDate == null ? date : fromDate; body['To'] = date; body['PageIndex'] = 0; body['PageSize'] = 0; + if(patientMrn == -1){ + body['PatientMRN'] = patientMrn; + } + if(appointmentNo == -1){ + body['AppointmentNo'] = appointmentNo; + } await baseAppClient.post( GET_PATIENT_ARRIVAL_LIST, diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index 251407ef..35747c37 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -133,4 +133,19 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + Future getPatientDetails(String fromDate, String toDate, int patientMrn, int appointmentNo) async { + setState(ViewState.Busy); + + await _referralPatientService.getPatientArrivalList(toDate, fromDate: fromDate, patientMrn: patientMrn, appointmentNo: appointmentNo); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + /* + * model + .getPatientArrivalList()*/ } diff --git a/lib/core/viewModel/patient-vital-sign-viewmodel.dart b/lib/core/viewModel/patient-vital-sign-viewmodel.dart index 4282141c..4f2e7e28 100644 --- a/lib/core/viewModel/patient-vital-sign-viewmodel.dart +++ b/lib/core/viewModel/patient-vital-sign-viewmodel.dart @@ -16,35 +16,6 @@ class VitalSignsViewModel extends BaseViewModel { VitalSignData get patientVitalSigns => _vitalSignService.patientVitalSigns; - /*Future getPatientArrivalList(String date, PatiantInformtion patient, - {String fromDate}) async { - // TODO when arrival list work un comment below lines - *//* setState(ViewState.Busy); - await _vitalSignService.getPatientArrivalList(date, fromDate: fromDate); - if (_vitalSignService.hasError) { - error = _vitalSignService.error; - setState(ViewState.Error); - } else { - await getPatientVitalSign(patient); - }*//* - makeVitalSignDemoData(); - } - - PatientArrivalEntity getPatientAppointmentEntity(PatiantInformtion patient) { - String ffName = "${patient.firstName} ${patient.lastName}"; - String fmfName = - "${patient.firstName} ${patient.middleName} ${patient.lastName}"; - - for (var element in patientArrivalList) { - int index = patientArrivalList.indexOf(element); - if (element.patientName == ffName || element.patientName == fmfName) { - return element; - } - // print("patient index: $index"); - } - return null; - }*/ - Future getPatientVitalSign(PatiantInformtion patient) async { setState(ViewState.Busy); await _vitalSignService.getPatientVitalSign(patient); diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 4428da8d..0a655231 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -11,9 +11,12 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/borderedButton.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import '../../../../routes.dart'; + class UcafDetailScreen extends StatefulWidget { @override _UcafDetailScreenState createState() => _UcafDetailScreenState(); @@ -36,32 +39,73 @@ class _UcafDetailScreenState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).ucaf, - body: Container( - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - PatientHeaderWidgetNoAvatar(patient), - SizedBox( - height: 10, - ), - Container( - margin: - EdgeInsets.symmetric(vertical: 16, horizontal: 16), + body: Column( + children: [ + Expanded( + child: Container( + child: SingleChildScrollView( child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - treatmentStepsBar( - context, model, screenSize, patient), + PatientHeaderWidgetNoAvatar(patient), SizedBox( - height: 16, + height: 10, + ), + Container( + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Column( + children: [ + treatmentStepsBar( + context, model, screenSize, patient), + SizedBox( + height: 16, + ), + ...getSelectedTreatmentStepItem(context, model), + ], + ), ), - ...getSelectedTreatmentStepItem(context, model), ], ), ), - ], + ), ), - ), + Container( + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: BorderedButton( + TranslationBase.of(context).save, + hasBorder: true, + vPadding: 16, + hPadding: 8, + borderColor: HexColor("#B8382B"), + backgroundColor: HexColor("#B8382B"), + textColor: Colors.white, + fontSize: SizeConfig.textMultiplier * 2.0, + handler: () {}, + ), + ), + Container( + margin: + EdgeInsets.only(left: 16, right: 16, top: 0, bottom: 16), + child: BorderedButton( + TranslationBase.of(context).cancel, + hasBorder: true, + vPadding: 16, + hPadding: 8, + borderColor: Colors.white, + backgroundColor: Colors.white, + textColor: HexColor("#B8382B"), + fontSize: SizeConfig.textMultiplier * 2.2, + handler: () { + Navigator.of(context).popUntil((route){ + return route.settings.name == PATIENTS_PROFILE; + }); + + }, + ), + ), + ], ), )); } diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index 4c9d41e0..1019ede4 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; @@ -13,6 +14,8 @@ import 'package:doctor_app_flutter/widgets/shared/borderedButton.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../../../routes.dart'; + class MyReferralDetailScreen extends StatelessWidget { PendingReferral pendingReferral; @@ -25,6 +28,14 @@ class MyReferralDetailScreen extends StatelessWidget { pendingReferral = routeArgs['referral']; return BaseView( + onModelReady: (model) => model.getPatientDetails( + DateUtils.convertStringToDateFormat( + DateTime.now().subtract(Duration(days: 350)).toString(), + "yyyy-MM-dd"), + DateUtils.convertStringToDateFormat( + DateTime.now().toString(), "yyyy-MM-dd"), + pendingReferral.patientID, + pendingReferral.sourceAppointmentNo), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).referPatient, @@ -63,8 +74,10 @@ class MyReferralDetailScreen extends StatelessWidget { patientName: pendingReferral.patientName, referralStatus: null, isReferredTo: false, - isSameBranch: pendingReferral.isReferralDoctorSameBranch, - referralDoctorName: pendingReferral.referredByDoctorInfo, + isSameBranch: + pendingReferral.isReferralDoctorSameBranch, + referralDoctorName: + pendingReferral.referredByDoctorInfo, clinicDescription: null, remark: pendingReferral.remarksFromSource, ), @@ -73,7 +86,8 @@ class MyReferralDetailScreen extends StatelessWidget { childAspectRatio: 1.8, crossAxisSpacing: 8, mainAxisSpacing: 10, - controller: new ScrollController(keepScrollOffset: false), + controller: + new ScrollController(keepScrollOffset: false), shrinkWrap: true, padding: const EdgeInsets.all(4.0), crossAxisCount: 2, @@ -82,8 +96,10 @@ class MyReferralDetailScreen extends StatelessWidget { key: key, // patient: patient, // route: RADIOLOGY, - nameLine1: TranslationBase.of(context).previewHealth, - nameLine2: TranslationBase.of(context).summaryReport, + nameLine1: + TranslationBase.of(context).previewHealth, + nameLine2: + TranslationBase.of(context).summaryReport, icon: 'radiology-1.png'), PatientProfileButton( key: key, @@ -95,7 +111,7 @@ class MyReferralDetailScreen extends StatelessWidget { PatientProfileButton( key: key, // patient: patient, - // route: VITAL_SIGN_DETAILS, + route: PATIENT_VITAL_SIGN, nameLine1: TranslationBase.of(context).vital, nameLine2: TranslationBase.of(context).signs, icon: 'heartbeat.png'), @@ -119,7 +135,7 @@ class MyReferralDetailScreen extends StatelessWidget { fontSize: 16, hPadding: 8, vPadding: 12, - handler: (){ + handler: () { model.responseReferral(pendingReferral, true); }, ), @@ -135,7 +151,7 @@ class MyReferralDetailScreen extends StatelessWidget { fontSize: 16, hPadding: 8, vPadding: 12, - handler: (){ + handler: () { model.responseReferral(pendingReferral, false); }, ), diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 8860a7dc..c39c7c95 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -44,13 +44,12 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine2: TranslationBase.of(context).episode, route: UPDATE_EPISODE, icon: 'modilfy-episode.png'), - if(selectedPatientType == 6 || selectedPatientType == 7) PatientProfileButton( key: key, patient: patient, nameLine1: TranslationBase.of(context).vital, nameLine2: TranslationBase.of(context).signs, - route: PATIENT_VITAL_SIGN, + route: (selectedPatientType == 6 || selectedPatientType == 7) ? PATIENT_VITAL_SIGN : VITAL_SIGN_DETAILS, icon: 'heartbeat.png'), if(selectedPatientType != 7) PatientProfileButton(