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.
258 lines
14 KiB
Dart
258 lines
14 KiB
Dart
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
|
import 'package:doctor_app_flutter/core/model/diagnosis/GetDiagnosisForInPatientRequestModel.dart';
|
|
import 'package:doctor_app_flutter/core/viewModel/authentication_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/core/model/patient/patiant_info_model.dart';
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
import 'package:doctor_app_flutter/utils/date-utils.dart';
|
|
import 'package:doctor_app_flutter/utils/dr_app_shared_pref.dart';
|
|
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.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/card_with_bg_widget.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
|
|
class DiagnosisScreen extends StatefulWidget {
|
|
const DiagnosisScreen({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
_ProgressNoteState createState() => _ProgressNoteState();
|
|
}
|
|
|
|
class _ProgressNoteState extends State<DiagnosisScreen> {
|
|
bool isDischargedPatient = false;
|
|
AuthenticationViewModel authenticationViewModel = AuthenticationViewModel();
|
|
late ProjectViewModel projectViewModel;
|
|
|
|
getDiagnosisForInPatient(BuildContext context, PatientViewModel model,
|
|
{bool isLocalBusy = false}) async {
|
|
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
|
|
PatiantInformtion patient = routeArgs['patient'];
|
|
// String type = await sharedPref.getString(SLECTED_PATIENT_TYPE);
|
|
//
|
|
// print(type);
|
|
GetDiagnosisForInPatientRequestModel getDiagnosisForInPatientRequestModel =
|
|
GetDiagnosisForInPatientRequestModel(
|
|
admissionNo: int.parse(patient.admissionNo!),
|
|
patientTypeID: patient.patientType,
|
|
patientID: patient.patientId,
|
|
);
|
|
model.getDiagnosisForInPatient(getDiagnosisForInPatientRequestModel);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
authenticationViewModel = Provider.of(context);
|
|
projectViewModel = Provider.of(context);
|
|
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
|
|
PatiantInformtion patient = routeArgs['patient'];
|
|
if (routeArgs.containsKey('isDischargedPatient'))
|
|
isDischargedPatient = routeArgs['isDischargedPatient'];
|
|
return BaseView<PatientViewModel>(
|
|
onModelReady: (model) => getDiagnosisForInPatient(context, model),
|
|
builder: (_, model, w) => AppScaffold(
|
|
baseViewModel: model,
|
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
|
appBar: PatientProfileAppBar(
|
|
patient,
|
|
isInpatient: true,
|
|
),
|
|
body: model.diagnosisForInPatientList == null ||
|
|
model.diagnosisForInPatientList.length == 0
|
|
? Center(
|
|
child: ErrorMessage(
|
|
error: TranslationBase.of(context).noDataAvailable,
|
|
),
|
|
)
|
|
: Container(
|
|
color: Colors.grey[200],
|
|
child: Column(
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: Container(
|
|
child: ListView.builder(
|
|
itemCount: model.diagnosisForInPatientList.length,
|
|
itemBuilder: (BuildContext ctxt, int index) {
|
|
return FractionallySizedBox(
|
|
widthFactor: 0.95,
|
|
child: CardWithBgWidget(
|
|
hasBorder: false,
|
|
bgColor: Colors.transparent,
|
|
widget: Column(
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.spaceBetween,
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
width: MediaQuery.of(context)
|
|
.size
|
|
.width *
|
|
0.60,
|
|
child: Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment
|
|
.start,
|
|
children: [
|
|
AppText(
|
|
TranslationBase.of(
|
|
context)
|
|
.createdBy,
|
|
fontSize: 12,
|
|
),
|
|
Expanded(
|
|
child: AppText(
|
|
model
|
|
.diagnosisForInPatientList[
|
|
index]
|
|
.createdByName
|
|
.toString() ??
|
|
'',
|
|
fontWeight:
|
|
FontWeight.w600,
|
|
fontSize: 12,
|
|
isCopyable: true,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Column(
|
|
children: [
|
|
AppText(
|
|
model
|
|
.diagnosisForInPatientList[
|
|
index]
|
|
.createdOn !=
|
|
null
|
|
? AppDateUtils.getDayMonthYearDateFormatted(
|
|
AppDateUtils
|
|
.getDateTimeFromServerFormat(model
|
|
.diagnosisForInPatientList[
|
|
index]
|
|
.createdOn!),
|
|
isArabic:
|
|
projectViewModel
|
|
.isArabic,
|
|
isMonthShort: true)
|
|
: AppDateUtils
|
|
.getDayMonthYearDateFormatted(
|
|
DateTime.now(),
|
|
isArabic:
|
|
projectViewModel
|
|
.isArabic),
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 14,
|
|
isCopyable: true,
|
|
),
|
|
AppText(
|
|
model
|
|
.diagnosisForInPatientList[
|
|
index]
|
|
.createdOn !=
|
|
null
|
|
? AppDateUtils.getHour(
|
|
AppDateUtils
|
|
.getDateTimeFromServerFormat(model
|
|
.diagnosisForInPatientList[
|
|
index]
|
|
.createdOn!))
|
|
: AppDateUtils.getHour(
|
|
DateTime.now()),
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 14,
|
|
isCopyable: true,
|
|
),
|
|
],
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.end,
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 8,
|
|
),
|
|
Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.start,
|
|
children: [
|
|
AppText(
|
|
TranslationBase.of(context)
|
|
.icd +
|
|
" : ",
|
|
fontSize: 12,
|
|
),
|
|
Expanded(
|
|
child: AppText(
|
|
model
|
|
.diagnosisForInPatientList[
|
|
index]
|
|
.iCDCode10ID!,
|
|
fontSize: 12,
|
|
isCopyable: true,
|
|
),
|
|
),
|
|
]),
|
|
SizedBox(
|
|
height: 8,
|
|
),
|
|
Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.start,
|
|
children: [
|
|
AppText(
|
|
"Ascii Desc : ",
|
|
fontSize: 12,
|
|
),
|
|
Expanded(
|
|
child: AppText(
|
|
model
|
|
.diagnosisForInPatientList[
|
|
index]
|
|
.asciiDesc!,
|
|
fontSize: 12,
|
|
isCopyable: true,
|
|
),
|
|
),
|
|
])
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|