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.
279 lines
13 KiB
Dart
279 lines
13 KiB
Dart
import 'package:doctor_app_flutter/core/model/note/note_model.dart';
|
|
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
|
|
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
|
import 'package:doctor_app_flutter/models/patient/progress_note_request.dart';
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
import 'package:doctor_app_flutter/screens/patients/profile/note/update_note.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/profile/add-order/addNewOrder.dart';
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart';
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
import '../../../../config/shared_pref_kay.dart';
|
|
import '../../../../config/size_config.dart';
|
|
import '../../../../models/patient/patiant_info_model.dart';
|
|
import '../../../../util/dr_app_shared_pref.dart';
|
|
import '../../../../widgets/shared/app_scaffold_widget.dart';
|
|
import '../../../../widgets/shared/app_texts_widget.dart';
|
|
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
|
|
class ProgressNoteScreen extends StatefulWidget {
|
|
final int visitType;
|
|
|
|
const ProgressNoteScreen({Key key, this.visitType}) : super(key: key);
|
|
|
|
@override
|
|
_ProgressNoteState createState() => _ProgressNoteState();
|
|
}
|
|
|
|
class _ProgressNoteState extends State<ProgressNoteScreen> {
|
|
List<NoteModel> notesList;
|
|
var filteredNotesList;
|
|
final _controller = TextEditingController();
|
|
var _isInit = true;
|
|
|
|
getProgressNoteList(BuildContext context, PatientViewModel model) async {
|
|
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
PatiantInformtion patient = routeArgs['patient'];
|
|
String token = await sharedPref.getString(TOKEN);
|
|
String type = await sharedPref.getString(SLECTED_PATIENT_TYPE);
|
|
|
|
print(type);
|
|
ProgressNoteRequest progressNoteRequest = ProgressNoteRequest(
|
|
visitType: widget.visitType,
|
|
// if equal 5 then this will return progress note
|
|
admissionNo: int.parse(patient.admissionNo),
|
|
projectID: patient.projectId,
|
|
tokenID: token,
|
|
patientTypeID: patient.patientType,
|
|
languageID: 2);
|
|
model.getPatientProgressNote(progressNoteRequest.toJson()).then((c) {
|
|
notesList = model.patientProgressNoteList;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
PatiantInformtion patient = routeArgs['patient'];
|
|
String arrivalType = routeArgs['arrivalType'];
|
|
return BaseView<PatientViewModel>(
|
|
onModelReady: (model) => getProgressNoteList(context, model),
|
|
builder: (_, model, w) => AppScaffold(
|
|
baseViewModel: model,
|
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
|
// appBarTitle: TranslationBase.of(context).progressNote,
|
|
appBar: PatientProfileHeaderNewDesignAppBar(
|
|
patient, patient.patientType.toString() ?? '0', arrivalType),
|
|
body: notesList == null || notesList.length == 0
|
|
? DrAppEmbeddedError(
|
|
error: TranslationBase.of(context).errorNoProgressNote)
|
|
: Container(
|
|
color: Colors.grey[200],
|
|
child: Column(
|
|
children: <Widget>[
|
|
AddNewOrder( onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => UpdateNoteOrder(
|
|
patientModel: model,
|
|
patient: patient,
|
|
visitType: widget.visitType,
|
|
isUpdate: false,
|
|
)),
|
|
);
|
|
},label: 'Add a New Order',),
|
|
Expanded(
|
|
child: Container(
|
|
|
|
child: ListView.builder(
|
|
itemCount: notesList.length,
|
|
itemBuilder: (BuildContext ctxt, int index) {
|
|
return Column(
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(
|
|
left: 10,
|
|
right: 10,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
padding: EdgeInsets.all(15),
|
|
child: Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.spaceBetween,
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
|
|
Container(
|
|
width: MediaQuery.of(context).size.width * 0.65,
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
|
|
child: AppText('Created By: ',
|
|
fontSize: 12,
|
|
),
|
|
margin: EdgeInsets.only(top: 3),
|
|
),
|
|
Expanded(
|
|
child: AppText(
|
|
notesList[index].doctorName??'',fontWeight: FontWeight.w600),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Column(
|
|
children: [
|
|
AppText(
|
|
notesList[index]
|
|
.createdOn !=
|
|
null
|
|
? DateUtils
|
|
.getDayMonthYearDateFormatted(
|
|
DateUtils.getDateTimeFromServerFormat(notesList[index].createdOn))
|
|
: DateUtils
|
|
.getDayMonthYearDateFormatted(
|
|
DateTime.now()),
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 14,
|
|
),
|
|
AppText(
|
|
notesList[index]
|
|
.createdOn !=
|
|
null
|
|
? DateUtils
|
|
.getHour(
|
|
DateUtils.getDateTimeFromServerFormat(notesList[index].createdOn ))
|
|
: DateUtils
|
|
.getHour(
|
|
DateTime.now()),
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 14,
|
|
),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 8,
|
|
),
|
|
Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.start,
|
|
children: [
|
|
Expanded(
|
|
child: AppText(
|
|
notesList[index].notes,
|
|
fontSize: 10,
|
|
),
|
|
),
|
|
InkWell(
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => UpdateNoteOrder(
|
|
note: notesList[index],
|
|
patientModel: model,
|
|
patient: patient,
|
|
visitType: widget.visitType,
|
|
isUpdate: true,
|
|
|
|
)),
|
|
);
|
|
},
|
|
child: Icon(
|
|
DoctorApp.edit,
|
|
size: 18,
|
|
))
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
|
|
),
|
|
],
|
|
);
|
|
}),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
InputDecoration buildInputDecoration(BuildContext context, hint) {
|
|
return InputDecoration(
|
|
prefixIcon: Icon(Icons.search, color: Colors.black),
|
|
filled: true,
|
|
fillColor: Colors.white,
|
|
hintText: hint,
|
|
hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(10)),
|
|
borderSide: BorderSide(color: HexColor('#CCCCCC')),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
|
borderSide: BorderSide(color: Colors.grey), //),
|
|
));
|
|
}
|
|
|
|
// searchData(String str, PatientViewModel model) {
|
|
// var strExist = str.length > 0 ? true : false;
|
|
//
|
|
// if (strExist) {
|
|
// filteredNotesList = null;
|
|
// filteredNotesList = model.patientProgressNoteList
|
|
// .where((note) =>
|
|
// note["DoctorName"].toString().contains(str.toUpperCase()))
|
|
// .toList();
|
|
// setState(() {
|
|
// notesList = filteredNotesList;
|
|
// });
|
|
// } else {
|
|
// setState(() {
|
|
// notesList = model.patientProgressNoteList;
|
|
// });
|
|
// }
|
|
// }
|
|
|
|
convertDateFormat(String str) {
|
|
const start = "/Date(";
|
|
const end = "+0300)";
|
|
|
|
final startIndex = str.indexOf(start);
|
|
final endIndex = str.indexOf(end, startIndex + start.length);
|
|
|
|
var date = new DateTime.fromMillisecondsSinceEpoch(
|
|
int.parse(str.substring(startIndex + start.length, endIndex)));
|
|
String newDate = date.year.toString() +
|
|
"-" +
|
|
date.month.toString().padLeft(2, '0') +
|
|
"-" +
|
|
date.day.toString().padLeft(2, '0');
|
|
|
|
return newDate.toString();
|
|
}
|
|
}
|