diff --git a/lib/config/config.dart b/lib/config/config.dart index 5bc953f2..01a89033 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -350,6 +350,8 @@ const GET_OPERATION_REPORT = const NURSING_PROGRESS_NOTE = "Services/DoctorApplication.svc/REST/DoctorApp_GetNursingProgressNote"; +const GET_DIAGNOSIS_FOR_IN_PATIENT = + "Services/DoctorApplication.svc/REST/DoctorApp_GetDiagnosisForInPatient"; var selectedPatientType = 1; diff --git a/lib/core/model/diagnosis/GetDiagnosisForInPatientRequestModel.dart b/lib/core/model/diagnosis/GetDiagnosisForInPatientRequestModel.dart new file mode 100644 index 00000000..310cfb50 --- /dev/null +++ b/lib/core/model/diagnosis/GetDiagnosisForInPatientRequestModel.dart @@ -0,0 +1,32 @@ +class GetDiagnosisForInPatientRequestModel { + int patientID; + int admissionNo; + String setupID; + int patientType; + int patientTypeID; + + GetDiagnosisForInPatientRequestModel( + {this.patientID, + this.admissionNo, + this.setupID, + this.patientType, + this.patientTypeID}); + + GetDiagnosisForInPatientRequestModel.fromJson(Map json) { + patientID = json['PatientID']; + admissionNo = json['AdmissionNo']; + setupID = json['SetupID']; + patientType = json['PatientType']; + patientTypeID = json['PatientTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientID'] = this.patientID; + data['AdmissionNo'] = this.admissionNo; + data['SetupID'] = this.setupID; + data['PatientType'] = this.patientType; + data['PatientTypeID'] = this.patientTypeID; + return data; + } +} diff --git a/lib/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart b/lib/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart new file mode 100644 index 00000000..c4a4e528 --- /dev/null +++ b/lib/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart @@ -0,0 +1,48 @@ +class GetDiagnosisForInPatientResponseModel { + String iCDCode10ID; + int diagnosisTypeID; + int conditionID; + bool complexDiagnosis; + String asciiDesc; + int createdBy; + String createdOn; + int editedBy; + String editedOn; + + GetDiagnosisForInPatientResponseModel( + {this.iCDCode10ID, + this.diagnosisTypeID, + this.conditionID, + this.complexDiagnosis, + this.asciiDesc, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn}); + + GetDiagnosisForInPatientResponseModel.fromJson(Map json) { + iCDCode10ID = json['ICDCode10ID']; + diagnosisTypeID = json['DiagnosisTypeID']; + conditionID = json['ConditionID']; + complexDiagnosis = json['ComplexDiagnosis']; + asciiDesc = json['Ascii_Desc']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + } + + Map toJson() { + final Map data = new Map(); + data['ICDCode10ID'] = this.iCDCode10ID; + data['DiagnosisTypeID'] = this.diagnosisTypeID; + data['ConditionID'] = this.conditionID; + data['ComplexDiagnosis'] = this.complexDiagnosis; + data['Ascii_Desc'] = this.asciiDesc; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + return data; + } +} diff --git a/lib/core/service/patient/patient_service.dart b/lib/core/service/patient/patient_service.dart index 26ec11ad..a3272201 100644 --- a/lib/core/service/patient/patient_service.dart +++ b/lib/core/service/patient/patient_service.dart @@ -1,6 +1,8 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.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/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; import 'package:doctor_app_flutter/core/model/note/GetNursingProgressNoteRequestModel.dart'; import 'package:doctor_app_flutter/core/model/note/GetNursingProgressNoteResposeModel.dart'; @@ -61,6 +63,10 @@ class PatientService extends BaseService { List get patientNursingProgressNoteList => _patientNursingProgressNoteList; + List _diagnosisForInPatientList = []; + + List get diagnosisForInPatientList => _diagnosisForInPatientList; + // TODO: replace var with model var _insuranceApporvalsList = []; @@ -490,4 +496,23 @@ class PatientService extends BaseService { body: getNursingProgressNoteRequestModel.toJson(), ); } + + Future getDiagnosisForInPatient(GetDiagnosisForInPatientRequestModel getDiagnosisForInPatientRequestModel) async { + hasError = false; + + await baseAppClient.post( + GET_DIAGNOSIS_FOR_IN_PATIENT, + onSuccess: (dynamic response, int statusCode) { + _diagnosisForInPatientList = []; + response['List_DiagnosisForInPatient'].forEach((v) { + _diagnosisForInPatientList.add( GetDiagnosisForInPatientResponseModel.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: getDiagnosisForInPatientRequestModel.toJson(), + ); + } } diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index 24d1479d..38d23df9 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -1,4 +1,6 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/diagnosis/GetDiagnosisForInPatientRequestModel.dart'; +import 'package:doctor_app_flutter/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; import 'package:doctor_app_flutter/core/model/note/GetNursingProgressNoteRequestModel.dart'; import 'package:doctor_app_flutter/core/model/note/GetNursingProgressNoteResposeModel.dart'; @@ -44,6 +46,7 @@ class PatientViewModel extends BaseViewModel { List get patientProgressNoteList => _patientService.patientProgressNoteList; List get patientNursingProgressNoteList => _patientService.patientNursingProgressNoteList; + List get diagnosisForInPatientList => _patientService.diagnosisForInPatientList; List get clinicsList => _patientService.clinicsList; @@ -300,4 +303,16 @@ class PatientViewModel extends BaseViewModel { setState(ViewState.Idle); } } + Future getDiagnosisForInPatient(GetDiagnosisForInPatientRequestModel requestModel) async { + await getDoctorProfile(); + setState(ViewState.Busy); + + await _patientService.getDiagnosisForInPatient(requestModel); + if (_patientService.hasError) { + error = _patientService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } } diff --git a/lib/routes.dart b/lib/routes.dart index 8e6d346d..c5048c56 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/screens/medical-file/health_summary_page.dart import 'package:doctor_app_flutter/screens/patient-sick-leave/patient_sick_leave_screen.dart'; import 'package:doctor_app_flutter/screens/patients/ECGPage.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/diagnosis/diagnosis_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/all_lab_special_result_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/labs_home_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart'; @@ -70,6 +71,7 @@ const String RADIOLOGY_PATIENT = 'radiology-patient'; const String ALL_SPECIAL_LAB_RESULT = 'all-special_lab'; const String GET_OPERATION_REPORT = 'operation-report'; const String NURSING_PROGRESS_NOTE = 'nursing_progress_note'; +const String DIAGNOSIS_FOR_IN_PATIENT = 'get_diagnosis_for_in_patient'; //todo: change the routing way. var routes = { @@ -115,4 +117,5 @@ var routes = { ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(), NURSING_PROGRESS_NOTE: (_) => NursingProgressNoteScreen(), + DIAGNOSIS_FOR_IN_PATIENT: (_) => DiagnosisScreen(), }; diff --git a/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart b/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart new file mode 100644 index 00000000..3347beaf --- /dev/null +++ b/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart @@ -0,0 +1,238 @@ +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/model/note/GetNursingProgressNoteRequestModel.dart'; +import 'package:doctor_app_flutter/core/model/note/note_model.dart'; +import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.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/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_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/screens/patients/profile/notes/note/update_note.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.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-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/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.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 { + bool isDischargedPatient = false; + AuthenticationViewModel authenticationViewModel; + 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, setupID: "010266"); + 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( + 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 + ? DrAppEmbeddedError( + error: TranslationBase.of(context).errorNoProgressNote) + : Container( + color: Colors.grey[200], + child: Column( + children: [ + 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.black38, + 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: 10, + ), + Expanded( + child: AppText( + model + .diagnosisForInPatientList[ + index] + .createdBy + .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: [ + Expanded( + child: AppText( + model + .diagnosisForInPatientList[ + index] + .iCDCode10ID, + fontSize: 10, + isCopyable: true, + ), + ), + ]) + ], + ), + SizedBox( + height: 20, + ), + ], + ), + ), + ); + }), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart index bc1deb07..6e3d785e 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart @@ -140,6 +140,13 @@ class ProfileGridForInPatient extends StatelessWidget { 'patient/patient_sick_leave.png', isInPatient: isInpatient, ), + PatientProfileCardModel( + "Diagnosis", + "", + DIAGNOSIS_FOR_IN_PATIENT, + 'patient/patient_sick_leave.png', + isInPatient: isInpatient, + ), ]; return Padding(