You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
224 lines
11 KiB
Dart
224 lines
11 KiB
Dart
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
|
|
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
|
|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
|
import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart';
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
import 'package:doctor_app_flutter/models/patient/patient_model.dart';
|
|
import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart';
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
|
import 'package:doctor_app_flutter/util/helpers.dart';
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart';
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart';
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/profile_medical_info_widget.dart';
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/profile_medical_info_widget_in_patient.dart';
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/profile_medical_info_widget_search.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import '../../../routes.dart';
|
|
|
|
// ignore: must_be_immutable
|
|
class PatientProfileScreen extends StatelessWidget {
|
|
PatiantInformtion patient;
|
|
bool isFromSearch = false;
|
|
bool isInpatient = false;
|
|
bool isDischargedPatient = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
patient = routeArgs['patient'];
|
|
String patientType = routeArgs['patientType'];
|
|
String arrivalType = routeArgs['arrivalType'];
|
|
String from = routeArgs['from'];
|
|
String to = routeArgs['to'];
|
|
if (routeArgs.containsKey("isSearch")) {
|
|
isFromSearch = routeArgs['isSearch'];
|
|
}
|
|
if (routeArgs.containsKey("isInpatient")) {
|
|
isInpatient = routeArgs['isInpatient'];
|
|
}
|
|
if (routeArgs.containsKey("isDischargedPatient")) {
|
|
isDischargedPatient = routeArgs['isDischargedPatient'];
|
|
}
|
|
|
|
return BaseView<PatientViewModel>(
|
|
builder: (_, patientViewModel, w) => AppScaffold(
|
|
baseViewModel: patientViewModel,
|
|
appBarTitle: TranslationBase.of(context).patientProfile,
|
|
isShowAppBar: false,
|
|
body: Container(
|
|
color: Color(0XFFF2F2F2),
|
|
child: Stack(
|
|
children: [
|
|
Container(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
!isFromSearch && isInpatient/*patientType == "1"*/
|
|
? PatientProfileHeaderNewDesignInPatient(
|
|
patient, patientType, arrivalType)
|
|
: PatientProfileHeaderNewDesign(
|
|
patient, patientType, arrivalType),
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
isInpatient
|
|
? ProfileMedicalInfoWidgetInPatient(
|
|
patient: patient,
|
|
patientType: patientType,
|
|
arrivalType: arrivalType,
|
|
from: from,
|
|
to: to,
|
|
isInpatient:isInpatient,
|
|
isDischargedPatient: isDischargedPatient,
|
|
)
|
|
: isFromSearch
|
|
? ProfileMedicalInfoWidgetSearch(
|
|
patient: patient,
|
|
patientType: patientType,
|
|
arrivalType: arrivalType,
|
|
from: from,
|
|
to: to,
|
|
isInpatient:false
|
|
)
|
|
: ProfileMedicalInfoWidget(
|
|
patient: patient,
|
|
patientType: patientType,
|
|
arrivalType: arrivalType,
|
|
from: from,
|
|
to: to,
|
|
isInpatient:isInpatient
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
if (patient.patientStatusType != null &&
|
|
patient.patientStatusType == 43)
|
|
BaseView<SOAPViewModel>(
|
|
onModelReady: (model) async {},
|
|
builder: (_, model, w) => Positioned(
|
|
top: 175,
|
|
left: 20,
|
|
right: 20,
|
|
child: Row(
|
|
children: [
|
|
Expanded(child: Container()),
|
|
if (patient.episodeNo == 0)
|
|
AppButton(
|
|
title:
|
|
"${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}",
|
|
color: patient.patientStatusType == 43
|
|
? Colors.red.shade700
|
|
: Colors.grey.shade700,
|
|
fontColor: Colors.white,
|
|
vPadding: 8,
|
|
radius: 30,
|
|
hPadding: 20,
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: 1.6,
|
|
icon: Image.asset(
|
|
"assets/images/create-episod.png",
|
|
color: Colors.white,
|
|
height: 30,
|
|
),
|
|
onPressed: () async {
|
|
if (patient.patientStatusType == 43) {
|
|
PostEpisodeReqModel
|
|
postEpisodeReqModel =
|
|
PostEpisodeReqModel(
|
|
appointmentNo:
|
|
patient.appointmentNo,
|
|
patientMRN:
|
|
patient.patientMRN);
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
context);
|
|
await model.postEpisode(
|
|
postEpisodeReqModel);
|
|
GifLoaderDialogUtils.hideDialog(
|
|
context);
|
|
patient.episodeNo = model.episodeID;
|
|
Navigator.of(context).pushNamed(
|
|
CREATE_EPISODE,
|
|
arguments: {
|
|
'patient': patient
|
|
});
|
|
}
|
|
},
|
|
),
|
|
if (patient.episodeNo != 0)
|
|
AppButton(
|
|
title:
|
|
"${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}",
|
|
color: patient.patientStatusType == 43
|
|
? Colors.red.shade700
|
|
: Colors.grey.shade700,
|
|
fontColor: Colors.white,
|
|
vPadding: 8,
|
|
radius: 30,
|
|
hPadding: 20,
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: 1.6,
|
|
icon: Image.asset(
|
|
"assets/images/modilfy-episode.png",
|
|
color: Colors.white,
|
|
height: 30,
|
|
),
|
|
onPressed: () {
|
|
if (patient.patientStatusType ==
|
|
43) {
|
|
Navigator.of(context).pushNamed(
|
|
UPDATE_EPISODE,
|
|
arguments: {
|
|
'patient': patient
|
|
});
|
|
}
|
|
}),
|
|
],
|
|
),
|
|
)),
|
|
],
|
|
),
|
|
),
|
|
));
|
|
}
|
|
}
|
|
|
|
class AvatarWidget extends StatelessWidget {
|
|
final Widget avatarIcon;
|
|
|
|
AvatarWidget(this.avatarIcon);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Color.fromRGBO(0, 0, 0, 0.08),
|
|
offset: Offset(0.0, 5.0),
|
|
blurRadius: 16.0)
|
|
],
|
|
borderRadius: BorderRadius.all(Radius.circular(35.0)),
|
|
color: Color(0xffCCCCCC),
|
|
),
|
|
child: avatarIcon,
|
|
);
|
|
}
|
|
}
|