diff --git a/lib/config/config.dart b/lib/config/config.dart index 7c5e6ae0..35446d66 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -252,6 +252,8 @@ const SEND_PRESCRIPTION_EMAIL = const GET_PRESCRIPTION_REPORT_ENH = 'Services/Patients.svc/REST/GetPrescriptionReport_enh'; const GET_PHARMACY_LIST = "Services/Patients.svc/REST/GetPharmcyList"; +const UPDATE_PROGRESS_NOTE_FOR_INPATIENT = "Services/DoctorApplication.svc/REST/UpdateProgressNoteForInPatient"; +const CREATE_PROGRESS_NOTE_FOR_INPATIENT = "Services/DoctorApplication.svc/REST/CreateProgressNoteForInPatient"; const GET_PRESCRIPTION_IN_PATIENT = 'Services/DoctorApplication.svc/REST/GetPrescriptionReportForInPatient'; diff --git a/lib/core/model/labs/lab_result.dart b/lib/core/model/labs/lab_result.dart index 2deb13f3..1c09696b 100644 --- a/lib/core/model/labs/lab_result.dart +++ b/lib/core/model/labs/lab_result.dart @@ -47,10 +47,10 @@ class LabResult { lineItemNo = json['LineItemNo']; maleInterpretativeData = json['MaleInterpretativeData']; notes = json['Notes']; - packageID = json['PackageID']; + packageID = json['PackageID'].toString(); patientID = json['PatientID']; - projectID = json['ProjectID']; - referanceRange = json['ReferanceRange']; + projectID = json['ProjectID'].toString(); + referanceRange = json['ReferenceRange'] ?? json['ReferanceRange']; resultValue = json['ResultValue']; sampleCollectedOn = json['SampleCollectedOn']; sampleReceivedOn = json['SampleReceivedOn']; diff --git a/lib/core/model/labs/patient_lab_orders.dart b/lib/core/model/labs/patient_lab_orders.dart index 07044b0e..62eac5cc 100644 --- a/lib/core/model/labs/patient_lab_orders.dart +++ b/lib/core/model/labs/patient_lab_orders.dart @@ -85,7 +85,7 @@ class PatientLabOrders { doctorTitle = json['DoctorTitle']; gender = json['Gender']; genderDescription = json['GenderDescription']; - invoiceNo = json['InvoiceNo']; + invoiceNo = json['InvoiceNo'].toString(); isActiveDoctorProfile = json['IsActiveDoctorProfile']; isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; isExecludeDoctor = json['IsExecludeDoctor']; @@ -96,9 +96,9 @@ class PatientLabOrders { nationalityFlagURL = json['NationalityFlagURL']; noOfPatientsRate = json['NoOfPatientsRate']; orderDate = DateUtils.convertStringToDate(json['OrderDate']); - orderNo = json['OrderNo']; - patientID = json['PatientID']; - projectID = json['ProjectID']; + orderNo = json['OrderNo'].toString(); + patientID = json['PatientID'].toString(); + projectID = json['ProjectID'].toString(); projectName = json['ProjectName']; projectNameN = json['ProjectNameN']; qR = json['QR']; diff --git a/lib/core/model/labs/request_patient_lab_special_result.dart b/lib/core/model/labs/request_patient_lab_special_result.dart index bdeb3930..b48cf0e1 100644 --- a/lib/core/model/labs/request_patient_lab_special_result.dart +++ b/lib/core/model/labs/request_patient_lab_special_result.dart @@ -65,7 +65,7 @@ class RequestPatientLabSpecialResult { data['OrderNo'] = this.orderNo; data['SetupID'] = this.setupID; data['ProjectID'] = this.projectID; - data['ClinicID'] = this.clinicID; + data['ClinicID'] = this.clinicID ?? 0; data['VersionID'] = this.versionID; data['Channel'] = this.channel; data['LanguageID'] = this.languageID; diff --git a/lib/core/model/note/CreateNoteModel.dart b/lib/core/model/note/CreateNoteModel.dart new file mode 100644 index 00000000..ce076705 --- /dev/null +++ b/lib/core/model/note/CreateNoteModel.dart @@ -0,0 +1,88 @@ +class CreateNoteModel { + int visitType; + int admissionNo; + int projectID; + int patientTypeID; + int patientID; + int clinicID; + String notes; + int createdBy; + int editedBy; + String nursingRemarks; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + + CreateNoteModel( + {this.visitType, + this.admissionNo, + this.projectID, + this.patientTypeID, + this.patientID, + this.clinicID, + this.notes, + this.createdBy, + this.editedBy, + this.nursingRemarks, + this.languageID, + this.stamp, + this.iPAdress, + this.versionID, + this.channel, + this.tokenID, + this.sessionID, + this.isLoginForDoctorApp, + this.patientOutSA}); + + CreateNoteModel.fromJson(Map json) { + visitType = json['VisitType']; + admissionNo = json['AdmissionNo']; + projectID = json['ProjectID']; + patientTypeID = json['PatientTypeID']; + patientID = json['PatientID']; + clinicID = json['ClinicID']; + notes = json['Notes']; + createdBy = json['CreatedBy']; + editedBy = json['EditedBy']; + nursingRemarks = json['NursingRemarks']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + } + + Map toJson() { + final Map data = new Map(); + data['VisitType'] = this.visitType; + data['AdmissionNo'] = this.admissionNo; + data['ProjectID'] = this.projectID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientID'] = this.patientID; + data['ClinicID'] = this.clinicID; + data['Notes'] = this.notes; + data['CreatedBy'] = this.createdBy; + data['EditedBy'] = this.editedBy; + data['NursingRemarks'] = this.nursingRemarks; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + return data; + } +} diff --git a/lib/core/model/note/note_model.dart b/lib/core/model/note/note_model.dart new file mode 100644 index 00000000..797f9b6d --- /dev/null +++ b/lib/core/model/note/note_model.dart @@ -0,0 +1,92 @@ +class NoteModel { + String setupID; + int projectID; + int patientID; + int patientType; + String admissionNo; + int lineItemNo; + int visitType; + String notes; + String assessmentDate; + String visitTime; + int status; + String nursingRemarks; + String createdOn; + String editedOn; + int createdBy; + int admissionClinicID; + String admissionClinicName; + Null doctorClinicName; + String doctorName; + String visitTypeDesc; + + NoteModel( + {this.setupID, + this.projectID, + this.patientID, + this.patientType, + this.admissionNo, + this.lineItemNo, + this.visitType, + this.notes, + this.assessmentDate, + this.visitTime, + this.status, + this.nursingRemarks, + this.createdOn, + this.editedOn, + this.createdBy, + this.admissionClinicID, + this.admissionClinicName, + this.doctorClinicName, + this.doctorName, + this.visitTypeDesc}); + + NoteModel.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + patientID = json['PatientID']; + patientType = json['PatientType']; + admissionNo = json['AdmissionNo']; + lineItemNo = json['LineItemNo']; + visitType = json['VisitType']; + notes = json['Notes']; + assessmentDate = json['AssessmentDate']; + visitTime = json['VisitTime']; + status = json['Status']; + nursingRemarks = json['NursingRemarks']; + createdOn = json['CreatedOn']; + editedOn = json['EditedOn']; + createdBy = json['CreatedBy']; + admissionClinicID = json['AdmissionClinicID']; + admissionClinicName = json['AdmissionClinicName']; + doctorClinicName = json['DoctorClinicName']; + doctorName = json['DoctorName']; + visitTypeDesc = json['VisitTypeDesc']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['AdmissionNo'] = this.admissionNo; + data['LineItemNo'] = this.lineItemNo; + data['VisitType'] = this.visitType; + data['Notes'] = this.notes; + data['AssessmentDate'] = this.assessmentDate; + data['VisitTime'] = this.visitTime; + data['Status'] = this.status; + data['NursingRemarks'] = this.nursingRemarks; + data['CreatedOn'] = this.createdOn; + data['EditedOn'] = this.editedOn; + data['CreatedBy'] = this.createdBy; + data['AdmissionClinicID'] = this.admissionClinicID; + data['AdmissionClinicName'] = this.admissionClinicName; + data['DoctorClinicName'] = this.doctorClinicName; + data['DoctorName'] = this.doctorName; + data['VisitTypeDesc'] = this.visitTypeDesc; + return data; + } +} diff --git a/lib/core/model/note/update_note_model.dart b/lib/core/model/note/update_note_model.dart new file mode 100644 index 00000000..20fd4b86 --- /dev/null +++ b/lib/core/model/note/update_note_model.dart @@ -0,0 +1,80 @@ +class UpdateNoteReqModel { + int projectID; + int createdBy; + int admissionNo; + int lineItemNo; + String notes; + bool verifiedNote; + bool cancelledNote; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + int patientTypeID; + + UpdateNoteReqModel( + {this.projectID, + this.createdBy, + this.admissionNo, + this.lineItemNo, + this.notes, + this.verifiedNote, + this.cancelledNote, + this.languageID, + this.stamp, + this.iPAdress, + this.versionID, + this.channel, + this.tokenID, + this.sessionID, + this.isLoginForDoctorApp, + this.patientOutSA, + this.patientTypeID}); + + UpdateNoteReqModel.fromJson(Map json) { + projectID = json['ProjectID']; + createdBy = json['CreatedBy']; + admissionNo = json['AdmissionNo']; + lineItemNo = json['LineItemNo']; + notes = json['Notes']; + verifiedNote = json['VerifiedNote']; + cancelledNote = json['CancelledNote']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + patientTypeID = json['PatientTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['CreatedBy'] = this.createdBy; + data['AdmissionNo'] = this.admissionNo; + data['LineItemNo'] = this.lineItemNo; + data['Notes'] = this.notes; + data['VerifiedNote'] = this.verifiedNote; + data['CancelledNote'] = this.cancelledNote; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + data['PatientTypeID'] = this.patientTypeID; + return data; + } +} diff --git a/lib/core/service/labs_service.dart b/lib/core/service/labs_service.dart index ecfc96a1..6ea6e6cf 100644 --- a/lib/core/service/labs_service.dart +++ b/lib/core/service/labs_service.dart @@ -12,16 +12,30 @@ import 'base/base_service.dart'; class LabsService extends BaseService { List patientLabOrdersList = List(); - Future getPatientLabOrdersList(PatiantInformtion patient) async { + Future getPatientLabOrdersList( + PatiantInformtion patient, bool isArrived) async { hasError = false; Map body = Map(); - body['isDentalAllowedBackend'] = false; - await baseAppClient.postPatient(GET_Patient_LAB_ORDERS, patient: patient, + String url = ""; + if (isArrived) { + body['isDentalAllowedBackend'] = false; + url = GET_Patient_LAB_ORDERS; + } else { + url = GET_PATIENT_LAB_OREDERS; + } + + await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) { patientLabOrdersList.clear(); - response['ListPLO'].forEach((hospital) { - patientLabOrdersList.add(PatientLabOrders.fromJson(hospital)); - }); + if (isArrived) { + response['ListPLO'].forEach((hospital) { + patientLabOrdersList.add(PatientLabOrders.fromJson(hospital)); + }); + } else { + response['List_GetLabOreders'].forEach((hospital) { + patientLabOrdersList.add(PatientLabOrders.fromJson(hospital)); + }); + } }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -40,42 +54,65 @@ class LabsService extends BaseService { int clinicID, String invoiceNo, String orderNo, - PatiantInformtion patient}) async { + PatiantInformtion patient, + bool isInpatient = false}) async { hasError = false; + + Map body = Map(); _requestPatientLabSpecialResult.projectID = projectID; _requestPatientLabSpecialResult.clinicID = clinicID; _requestPatientLabSpecialResult.invoiceNo = invoiceNo; _requestPatientLabSpecialResult.orderNo = orderNo; + body = _requestPatientLabSpecialResult.toJson(); - await baseAppClient.postPatient(GET_Patient_LAB_SPECIAL_RESULT, - patient: patient, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.postPatient(GET_Patient_LAB_SPECIAL_RESULT, patient: patient, + onSuccess: (dynamic response, int statusCode) { patientLabSpecialResult.clear(); + response['ListPLSR'].forEach((hospital) { patientLabSpecialResult.add(PatientLabSpecialResult.fromJson(hospital)); }); + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: _requestPatientLabSpecialResult.toJson()); + }, body: body); } Future getPatientLabResult( - {PatientLabOrders patientLabOrder, PatiantInformtion patient}) async { + {PatientLabOrders patientLabOrder, PatiantInformtion patient, bool isInpatient}) async { hasError = false; + + String url = ""; + if (isInpatient) { + url = GET_PATIENT_LAB_RESULTS; + } else { + url = GET_Patient_LAB_RESULT; + } + Map body = Map(); body['InvoiceNo'] = patientLabOrder.invoiceNo; body['OrderNo'] = patientLabOrder.orderNo; body['isDentalAllowedBackend'] = false; body['SetupID'] = patientLabOrder.setupID; body['ProjectID'] = patientLabOrder.projectID; - body['ClinicID'] = patientLabOrder.clinicID; - await baseAppClient.postPatient(GET_Patient_LAB_RESULT, patient: patient, + body['ClinicID'] = patientLabOrder.clinicID ?? 0; + + await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) { patientLabSpecialResult.clear(); labResultList.clear(); - response['ListPLR'].forEach((lab) { - labResultList.add(LabResult.fromJson(lab)); - }); + + if(isInpatient){ + response['List_GetLabNormal'].forEach((hospital) { + labResultList.add(LabResult.fromJson(hospital)); + }); + }else { + response['ListPLR'].forEach((lab) { + labResultList.add(LabResult.fromJson(lab)); + }); + } + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/service/patient_service.dart b/lib/core/service/patient_service.dart index 4f135eaa..6caaf0fc 100644 --- a/lib/core/service/patient_service.dart +++ b/lib/core/service/patient_service.dart @@ -1,6 +1,9 @@ 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/note/CreateNoteModel.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/base/base_service.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/request_schedule.dart'; @@ -51,9 +54,9 @@ class PatientService extends BaseService { List get labResultList => _labResultList; // TODO: replace var with model - var _patientProgressNoteList = []; + List _patientProgressNoteList = []; - get patientProgressNoteList => _patientProgressNoteList; + List get patientProgressNoteList => _patientProgressNoteList; // TODO: replace var with model var _insuranceApporvalsList = []; @@ -277,7 +280,10 @@ class PatientService extends BaseService { PATIENT_PROGRESS_NOTE_URL, onSuccess: (dynamic response, int statusCode) { _patientProgressNoteList = []; - _patientProgressNoteList = response['List_GetPregressNoteForInPatient']; + // _patientProgressNoteList = + response['List_GetPregressNoteForInPatient'].forEach((v) { + _patientProgressNoteList.add(new NoteModel.fromJson(v)); + }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -287,6 +293,39 @@ class PatientService extends BaseService { ); } + + Future updatePatientProgressNote(UpdateNoteReqModel req) async { + hasError = false; + + await baseAppClient.post( + UPDATE_PROGRESS_NOTE_FOR_INPATIENT, + onSuccess: (dynamic response, int statusCode) { + print("ok"); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: req.toJson(), + ); + } + + Future createPatientProgressNote(CreateNoteModel req) async { + hasError = false; + + await baseAppClient.post( + CREATE_PROGRESS_NOTE_FOR_INPATIENT, + onSuccess: (dynamic response, int statusCode) { + print("ok"); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: req.toJson(), + ); + } + Future getClinicsList() async { hasError = false; diff --git a/lib/core/viewModel/labs_view_model.dart b/lib/core/viewModel/labs_view_model.dart index 43851649..020a6184 100644 --- a/lib/core/viewModel/labs_view_model.dart +++ b/lib/core/viewModel/labs_view_model.dart @@ -28,7 +28,7 @@ class LabsViewModel extends BaseViewModel { void getLabs(PatiantInformtion patient) async { setState(ViewState.Busy); - await _labsService.getPatientLabOrdersList(patient); + await _labsService.getPatientLabOrdersList(patient, true); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); @@ -89,7 +89,6 @@ class LabsViewModel extends BaseViewModel { List labResultLists = List(); List get labResultListsCoustom { - return labResultLists; } @@ -98,14 +97,16 @@ class LabsViewModel extends BaseViewModel { int clinicID, String invoiceNo, String orderNo, - PatiantInformtion patient}) async { + PatiantInformtion patient, + bool isInpatient}) async { setState(ViewState.Busy); await _labsService.getLaboratoryResult( invoiceNo: invoiceNo, orderNo: orderNo, projectID: projectID, clinicID: clinicID, - patient: patient); + patient: patient, + isInpatient: isInpatient); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); @@ -114,9 +115,11 @@ class LabsViewModel extends BaseViewModel { } } - getPatientLabResult({PatientLabOrders patientLabOrder,PatiantInformtion patient}) async { + getPatientLabResult( + {PatientLabOrders patientLabOrder, PatiantInformtion patient, bool isInpatient}) async { setState(ViewState.Busy); - await _labsService.getPatientLabResult(patientLabOrder: patientLabOrder,patient: patient); + await _labsService.getPatientLabResult( + patientLabOrder: patientLabOrder, patient: patient, isInpatient: isInpatient); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); @@ -149,10 +152,14 @@ class LabsViewModel extends BaseViewModel { } getPatientLabOrdersResults( - {PatientLabOrders patientLabOrder, String procedure,PatiantInformtion patient}) async { + {PatientLabOrders patientLabOrder, + String procedure, + PatiantInformtion patient}) async { setState(ViewState.Busy); await _labsService.getPatientLabOrdersResults( - patientLabOrder: patientLabOrder, procedure: procedure,patient: patient); + patientLabOrder: patientLabOrder, + procedure: procedure, + patient: patient); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index 00b64204..aaa7364f 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -1,4 +1,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.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/patient_service.dart'; import 'package:doctor_app_flutter/models/patient/lab_orders/lab_orders_res_model.dart'; import 'package:doctor_app_flutter/models/patient/lab_result/lab_result.dart'; @@ -39,7 +42,7 @@ class PatientViewModel extends BaseViewModel { get insuranceApporvalsList => _patientService.insuranceApporvalsList; - get patientProgressNoteList => _patientService.patientProgressNoteList; + List get patientProgressNoteList => _patientService.patientProgressNoteList; List get clinicsList => _patientService.clinicsList; @@ -146,6 +149,26 @@ class PatientViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future updatePatientProgressNote(UpdateNoteReqModel req) async { + setState(ViewState.BusyLocal); + await _patientService.updatePatientProgressNote(req); + if (_patientService.hasError) { + error = _patientService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future createPatientProgressNote(CreateNoteModel req) async { + setState(ViewState.BusyLocal); + await _patientService.createPatientProgressNote(req); + if (_patientService.hasError) { + error = _patientService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + Future getClinicsList() async { setState(ViewState.Busy); await _patientService.getClinicsList(); diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 0d0b41ef..d35b2c14 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -228,7 +228,7 @@ class ProcedureViewModel extends BaseViewModel { void getLabs(PatiantInformtion patient,{bool isArrived}) async { setState(ViewState.Busy); - await _labsService.getPatientLabOrdersList(patient); + await _labsService.getPatientLabOrdersList(patient, isArrived); if (_labsService.hasError) { error = _labsService.error; if(isArrived) 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/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 17d44839..04cd8c41 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -93,7 +93,7 @@ class _PatientSearchScreenState extends State { }); Navigator.of(context).pushNamed(PATIENTS, arguments: { "patientSearchForm": _patientSearchFormValues, - "selectedType": _selectedType, + "selectedType": isView == false ? '0' : _selectedType, "isSearch": true, "isView": isView }); diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 014f656d..5c72e574 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -21,6 +21,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.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:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:intl/intl.dart'; @@ -394,20 +395,51 @@ class _PatientsScreenState extends State { children: [ Column(children: [ SizedBox(height: 18.5), + Container( - width: SizeConfig.screenWidth * 0.9, - height: SizeConfig.screenHeight * 0.08, - child: TextField( - controller: _controller, - onChanged: (String str) { - this.searchData(str); - }, - decoration: buildInputDecoration( - context, - TranslationBase.of(context) - .searchPatientName), - ), - ), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"), + ), + color: Colors.white), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + left: 10, top: 10), + child: AppText( + TranslationBase.of(context) + .selectYourProject, + fontWeight: FontWeight.w600, + )), + AppTextFormField( + // focusNode: focusProject, + controller: _controller, + borderColor: Colors.white, + suffixIcon: Icons.arrow_drop_down, + onTap: () {}, + ) + ])), + + // Container( + // width: SizeConfig.screenWidth * 0.9, + // height: SizeConfig.screenHeight * 0.08, + // child: TextField( + // controller: _controller, + // onChanged: (String str) { + // this.searchData(str); + // }, + // decoration: buildInputDecoration( + // context, + // TranslationBase.of(context) + // .searchPatientName), + // ), + // ), SizedBox( height: 10.0, ), @@ -484,21 +516,65 @@ class _PatientsScreenState extends State { : Column( children: [ SizedBox(height: 18.5), + Container( - width: SizeConfig.screenWidth * 0.9, - height: - SizeConfig.screenHeight * 0.08, - child: TextField( - controller: _controller, - onChanged: (String str) { - this.searchData(str); - }, - decoration: buildInputDecoration( - context, - TranslationBase.of(context) - .searchPatientName), - ), - ), + width: SizeConfig.screenWidth * 0.9, + height: 75, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"), + ), + color: Colors.white), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + left: 10, top: 10), + child: AppText( + TranslationBase.of( + context) + .searchPatientName, + fontWeight: + FontWeight.bold, + )), + AppTextFormField( + // focusNode: focusProject, + controller: _controller, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon( + DoctorApp.filter_1, + color: Colors.black, + ), + iconSize: 20, + padding: + EdgeInsets.only( + bottom: 30), + ), + onChanged: (String str) { + this.searchData(str); + }), + ])), + // Container( + // width: SizeConfig.screenWidth * 0.9, + // height: + // SizeConfig.screenHeight * 0.08, + // child: TextField( + // controller: _controller, + // onChanged: (String str) { + // this.searchData(str); + // }, + // decoration: buildInputDecoration( + // context, + // TranslationBase.of(context) + // .searchPatientName), + // ), + // ), SizedBox( height: 10.0, ), @@ -696,28 +772,6 @@ class _PatientsScreenState extends State { }); } - InputDecoration buildInputDecoration(BuildContext context, hint) { - return InputDecoration( - suffixIcon: IconButton( - icon: Icon(DoctorApp.search_patient), - color: Colors.grey, - onPressed: () {}, - iconSize: 30, - ), - filled: true, - fillColor: Colors.white, - hintText: hint, - hintStyle: TextStyle(fontSize: 1.66 * SizeConfig.textMultiplier), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: HexColor('#CCCCCC')), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: Colors.grey), //), - )); - } - Widget _locationBar(BuildContext _context, model) { return Container( height: MediaQuery.of(context).size.height * 0.0619, diff --git a/lib/screens/patients/profile/lab_result/LabResultWidget.dart b/lib/screens/patients/profile/lab_result/LabResultWidget.dart index 9bdd712c..c63f5bdf 100644 --- a/lib/screens/patients/profile/lab_result/LabResultWidget.dart +++ b/lib/screens/patients/profile/lab_result/LabResultWidget.dart @@ -11,15 +11,23 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - class LabResultWidget extends StatelessWidget { - final String filterName; final List patientLabResultList; final PatientLabOrders patientLabOrder; final PatiantInformtion patient; - LabResultWidget({Key key, this.filterName, this.patientLabResultList, this.patientLabOrder, this.patient}) : super(key: key); + final bool isInpatient; + + LabResultWidget( + {Key key, + this.filterName, + this.patientLabResultList, + this.patientLabOrder, + this.patient, + this.isInpatient}) + : super(key: key); ProjectViewModel projectViewModel; + @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); @@ -29,31 +37,32 @@ class LabResultWidget extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(filterName), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: FlowChartPage( - filterName: filterName, - patientLabOrder: patientLabOrder, - patient: patient, + if (!isInpatient) + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(filterName), + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: FlowChartPage( + filterName: filterName, + patientLabOrder: patientLabOrder, + patient: patient, + ), ), - ), - ); - }, - child: AppText( - TranslationBase.of(context).showMoreBtn, - textDecoration: TextDecoration.underline, - color: Colors.blue, + ); + }, + child: AppText( + TranslationBase.of(context).showMoreBtn, + textDecoration: TextDecoration.underline, + color: Colors.blue, + ), ), - ), - ], - ), + ], + ), Row( children: [ Expanded( @@ -61,7 +70,8 @@ class LabResultWidget extends StatelessWidget { child: Center( child: AppText( TranslationBase.of(context).description, - color: Colors.black,bold: true, + color: Colors.black, + bold: true, ), ), ), @@ -69,68 +79,87 @@ class LabResultWidget extends StatelessWidget { Expanded( child: Container( child: Center( - child: AppText(TranslationBase.of(context).value, color: Colors.black,bold: true,), + child: AppText( + TranslationBase.of(context).value, + color: Colors.black, + bold: true, + ), ), ), ), Expanded( child: Container( child: Center( - child: AppText(TranslationBase.of(context).range, color: Colors.black,bold: true,), + child: AppText( + TranslationBase.of(context).range, + color: Colors.black, + bold: true, + ), ), ), ) ], ), - SizedBox(height: 7,), - Divider(color: Colors.black,thickness: 1,), - SizedBox(height: 12,), - ...List.generate(patientLabResultList.length, (index) => Column( - children: [ - Row( - children: [ - Expanded( - child: Container( - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: AppText( - '${patientLabResultList[index].testCode}\n'+ - patientLabResultList[index].description, - textAlign: TextAlign.center, - ), - ), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: AppText( - patientLabResultList[index].resultValue+" "+patientLabResultList[index].uOM, - textAlign: TextAlign.center, - ), - ), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: AppText( - patientLabResultList[index].referanceRange, - textAlign: TextAlign.center, - ), + SizedBox( + height: 7, + ), + Divider( + color: Colors.black, + thickness: 1, + ), + SizedBox( + height: 12, + ), + ...List.generate( + patientLabResultList.length, + (index) => Column( + children: [ + Row( + children: [ + Expanded( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: AppText( + '${patientLabResultList[index].testCode}\n' + + patientLabResultList[index].description, + textAlign: TextAlign.center, + ), + ), + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: AppText( + patientLabResultList[index].resultValue + + " " + + "${patientLabResultList[index].uOM ?? ""}", + textAlign: TextAlign.center, + ), + ), + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: AppText( + patientLabResultList[index].referanceRange, + textAlign: TextAlign.center, + ), + ), + ), + ), + ], ), - ), - ), - ], - ), - Divider(), - ], - )) + Divider(), + ], + )) // Table( // border: TableBorder.symmetric( // inside: BorderSide(width: 2.0, color: Colors.grey[300],style: BorderStyle.solid), @@ -141,7 +170,8 @@ class LabResultWidget extends StatelessWidget { ), ); } - List fullData(List labResultList,context) { + + List fullData(List labResultList, context) { List tableRow = []; tableRow.add( TableRow( @@ -150,18 +180,27 @@ class LabResultWidget extends StatelessWidget { child: Center( child: AppText( TranslationBase.of(context).description, - color: Colors.black,bold: true, + color: Colors.black, + bold: true, ), ), ), Container( child: Center( - child: AppText(TranslationBase.of(context).value, color: Colors.black,bold: true,), + child: AppText( + TranslationBase.of(context).value, + color: Colors.black, + bold: true, + ), ), ), Container( child: Center( - child: AppText(TranslationBase.of(context).range, color: Colors.black,bold: true,), + child: AppText( + TranslationBase.of(context).range, + color: Colors.black, + bold: true, + ), ), ), ], @@ -189,7 +228,7 @@ class LabResultWidget extends StatelessWidget { color: Colors.white, child: Center( child: AppText( - lab.resultValue+" "+lab.uOM, + lab.resultValue + " " + lab.uOM, textAlign: TextAlign.center, ), ), @@ -213,7 +252,4 @@ class LabResultWidget extends StatelessWidget { }); return tableRow; } - } - - diff --git a/lib/screens/patients/profile/lab_result/laboratory_result_page.dart b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart index 0d8b1749..4a5a768d 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result_page.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart @@ -18,7 +18,13 @@ class LaboratoryResultPage extends StatefulWidget { final PatiantInformtion patient; final String patientType; final String arrivalType; - LaboratoryResultPage({Key key, this.patientLabOrders, this.patient, this.patientType, this.arrivalType}); + + LaboratoryResultPage( + {Key key, + this.patientLabOrders, + this.patient, + this.patientType, + this.arrivalType}); @override _LaboratoryResultPageState createState() => _LaboratoryResultPageState(); @@ -33,15 +39,16 @@ class _LaboratoryResultPageState extends State { clinicID: widget.patientLabOrders.clinicID, projectID: widget.patientLabOrders.projectID, orderNo: widget.patientLabOrders.orderNo, - patient: widget.patient), + patient: widget.patient, + isInpatient: widget.patientType == "1"), builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBar: PatientProfileHeaderWhitAppointmentAppBar( patient: widget.patient, - patientType: widget.patientType??"0", - arrivalType: widget.arrivalType??"0", + patientType: widget.patientType ?? "0", + arrivalType: widget.arrivalType ?? "0", orderNo: widget.patientLabOrders.orderNo, - appointmentDate:widget.patientLabOrders.orderDate, + appointmentDate: widget.patientLabOrders.orderDate, doctorName: widget.patientLabOrders.doctorName, branch: widget.patientLabOrders.projectName, clinic: widget.patientLabOrders.clinicDescription, @@ -53,17 +60,18 @@ class _LaboratoryResultPageState extends State { body: SingleChildScrollView( child: Column( children: [ - ...List.generate(model.patientLabSpecialResult.length, (index) => LaboratoryResultWidget( - onTap: () async { - - }, - billNo: widget.patientLabOrders.invoiceNo, - details: model.patientLabSpecialResult[index].resultDataHTML, - orderNo: widget.patientLabOrders.orderNo, - patientLabOrder: widget.patientLabOrders, - patient: widget.patient, - )), - + ...List.generate( + model.patientLabSpecialResult.length, + (index) => LaboratoryResultWidget( + onTap: () async {}, + billNo: widget.patientLabOrders.invoiceNo, + details: model + .patientLabSpecialResult[index].resultDataHTML, + orderNo: widget.patientLabOrders.orderNo, + patientLabOrder: widget.patientLabOrders, + patient: widget.patient, + isInpatient: widget.patientType == "1", + )), ], ), ), diff --git a/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart b/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart index 388a4859..8ae1e083 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart @@ -20,13 +20,17 @@ class LaboratoryResultWidget extends StatefulWidget { final String orderNo; final PatientLabOrders patientLabOrder; final PatiantInformtion patient; + final bool isInpatient; + const LaboratoryResultWidget( {Key key, this.onTap, this.billNo, this.details, this.orderNo, - this.patientLabOrder, this.patient}) + this.patientLabOrder, + this.patient, + this.isInpatient}) : super(key: key); @override @@ -41,7 +45,10 @@ class _LaboratoryResultWidgetState extends State { Widget build(BuildContext context) { projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getPatientLabResult(patientLabOrder: widget.patientLabOrder,patient: widget.patient), + onModelReady: (model) => model.getPatientLabResult( + patientLabOrder: widget.patientLabOrder, + patient: widget.patient, + isInpatient: widget.isInpatient), builder: (_, model, w) => NetworkBaseView( baseViewModel: model, child: Container( @@ -77,9 +84,15 @@ class _LaboratoryResultWidgetState extends State { )), child: Row( children: [ - Expanded(child: Container( - margin: EdgeInsets.only(left: 10, right: 10), - child: AppText(TranslationBase.of(context).generalResult,bold: true,))), + Expanded( + child: Container( + margin: EdgeInsets.only( + left: 10, right: 10), + child: AppText( + TranslationBase.of(context) + .generalResult, + bold: true, + ))), Container( width: 25, height: 25, @@ -115,14 +128,15 @@ class _LaboratoryResultWidgetState extends State { children: [ ...List.generate( model.labResultLists.length, - (index) => LabResultWidget( + (index) => LabResultWidget( patientLabOrder: widget.patientLabOrder, filterName: model .labResultLists[index].filterName, patientLabResultList: model .labResultLists[index] .patientLabResultList, - patient:widget.patient, + patient: widget.patient, + isInpatient: widget.isInpatient, ), ) ], @@ -135,7 +149,6 @@ class _LaboratoryResultWidgetState extends State { SizedBox( height: 10, ), - ], ), ], diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index 7e812848..ddb0d3de 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -13,14 +13,11 @@ import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-head import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_expandable_notifier_new.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/doctor_card.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; -import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; class LabsHomePage extends StatelessWidget { String patientType; 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..3682a6a0 --- /dev/null +++ b/lib/screens/patients/profile/note/progress_note_screen.dart @@ -0,0 +1,278 @@ +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 { + List 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) => 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(); + } +} 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..c3806b1a --- /dev/null +++ b/lib/screens/patients/profile/note/update_note.dart @@ -0,0 +1,174 @@ +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.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/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.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/soap_update/shared_soap_widgets/bottom_sheet_title.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/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:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; + +class UpdateNoteOrder extends StatefulWidget { + final NoteModel note; + final PatientViewModel patientModel; + final PatiantInformtion patient; + final int visitType; + final bool isUpdate; + + const UpdateNoteOrder( + {Key key, this.note, this.patientModel, this.patient, this.visitType, this.isUpdate}) + : super(key: key); + + @override + _UpdateNoteOrderState createState() => + _UpdateNoteOrderState(); +} + +class _UpdateNoteOrderState extends State { + int selectedType; + + TextEditingController progressNoteController = TextEditingController(); + + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + @override + Widget build(BuildContext context) { + if (widget.note != null) { + progressNoteController.text = widget.note.notes; + } + return BaseView( + builder: (BuildContext context, PatientViewModel 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), + // disabled: progressNoteController.text.isEmpty, + fontWeight: FontWeight.w700, + onPressed: () async { + GifLoaderDialogUtils.showMyDialog(context); + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + + + if (widget.isUpdate) { + UpdateNoteReqModel reqModel = UpdateNoteReqModel( + admissionNo: int.parse(widget.patient.admissionNo), + cancelledNote: false, + lineItemNo: 30, + createdBy: widget.note.createdBy, + notes: progressNoteController.text + + , + verifiedNote: false, + + patientTypeID: widget.patient.patientType, + patientOutSA: false, + ); + await model.updatePatientProgressNote(reqModel); + } else { + CreateNoteModel reqModel = CreateNoteModel( + admissionNo: int.parse(widget.patient.admissionNo), + createdBy: doctorProfile.doctorID, + visitType: widget.visitType, + patientID: widget.patient.patientId, + nursingRemarks: ' ', + patientTypeID: widget.patient.patientType, + patientOutSA: false, + + notes: progressNoteController.text + ); + + await model.createPatientProgressNote(reqModel); + } + + if (model.state == ViewState.ErrorLocal) { + Helpers.showErrorToast("Error"); + } else { + ProgressNoteRequest progressNoteRequest = + ProgressNoteRequest( + visitType: widget.visitType, + // if equal 5 then this will return progress note + admissionNo: int.parse(widget.patient.admissionNo), + projectID: widget.patient.projectId, + patientTypeID: widget.patient.patientType, + languageID: 2); + await widget.patientModel.getPatientProgressNote( + progressNoteRequest.toJson()); + } + + GifLoaderDialogUtils.hideDialog(context); + Navigator.of(context).pop(); + }, + ), + ], + ), + ), + ), + ); + } +} 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/PatientCard.dart b/lib/widgets/patients/PatientCard.dart index d3992b41..47528864 100644 --- a/lib/widgets/patients/PatientCard.dart +++ b/lib/widgets/patients/PatientCard.dart @@ -213,8 +213,8 @@ class PatientCard extends StatelessWidget { ), ), ), - if (SERVICES_PATIANT2[int.parse(patientType)] == - "List_MyOutPatient") + if (SERVICES_PATIANT2[int.parse(patientType)] != + "List_MyInPatient") Container( child: RichText( text: new TextSpan( @@ -298,51 +298,52 @@ class PatientCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - Expanded( - child: AppText( - TranslationBase.of(context) - .appointmentDate + - " : ", - fontSize: 14, - ), + AppText( + TranslationBase.of(context) + .appointmentDate + + " : ", + fontSize: 14, ), + + // Container( + // child: + patientInfo.appointmentDate != null + ? AppText( + DateUtils + .convertDateFromServerFormat( + patientInfo.appointmentDate + .toString(), + 'yyyy-MM-dd'), + fontSize: 12, + fontWeight: FontWeight.bold, + ) + : SizedBox(), + //), patientInfo.startTimes != null - ? Container( - height: 15, - width: 60, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(25), - color: HexColor("#20A169"), - ), - child: AppText( - patientInfo.startTimes, - color: Colors.white, - fontSize: 1.5 * - SizeConfig.textMultiplier, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, - ), + ? + // + // Container( + // // height: 15, + // // width: 60, + // padding: EdgeInsets.all(5), + // decoration: BoxDecoration( + // borderRadius: + // BorderRadius.circular(25), + // color: HexColor("#20A169"), + // ), + // child: + + AppText( + ' ' + patientInfo.startTimes, + fontSize: 11, + fontWeight: FontWeight.bold, ) + //) : SizedBox(), SizedBox( width: 3.5, ), - Container( - child: patientInfo.appointmentDate != null - ? AppText( - DateUtils - .convertDateFromServerFormat( - patientInfo - .appointmentDate - .toString(), - 'yyyy-MM-dd'), - fontSize: 1.5 * - SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ) - : SizedBox(), - ), + //, SizedBox( height: 0.5, ) diff --git a/lib/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart b/lib/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart index 0425794b..fe118973 100644 --- a/lib/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart +++ b/lib/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:intl/intl.dart'; +import 'package:url_launcher/url_launcher.dart'; class PatientProfileHeaderNewDesignInPatient extends StatelessWidget { final PatiantInformtion patient; @@ -77,7 +78,7 @@ class PatientProfileHeaderNewDesignInPatient extends StatelessWidget { margin: EdgeInsets.symmetric(horizontal: 4), child: InkWell( onTap: () { - // should call patient or show mobile number : patient.mobileNumber + launch("tel://" + patient.mobileNumber); }, child: Icon( Icons.phone, 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_in_patient.dart b/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart index e685a9ba..c1f746aa 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart @@ -82,20 +82,20 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { nameLine2: TranslationBase.of(context).prescription, icon: 'patient/order_prescription.png'), PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: PROGRESS_NOTE, - nameLine1: TranslationBase.of(context).progress, - nameLine2: TranslationBase.of(context).note, - icon: 'patient/Progress_notes.png'), + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: PROGRESS_NOTE, + nameLine1: TranslationBase.of(context).progress, + nameLine2: TranslationBase.of(context).note, + icon: 'patient/Progress_notes.png'), PatientProfileButton( key: key, patient: patient, patientType: patientType, arrivalType: arrivalType, - route: null, + route: ORDER_NOTE, nameLine1: "Text", nameLine2: TranslationBase.of(context).orders, icon: 'patient/Progress_notes.png'), @@ -124,7 +124,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { patient: patient, patientType: patientType, arrivalType: arrivalType, - route: null, + route: MEDICAL_FILE, nameLine1: "Health", //TranslationBase.of(context).medicalReport, nameLine2: "Summery", @@ -135,7 +135,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { patient: patient, patientType: patientType, arrivalType: arrivalType, - route: null, + route: REFER_PATIENT_TO_DOCTOR, nameLine1: TranslationBase.of(context).referral, nameLine2: TranslationBase.of(context).patient, icon: 'patient/refer_patient.png'), @@ -149,14 +149,15 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { nameLine2: TranslationBase.of(context).approvals, icon: 'patient/vital_signs.png'), PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: null, - nameLine1: "Discharge", - nameLine2: "Summery", - icon: 'patient/patient_sick_leave.png'), + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + isDisable: true, + route: null, + nameLine1: "Discharge", + nameLine2: "Summery", + icon: 'patient/patient_sick_leave.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, diff --git a/lib/widgets/shared/buttons/app_buttons_widget.dart b/lib/widgets/shared/buttons/app_buttons_widget.dart index 36f9d983..521d1025 100644 --- a/lib/widgets/shared/buttons/app_buttons_widget.dart +++ b/lib/widgets/shared/buttons/app_buttons_widget.dart @@ -49,7 +49,7 @@ class _AppButtonState extends State { @override Widget build(BuildContext context) { return IgnorePointer( - ignoring: widget.loading, + ignoring: widget.loading ||widget.disabled, child: RawMaterialButton( fillColor: widget.color != null ? widget.color : HexColor("#B8382C"), splashColor: widget.color,