import 'package:doctor_app_flutter/core/viewModel/medical_file_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/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/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; class MedicalFileDetails extends StatefulWidget { String age; String firstName; String lastName; String gender; int encounterNumber; int pp; MedicalFileDetails( {this.age, this.firstName, this.lastName, this.gender, this.encounterNumber, this.pp}); @override _MedicalFileDetailsState createState() => _MedicalFileDetailsState( firstName: firstName, age: age, lastName: lastName, gender: gender, encounterNumber: encounterNumber, pp: pp); } class _MedicalFileDetailsState extends State { int encounterNumber; String age; String firstName; String lastName; String gender; int pp; _MedicalFileDetailsState( {this.age, this.firstName, this.lastName, this.gender, this.encounterNumber, this.pp}); bool isPhysicalExam = false; bool isProcedureExpand = false; bool isHistoryExpand = false; bool isAssessmentExpand = false; @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getMedicalFile(mrn: pp), builder: (BuildContext context, MedicalFileViewModel model, Widget child) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).medicalReport.toUpperCase(), body: NetworkBaseView( baseViewModel: model, child: SingleChildScrollView( child: Container( child: Column( children: [ Padding( padding: EdgeInsets.all(8.0), child: Row( children: [ AvatarWidget( Icon( gender == "Male" ? DoctorApp.male : DoctorApp.female_icon, size: 70, color: Colors.white, ), ), SizedBox( width: 20, ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( firstName + ' ' + lastName, color: Colors.black, fontWeight: FontWeight.bold, ), Row( children: [ AppText( TranslationBase.of(context).age2, color: Colors.black, fontWeight: FontWeight.bold, ), SizedBox( width: 5.0, ), AppText( age, color: Colors.black, fontWeight: FontWeight.normal, ), ], ), ], ) ], ), ), Divider( height: 1.0, thickness: 1.0, color: Colors.grey, ), model.medicalFileList.length != 0 && model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations .length != 0 ? Padding( padding: EdgeInsets.all(10.0), child: Container( child: Column( children: [ Row( children: [ AppText( TranslationBase.of(context).visitDate + ": ", fontWeight: FontWeight.w700, ), if (model.medicalFileList.length != 0 && model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations .length != 0) AppText(model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations[0] .appointmentDate .toString()), SizedBox(width: 35.0), // AppText( // 'Appt Date : ', // fontWeight: FontWeight.w700, // ), // AppText( // '23/12/2020', // ), ], ), Row( children: [ AppText( TranslationBase.of(context).doctorName + ": ".toUpperCase(), fontWeight: FontWeight.w700, ), if (model.medicalFileList.length != 0 && model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations .length != 0) Expanded( child: AppText( model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations[0] .doctorName .toUpperCase(), fontWeight: FontWeight.w700, ), ), ], ), if (model.medicalFileList.length != 0) Row( children: [ AppText( TranslationBase.of(context).clinicName + ": ", fontWeight: FontWeight.w700, ), if (model.medicalFileList.length != 0 && model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations .length != 0) AppText( model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations[0] .clinicName, ), ], ), Row( children: [ AppText( TranslationBase.of(context).episode + ": ", fontWeight: FontWeight.w700, ), if (model.medicalFileList.length != 0 && model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations .length != 0) AppText( model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations[0] .episodeID .toString(), ), ], ), SizedBox(height: 15.0), Divider( height: 1.0, thickness: 1.0, color: Colors.grey.shade400, ), SizedBox(height: 25.0), if (model.medicalFileList.length != 0 && model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations .length != 0) HeaderBodyExpandableNotifier( headerWidget: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ Texts( TranslationBase.of(context) .historyOfPresentIllness .toUpperCase(), variant: isHistoryExpand ? "bodyText" : '', bold: isHistoryExpand ? true : false, color: Colors.black), ], ), InkWell( onTap: () { setState(() { isHistoryExpand = !isHistoryExpand; }); }, child: Icon(isHistoryExpand ? EvaIcons.minus : EvaIcons.plus)) ], ), bodyWidget: ListView.builder( //physics: , scrollDirection: Axis.vertical, shrinkWrap: true, itemCount: model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations[0] .lstCheifComplaint .length, itemBuilder: (BuildContext ctxt, int index) { return Padding( padding: EdgeInsets.all(8.0), child: Container( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Row( children: [ Expanded( child: AppText( model .medicalFileList[ 0] .entityList[0] .timelines[ encounterNumber] .timeLineEvents[0] .consulations[0] .lstCheifComplaint[ index] .hOPI .trim(), ), ), SizedBox(width: 35.0), ], ), ], ), ), ); }), isExpand: isHistoryExpand, ), SizedBox( height: 30, ), Container( width: double.infinity, height: 1, color: Color(0xffCCCCCC), ), SizedBox( height: 30, ), if (model.medicalFileList.length != 0 && model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations .length != 0) HeaderBodyExpandableNotifier( headerWidget: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ Texts( TranslationBase.of(context) .assessment .toUpperCase(), variant: isAssessmentExpand ? "bodyText" : '', bold: isAssessmentExpand ? true : false, color: Colors.black), ], ), InkWell( onTap: () { setState(() { isAssessmentExpand = !isAssessmentExpand; }); }, child: Icon(isAssessmentExpand ? EvaIcons.minus : EvaIcons.plus)) ], ), bodyWidget: ListView.builder( //physics: , scrollDirection: Axis.vertical, shrinkWrap: true, itemCount: model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations[0] .lstAssessments .length, itemBuilder: (BuildContext ctxt, int index) { return Padding( padding: EdgeInsets.all(8.0), child: Container( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Row( children: [ AppText( 'ICD', fontWeight: FontWeight.w700, ), AppText( model .medicalFileList[0] .entityList[0] .timelines[ encounterNumber] .timeLineEvents[0] .consulations[0] .lstAssessments[ index] .iCD10 .trim(), ), SizedBox(width: 35.0), AppText( 'Condition: ', fontWeight: FontWeight.w700, ), AppText( model .medicalFileList[0] .entityList[0] .timelines[ encounterNumber] .timeLineEvents[0] .consulations[0] .lstAssessments[ index] .condition .trim(), ), ], ), Row( children: [ AppText( model .medicalFileList[0] .entityList[0] .timelines[ encounterNumber] .timeLineEvents[0] .consulations[0] .lstAssessments[ index] .description, fontWeight: FontWeight.w700, ) ], ), Row( children: [ AppText( 'Type: ', fontWeight: FontWeight.w700, ), AppText(model .medicalFileList[0] .entityList[0] .timelines[ encounterNumber] .timeLineEvents[0] .consulations[0] .lstAssessments[index] .type), ], ), SizedBox( height: 15.0, ), AppText( model .medicalFileList[0] .entityList[0] .timelines[ encounterNumber] .timeLineEvents[0] .consulations[0] .lstAssessments[index] .remarks .trim(), ), Divider( height: 1, color: Colors.grey, thickness: 1.0, ), SizedBox( height: 8.0, ), ], ), ), ); }), isExpand: isAssessmentExpand, ), SizedBox( height: 30, ), Container( width: double.infinity, height: 1, color: Color(0xffCCCCCC), ), SizedBox( height: 30, ), if (model.medicalFileList.length != 0 && model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations .length != 0) HeaderBodyExpandableNotifier( headerWidget: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ Texts( TranslationBase.of(context) .test .toUpperCase(), variant: isProcedureExpand ? "bodyText" : '', bold: isProcedureExpand ? true : false, color: Colors.black), ], ), InkWell( onTap: () { setState(() { isProcedureExpand = !isProcedureExpand; }); }, child: Icon(isProcedureExpand ? EvaIcons.minus : EvaIcons.plus)) ], ), bodyWidget: ListView.builder( //physics: , scrollDirection: Axis.vertical, shrinkWrap: true, itemCount: model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations[0] .lstProcedure .length, itemBuilder: (BuildContext ctxt, int index) { return Padding( padding: EdgeInsets.all(8.0), child: Container( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Row( children: [ AppText( 'Procedure ID: ', fontWeight: FontWeight.w700, ), AppText( model .medicalFileList[0] .entityList[0] .timelines[ encounterNumber] .timeLineEvents[0] .consulations[0] .lstProcedure[index] .procedureId .trim(), ), SizedBox(width: 35.0), AppText( 'Order Date: ', fontWeight: FontWeight.w700, ), Expanded( child: AppText( model .medicalFileList[ 0] .entityList[0] .timelines[ encounterNumber] .timeLineEvents[0] .consulations[0] .lstProcedure[ index] .orderDate .trim(), ), ), ], ), Row( children: [ Expanded( child: AppText( model .medicalFileList[ 0] .entityList[0] .timelines[ encounterNumber] .timeLineEvents[0] .consulations[0] .lstProcedure[ index] .procName, fontWeight: FontWeight.w700, ), ) ], ), Row( children: [ AppText( 'CPT Code : ', fontWeight: FontWeight.w700, ), AppText(model .medicalFileList[0] .entityList[0] .timelines[ encounterNumber] .timeLineEvents[0] .consulations[0] .lstProcedure[index] .patientID .toString()), ], ), SizedBox( height: 15.0, ), Divider( height: 1, color: Colors.grey, thickness: 1.0, ), SizedBox( height: 8.0, ), ], ), ), ); }), isExpand: isProcedureExpand, ), SizedBox( height: 30, ), Container( width: double.infinity, height: 1, color: Color(0xffCCCCCC), ), SizedBox( height: 30, ), if (model.medicalFileList.length != 0 && model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations .length != 0) HeaderBodyExpandableNotifier( headerWidget: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ Texts( TranslationBase.of(context) .physicalSystemExamination .toUpperCase(), variant: isPhysicalExam ? "bodyText" : '', bold: isPhysicalExam ? true : false, color: Colors.black), ], ), InkWell( onTap: () { setState(() { isPhysicalExam = !isPhysicalExam; }); }, child: Icon(isPhysicalExam ? EvaIcons.minus : EvaIcons.plus)) ], ), bodyWidget: ListView.builder( //physics: , scrollDirection: Axis.vertical, shrinkWrap: true, itemCount: model .medicalFileList[0] .entityList[0] .timelines[encounterNumber] .timeLineEvents[0] .consulations[0] .lstPhysicalExam .length, itemBuilder: (BuildContext ctxt, int index) { return Padding( padding: EdgeInsets.all(8.0), child: Container( child: Column( children: [ Row( children: [ AppText( 'Exam Type: ', fontWeight: FontWeight.w700, ), AppText(model .medicalFileList[0] .entityList[0] .timelines[ encounterNumber] .timeLineEvents[0] .consulations[0] .lstPhysicalExam[ index] .examDesc), ], ), Row( children: [ AppText( model .medicalFileList[0] .entityList[0] .timelines[ encounterNumber] .timeLineEvents[0] .consulations[0] .lstPhysicalExam[ index] .examDesc, fontWeight: FontWeight.w700, ) ], ), Row( children: [ AppText( 'Abnormal: ', fontWeight: FontWeight.w700, ), AppText(model .medicalFileList[0] .entityList[0] .timelines[ encounterNumber] .timeLineEvents[0] .consulations[0] .lstPhysicalExam[ index] .abnormal), ], ), SizedBox( height: 15.0, ), AppText( model .medicalFileList[0] .entityList[0] .timelines[ encounterNumber] .timeLineEvents[0] .consulations[0] .lstPhysicalExam[index] .remarks, ), Divider( height: 1, color: Colors.grey, thickness: 1.0, ), SizedBox( height: 8.0, ), ], ), ), ); }), isExpand: isPhysicalExam, ), SizedBox( height: 30, ), Container( width: double.infinity, height: 1, color: Color(0xffCCCCCC), ), ], ), ), ) : Text("There's no medical file for this patient") ], ), ), ), ), ), ); } }