Radiology Implementation

merge-requests/390/head
Mirza.Shafique 5 years ago
parent 26c30038c9
commit 66efbc1bac

@ -0,0 +1,16 @@
class HeaderModel{
String doctorName;
String doctorImageURL;
List<String> speciality;
String invoiceNo;
String projectName;
DateTime orderDate;
String nationalityFlagURL;
int doctorRate;
int actualDoctorRate;
String email;
HeaderModel(this.doctorName, this.doctorImageURL, this.speciality, this.invoiceNo, this.projectName, this.orderDate, this.nationalityFlagURL, this.doctorRate, this.actualDoctorRate, this.email);
}

@ -28,8 +28,7 @@ class HomePageFragment2 extends StatefulWidget {
DashboardViewModel model; DashboardViewModel model;
Function onPharmacyClick, onLoginClick; Function onPharmacyClick, onLoginClick;
HomePageFragment2(this.model, {this.onLoginClick, this.onPharmacyClick});
HomePageFragment2(this.model,{this.onLoginClick, this.onPharmacyClick});
@override @override
_HomePageFragment2State createState() => _HomePageFragment2State(); _HomePageFragment2State createState() => _HomePageFragment2State();
@ -84,7 +83,8 @@ class _HomePageFragment2State extends State<HomePageFragment2> {
child: LoggedSliderView( child: LoggedSliderView(
projectViewModel, projectViewModel,
new SliderData(TranslationBase.of(context).fileno + ": " + projectViewModel.user.patientID.toString(), projectViewModel.user.firstName + ' ' + projectViewModel.user.lastName, new SliderData(TranslationBase.of(context).fileno + ": " + projectViewModel.user.patientID.toString(), projectViewModel.user.firstName + ' ' + projectViewModel.user.lastName,
"", bannerColor[0].darkColor, bannerColor[0].lightColor),widget.model), "", bannerColor[0].darkColor, bannerColor[0].lightColor),
widget.model),
), ),
), ),
) )

@ -107,7 +107,7 @@ class LoggedSliderView extends StatelessWidget {
height: 25 / 17, height: 25 / 17,
), ),
), ),
mHeight(3), mHeight(2),
Text( Text(
sliderData.pateintId, sliderData.pateintId,
style: TextStyle( style: TextStyle(

@ -3,11 +3,15 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart'; import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/radiology_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/radiology_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/header_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart';
import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -23,91 +27,118 @@ class RadiologyDetailsPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<RadiologyViewModel>( return BaseView<RadiologyViewModel>(
onModelReady: (model) => model.getRadImageURL( onModelReady: (model) => model.getRadImageURL(projectId: finalRadiology.projectID, lineItem: finalRadiology.invoiceLineItemNo, invoiceNo: finalRadiology.invoiceNo),
projectId: finalRadiology.projectID,
lineItem: finalRadiology.invoiceLineItemNo,
invoiceNo: finalRadiology.invoiceNo),
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
appBarTitle: TranslationBase.of(context).report, appBarTitle: TranslationBase.of(context).report,
isShowAppBar: true, isShowAppBar: true,
baseViewModel: model, baseViewModel: model,
body: SingleChildScrollView( showNewAppBar: true,
child: Column( showNewAppBarTitle: true,
mainAxisSize: MainAxisSize.max, backgroundColor: Color(0xffF8F8F8),
crossAxisAlignment: CrossAxisAlignment.center, body: SingleChildScrollView(
children: <Widget>[ child: Column(
Texts( mainAxisSize: MainAxisSize.max,
'${finalRadiology.reportData}', crossAxisAlignment: CrossAxisAlignment.center,
textAlign: TextAlign.center, children: <Widget>[
), DoctorHeader(
Padding( headerModel: new HeaderModel(finalRadiology.doctorName, finalRadiology.doctorImageURL, finalRadiology.speciality, finalRadiology.invoiceNo.toString(), finalRadiology.projectName,
padding: const EdgeInsets.all(8.0), finalRadiology.orderDate, finalRadiology.nationalityFlagURL, finalRadiology.doctorRate, finalRadiology.actualDoctorRate, model.user.emailAddress),
child: Texts( onTap: () {
'${finalRadiology.reportData}', showConfirmMessage(finalRadiology: finalRadiology, model: model);
textAlign: TextAlign.start, },
fontSize: 17, buttonTitle: TranslationBase.of(context).sendCopyRad,
), isNeedToShowButton: projectViewModel.havePrivilege(8),
), ),
SizedBox( Card(
height: MediaQuery.of(context).size.height * 0.2, margin: EdgeInsets.all(24),
) shape: cardRadius(12),
], elevation: 0,
), child: Container(
),
bottomSheet: (projectViewModel.havePrivilege(9) ||
projectViewModel.havePrivilege(8))
? Container(
width: double.infinity, width: double.infinity,
height: finalRadiology.dIAPACSURL != "" child: Padding(
? MediaQuery.of(context).size.height * 0.25 padding: const EdgeInsets.all(12.0),
: MediaQuery.of(context).size.height * 0.14, child: Column(
color: Colors.grey[100], crossAxisAlignment: CrossAxisAlignment.start,
child: Column( mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min, children: [
children: <Widget>[ Text(
Divider(), "General Result",
if (finalRadiology.dIAPACSURL != "" && style: TextStyle(
projectViewModel.havePrivilege(9)) fontSize: 16,
Container( letterSpacing: -0.64,
width: MediaQuery.of(context).size.width * 0.8, fontWeight: FontWeight.w600,
child: Button(
onTap: () {
launch(model.radImageURL);
},
label: TranslationBase.of(context).openRad,
backgroundColor: Colors.grey[800],
), ),
), ),
if (projectViewModel.havePrivilege(8)) mHeight(10),
Container( Text(
width: MediaQuery.of(context).size.width * 0.8, '${finalRadiology.reportData}',
child: Button( style: TextStyle(fontSize: 12, letterSpacing: -0.48),
onTap: () { ),
showConfirmMessage( // Texts(
finalRadiology: finalRadiology, model: model); // '${finalRadiology.reportData}',
}, // textAlign: TextAlign.start,
label: TranslationBase.of(context).sendCopyRad, // fontSize: 12,
loading: model.state == ViewState.BusyLocal, //
backgroundColor: Theme.of(context).primaryColor, // ),
), mHeight(16),
) (projectViewModel.havePrivilege(9) || projectViewModel.havePrivilege(8))
], ? (finalRadiology.dIAPACSURL != "" && projectViewModel.havePrivilege(9))
? Container(
width: MediaQuery.of(context).size.width * 0.8,
child: Button(
onTap: () {
launch(model.radImageURL);
},
label: TranslationBase.of(context).openRad,
backgroundColor: CustomColors.accentColor,
),
)
: Container()
: Container(),
],
),
), ),
) ),
: Container()), ),
],
),
),
// bottomSheet: (projectViewModel.havePrivilege(9) || projectViewModel.havePrivilege(8))
// ? Container(
// width: double.infinity,
// height: finalRadiology.dIAPACSURL != "" ? MediaQuery.of(context).size.height * 0.25 : MediaQuery.of(context).size.height * 0.14,
// color: Colors.grey[100],
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Divider(),
// if (projectViewModel.havePrivilege(8))
// Container(
// width: MediaQuery.of(context).size.width * 0.8,
// child: Button(
// onTap: () {
// showConfirmMessage(finalRadiology: finalRadiology, model: model);
// },
// label: TranslationBase.of(context).sendCopyRad,
// loading: model.state == ViewState.BusyLocal,
// backgroundColor: Theme.of(context).primaryColor,
// ),
// )
// ],
// ),
// )
// : Container(),
),
); );
} }
void showConfirmMessage( void showConfirmMessage({FinalRadiology finalRadiology, RadiologyViewModel model}) {
{FinalRadiology finalRadiology, RadiologyViewModel model}) {
showDialog( showDialog(
context: AppGlobal.context, context: AppGlobal.context,
child: ConfirmSendEmailDialog( child: ConfirmSendEmailDialog(
email: model.user.emailAddress, email: model.user.emailAddress,
onTapSendEmail: () { onTapSendEmail: () {
model.sendRadReportEmail( model.sendRadReportEmail(mes: TranslationBase.of(AppGlobal.context).sendSuc, finalRadiology: finalRadiology);
mes: TranslationBase.of(AppGlobal.context).sendSuc,
finalRadiology: finalRadiology);
}, },
), ),
); );

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart';
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/header_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -50,9 +51,17 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
DoctorHeader( DoctorHeader(
patientLabOrder: widget.patientLabOrder, headerModel: new HeaderModel(
invoiceNo: widget.billNo, widget.patientLabOrder.doctorName,
email: model.user.emailAddress, widget.patientLabOrder.doctorImageURL,
widget.patientLabOrder.speciality,
widget.billNo,
widget.patientLabOrder.projectName,
widget.patientLabOrder.orderDate,
widget.patientLabOrder.nationalityFlagURL,
widget.patientLabOrder.doctorRate,
widget.patientLabOrder.actualDoctorRate,
model.user.emailAddress),
onTap: widget.onTap, onTap: widget.onTap,
), ),
SizedBox(height: 10), SizedBox(height: 10),

@ -76,7 +76,7 @@ class DoctorCard extends StatelessWidget {
: !isInOutPatient : !isInOutPatient
? TranslationBase.of(context).inPatient.toLowerCase().capitalizeFirstofEach ? TranslationBase.of(context).inPatient.toLowerCase().capitalizeFirstofEach
: TranslationBase.of(context).outpatient.toLowerCase().capitalizeFirstofEach, : TranslationBase.of(context).outpatient.toLowerCase().capitalizeFirstofEach,
style: TextStyle(fontSize: 10, fontFamily: "Poppins", fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10), style: TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10),
), ),
), ),
), ),
@ -94,7 +94,7 @@ class DoctorCard extends StatelessWidget {
Expanded( Expanded(
child: Text( child: Text(
(name ?? ""), (name ?? ""),
style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
), ),
), ),
Column( Column(
@ -103,11 +103,11 @@ class DoctorCard extends StatelessWidget {
children: [ children: [
Text( Text(
DateUtil.formatDateToDate(date), DateUtil.formatDateToDate(date),
style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12),
), ),
Text( Text(
DateUtil.formatDateToTime(date), DateUtil.formatDateToTime(date),
style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.48, height: 18 / 12), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.48, height: 18 / 12),
), ),
], ],
) )
@ -159,14 +159,12 @@ class DoctorCard extends StatelessWidget {
// todo 'sikander' move this widget to separate file // todo 'sikander' move this widget to separate file
Widget myRichText(String title, String value) { Widget myRichText(String title, String value) {
return RichText( return RichText(
text: TextSpan( text:
text: title, TextSpan(text: title, style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 18 / 10), children: <TextSpan>[
style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 18 / 10), TextSpan(
children: <TextSpan>[ text: " $value",
TextSpan( style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12),
text: " $value", )
style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), ]),
)
]),
); );
} }

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
import 'package:diplomaticquarterapp/models/header_model.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
@ -10,11 +11,12 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:rating_bar/rating_bar.dart'; import 'package:rating_bar/rating_bar.dart';
class DoctorHeader extends StatelessWidget { class DoctorHeader extends StatelessWidget {
final PatientLabOrders patientLabOrder; final HeaderModel headerModel;
final String invoiceNo;
final String email;
final VoidCallback onTap; final VoidCallback onTap;
DoctorHeader({Key key, @required this.patientLabOrder, @required this.email, @required this.invoiceNo, @required this.onTap}) : super(key: key); final String buttonTitle;
final bool isNeedToShowButton;
DoctorHeader({Key key, @required this.headerModel, @required this.buttonTitle, @required this.onTap, this.isNeedToShowButton = true}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -30,8 +32,8 @@ class DoctorHeader extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LargeAvatar( LargeAvatar(
name: patientLabOrder.doctorName, name: headerModel.doctorName,
url: patientLabOrder.doctorImageURL, url: headerModel.doctorImageURL,
width: 51, width: 51,
height: 51, height: 51,
), ),
@ -42,11 +44,11 @@ class DoctorHeader extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
(patientLabOrder?.speciality?.toString()?.toLowerCase()?.capitalizeFirstofEach ?? ""), (headerModel?.speciality?.toString()?.toLowerCase()?.capitalizeFirstofEach ?? ""),
style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12),
), ),
myRichText(TranslationBase.of(context).invoiceNo + ":", invoiceNo), myRichText(TranslationBase.of(context).invoiceNo + ":", headerModel.invoiceNo),
myRichText(TranslationBase.of(context).branch, patientLabOrder.projectName), myRichText(TranslationBase.of(context).branch, headerModel.projectName),
], ],
), ),
), ),
@ -55,16 +57,16 @@ class DoctorHeader extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
Text( Text(
DateUtil.formatDateToDate(patientLabOrder.orderDate), DateUtil.formatDateToDate(headerModel.orderDate),
style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12),
), ),
Text( Text(
DateUtil.formatDateToTime(patientLabOrder.orderDate), DateUtil.formatDateToTime(headerModel.orderDate),
style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12),
), ),
Padding( Padding(
padding: const EdgeInsets.only(top: 8.0), padding: const EdgeInsets.only(top: 8.0),
child: Image.network(patientLabOrder.nationalityFlagURL, height: 16), child: Image.network(headerModel.nationalityFlagURL ?? "", height: 16),
), ),
], ],
) )
@ -80,7 +82,7 @@ class DoctorHeader extends StatelessWidget {
children: [ children: [
SizedBox(width: 21), SizedBox(width: 21),
RatingBar.readOnly( RatingBar.readOnly(
initialRating: patientLabOrder.doctorRate + 0.0, initialRating: headerModel.doctorRate + 0.0,
size: 15.0, size: 15.0,
filledColor: Color(0XFFD02127), filledColor: Color(0XFFD02127),
emptyColor: Color(0XFFD02127), emptyColor: Color(0XFFD02127),
@ -91,32 +93,34 @@ class DoctorHeader extends StatelessWidget {
), ),
SizedBox(width: 6), SizedBox(width: 6),
Text( Text(
"${patientLabOrder.actualDoctorRate} ${TranslationBase.of(context).reviews}", "${headerModel.actualDoctorRate} ${TranslationBase.of(context).reviews}",
style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12),
), ),
], ],
), ),
InkWell( isNeedToShowButton
onTap: () { ? InkWell(
showConfirmMessage(context, onTap, email); onTap: () {
}, showConfirmMessage(context, onTap, headerModel.email);
child: Container( },
padding: EdgeInsets.only(top: 10, bottom: 10, right: 21, left: 15), child: Container(
decoration: BoxDecoration(color: Color(0XFFD02127), borderRadius: BorderRadius.only(topLeft: Radius.circular(10))), padding: EdgeInsets.only(top: 10, bottom: 10, right: 21, left: 15),
child: Row( decoration: BoxDecoration(color: Color(0XFFD02127), borderRadius: BorderRadius.only(topLeft: Radius.circular(10))),
mainAxisSize: MainAxisSize.min, child: Row(
children: [ mainAxisSize: MainAxisSize.min,
// todo: 'change icon for send email' children: [
SvgPicture.asset('assets/images/new-design/covid-19-car.svg', width: 19.0), // todo: 'change icon for send email'
SizedBox(width: 6), SvgPicture.asset('assets/images/new/email.svg', width: 19.0),
Text( SizedBox(width: 6),
TranslationBase.of(context).sendEmail, Text(
style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.64, height: 25 / 16), buttonTitle == null ? TranslationBase.of(context).sendEmail : buttonTitle,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.64, height: 25 / 16),
),
],
),
), ),
], )
), : Container(),
),
)
], ],
) )
], ],

Loading…
Cancel
Save