diff --git a/lib/config/config.dart b/lib/config/config.dart index a7746532..a7ffc7c0 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -4,8 +4,8 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; -const BASE_URL = 'https://hmgwebservices.com/'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = diff --git a/lib/routes.dart b/lib/routes.dart index b18e181d..7bc93fdc 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -5,7 +5,7 @@ import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_pa import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-detail-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-input-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/labs_home_page.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/progress_note_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/note/progress_note_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/radiology/radiology_home_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/update_soap_index.dart'; @@ -17,7 +17,7 @@ import './screens/auth/login_screen.dart'; import './screens/auth/verification_methods_screen.dart'; import './screens/patients/patients_screen.dart'; import './screens/patients/profile/patient_profile_screen.dart'; -import './screens/patients/profile/progress_note_screen.dart'; +import 'screens/patients/profile/note/progress_note_screen.dart'; import './screens/patients/profile/vital_sign/vital_sign_details_screen.dart'; import 'landing_page.dart'; import 'screens/patients/profile/admission-request/admission-request-first-screen.dart'; @@ -36,6 +36,8 @@ const String PATIENTS_PROFILE = 'patients/patients-profile'; const String LAB_RESULT = 'patients/lab_result'; const String MEDICAL_FILE = 'patients/radiology'; const String PROGRESS_NOTE = 'patients/progress-note'; +const String ORDER_NOTE = 'patients/order-note'; + const String MY_REFERRAL_DETAIL = 'my_referral_detail'; const String REFER_PATIENT_TO_DOCTOR = 'patients/refer-to-doctor'; const String PATIENT_INSURANCE_APPROVALS_NEW = @@ -65,7 +67,8 @@ var routes = { PATIENTS_PROFILE: (_) => PatientProfileScreen(), LAB_RESULT: (_) => LabsHomePage(), MEDICAL_FILE: (_) => MedicalFilePage(), - PROGRESS_NOTE: (_) => ProgressNoteScreen(), + PROGRESS_NOTE: (_) => ProgressNoteScreen(visitType: 5,), + ORDER_NOTE: (_) => ProgressNoteScreen(visitType: 3,), REFER_PATIENT_TO_DOCTOR: (_) => PatientMakeReferralScreen(), PATIENT_INSURANCE_APPROVALS_NEW: (_) => InsuranceApprovalScreenNew(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), diff --git a/lib/screens/patients/profile/note/progress_note_screen.dart b/lib/screens/patients/profile/note/progress_note_screen.dart new file mode 100644 index 00000000..37374009 --- /dev/null +++ b/lib/screens/patients/profile/note/progress_note_screen.dart @@ -0,0 +1,312 @@ +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 { + var 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( + 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: [ + AddNewOrder( onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddNoteOrder( + + )), + ); + },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: () {}, + child: Icon( + DoctorApp.edit, + size: 18, + )) + ], + ), + ], + ), + ), + SizedBox( + height: 20, + + ), + ], + ); + + // RoundedContainer( + // backgroundColor: Colors.white, + // child: Column( + // crossAxisAlignment: + // CrossAxisAlignment.start, + // children: [ + // ExpansionTile( + // title: Container( + // child: Column( + // crossAxisAlignment: + // CrossAxisAlignment.start, + // children: [ + // AppText( + // notesList[index] + // ["DoctorName"], + // marginTop: 10, + // marginLeft: 10, + // marginBottom: 5, + // fontWeight: FontWeight.bold, + // ), + // AppText( + // convertDateFormat( + // notesList[index] + // ["AssessmentDate"]), + // marginLeft: 10, + // color: Colors.grey[600], + // ), + // ], + // ), + // ), + // children: [ + // Divider( + // color: Colors.black, + // height: 20, + // thickness: 1, + // indent: 0, + // endIndent: 0, + // ), + // Row(mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // AppText( + // notesList[index]["Notes"], + // margin: 5, + // ), + // ], + // ) + // ], + // ), + // ], + // )); + }), + ), + ), + ], + ), + ), + ), + ); + } + + 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(); + } +} diff --git a/lib/screens/patients/profile/note/update_note.dart b/lib/screens/patients/profile/note/update_note.dart new file mode 100644 index 00000000..34f5433e --- /dev/null +++ b/lib/screens/patients/profile/note/update_note.dart @@ -0,0 +1,106 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/medical_file_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.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/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; +import 'package:doctor_app_flutter/screens/procedures/entity_list_checkbox_search_widget.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.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/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; + +class AddNoteOrder extends StatefulWidget { + // final ProcedureViewModel model; + // final PatiantInformtion patient; + // + // const AddNoteOrder({Key key, this.model, this.patient}) + // : super(key: key); + @override + _AddNoteOrderState createState() => + _AddNoteOrderState(); +} + +class _AddNoteOrderState extends State { + int selectedType; + ProcedureViewModel model; + PatiantInformtion patient; + TextEditingController progressNoteController = TextEditingController(); + + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + @override + Widget build(BuildContext context) { + return BaseView( + // onModelReady: (model) => model.getProcedureCategory( + // categoryName: "Radiology", categoryID: "03"), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + AppScaffold( + isShowAppBar: false, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + body: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.0, + child: Padding( + padding: EdgeInsets.all(0.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BottomSheetTitle(title: 'Add Progress Note',), + SizedBox( + height: 10.0, + ), + + Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + AppTextFieldCustom( + hintText: TranslationBase.of(context).addProgressNote, + controller: progressNoteController, + maxLines: 25, + minLines: 7, + hasBorder: true, + // validationError:complaintsController.text.isEmpty , + + ), + ], + ), + ), + ), + + ], + ), + ), + ), + ), + bottomSheet: Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: 'Add Progress Note', + color: Color(0xff359846), + fontWeight: FontWeight.w700, + onPressed: () { + + }, + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/progress_note_screen.dart b/lib/screens/patients/profile/progress_note_screen.dart deleted file mode 100644 index 56a5cd5e..00000000 --- a/lib/screens/patients/profile/progress_note_screen.dart +++ /dev/null @@ -1,217 +0,0 @@ -import 'package:doctor_app_flutter/core/viewModel/patient_view_model.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/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; -import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.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(); - -/* - *@author: ibrahim albitar - *@Date:15/5/2020 - *@param: ' - *@return: - *@desc: - */ - -class ProgressNoteScreen extends StatefulWidget { - @override - _ProgressNoteState createState() => _ProgressNoteState(); -} - -class _ProgressNoteState extends State { - var notesList; - var filteredNotesList; - final _controller = TextEditingController(); - var _isInit = true; - - /* - *@author: ibrahim al bitar - *@Date:16/5/2020 - *@param: - *@return: - *@desc: - */ - 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: 5, - // 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) { - return BaseView( - onModelReady: (model) => getProgressNoteList(context, model), - builder: (_, model, w) => - AppScaffold( - baseViewModel: model, - appBarTitle: TranslationBase - .of(context) - .progressNote, - body: notesList == null || notesList.length == 0 - ? DrAppEmbeddedError( - error: TranslationBase - .of(context) - .errorNoProgressNote) - : Column( - children: [ - Container( - margin: EdgeInsets.all(10), - width: SizeConfig.screenWidth * 0.80, - child: TextField( - controller: _controller, - onChanged: (String str) { - this.searchData(str, model); - }, - textInputAction: TextInputAction.done, - decoration: buildInputDecoration(context, - TranslationBase.of(context).searchNote), - ), - ), - Expanded( - child: Container( - margin: EdgeInsets.fromLTRB( - SizeConfig.realScreenWidth * 0.05, - 0, - SizeConfig.realScreenWidth * 0.05, - 0), - child: ListView.builder( - itemCount: notesList.length, - itemBuilder: (BuildContext ctxt, int index) { - return RoundedContainer( - backgroundColor: Colors.white, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - ExpansionTile( - title: Container( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - notesList[index] - ["DoctorName"], - marginTop: 10, - marginLeft: 10, - marginBottom: 5, - fontWeight: FontWeight.bold, - ), - AppText( - convertDateFormat( - notesList[index] - ["AssessmentDate"]), - marginLeft: 10, - color: Colors.grey[600], - ), - ], - ), - ), - children: [ - Divider( - color: Colors.black, - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row(mainAxisAlignment: MainAxisAlignment.start, - children: [ - AppText( - notesList[index]["Notes"], - margin: 5, - ), - ], - ) - ], - ), - ], - )); - }), - ), - ), - ], - ), - ),); - } - - 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(); - } -} diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index f75dd9ee..f7046a4a 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -175,6 +175,16 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).progress, nameLine2: TranslationBase.of(context).note, icon: 'patient/Progress_notes.png'), + if (patientType == "1") + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: ORDER_NOTE, + nameLine1: 'Order',//TranslationBase.of(context).progress, + nameLine2: TranslationBase.of(context).note, + icon: 'patient/Progress_notes.png'), ], ), ); diff --git a/lib/widgets/patients/profile/profile_medical_info_widget_search.dart b/lib/widgets/patients/profile/profile_medical_info_widget_search.dart index 6ce09117..38cc598f 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget_search.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget_search.dart @@ -138,6 +138,17 @@ class ProfileMedicalInfoWidgetSearch extends StatelessWidget { nameLine2: TranslationBase.of(context).note, icon: 'patient/Progress_notes.png'), + if (patientType == "1") + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: ORDER_NOTE, + nameLine1: 'Order',//TranslationBase.of(context).progress, + nameLine2: TranslationBase.of(context).note, + icon: 'patient/Progress_notes.png'), + if (patientType == "1") PatientProfileButton( key: key,