From c82a4a05d548df090eb91bee7a4edb941bb8e4e8 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Mon, 31 May 2021 10:36:44 +0300 Subject: [PATCH 01/14] medical report design changes --- .../MedicalReport/MeidcalReportModel.dart | 20 +++++ .../medical_report/MedicalReportPage.dart | 76 ++++++++++++------- lib/widgets/patients/PatientCard.dart | 29 +++++++ 3 files changed, 96 insertions(+), 29 deletions(-) diff --git a/lib/models/patient/MedicalReport/MeidcalReportModel.dart b/lib/models/patient/MedicalReport/MeidcalReportModel.dart index 473140d1..1acbc1b4 100644 --- a/lib/models/patient/MedicalReport/MeidcalReportModel.dart +++ b/lib/models/patient/MedicalReport/MeidcalReportModel.dart @@ -2,6 +2,8 @@ class MedicalReportModel { String reportData; String setupID; int projectID; + String projectName; + String projectNameN; int patientID; String invoiceNo; int status; @@ -19,12 +21,17 @@ class MedicalReportModel { String doctorImageURL; String doctorName; String doctorNameN; + int clinicID; + String clinicName; + String clinicNameN; String reportDataHtml; MedicalReportModel( {this.reportData, this.setupID, this.projectID, + this.projectName, + this.projectNameN, this.patientID, this.invoiceNo, this.status, @@ -42,12 +49,17 @@ class MedicalReportModel { this.doctorImageURL, this.doctorName, this.doctorNameN, + this.clinicID, + this.clinicName, + this.clinicNameN, this.reportDataHtml}); MedicalReportModel.fromJson(Map json) { reportData = json['ReportData']; setupID = json['SetupID']; projectID = json['ProjectID']; + projectName = json['ProjectName']; + projectNameN = json['ProjectNameN']; patientID = json['PatientID']; invoiceNo = json['InvoiceNo']; status = json['Status']; @@ -65,6 +77,9 @@ class MedicalReportModel { doctorImageURL = json['DoctorImageURL']; doctorName = json['DoctorName']; doctorNameN = json['DoctorNameN']; + clinicID = json['ClinicID']; + clinicName = json['ClinicName']; + clinicNameN = json['ClinicNameN']; reportDataHtml = json['ReportDataHtml']; } @@ -73,6 +88,8 @@ class MedicalReportModel { data['ReportData'] = this.reportData; data['SetupID'] = this.setupID; data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['ProjectNameN'] = this.projectNameN; data['PatientID'] = this.patientID; data['InvoiceNo'] = this.invoiceNo; data['Status'] = this.status; @@ -90,6 +107,9 @@ class MedicalReportModel { data['DoctorImageURL'] = this.doctorImageURL; data['DoctorName'] = this.doctorName; data['DoctorNameN'] = this.doctorNameN; + data['ClinicID'] = this.clinicID; + data['ClinicName'] = this.clinicName; + data['ClinicNameN'] = this.clinicNameN; data['ReportDataHtml'] = this.reportDataHtml; return data; } diff --git a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart index 746068ad..e2da651b 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart @@ -89,17 +89,15 @@ class MedicalReportPage extends StatelessWidget { ...List.generate( model.medicalReportList.length, (index) => InkWell( - onTap: (){ - if (model.medicalReportList[index].status == - 1) { + onTap: () { + if (model.medicalReportList[index].status == 1) { Navigator.of(context).pushNamed( PATIENT_MEDICAL_REPORT_DETAIL, arguments: { 'patient': patient, 'patientType': patientType, 'arrivalType': arrivalType, - 'medicalReport': - model.medicalReportList[index] + 'medicalReport': model.medicalReportList[index] }); } else { Navigator.of(context).pushNamed( @@ -109,8 +107,7 @@ class MedicalReportPage extends StatelessWidget { 'patientType': patientType, 'arrivalType': arrivalType, 'type': MedicalReportStatus.ADD, - 'medicalReport': - model.medicalReportList[index] + 'medicalReport': model.medicalReportList[index] }); } }, @@ -132,12 +129,13 @@ class MedicalReportPage extends StatelessWidget { AppText( model.medicalReportList[index].status == 1 ? TranslationBase.of(context).onHold - : TranslationBase.of(context).verified, - color: - model.medicalReportList[index].status == - 1 - ? Colors.red[700] - : Colors.green[700], + : TranslationBase.of(context) + .verified, + color: model.medicalReportList[index] + .status == + 1 + ? Colors.red[700] + : Colors.green[700], fontSize: 1.4 * SizeConfig.textMultiplier, bold: true, ), @@ -173,37 +171,55 @@ class MedicalReportPage extends StatelessWidget { ], ), Row( - crossAxisAlignment: CrossAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( margin: EdgeInsets.only( left: 0, top: 4, right: 8, bottom: 0), child: LargeAvatar( name: projectViewModel.isArabic - ? model - .medicalReportList[index].doctorNameN - : model - .medicalReportList[index].doctorName, - url: model - .medicalReportList[index].doctorImageURL, + ? model.medicalReportList[index] + .doctorNameN + : model.medicalReportList[index] + .doctorName, + url: model.medicalReportList[index] + .doctorImageURL, ), width: 50, height: 50, ), Expanded( child: Container( - height: 50, - child: AppText( - TranslationBase.of(context).showDetail, - fontSize: 1.4 * SizeConfig.textMultiplier, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + projectViewModel.isArabic + ? model.medicalReportList[index] + .projectNameN + : model.medicalReportList[index] + .projectName, + fontSize: + 1.6 * SizeConfig.textMultiplier, + color: Color(0xFF2E303A), + ), + AppText( + projectViewModel.isArabic + ? model.medicalReportList[index] + .clinicNameN + : model.medicalReportList[index] + .clinicName, + fontSize: + 1.6 * SizeConfig.textMultiplier, + color: Color(0xFF2E303A), + ), + ], ), ), - // child: Html( - // data: model.medicalReportList[index] - // .reportDataHtml ?? - // ""), ), Container( + height: 50, child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -224,7 +240,9 @@ class MedicalReportPage extends StatelessWidget { ), ), ), - SizedBox(height: 15,) + SizedBox( + height: 15, + ) ], ), ), diff --git a/lib/widgets/patients/PatientCard.dart b/lib/widgets/patients/PatientCard.dart index 45445bbf..2174e6d5 100644 --- a/lib/widgets/patients/PatientCard.dart +++ b/lib/widgets/patients/PatientCard.dart @@ -440,6 +440,35 @@ class PatientCard extends StatelessWidget { fontWeight: FontWeight.w700, fontSize: 13)), ]))), + if (isFromLiveCare) + Column( + children: [ + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: + TranslationBase.of(context).clinic + + " : ", + style: TextStyle(fontSize: 12)), + new TextSpan( + text: + patientInfo.clinicName, + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 13)), + ], + ), + ), + ), + ], + ), ])) ]), isFromLiveCare From dc6cbdd1889b4114389c4aede5c6b017b2c8db68 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Mon, 31 May 2021 16:44:05 +0300 Subject: [PATCH 02/14] Add ChangeCallStatus services --- .../Service/SessionStatusAPI.java | 15 -- .../ui/VideoCallContract.java | 18 --- .../main/kotlin/com/hmg/hmgDr/MainActivity.kt | 6 +- .../Model/ChangeCallStatusRequestModel.java | 137 ++++++++++++++++++ .../hmgDr}/Model/GetSessionStatusModel.java | 2 +- .../hmg/hmgDr}/Model/SessionStatusModel.java | 2 +- .../com/hmg/hmgDr}/Service/AppRetrofit.java | 2 +- .../hmg/hmgDr/Service/SessionStatusAPI.java | 19 +++ .../com/hmg/hmgDr}/ui/VideoCallActivity.java | 14 +- .../com/hmg/hmgDr/ui/VideoCallContract.java | 24 +++ .../hmg/hmgDr}/ui/VideoCallPresenterImpl.java | 32 +++- 11 files changed, 224 insertions(+), 47 deletions(-) delete mode 100644 android/app/src/main/java/com/example/doctor_app_flutter/Service/SessionStatusAPI.java delete mode 100644 android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallContract.java create mode 100644 android/app/src/main/kotlin/com/hmg/hmgDr/Model/ChangeCallStatusRequestModel.java rename android/app/src/main/{java/com/example/doctor_app_flutter => kotlin/com/hmg/hmgDr}/Model/GetSessionStatusModel.java (98%) rename android/app/src/main/{java/com/example/doctor_app_flutter => kotlin/com/hmg/hmgDr}/Model/SessionStatusModel.java (98%) rename android/app/src/main/{java/com/example/doctor_app_flutter => kotlin/com/hmg/hmgDr}/Service/AppRetrofit.java (97%) create mode 100644 android/app/src/main/kotlin/com/hmg/hmgDr/Service/SessionStatusAPI.java rename android/app/src/main/{java/com/example/doctor_app_flutter => kotlin/com/hmg/hmgDr}/ui/VideoCallActivity.java (95%) create mode 100644 android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallContract.java rename android/app/src/main/{java/com/example/doctor_app_flutter => kotlin/com/hmg/hmgDr}/ui/VideoCallPresenterImpl.java (56%) diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/Service/SessionStatusAPI.java b/android/app/src/main/java/com/example/doctor_app_flutter/Service/SessionStatusAPI.java deleted file mode 100644 index fbc8d1d3..00000000 --- a/android/app/src/main/java/com/example/doctor_app_flutter/Service/SessionStatusAPI.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.example.doctor_app_flutter.Service; - -import com.example.doctor_app_flutter.Model.GetSessionStatusModel; -import com.example.doctor_app_flutter.Model.SessionStatusModel; - - -import retrofit2.Call; -import retrofit2.http.Body; -import retrofit2.http.POST; - -public interface SessionStatusAPI { - - @POST("LiveCareApi/DoctorApp/GetSessionStatus") - Call getSessionStatusModelData(@Body GetSessionStatusModel getSessionStatusModel); -} diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallContract.java b/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallContract.java deleted file mode 100644 index 21122239..00000000 --- a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallContract.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.example.doctor_app_flutter.ui; - -import com.example.doctor_app_flutter.Model.GetSessionStatusModel; -import com.example.doctor_app_flutter.Model.SessionStatusModel; - -public interface VideoCallContract { - - interface VideoCallView{ - - void onCallSuccessful(SessionStatusModel sessionStatusModel); - void onFailure(); - } - - interface VideoCallPresenter { - - void callClintConnected(GetSessionStatusModel statusModel); - } -} diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt b/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt index aed21dd3..612118c9 100644 --- a/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt @@ -3,9 +3,9 @@ package com.hmg.hmgDr import android.app.Activity import android.content.Intent import androidx.annotation.NonNull -import com.example.doctor_app_flutter.Model.GetSessionStatusModel -import com.example.doctor_app_flutter.Model.SessionStatusModel -import com.example.doctor_app_flutter.ui.VideoCallActivity +import com.hmg.hmgDr.Model.GetSessionStatusModel +import com.hmg.hmgDr.Model.SessionStatusModel +import com.hmg.hmgDr.ui.VideoCallActivity import com.google.gson.GsonBuilder import io.flutter.embedding.android.FlutterFragmentActivity import io.flutter.embedding.engine.FlutterEngine diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/Model/ChangeCallStatusRequestModel.java b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/ChangeCallStatusRequestModel.java new file mode 100644 index 00000000..5fcdb611 --- /dev/null +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/ChangeCallStatusRequestModel.java @@ -0,0 +1,137 @@ +package com.hmg.hmgDr.Model; + + +import android.os.Parcel; +import android.os.Parcelable; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + + +public class ChangeCallStatusRequestModel implements Parcelable { + + @SerializedName("CallStatus") + @Expose + private Integer callStatus; + @SerializedName("DoctorId") + @Expose + private Integer doctorId; + @SerializedName("generalid") + @Expose + private String generalid; + @SerializedName("TokenID") + @Expose + private String tokenID; + @SerializedName("VC_ID") + @Expose + private Integer vcId; + + public ChangeCallStatusRequestModel(Integer callStatus, Integer doctorId, String generalid, String tokenID, Integer vcId) { + this.callStatus = callStatus; + this.doctorId = doctorId; + this.generalid = generalid; + this.tokenID = tokenID; + this.vcId = vcId; + } + + protected ChangeCallStatusRequestModel(Parcel in) { + if (in.readByte() == 0) { + callStatus = null; + } else { + callStatus = in.readInt(); + } + if (in.readByte() == 0) { + doctorId = null; + } else { + doctorId = in.readInt(); + } + generalid = in.readString(); + tokenID = in.readString(); + if (in.readByte() == 0) { + vcId = null; + } else { + vcId = in.readInt(); + } + } + + public static final Creator CREATOR = new Creator() { + @Override + public ChangeCallStatusRequestModel createFromParcel(Parcel in) { + return new ChangeCallStatusRequestModel(in); + } + + @Override + public ChangeCallStatusRequestModel[] newArray(int size) { + return new ChangeCallStatusRequestModel[size]; + } + }; + + public Integer getCallStatus() { + return callStatus; + } + + public void setCallStatus(Integer callStatus) { + this.callStatus = callStatus; + } + + public Integer getDoctorId() { + return doctorId; + } + + public void setDoctorId(Integer doctorId) { + this.doctorId = doctorId; + } + + public String getGeneralid() { + return generalid; + } + + public void setGeneralid(String generalid) { + this.generalid = generalid; + } + + public String getTokenID() { + return tokenID; + } + + public void setTokenID(String tokenID) { + this.tokenID = tokenID; + } + + public Integer getVcId() { + return vcId; + } + + public void setVcId(Integer vcId) { + this.vcId = vcId; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + if (callStatus == null) { + dest.writeByte((byte) 0); + } else { + dest.writeByte((byte) 1); + dest.writeInt(callStatus); + } + if (doctorId == null) { + dest.writeByte((byte) 0); + } else { + dest.writeByte((byte) 1); + dest.writeInt(doctorId); + } + dest.writeString(generalid); + dest.writeString(tokenID); + if (vcId == null) { + dest.writeByte((byte) 0); + } else { + dest.writeByte((byte) 1); + dest.writeInt(vcId); + } + } +} diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/Model/GetSessionStatusModel.java b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/GetSessionStatusModel.java similarity index 98% rename from android/app/src/main/java/com/example/doctor_app_flutter/Model/GetSessionStatusModel.java rename to android/app/src/main/kotlin/com/hmg/hmgDr/Model/GetSessionStatusModel.java index 8f83b7b9..d41aa146 100644 --- a/android/app/src/main/java/com/example/doctor_app_flutter/Model/GetSessionStatusModel.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/GetSessionStatusModel.java @@ -1,4 +1,4 @@ -package com.example.doctor_app_flutter.Model; +package com.hmg.hmgDr.Model; import android.os.Parcel; import android.os.Parcelable; diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/Model/SessionStatusModel.java b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/SessionStatusModel.java similarity index 98% rename from android/app/src/main/java/com/example/doctor_app_flutter/Model/SessionStatusModel.java rename to android/app/src/main/kotlin/com/hmg/hmgDr/Model/SessionStatusModel.java index da6bba1d..51b0b1ee 100644 --- a/android/app/src/main/java/com/example/doctor_app_flutter/Model/SessionStatusModel.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/SessionStatusModel.java @@ -1,4 +1,4 @@ -package com.example.doctor_app_flutter.Model; +package com.hmg.hmgDr.Model; import android.os.Parcel; import android.os.Parcelable; diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/Service/AppRetrofit.java b/android/app/src/main/kotlin/com/hmg/hmgDr/Service/AppRetrofit.java similarity index 97% rename from android/app/src/main/java/com/example/doctor_app_flutter/Service/AppRetrofit.java rename to android/app/src/main/kotlin/com/hmg/hmgDr/Service/AppRetrofit.java index 6646bd6f..9ca9abc1 100644 --- a/android/app/src/main/java/com/example/doctor_app_flutter/Service/AppRetrofit.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/Service/AppRetrofit.java @@ -1,4 +1,4 @@ -package com.example.doctor_app_flutter.Service; +package com.hmg.hmgDr.Service; import android.app.Activity; import android.app.Application; diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/Service/SessionStatusAPI.java b/android/app/src/main/kotlin/com/hmg/hmgDr/Service/SessionStatusAPI.java new file mode 100644 index 00000000..e507650e --- /dev/null +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/Service/SessionStatusAPI.java @@ -0,0 +1,19 @@ +package com.hmg.hmgDr.Service; + +import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel; +import com.hmg.hmgDr.Model.GetSessionStatusModel; +import com.hmg.hmgDr.Model.SessionStatusModel; + + +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.POST; + +public interface SessionStatusAPI { + + @POST("LiveCareApi/DoctorApp/GetSessionStatus") + Call getSessionStatusModelData(@Body GetSessionStatusModel getSessionStatusModel); + + @POST("LiveCareApi/DoctorApp/ChangeCallStatus") + Call changeCallStatus(@Body ChangeCallStatusRequestModel changeCallStatusRequestModel); +} diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallActivity.java b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallActivity.java similarity index 95% rename from android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallActivity.java rename to android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallActivity.java index 0b6adadb..e196e7f1 100644 --- a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallActivity.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallActivity.java @@ -1,4 +1,4 @@ -package com.example.doctor_app_flutter.ui; +package com.hmg.hmgDr.ui; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; @@ -20,8 +20,9 @@ import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; -import com.example.doctor_app_flutter.Model.GetSessionStatusModel; -import com.example.doctor_app_flutter.Model.SessionStatusModel; +import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel; +import com.hmg.hmgDr.Model.GetSessionStatusModel; +import com.hmg.hmgDr.Model.SessionStatusModel; import com.hmg.hmgDr.R; import com.opentok.android.Session; import com.opentok.android.Stream; @@ -277,6 +278,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi } isConnected = true; subscribeToStream(stream); + videoCallPresenter.callChangeCallStatus(new ChangeCallStatusRequestModel(3,sessionStatusModel.getDoctorId(), sessionStatusModel.getGeneralid(),token,sessionStatusModel.getVCID())); } @Override @@ -369,6 +371,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi if (countDownTimer != null) { countDownTimer.cancel(); } + videoCallPresenter.callChangeCallStatus(new ChangeCallStatusRequestModel(16,sessionStatusModel.getDoctorId(), sessionStatusModel.getGeneralid(),token,sessionStatusModel.getVCID())); finish(); } @@ -423,6 +426,11 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi } } + @Override + public void onCallChangeCallStatusSuccessful(SessionStatusModel sessionStatusModel) { + + } + @Override public void onFailure() { diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallContract.java b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallContract.java new file mode 100644 index 00000000..2b099551 --- /dev/null +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallContract.java @@ -0,0 +1,24 @@ +package com.hmg.hmgDr.ui; + +import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel; +import com.hmg.hmgDr.Model.GetSessionStatusModel; +import com.hmg.hmgDr.Model.SessionStatusModel; + +public interface VideoCallContract { + + interface VideoCallView { + + void onCallSuccessful(SessionStatusModel sessionStatusModel); + + void onCallChangeCallStatusSuccessful(SessionStatusModel sessionStatusModel); + + void onFailure(); + } + + interface VideoCallPresenter { + + void callClintConnected(GetSessionStatusModel statusModel); + + void callChangeCallStatus(ChangeCallStatusRequestModel statusModel); + } +} diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallPresenterImpl.java b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallPresenterImpl.java similarity index 56% rename from android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallPresenterImpl.java rename to android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallPresenterImpl.java index 363d1ca8..ea2128ba 100644 --- a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallPresenterImpl.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallPresenterImpl.java @@ -1,9 +1,10 @@ -package com.example.doctor_app_flutter.ui; +package com.hmg.hmgDr.ui; -import com.example.doctor_app_flutter.Model.GetSessionStatusModel; -import com.example.doctor_app_flutter.Model.SessionStatusModel; -import com.example.doctor_app_flutter.Service.AppRetrofit; -import com.example.doctor_app_flutter.Service.SessionStatusAPI; +import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel; +import com.hmg.hmgDr.Model.GetSessionStatusModel; +import com.hmg.hmgDr.Model.SessionStatusModel; +import com.hmg.hmgDr.Service.AppRetrofit; +import com.hmg.hmgDr.Service.SessionStatusAPI; import org.jetbrains.annotations.NotNull; @@ -46,4 +47,25 @@ public class VideoCallPresenterImpl implements VideoCallContract.VideoCallPresen }); } + + @Override + public void callChangeCallStatus(ChangeCallStatusRequestModel statusModel) { + sessionStatusAPI = AppRetrofit.getRetrofit(baseUrl).create(SessionStatusAPI.class); + + Call call = sessionStatusAPI.changeCallStatus(statusModel); + + call.enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) { + if (!response.isSuccessful()) + view.onFailure(); + + } + + @Override + public void onFailure(@NotNull Call call, @NotNull Throwable t) { + view.onFailure(); + } + }); + } } From 9454e9d8affc47a8ed54c0b5dcd712337d8e5dbd Mon Sep 17 00:00:00 2001 From: mosazaid Date: Mon, 31 May 2021 16:59:28 +0300 Subject: [PATCH 03/14] working on procedure refactoring --- lib/config/localized_values.dart | 8 + .../procedure/procedure_service.dart | 2 +- .../radiology/radiology_service.dart | 3 + .../profile/lab_result/labs_home_page.dart | 14 +- .../radiology/radiology_home_page.dart | 38 +-- lib/screens/procedures/ProcedureType.dart | 5 + .../procedures/add-favourite-procedure.dart | 4 - .../procedures/add-procedure-form.dart | 142 ++++++------ .../procedures/add_lab_home_screen.dart | 218 ----------------- .../procedures/add_radiology_screen.dart | 219 ------------------ ....dart => base_add_procedure_tab_page.dart} | 110 +++++++-- lib/screens/procedures/procedure_screen.dart | 13 +- lib/util/translations_delegate_base.dart | 6 + 13 files changed, 215 insertions(+), 567 deletions(-) create mode 100644 lib/screens/procedures/ProcedureType.dart delete mode 100644 lib/screens/procedures/add_lab_home_screen.dart delete mode 100644 lib/screens/procedures/add_radiology_screen.dart rename lib/screens/procedures/{add_procedure_homeScreen.dart => base_add_procedure_tab_page.dart} (60%) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 231e7f9b..4d3c0e78 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -651,6 +651,10 @@ const Map> localizedValues = { 'en': "add Selected Procedures", 'ar': "اضافة العمليات المختارة " }, + 'addProcedures': { + 'en': "Add Procedure", + 'ar': "اضافة العمليات" + }, 'updateProcedure': {'en': "Update Procedure", 'ar': "تحديث العملية"}, 'orderProcedure': {'en': "order procedure", 'ar': "طلب العمليات"}, 'nameOrICD': {'en': "Name or ICD", 'ar': "الاسم او  ICD"}, @@ -998,4 +1002,8 @@ const Map> localizedValues = { "onHold": {"en": "On Hold", "ar": "قيد الانتظار"}, "verified": {"en": "Verified", "ar": "تم التحقق"}, "endCall": {"en": "End Call", "ar": "انهاء"}, + "favoriteTemplates": {"en": "Favorite Templates", "ar": "القوالب المفضلة"}, + "allProcedures": {"en": "All Procedures", "ar": "كل الإجراءات"}, + "allRadiology": {"en": "All Radiology", "ar": "كل الأشعة"}, + "allLab": {"en": "All Lab", "ar": "كل المختبرات"}, }; diff --git a/lib/core/service/patient_medical_file/procedure/procedure_service.dart b/lib/core/service/patient_medical_file/procedure/procedure_service.dart index 0c284f3d..526b2b3e 100644 --- a/lib/core/service/patient_medical_file/procedure/procedure_service.dart +++ b/lib/core/service/patient_medical_file/procedure/procedure_service.dart @@ -66,7 +66,7 @@ class ProcedureService extends BaseService { Future getProcedureTemplate( {int doctorId, int projectId, int clinicId, String categoryID}) async { _procedureTempleteRequestModel = ProcedureTempleteRequestModel( - tokenID: "@dm!n", + // tokenID: "@dm!n", patientID: 0, searchType: 1, ); diff --git a/lib/core/service/patient_medical_file/radiology/radiology_service.dart b/lib/core/service/patient_medical_file/radiology/radiology_service.dart index 7cf17753..df646ca9 100644 --- a/lib/core/service/patient_medical_file/radiology/radiology_service.dart +++ b/lib/core/service/patient_medical_file/radiology/radiology_service.dart @@ -46,6 +46,9 @@ class RadiologyService extends BaseService { if (isInPatient) { label = "List_GetRadOreders"; } + if(response[label] == null || response[label].length == 0){ + label = "FinalRadiologyList"; + } response[label].forEach((radiology) { finalRadiologyList.add(FinalRadiology.fromJson(radiology)); }); 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 578e9f17..db3e6c21 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -3,8 +3,8 @@ import 'package:doctor_app_flutter/core/viewModel/project_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/lab_result/laboratory_result_page.dart'; -import 'package:doctor_app_flutter/screens/procedures/add_lab_home_screen.dart'; -import 'package:doctor_app_flutter/screens/procedures/add_lab_orders.dart'; +import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; +import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.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'; @@ -112,10 +112,12 @@ class _LabsHomePageState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => AddLabHomeScreen( - patient: patient, - model: model, - )), + builder: (context) => BaseAddProcedureTabPage( + patient: patient, + model: model, + procedureType: ProcedureType.LAB_RESULT, + ), + ), ); }, label: TranslationBase.of(context).applyForNewLabOrder, diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index 4e969793..9f93df35 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -3,8 +3,8 @@ import 'package:doctor_app_flutter/core/viewModel/project_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/radiology/radiology_details_page.dart'; -import 'package:doctor_app_flutter/screens/procedures/add_radiology_order.dart'; -import 'package:doctor_app_flutter/screens/procedures/add_radiology_screen.dart'; +import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; +import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.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'; @@ -100,9 +100,7 @@ class _RadiologyHomePageState extends State { fontSize: 13, ), AppText( - TranslationBase - .of(context) - .result, + TranslationBase.of(context).result, bold: true, fontSize: 22, ), @@ -110,18 +108,19 @@ class _RadiologyHomePageState extends State { ), ), if ((patient.patientStatusType != null && - patient.patientStatusType == 43) || + patient.patientStatusType == 43) || (isFromLiveCare && patient.appointmentNo != null)) AddNewOrder( onTap: () { Navigator.push( context, MaterialPageRoute( - builder: (context) => - AddRadiologyScreen( - patient: patient, - model: model, - )), + builder: (context) => BaseAddProcedureTabPage( + patient: patient, + model: model, + procedureType: ProcedureType.RADIOLOGY, + ), + ), ); }, label: TranslationBase.of(context).applyForRadiologyOrder, @@ -153,11 +152,18 @@ class _RadiologyHomePageState extends State { ? Colors.black : Color(0xffa9a089), borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic? Radius.circular(0):Radius.circular(8), - bottomLeft: projectViewModel.isArabic? Radius.circular(0):Radius.circular(8), - topRight: projectViewModel.isArabic? Radius.circular(8):Radius.circular(0), - bottomRight: projectViewModel.isArabic? Radius.circular(8):Radius.circular(0) - ), + topLeft: projectViewModel.isArabic + ? Radius.circular(0) + : Radius.circular(8), + bottomLeft: projectViewModel.isArabic + ? Radius.circular(0) + : Radius.circular(8), + topRight: projectViewModel.isArabic + ? Radius.circular(8) + : Radius.circular(0), + bottomRight: projectViewModel.isArabic + ? Radius.circular(8) + : Radius.circular(0)), ), child: RotatedBox( quarterTurns: 3, diff --git a/lib/screens/procedures/ProcedureType.dart b/lib/screens/procedures/ProcedureType.dart new file mode 100644 index 00000000..e05fb7e1 --- /dev/null +++ b/lib/screens/procedures/ProcedureType.dart @@ -0,0 +1,5 @@ +enum ProcedureType { + PROCEDURE, + LAB_RESULT, + RADIOLOGY, +} \ No newline at end of file diff --git a/lib/screens/procedures/add-favourite-procedure.dart b/lib/screens/procedures/add-favourite-procedure.dart index 9b5a97ad..a68336c7 100644 --- a/lib/screens/procedures/add-favourite-procedure.dart +++ b/lib/screens/procedures/add-favourite-procedure.dart @@ -1,12 +1,8 @@ import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; -import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_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/procedures/add_procedure_homeScreen.dart'; -import 'package:doctor_app_flutter/screens/procedures/entity_list_checkbox_search_widget.dart'; import 'package:doctor_app_flutter/screens/procedures/entity_list_fav_procedure.dart'; import 'package:doctor_app_flutter/screens/procedures/procedure_checkout_screen.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; diff --git a/lib/screens/procedures/add-procedure-form.dart b/lib/screens/procedures/add-procedure-form.dart index 354ada19..ba2ec3de 100644 --- a/lib/screens/procedures/add-procedure-form.dart +++ b/lib/screens/procedures/add-procedure-form.dart @@ -17,81 +17,9 @@ 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'; +import 'ProcedureType.dart'; import 'entity_list_checkbox_search_widget.dart'; -valdateProcedure(ProcedureViewModel model, PatiantInformtion patient, - List entityList) async { - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); - - procedureValadteRequestModel.patientMRN = patient.appointmentNo; - procedureValadteRequestModel.episodeID = patient.episodeNo; - procedureValadteRequestModel.appointmentNo = patient.appointmentNo; -} - -postProcedure( - {ProcedureViewModel model, - String remarks, - String orderType, - PatiantInformtion patient, - List entityList}) async { - PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); - procedureValadteRequestModel.patientMRN = patient.patientMRN; - procedureValadteRequestModel.episodeID = patient.episodeNo; - procedureValadteRequestModel.appointmentNo = patient.appointmentNo; - - List controlsProcedure = List(); - - postProcedureReqModel.appointmentNo = patient.appointmentNo; - - postProcedureReqModel.episodeID = patient.episodeNo; - postProcedureReqModel.patientMRN = patient.patientMRN; - - entityList.forEach((element) { - procedureValadteRequestModel.procedure = [element.procedureId]; - List controls = List(); - controls.add( - Controls( - code: "remarks", - controlValue: element.remarks != null ? element.remarks : ""), - ); - controls.add( - Controls(code: "ordertype", controlValue: element.type ?? "1"), - ); - controlsProcedure.add(Procedures( - category: element.categoryID, - procedure: element.procedureId, - controls: controls)); - }); - - postProcedureReqModel.procedures = controlsProcedure; - await model.valadteProcedure(procedureValadteRequestModel); - if (model.state == ViewState.Idle) { - if (model.valadteProcedureList[0].entityList.length == 0) { - await model.postProcedure(postProcedureReqModel, patient.patientMRN); - - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - model.getProcedure(mrn: patient.patientMRN); - } else if (model.state == ViewState.Idle) { - DrAppToastMsg.showSuccesToast('procedure has been added'); - } - } else { - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - model.getProcedure(mrn: patient.patientMRN); - } else if (model.state == ViewState.Idle) { - Helpers.showErrorToast( - model.valadteProcedureList[0].entityList[0].warringMessages); - } - } - } else { - Helpers.showErrorToast(model.error); - } -} - void addSelectedProcedure( context, ProcedureViewModel model, PatiantInformtion patient) { showModalBottomSheet( @@ -108,8 +36,9 @@ void addSelectedProcedure( class AddSelectedProcedure extends StatefulWidget { final ProcedureViewModel model; final PatiantInformtion patient; + final ProcedureType procedureType; - const AddSelectedProcedure({Key key, this.model, this.patient}) + const AddSelectedProcedure({Key key, this.model, this.patient, this.procedureType}) : super(key: key); @override @@ -352,4 +281,69 @@ class _AddSelectedProcedureState extends State { ), ); } + + postProcedure( + {ProcedureViewModel model, + String remarks, + String orderType, + PatiantInformtion patient, + List entityList, + ProcedureType procedureType}) async { + PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); + ProcedureValadteRequestModel procedureValadteRequestModel = + new ProcedureValadteRequestModel(); + procedureValadteRequestModel.patientMRN = patient.patientMRN; + procedureValadteRequestModel.episodeID = patient.episodeNo; + procedureValadteRequestModel.appointmentNo = patient.appointmentNo; + + List controlsProcedure = List(); + + postProcedureReqModel.appointmentNo = patient.appointmentNo; + postProcedureReqModel.episodeID = patient.episodeNo; + postProcedureReqModel.patientMRN = patient.patientMRN; + + entityList.forEach((element) { + procedureValadteRequestModel.procedure = [element.procedureId]; + List controls = List(); + controls.add( + Controls( + code: "remarks", + controlValue: element.remarks != null ? element.remarks : ""), + ); + controls.add( + Controls(code: "ordertype", controlValue: procedureType == + ProcedureType.PROCEDURE ? element.type ?? "1" : "0"), + ); + controlsProcedure.add(Procedures( + category: element.categoryID, + procedure: element.procedureId, + controls: controls)); + }); + + postProcedureReqModel.procedures = controlsProcedure; + await model.valadteProcedure(procedureValadteRequestModel); + if (model.state == ViewState.Idle) { + if (model.valadteProcedureList[0].entityList.length == 0) { + await model.postProcedure(postProcedureReqModel, patient.patientMRN); + + if (model.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(model.error); + model.getProcedure(mrn: patient.patientMRN); + } else if (model.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast('procedure has been added'); + } + } else { + if (model.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(model.error); + model.getProcedure(mrn: patient.patientMRN); + } else if (model.state == ViewState.Idle) { + Helpers.showErrorToast( + model.valadteProcedureList[0].entityList[0].warringMessages); + } + } + } else { + Helpers.showErrorToast(model.error); + } + } + } diff --git a/lib/screens/procedures/add_lab_home_screen.dart b/lib/screens/procedures/add_lab_home_screen.dart deleted file mode 100644 index d86c4ecd..00000000 --- a/lib/screens/procedures/add_lab_home_screen.dart +++ /dev/null @@ -1,218 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.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/procedures/add-favourite-procedure.dart'; -import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.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/network_base_view.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import 'add_lab_orders.dart'; - -class AddLabHomeScreen extends StatefulWidget { - final ProcedureViewModel model; - final PatiantInformtion patient; - const AddLabHomeScreen({Key key, this.model, this.patient}) : super(key: key); - @override - _AddLabHomeScreenState createState() => - _AddLabHomeScreenState(patient: patient, model: model); -} - -class _AddLabHomeScreenState extends State - with SingleTickerProviderStateMixin { - _AddLabHomeScreenState({this.patient, this.model}); - ProcedureViewModel model; - PatiantInformtion patient; - TabController _tabController; - int _activeTab = 0; - - @override - void initState() { - super.initState(); - _tabController = TabController(length: 2, vsync: this); - _tabController.addListener(_handleTabSelection); - } - - @override - void dispose() { - super.dispose(); - _tabController.dispose(); - } - - _handleTabSelection() { - setState(() { - _activeTab = _tabController.index; - }); - } - - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - return BaseView( - builder: (BuildContext context, ProcedureViewModel model, Widget child) => - AppScaffold( - isShowAppBar: false, - body: NetworkBaseView( - baseViewModel: model, - child: DraggableScrollableSheet( - minChildSize: 0.90, - initialChildSize: 0.95, - maxChildSize: 1.0, - builder: - (BuildContext context, ScrollController scrollController) { - return Container( - height: MediaQuery.of(context).size.height * 1.20, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - 'Add Procedure', - fontWeight: FontWeight.w700, - fontSize: 20, - ), - InkWell( - child: Icon( - Icons.close, - size: 24.0, - ), - onTap: () { - Navigator.pop(context); - }, - ) - ]), - SizedBox( - height: MediaQuery.of(context).size.height * 0.04, - ), - Expanded( - child: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight( - MediaQuery.of(context).size.height * 0.070), - child: Container( - height: - MediaQuery.of(context).size.height * 0.070, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.5), //width: 0.7 - ), - color: Colors.white), - child: Center( - child: TabBar( - isScrollable: false, - controller: _tabController, - indicatorColor: Colors.transparent, - indicatorWeight: 1.0, - indicatorSize: TabBarIndicatorSize.tab, - labelColor: Theme.of(context).primaryColor, - labelPadding: EdgeInsets.only( - top: 0, left: 0, right: 0, bottom: 0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - tabWidget( - screenSize, - _activeTab == 0, - "Favorite Templates", - ), - tabWidget( - screenSize, - _activeTab == 1, - 'All Lab', - ), - ], - ), - ), - ), - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - AddFavouriteProcedure( - patient: patient, - model: model, - addButtonTitle: TranslationBase.of(context).addLabOrder, - toolbarTitle: TranslationBase.of(context).applyForNewLabOrder, - categoryID: "02", - ), - AddSelectedLabOrder( - model: model, - patient: patient, - ), - ], - ), - ), - ], - ), - ), - ), - ], - ), - ), - ); - }), - ), - ), - ); - } - - Widget tabWidget(Size screenSize, bool isActive, String title, - {int counter = -1}) { - return Center( - child: Container( - height: screenSize.height * 0.070, - decoration: TextFieldsUtils.containerBorderDecoration( - isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA), - isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), - borderRadius: 4, - borderWidth: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - AppText( - title, - fontSize: SizeConfig.textMultiplier * 1.5, - color: isActive ? Colors.white : Color(0xFF2B353E), - fontWeight: FontWeight.w700, - ), - if (counter != -1) - Container( - margin: EdgeInsets.all(4), - width: 15, - height: 15, - decoration: BoxDecoration( - color: isActive ? Colors.white : Color(0xFFD02127), - shape: BoxShape.circle, - ), - child: Center( - child: FittedBox( - child: AppText( - "$counter", - fontSize: SizeConfig.textMultiplier * 1.5, - color: !isActive ? Colors.white : Color(0xFFD02127), - fontWeight: FontWeight.w700, - ), - ), - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/screens/procedures/add_radiology_screen.dart b/lib/screens/procedures/add_radiology_screen.dart deleted file mode 100644 index 26308553..00000000 --- a/lib/screens/procedures/add_radiology_screen.dart +++ /dev/null @@ -1,219 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.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/procedures/add-favourite-procedure.dart'; -import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.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/network_base_view.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import 'add_lab_orders.dart'; -import 'add_radiology_order.dart'; - -class AddRadiologyScreen extends StatefulWidget { - final ProcedureViewModel model; - final PatiantInformtion patient; - const AddRadiologyScreen({Key key, this.model, this.patient}) : super(key: key); - @override - _AddRadiologyScreenState createState() => - _AddRadiologyScreenState(patient: patient, model: model); -} - -class _AddRadiologyScreenState extends State - with SingleTickerProviderStateMixin { - _AddRadiologyScreenState({this.patient, this.model}); - ProcedureViewModel model; - PatiantInformtion patient; - TabController _tabController; - int _activeTab = 0; - - @override - void initState() { - super.initState(); - _tabController = TabController(length: 2, vsync: this); - _tabController.addListener(_handleTabSelection); - } - - @override - void dispose() { - super.dispose(); - _tabController.dispose(); - } - - _handleTabSelection() { - setState(() { - _activeTab = _tabController.index; - }); - } - - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - return BaseView( - builder: (BuildContext context, ProcedureViewModel model, Widget child) => - AppScaffold( - isShowAppBar: false, - body: NetworkBaseView( - baseViewModel: model, - child: DraggableScrollableSheet( - minChildSize: 0.90, - initialChildSize: 0.95, - maxChildSize: 1.0, - builder: - (BuildContext context, ScrollController scrollController) { - return Container( - height: MediaQuery.of(context).size.height * 1.20, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - TranslationBase.of(context).addRadiologyOrder, - fontWeight: FontWeight.w700, - fontSize: 20, - ), - InkWell( - child: Icon( - Icons.close, - size: 24.0, - ), - onTap: () { - Navigator.pop(context); - }, - ) - ]), - SizedBox( - height: MediaQuery.of(context).size.height * 0.04, - ), - Expanded( - child: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight( - MediaQuery.of(context).size.height * 0.070), - child: Container( - height: - MediaQuery.of(context).size.height * 0.070, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.5), //width: 0.7 - ), - color: Colors.white), - child: Center( - child: TabBar( - isScrollable: false, - controller: _tabController, - indicatorColor: Colors.transparent, - indicatorWeight: 1.0, - indicatorSize: TabBarIndicatorSize.tab, - labelColor: Theme.of(context).primaryColor, - labelPadding: EdgeInsets.only( - top: 0, left: 0, right: 0, bottom: 0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - tabWidget( - screenSize, - _activeTab == 0, - "Favorite Templates", - ), - tabWidget( - screenSize, - _activeTab == 1, - 'All Radiology', - ), - ], - ), - ), - ), - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - AddFavouriteProcedure( - patient: patient, - model: model, - addButtonTitle: TranslationBase.of(context).addRadiologyOrder, - toolbarTitle: TranslationBase.of(context).addRadiologyOrder, - categoryID: "03", - ), - AddSelectedRadiologyOrder( - model: model, - patient: patient, - ), - ], - ), - ), - ], - ), - ), - ), - ], - ), - ), - ); - }), - ), - ), - ); - } - - Widget tabWidget(Size screenSize, bool isActive, String title, - {int counter = -1}) { - return Center( - child: Container( - height: screenSize.height * 0.070, - decoration: TextFieldsUtils.containerBorderDecoration( - isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA), - isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), - borderRadius: 4, - borderWidth: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - AppText( - title, - fontSize: SizeConfig.textMultiplier * 1.5, - color: isActive ? Colors.white : Color(0xFF2B353E), - fontWeight: FontWeight.w700, - ), - if (counter != -1) - Container( - margin: EdgeInsets.all(4), - width: 15, - height: 15, - decoration: BoxDecoration( - color: isActive ? Colors.white : Color(0xFFD02127), - shape: BoxShape.circle, - ), - child: Center( - child: FittedBox( - child: AppText( - "$counter", - fontSize: SizeConfig.textMultiplier * 1.5, - color: !isActive ? Colors.white : Color(0xFFD02127), - fontWeight: FontWeight.w700, - ), - ), - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/screens/procedures/add_procedure_homeScreen.dart b/lib/screens/procedures/base_add_procedure_tab_page.dart similarity index 60% rename from lib/screens/procedures/add_procedure_homeScreen.dart rename to lib/screens/procedures/base_add_procedure_tab_page.dart index 39ed4b25..4d25de2b 100644 --- a/lib/screens/procedures/add_procedure_homeScreen.dart +++ b/lib/screens/procedures/base_add_procedure_tab_page.dart @@ -2,30 +2,41 @@ import 'package:doctor_app_flutter/config/size_config.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/procedures/add-favourite-procedure.dart'; -import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.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/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class AddProcedureHome extends StatefulWidget { +import 'ProcedureType.dart'; +import 'add-favourite-procedure.dart'; +import 'add-procedure-form.dart'; +import 'add_lab_orders.dart'; +import 'add_radiology_order.dart'; + +class BaseAddProcedureTabPage extends StatefulWidget { final ProcedureViewModel model; final PatiantInformtion patient; - const AddProcedureHome({Key key, this.model, this.patient}) : super(key: key); + final ProcedureType procedureType; + + const BaseAddProcedureTabPage( + {Key key, this.model, this.patient, this.procedureType}) + : super(key: key); + @override - _AddProcedureHomeState createState() => - _AddProcedureHomeState(patient: patient, model: model); + _BaseAddProcedureTabPageState createState() => + _BaseAddProcedureTabPageState(patient: patient, model: model, procedureType: procedureType); } -class _AddProcedureHomeState extends State +class _BaseAddProcedureTabPageState extends State with SingleTickerProviderStateMixin { - _AddProcedureHomeState({this.patient, this.model}); - ProcedureViewModel model; - PatiantInformtion patient; + final ProcedureViewModel model; + final PatiantInformtion patient; + final ProcedureType procedureType; + + _BaseAddProcedureTabPageState({this.patient, this.model, this.procedureType}); + TabController _tabController; int _activeTab = 0; @@ -50,11 +61,9 @@ class _AddProcedureHomeState extends State @override Widget build(BuildContext context) { - //final routeArgs = ModalRoute.of(context).settings.arguments as Map; - //PatiantInformtion patient = routeArgs['patient']; final screenSize = MediaQuery.of(context).size; + return BaseView( - //onModelReady: (model) => model.getCategory(), builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( isShowAppBar: false, @@ -77,7 +86,13 @@ class _AddProcedureHomeState extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppText( - 'Add Procedure', + procedureType == ProcedureType.PROCEDURE + ? TranslationBase.of(context).addProcedures + : procedureType == ProcedureType.RADIOLOGY + ? TranslationBase.of(context) + .addRadiologyOrder + : TranslationBase.of(context) + .addLabOrder, fontWeight: FontWeight.w700, fontSize: 20, ), @@ -125,12 +140,21 @@ class _AddProcedureHomeState extends State tabWidget( screenSize, _activeTab == 0, - "Favorite Templates", + TranslationBase.of(context) + .favoriteTemplates, ), tabWidget( screenSize, _activeTab == 1, - 'All Procedures', + procedureType == ProcedureType.PROCEDURE + ? TranslationBase.of(context) + .allProcedures + : procedureType == + ProcedureType.RADIOLOGY + ? TranslationBase.of(context) + .allRadiology + : TranslationBase.of(context) + .allLab, ), ], ), @@ -147,13 +171,49 @@ class _AddProcedureHomeState extends State AddFavouriteProcedure( patient: patient, model: model, - addButtonTitle: TranslationBase.of(context).addSelectedProcedures, - toolbarTitle: 'Add Procedure', - ), - AddSelectedProcedure( - model: model, - patient: patient, + addButtonTitle: procedureType == + ProcedureType.PROCEDURE + ? TranslationBase.of(context) + .addProcedures + : procedureType == + ProcedureType.RADIOLOGY + ? TranslationBase.of(context) + .addRadiologyOrder + : TranslationBase.of(context) + .addLabOrder, + toolbarTitle: procedureType == + ProcedureType.PROCEDURE + ? TranslationBase.of(context) + .addProcedures + : procedureType == + ProcedureType.RADIOLOGY + ? TranslationBase.of(context) + .addRadiologyOrder + : TranslationBase.of(context) + .addLabOrder, + categoryID: procedureType == + ProcedureType.PROCEDURE + ? null + : procedureType == + ProcedureType.RADIOLOGY + ? "03" + : "02", ), + procedureType == ProcedureType.PROCEDURE + ? AddSelectedProcedure( + model: model, + patient: patient, + ) + : procedureType == + ProcedureType.RADIOLOGY + ? AddSelectedRadiologyOrder( + model: model, + patient: patient, + ) + : AddSelectedLabOrder( + model: model, + patient: patient, + ), ], ), ), @@ -177,7 +237,7 @@ class _AddProcedureHomeState extends State child: Container( height: screenSize.height * 0.070, decoration: TextFieldsUtils.containerBorderDecoration( - isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA), + isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), borderRadius: 4, borderWidth: 0), @@ -216,3 +276,5 @@ class _AddProcedureHomeState extends State ); } } + + diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index f6752c4a..756a19a0 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -5,7 +5,6 @@ import 'package:doctor_app_flutter/core/viewModel/procedure_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/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/screens/procedures/add_procedure_homeScreen.dart'; import 'package:doctor_app_flutter/screens/procedures/update-procedure.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -15,6 +14,8 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'ProcedureCard.dart'; +import 'ProcedureType.dart'; +import 'base_add_procedure_tab_page.dart'; class ProcedureScreen extends StatelessWidget { int doctorNameP; @@ -107,10 +108,12 @@ class ProcedureScreen extends StatelessWidget { Navigator.push( context, MaterialPageRoute( - builder: (context) => AddProcedureHome( - patient: patient, - model: model, - )), + builder: (context) => BaseAddProcedureTabPage( + patient: patient, + model: model, + procedureType: ProcedureType.PROCEDURE, + ), + ), ); }, child: Container( diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 9ed00146..78041705 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1035,6 +1035,8 @@ class TranslationBase { String get addSelectedProcedures => localizedValues['addSelectedProcedures'][locale.languageCode]; + String get addProcedures => + localizedValues['addProcedures'][locale.languageCode]; String get updateProcedure => localizedValues['updateProcedure'][locale.languageCode]; @@ -1355,6 +1357,10 @@ class TranslationBase { String get impressionRecommendation => localizedValues['impressionRecommendation'][locale.languageCode]; String get onHold => localizedValues['onHold'][locale.languageCode]; String get verified => localizedValues['verified'][locale.languageCode]; + String get favoriteTemplates => localizedValues['favoriteTemplates'][locale.languageCode]; + String get allProcedures => localizedValues['allProcedures'][locale.languageCode]; + String get allRadiology => localizedValues['allRadiology'][locale.languageCode]; + String get allLab => localizedValues['allLab'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From bc48d915c67e428ed7bbf06cd60cd6bbd2e69a42 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Tue, 1 Jun 2021 15:19:06 +0300 Subject: [PATCH 04/14] procedure refactoring --- lib/config/config.dart | 4 +- lib/core/viewModel/procedure_View_model.dart | 83 ++++- lib/screens/procedures/ProcedureType.dart | 78 +++- .../procedures/add-procedure-form.dart | 349 ------------------ .../procedures/add-procedure-page.dart | 265 +++++++++++++ lib/screens/procedures/add_lab_orders.dart | 269 -------------- .../procedures/add_radiology_order.dart | 270 -------------- .../base_add_procedure_tab_page.dart | 85 +---- .../procedures/procedure_checkout_screen.dart | 5 +- 9 files changed, 442 insertions(+), 966 deletions(-) delete mode 100644 lib/screens/procedures/add-procedure-form.dart create mode 100644 lib/screens/procedures/add-procedure-page.dart delete mode 100644 lib/screens/procedures/add_lab_orders.dart delete mode 100644 lib/screens/procedures/add_radiology_order.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index c8af8ad9..0283577e 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -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 = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index ad62158e..68937c1c 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -4,10 +4,10 @@ import 'package:doctor_app_flutter/core/model/labs/LabOrderResult.dart'; import 'package:doctor_app_flutter/core/model/labs/lab_result.dart'; import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart'; import 'package:doctor_app_flutter/core/model/labs/patient_lab_special_result.dart'; +import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; -import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; @@ -19,8 +19,12 @@ import 'package:doctor_app_flutter/core/service/patient_medical_file/radiology/r import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:flutter/cupertino.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' + as cpe; class ProcedureViewModel extends BaseViewModel { //TODO Hussam clean it @@ -84,11 +88,15 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getProcedureCategory({String categoryName, String categoryID, patientId}) async { + Future getProcedureCategory( + {String categoryName, String categoryID, patientId}) async { + if (categoryName == null) return; hasError = false; setState(ViewState.Busy); await _procedureService.getProcedureCategory( - categoryName: categoryName, categoryID: categoryID,patientId: patientId); + categoryName: categoryName, + categoryID: categoryID, + patientId: patientId); if (_procedureService.hasError) { error = _procedureService.error; setState(ViewState.ErrorLocal); @@ -137,8 +145,7 @@ class ProcedureViewModel extends BaseViewModel { templateName: element.templateName, templateId: element.templateID, template: element); - if(!templateList.contains(template)) - templateList.add(template); + if (!templateList.contains(template)) templateList.add(template); } }); print(templateList.length.toString()); @@ -357,4 +364,70 @@ class ProcedureViewModel extends BaseViewModel { } else DrAppToastMsg.showSuccesToast(mes); } + + Future preparePostProcedure( + {String remarks, + String orderType, + PatiantInformtion patient, + List entityList, + ProcedureType procedureType}) async { + PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); + ProcedureValadteRequestModel procedureValadteRequestModel = + new ProcedureValadteRequestModel(); + procedureValadteRequestModel.patientMRN = patient.patientMRN; + procedureValadteRequestModel.episodeID = patient.episodeNo; + procedureValadteRequestModel.appointmentNo = patient.appointmentNo; + + List controlsProcedure = List(); + + postProcedureReqModel.appointmentNo = patient.appointmentNo; + postProcedureReqModel.episodeID = patient.episodeNo; + postProcedureReqModel.patientMRN = patient.patientMRN; + + entityList.forEach((element) { + procedureValadteRequestModel.procedure = [element.procedureId]; + List controls = List(); + controls.add( + Controls( + code: "remarks", + controlValue: element.remarks != null ? element.remarks : ""), + ); + controls.add( + Controls( + code: "ordertype", + controlValue: procedureType == ProcedureType.PROCEDURE + ? element.type ?? "1" + : "0"), + ); + controlsProcedure.add(Procedures( + category: element.categoryID, + procedure: element.procedureId, + controls: controls)); + }); + + postProcedureReqModel.procedures = controlsProcedure; + await valadteProcedure(procedureValadteRequestModel); + if (state == ViewState.Idle) { + if (valadteProcedureList[0].entityList.length == 0) { + await postProcedure(postProcedureReqModel, patient.patientMRN); + + if (state == ViewState.ErrorLocal) { + Helpers.showErrorToast(error); + getProcedure(mrn: patient.patientMRN); + } else if (state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast('procedure has been added'); + } + } else { + if (state == ViewState.ErrorLocal) { + Helpers.showErrorToast(error); + getProcedure(mrn: patient.patientMRN); + } else if (state == ViewState.Idle) { + Helpers.showErrorToast( + valadteProcedureList[0].entityList[0].warringMessages); + } + } + } else { + Helpers.showErrorToast(error); + } + } } diff --git a/lib/screens/procedures/ProcedureType.dart b/lib/screens/procedures/ProcedureType.dart index e05fb7e1..4fc7781a 100644 --- a/lib/screens/procedures/ProcedureType.dart +++ b/lib/screens/procedures/ProcedureType.dart @@ -1,5 +1,81 @@ +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; + enum ProcedureType { PROCEDURE, LAB_RESULT, RADIOLOGY, -} \ No newline at end of file +} + +extension procedureType on ProcedureType { + + String getFavouriteTabName(BuildContext context) { + return TranslationBase.of(context).favoriteTemplates; + } + + String getAllLabelName(BuildContext context) { + switch (this) { + case ProcedureType.PROCEDURE: + return TranslationBase.of(context).allProcedures; + case ProcedureType.LAB_RESULT: + return TranslationBase.of(context).allLab; + case ProcedureType.RADIOLOGY: + return TranslationBase.of(context).allRadiology; + default: + return ""; + } + } + + String getToolbarLabel(BuildContext context) { + switch (this) { + case ProcedureType.PROCEDURE: + return TranslationBase.of(context).addProcedures; + case ProcedureType.LAB_RESULT: + return TranslationBase.of(context).addRadiologyOrder; + case ProcedureType.RADIOLOGY: + return TranslationBase.of(context).addLabOrder; + default: + return ""; + } + } + + String getAddButtonTitle(BuildContext context) { + switch (this) { + case ProcedureType.PROCEDURE: + return TranslationBase.of(context).addProcedures; + case ProcedureType.LAB_RESULT: + return TranslationBase.of(context).addRadiologyOrder; + case ProcedureType.RADIOLOGY: + return TranslationBase.of(context).addLabOrder; + default: + return ""; + } + } + + String getCategoryId() { + switch (this) { + case ProcedureType.PROCEDURE: + return null; + case ProcedureType.LAB_RESULT: + return "02"; + case ProcedureType.RADIOLOGY: + return "03"; + default: + return null; + } + } + + String getCategoryName() { + switch (this) { + case ProcedureType.PROCEDURE: + return null; + case ProcedureType.LAB_RESULT: + return "Laboratory"; + case ProcedureType.RADIOLOGY: + return "Radiology"; + default: + return null; + } + } + +} diff --git a/lib/screens/procedures/add-procedure-form.dart b/lib/screens/procedures/add-procedure-form.dart deleted file mode 100644 index ba2ec3de..00000000 --- a/lib/screens/procedures/add-procedure-form.dart +++ /dev/null @@ -1,349 +0,0 @@ -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/procedure/ControlsModel.dart'; -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; -import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; -import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_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/util/dr_app_toast_msg.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/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'; - -import 'ProcedureType.dart'; -import 'entity_list_checkbox_search_widget.dart'; - -void addSelectedProcedure( - context, ProcedureViewModel model, PatiantInformtion patient) { - showModalBottomSheet( - context: context, - isScrollControlled: true, - builder: (BuildContext bc) { - return AddSelectedProcedure( - model: model, - patient: patient, - ); - }); -} - -class AddSelectedProcedure extends StatefulWidget { - final ProcedureViewModel model; - final PatiantInformtion patient; - final ProcedureType procedureType; - - const AddSelectedProcedure({Key key, this.model, this.patient, this.procedureType}) - : super(key: key); - - @override - _AddSelectedProcedureState createState() => - _AddSelectedProcedureState(patient: patient, model: model); -} - -class _AddSelectedProcedureState extends State { - int selectedType; - ProcedureViewModel model; - PatiantInformtion patient; - - _AddSelectedProcedureState({this.patient, this.model}); - - TextEditingController procedureController = TextEditingController(); - TextEditingController remarksController = TextEditingController(); - List entityList = List(); - List entityListProcedure = List(); - TextEditingController procedureName = TextEditingController(); - - dynamic selectedCategory; - - setSelectedType(int val) { - setState(() { - selectedType = val; - }); - } - - @override - Widget build(BuildContext context) { - return BaseView( - builder: (BuildContext context, ProcedureViewModel model, Widget child) => - AppScaffold( - isShowAppBar: false, - body: Column( - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.070, - ), - Expanded( - child: NetworkBaseView( - baseViewModel: model, - child: DraggableScrollableSheet( - minChildSize: 0.90, - initialChildSize: 0.95, - maxChildSize: 1.0, - builder: (BuildContext context, - ScrollController scrollController) { - return SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 1.20, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - AppText( - TranslationBase.of(context) - .pleaseEnterProcedure, - fontWeight: FontWeight.w700, - fontSize: 20, - ), - ]), - SizedBox( - height: - MediaQuery.of(context).size.height * 0.04, - ), - Row( - children: [ - Container( - width: MediaQuery.of(context).size.width * - 0.79, - child: AppTextFieldCustom( - hintText: TranslationBase.of(context) - .searchProcedureHere, - isTextFieldHasSuffix: false, - - maxLines: 1, - minLines: 1, - hasBorder: true, - controller: procedureName, - // onSubmitted: (_) { - // model.getProcedureCategory( - // categoryName: procedureName.text); - // }, - onClick: () { - if (procedureName.text.isNotEmpty && - procedureName.text.length >= 3) - model.getProcedureCategory( - patientId: patient.patientId, - categoryName: - procedureName.text); - else - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .atLeastThreeCharacters, - ); - }, - ), - ), - SizedBox( - width: MediaQuery.of(context).size.width * - 0.02, - ), - Expanded( - child: InkWell( - onTap: () { - if (procedureName.text.isNotEmpty && - procedureName.text.length >= 3) - model.getProcedureCategory( - patientId: patient.patientId, - categoryName: procedureName.text); - else - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .atLeastThreeCharacters, - ); - }, - child: Icon( - Icons.search, - size: 25.0, - ), - ), - ), - ], - ), - if (procedureName.text.isNotEmpty && - model.procedureList.length != 0) - NetworkBaseView( - baseViewModel: model, - child: EntityListCheckboxSearchWidget( - model: widget.model, - masterList: widget - .model.categoriesList[0].entityList, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => - isEntityListSelected(master), - )), - SizedBox( - height: 115.0, - ), - ], - ), - ), - ), - ); - }), - ), - ), - Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context).addSelectedProcedures, - color: Color(0xff359846), - fontWeight: FontWeight.w700, - onPressed: () { - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .fillTheMandatoryProcedureDetails, - ); - return; - } - - Navigator.pop(context); - postProcedure( - orderType: selectedType.toString(), - entityList: entityList, - patient: patient, - model: widget.model, - remarks: remarksController.text); - }, - ), - ], - ), - ), - ], - ), - ), - ); - } - - bool isEntityListSelected(EntityList masterKey) { - Iterable history = entityList - .where((element) => masterKey.procedureId == element.procedureId); - if (history.length > 0) { - return true; - } - return false; - } - - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {Icon suffixIcon}) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown - ? suffixIcon != null - ? suffixIcon - : Icon( - Icons.arrow_drop_down, - color: Colors.black, - ) - : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - } - - postProcedure( - {ProcedureViewModel model, - String remarks, - String orderType, - PatiantInformtion patient, - List entityList, - ProcedureType procedureType}) async { - PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); - procedureValadteRequestModel.patientMRN = patient.patientMRN; - procedureValadteRequestModel.episodeID = patient.episodeNo; - procedureValadteRequestModel.appointmentNo = patient.appointmentNo; - - List controlsProcedure = List(); - - postProcedureReqModel.appointmentNo = patient.appointmentNo; - postProcedureReqModel.episodeID = patient.episodeNo; - postProcedureReqModel.patientMRN = patient.patientMRN; - - entityList.forEach((element) { - procedureValadteRequestModel.procedure = [element.procedureId]; - List controls = List(); - controls.add( - Controls( - code: "remarks", - controlValue: element.remarks != null ? element.remarks : ""), - ); - controls.add( - Controls(code: "ordertype", controlValue: procedureType == - ProcedureType.PROCEDURE ? element.type ?? "1" : "0"), - ); - controlsProcedure.add(Procedures( - category: element.categoryID, - procedure: element.procedureId, - controls: controls)); - }); - - postProcedureReqModel.procedures = controlsProcedure; - await model.valadteProcedure(procedureValadteRequestModel); - if (model.state == ViewState.Idle) { - if (model.valadteProcedureList[0].entityList.length == 0) { - await model.postProcedure(postProcedureReqModel, patient.patientMRN); - - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - model.getProcedure(mrn: patient.patientMRN); - } else if (model.state == ViewState.Idle) { - DrAppToastMsg.showSuccesToast('procedure has been added'); - } - } else { - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - model.getProcedure(mrn: patient.patientMRN); - } else if (model.state == ViewState.Idle) { - Helpers.showErrorToast( - model.valadteProcedureList[0].entityList[0].warringMessages); - } - } - } else { - Helpers.showErrorToast(model.error); - } - } - -} diff --git a/lib/screens/procedures/add-procedure-page.dart b/lib/screens/procedures/add-procedure-page.dart new file mode 100644 index 00000000..65f0b2e1 --- /dev/null +++ b/lib/screens/procedures/add-procedure-page.dart @@ -0,0 +1,265 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.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/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'; + +import 'ProcedureType.dart'; +import 'entity_list_checkbox_search_widget.dart'; + +class AddProcedurePage extends StatefulWidget { + final ProcedureViewModel model; + final PatiantInformtion patient; + final ProcedureType procedureType; + + const AddProcedurePage( + {Key key, this.model, this.patient, this.procedureType}) + : super(key: key); + + @override + _AddProcedurePageState createState() => _AddProcedurePageState( + patient: patient, model: model, procedureType: this.procedureType); +} + +class _AddProcedurePageState extends State { + int selectedType; + ProcedureViewModel model; + PatiantInformtion patient; + ProcedureType procedureType; + + _AddProcedurePageState({this.patient, this.model, this.procedureType}); + + TextEditingController procedureController = TextEditingController(); + TextEditingController remarksController = TextEditingController(); + List entityList = List(); + List entityListProcedure = List(); + TextEditingController procedureName = TextEditingController(); + + dynamic selectedCategory; + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) { + model.getProcedureCategory( + categoryName: procedureType.getCategoryName(), + categoryID: procedureType.getCategoryId(), + patientId: patient.patientId); + }, + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + AppScaffold( + isShowAppBar: false, + body: Column( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + ), + Expanded( + child: NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Container( + // height: MediaQuery.of(context).size.height * 1.2, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (procedureType == ProcedureType.PROCEDURE) + Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + AppText( + TranslationBase.of(context) + .pleaseEnterProcedure, + fontWeight: FontWeight.w700, + fontSize: 20, + ), + ], + ), + SizedBox( + height: + MediaQuery.of(context).size.height * 0.02, + ), + Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * + 0.79, + child: AppTextFieldCustom( + hintText: TranslationBase.of(context) + .searchProcedureHere, + isTextFieldHasSuffix: false, + maxLines: 1, + minLines: 1, + hasBorder: true, + controller: procedureName, + // onClick: () { + // if (procedureName.text.isNotEmpty && + // procedureName.text.length >= 3) + // model.getProcedureCategory( + // patientId: patient.patientId, + // categoryName: + // procedureName.text); + // else + // DrAppToastMsg.showErrorToast( + // TranslationBase.of(context) + // .atLeastThreeCharacters, + // ); + // }, + ), + ), + SizedBox( + width: MediaQuery.of(context).size.width * + 0.02, + ), + Expanded( + child: InkWell( + onTap: () { + if (procedureName.text.isNotEmpty && + procedureName.text.length >= 3) + model.getProcedureCategory( + patientId: patient.patientId, + categoryName: + procedureName.text); + else + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .atLeastThreeCharacters, + ); + }, + child: Icon( + Icons.search, + size: 25.0, + ), + ), + ), + ], + ), + ], + ), + if (procedureName.text.isNotEmpty && + model.categoriesList.length != 0) + NetworkBaseView( + baseViewModel: model, + child: EntityListCheckboxSearchWidget( + model: widget.model, + masterList: + model.categoriesList[0].entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + )), + ], + ), + ), + ), + ), + ), + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: procedureType.getAddButtonTitle(context), + fontWeight: FontWeight.w700, + color: Color(0xff359846), + onPressed: () async { + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .fillTheMandatoryProcedureDetails, + ); + return; + } + + Navigator.pop(context); + await model.preparePostProcedure( + orderType: selectedType.toString(), + entityList: entityList, + patient: patient, + remarks: remarksController.text); + }, + ), + ], + ), + ), + ], + ), + ), + ); + } + + bool isEntityListSelected(EntityList masterKey) { + Iterable history = entityList + .where((element) => masterKey.procedureId == element.procedureId); + if (history.length > 0) { + return true; + } + return false; + } + + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.arrow_drop_down, + color: Colors.black, + ) + : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } +} diff --git a/lib/screens/procedures/add_lab_orders.dart b/lib/screens/procedures/add_lab_orders.dart deleted file mode 100644 index b8d4e7c7..00000000 --- a/lib/screens/procedures/add_lab_orders.dart +++ /dev/null @@ -1,269 +0,0 @@ -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/procedure/ControlsModel.dart'; -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; -import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; -import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_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/util/dr_app_toast_msg.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/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:flutter/material.dart'; - -import 'entity_list_checkbox_search_widget.dart'; - -valdateProcedure(ProcedureViewModel model, PatiantInformtion patient, - List entityList) async { - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); - - procedureValadteRequestModel.patientMRN = patient.appointmentNo; - procedureValadteRequestModel.episodeID = patient.episodeNo; - procedureValadteRequestModel.appointmentNo = patient.appointmentNo; -} - -postProcedure( - {ProcedureViewModel model, - String remarks, - String orderType, - PatiantInformtion patient, - List entityList}) async { - PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); - procedureValadteRequestModel.patientMRN = patient.patientMRN; - procedureValadteRequestModel.episodeID = patient.episodeNo; - procedureValadteRequestModel.appointmentNo = patient.appointmentNo; - - List controlsProcedure = List(); - - postProcedureReqModel.appointmentNo = patient.appointmentNo; - - postProcedureReqModel.episodeID = patient.episodeNo; - postProcedureReqModel.patientMRN = patient.patientMRN; - - entityList.forEach((element) { - procedureValadteRequestModel.procedure = [element.procedureId]; - List controls = List(); - controls.add( - Controls( - code: "remarks", - controlValue: element.remarks != null ? element.remarks : ""), - ); - controls.add( - Controls(code: "ordertype", controlValue: "0"), - ); - controlsProcedure.add(Procedures( - category: element.categoryID, - procedure: element.procedureId, - controls: controls)); - }); - - postProcedureReqModel.procedures = controlsProcedure; - await model.valadteProcedure(procedureValadteRequestModel); - if (model.state == ViewState.Idle) { - if (model.valadteProcedureList[0].entityList.length == 0) { - await model.postProcedure(postProcedureReqModel, patient.patientMRN); - - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - model.getLabs(patient); - } else if (model.state == ViewState.Idle) { - DrAppToastMsg.showSuccesToast('procedure has been added'); - } - } else { - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - model.getLabs(patient); - } else if (model.state == ViewState.Idle) { - Helpers.showErrorToast( - model.valadteProcedureList[0].entityList[0].warringMessages); - } - } - } else { - Helpers.showErrorToast(model.error); - } -} - -void addSelectedLabOrder( - context, ProcedureViewModel model, PatiantInformtion patient) { - showModalBottomSheet( - context: context, - isScrollControlled: true, - builder: (BuildContext bc) { - return AddSelectedLabOrder( - model: model, - patient: patient, - ); - }); -} - -class AddSelectedLabOrder extends StatefulWidget { - final ProcedureViewModel model; - final PatiantInformtion patient; - - const AddSelectedLabOrder({Key key, this.model, this.patient}) - : super(key: key); - @override - _AddSelectedLabOrderState createState() => - _AddSelectedLabOrderState(patient: patient, model: model); -} - -class _AddSelectedLabOrderState extends State { - int selectedType; - ProcedureViewModel model; - PatiantInformtion patient; - _AddSelectedLabOrderState({this.patient, this.model}); - TextEditingController procedureController = TextEditingController(); - TextEditingController remarksController = TextEditingController(); - List entityList = List(); - List entityListProcedure = List(); - - dynamic selectedCategory; - - setSelectedType(int val) { - setState(() { - selectedType = val; - }); - } - - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - return BaseView( - onModelReady: (model) => model.getProcedureCategory( - categoryName: "Laboratory", categoryID: "02",patientId: patient.patientId), - builder: (BuildContext context, ProcedureViewModel model, Widget child) => - AppScaffold( - isShowAppBar: false, - body: NetworkBaseView( - baseViewModel: model, - child: DraggableScrollableSheet( - minChildSize: 0.90, - initialChildSize: 0.95, - maxChildSize: 1.0, - builder: - (BuildContext context, ScrollController scrollController) { - return SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * .90, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 10.0, - ), - if (widget.model.categoriesList.length != 0) - NetworkBaseView( - baseViewModel: model, - child: EntityListCheckboxSearchWidget( - model: widget.model, - masterList: - widget.model.categoriesList[0].entityList, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => - isEntityListSelected(master), - )), - ], - ), - ), - ), - ); - }), - ), - bottomSheet: Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context).addLabOrder, - fontWeight: FontWeight.w700, - color: Color(0xff359846), - onPressed: () { - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .fillTheMandatoryProcedureDetails, - ); - return; - } - - Navigator.pop(context); - postProcedure( - orderType: selectedType.toString(), - entityList: entityList, - patient: patient, - model: widget.model, - remarks: remarksController.text); - }, - ), - ], - ), - ), - ), - ); - } - - bool isEntityListSelected(EntityList masterKey) { - Iterable history = entityList - .where((element) => masterKey.procedureId == element.procedureId); - if (history.length > 0) { - return true; - } - return false; - } - - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {Icon suffixIcon}) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown - ? suffixIcon != null - ? suffixIcon - : Icon( - Icons.arrow_drop_down, - color: Colors.black, - ) - : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - } -} diff --git a/lib/screens/procedures/add_radiology_order.dart b/lib/screens/procedures/add_radiology_order.dart deleted file mode 100644 index dc68aacc..00000000 --- a/lib/screens/procedures/add_radiology_order.dart +++ /dev/null @@ -1,270 +0,0 @@ -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/procedure/ControlsModel.dart'; -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; -import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; -import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_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/util/dr_app_toast_msg.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/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:flutter/material.dart'; - -import 'entity_list_checkbox_search_widget.dart'; - -valdateProcedure(ProcedureViewModel model, PatiantInformtion patient, - List entityList) async { - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); - - procedureValadteRequestModel.patientMRN = patient.appointmentNo; - procedureValadteRequestModel.episodeID = patient.episodeNo; - procedureValadteRequestModel.appointmentNo = patient.appointmentNo; -} - -postProcedure( - {ProcedureViewModel model, - String remarks, - String orderType, - PatiantInformtion patient, - List entityList}) async { - PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); - procedureValadteRequestModel.patientMRN = patient.patientMRN; - procedureValadteRequestModel.episodeID = patient.episodeNo; - procedureValadteRequestModel.appointmentNo = patient.appointmentNo; - - List controlsProcedure = List(); - - postProcedureReqModel.appointmentNo = patient.appointmentNo; - - postProcedureReqModel.episodeID = patient.episodeNo; - postProcedureReqModel.patientMRN = patient.patientMRN; - - entityList.forEach((element) { - procedureValadteRequestModel.procedure = [element.procedureId]; - List controls = List(); - controls.add( - Controls( - code: "remarks", - controlValue: element.remarks != null ? element.remarks : ""), - ); - controls.add( - Controls(code: "ordertype", controlValue: "0"), - ); - controlsProcedure.add(Procedures( - category: element.categoryID, - procedure: element.procedureId, - controls: controls)); - }); - - postProcedureReqModel.procedures = controlsProcedure; - await model.valadteProcedure(procedureValadteRequestModel); - if (model.state == ViewState.Idle) { - if (model.valadteProcedureList[0].entityList.length == 0) { - await model.postProcedure(postProcedureReqModel, patient.patientMRN); - - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - model.getPatientRadOrders(patient); - } else if (model.state == ViewState.Idle) { - DrAppToastMsg.showSuccesToast('procedure has been added'); - } - } else { - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - model.getPatientRadOrders(patient); - } else if (model.state == ViewState.Idle) { - Helpers.showErrorToast( - model.valadteProcedureList[0].entityList[0].warringMessages); - } - } - } else { - Helpers.showErrorToast(model.error); - } -} - -void addSelectedRadiologyOrder( - context, ProcedureViewModel model, PatiantInformtion patient) { - showModalBottomSheet( - context: context, - isScrollControlled: true, - builder: (BuildContext bc) { - return AddSelectedRadiologyOrder( - model: model, - patient: patient, - ); - }); -} - -class AddSelectedRadiologyOrder extends StatefulWidget { - final ProcedureViewModel model; - final PatiantInformtion patient; - - const AddSelectedRadiologyOrder({Key key, this.model, this.patient}) - : super(key: key); - - @override - _AddSelectedRadiologyOrderState createState() => - _AddSelectedRadiologyOrderState(patient: patient, model: model); -} - -class _AddSelectedRadiologyOrderState extends State { - int selectedType; - ProcedureViewModel model; - PatiantInformtion patient; - - _AddSelectedRadiologyOrderState({this.patient, this.model}); - - TextEditingController procedureController = TextEditingController(); - TextEditingController remarksController = TextEditingController(); - List entityList = List(); - List entityListProcedure = List(); - - dynamic selectedCategory; - - setSelectedType(int val) { - setState(() { - selectedType = val; - }); - } - - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - return BaseView( - onModelReady: (model) => model.getProcedureCategory( - categoryName: "Radiology", categoryID: "03",patientId: patient.patientId), - builder: (BuildContext context, ProcedureViewModel model, Widget child) => - AppScaffold( - isShowAppBar: false, - body: NetworkBaseView( - baseViewModel: model, - child: DraggableScrollableSheet( - minChildSize: 0.90, - initialChildSize: 0.95, - maxChildSize: 1.0, - builder: - (BuildContext context, ScrollController scrollController) { - return SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 1.0, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 10.0, - ), - if (widget.model.categoriesList.length != 0) - NetworkBaseView( - baseViewModel: model, - child: EntityListCheckboxSearchWidget( - model: widget.model, - masterList: - widget.model.categoriesList[0].entityList, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => - isEntityListSelected(master), - )), - ], - ), - ), - ), - ); - }), - ), - bottomSheet: Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context).addRadiologyOrder, - color: Color(0xff359846), - fontWeight: FontWeight.w700, - onPressed: () { - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast(TranslationBase.of(context) - .fillTheMandatoryProcedureDetails); - return; - } - - Navigator.pop(context); - postProcedure( - orderType: selectedType.toString(), - entityList: entityList, - patient: patient, - model: widget.model, - remarks: remarksController.text); - }, - ), - ], - ), - ), - ), - ); - } - - bool isEntityListSelected(EntityList masterKey) { - Iterable history = entityList - .where((element) => masterKey.procedureId == element.procedureId); - if (history.length > 0) { - return true; - } - return false; - } - - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {Icon suffixIcon}) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown - ? suffixIcon != null - ? suffixIcon - : Icon( - Icons.arrow_drop_down, - color: Colors.black, - ) - : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - } -} diff --git a/lib/screens/procedures/base_add_procedure_tab_page.dart b/lib/screens/procedures/base_add_procedure_tab_page.dart index 4d25de2b..f4a6c85e 100644 --- a/lib/screens/procedures/base_add_procedure_tab_page.dart +++ b/lib/screens/procedures/base_add_procedure_tab_page.dart @@ -11,9 +11,7 @@ import 'package:flutter/material.dart'; import 'ProcedureType.dart'; import 'add-favourite-procedure.dart'; -import 'add-procedure-form.dart'; -import 'add_lab_orders.dart'; -import 'add_radiology_order.dart'; +import 'add-procedure-page.dart'; class BaseAddProcedureTabPage extends StatefulWidget { final ProcedureViewModel model; @@ -25,8 +23,8 @@ class BaseAddProcedureTabPage extends StatefulWidget { : super(key: key); @override - _BaseAddProcedureTabPageState createState() => - _BaseAddProcedureTabPageState(patient: patient, model: model, procedureType: procedureType); + _BaseAddProcedureTabPageState createState() => _BaseAddProcedureTabPageState( + patient: patient, model: model, procedureType: procedureType); } class _BaseAddProcedureTabPageState extends State @@ -86,13 +84,7 @@ class _BaseAddProcedureTabPageState extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppText( - procedureType == ProcedureType.PROCEDURE - ? TranslationBase.of(context).addProcedures - : procedureType == ProcedureType.RADIOLOGY - ? TranslationBase.of(context) - .addRadiologyOrder - : TranslationBase.of(context) - .addLabOrder, + procedureType.getToolbarLabel(context), fontWeight: FontWeight.w700, fontSize: 20, ), @@ -140,21 +132,13 @@ class _BaseAddProcedureTabPageState extends State tabWidget( screenSize, _activeTab == 0, - TranslationBase.of(context) - .favoriteTemplates, + procedureType + .getFavouriteTabName(context), ), tabWidget( screenSize, _activeTab == 1, - procedureType == ProcedureType.PROCEDURE - ? TranslationBase.of(context) - .allProcedures - : procedureType == - ProcedureType.RADIOLOGY - ? TranslationBase.of(context) - .allRadiology - : TranslationBase.of(context) - .allLab, + procedureType.getAllLabelName(context), ), ], ), @@ -171,49 +155,18 @@ class _BaseAddProcedureTabPageState extends State AddFavouriteProcedure( patient: patient, model: model, - addButtonTitle: procedureType == - ProcedureType.PROCEDURE - ? TranslationBase.of(context) - .addProcedures - : procedureType == - ProcedureType.RADIOLOGY - ? TranslationBase.of(context) - .addRadiologyOrder - : TranslationBase.of(context) - .addLabOrder, - toolbarTitle: procedureType == - ProcedureType.PROCEDURE - ? TranslationBase.of(context) - .addProcedures - : procedureType == - ProcedureType.RADIOLOGY - ? TranslationBase.of(context) - .addRadiologyOrder - : TranslationBase.of(context) - .addLabOrder, - categoryID: procedureType == - ProcedureType.PROCEDURE - ? null - : procedureType == - ProcedureType.RADIOLOGY - ? "03" - : "02", + addButtonTitle: procedureType + .getAddButtonTitle(context), + toolbarTitle: procedureType + .getToolbarLabel(context), + categoryID: + procedureType.getCategoryId(), + ), + AddProcedurePage( + model: model, + patient: patient, + procedureType: procedureType, ), - procedureType == ProcedureType.PROCEDURE - ? AddSelectedProcedure( - model: model, - patient: patient, - ) - : procedureType == - ProcedureType.RADIOLOGY - ? AddSelectedRadiologyOrder( - model: model, - patient: patient, - ) - : AddSelectedLabOrder( - model: model, - patient: patient, - ), ], ), ), @@ -276,5 +229,3 @@ class _BaseAddProcedureTabPageState extends State ); } } - - diff --git a/lib/screens/procedures/procedure_checkout_screen.dart b/lib/screens/procedures/procedure_checkout_screen.dart index 76d6cf6f..4c054fc5 100644 --- a/lib/screens/procedures/procedure_checkout_screen.dart +++ b/lib/screens/procedures/procedure_checkout_screen.dart @@ -4,7 +4,7 @@ import 'package:doctor_app_flutter/core/model/procedure/procedure_template_detai 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/procedures/add-procedure-form.dart'; +import 'package:doctor_app_flutter/screens/procedures/add-procedure-page.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -223,10 +223,9 @@ class _ProcedureCheckOutScreenState extends State { ); }); Navigator.pop(context); - await postProcedure( + await model.preparePostProcedure( entityList: entityList, patient: widget.patient, - model: widget.model, remarks: remarksController.text); Navigator.pop(context); Navigator.pop(context); From ad74ff00dc6e1f775810c5596ad8bb9b36fd37d2 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Tue, 1 Jun 2021 15:49:51 +0300 Subject: [PATCH 05/14] fix issues in android and add ChangeCallStatus services in IOS --- android/app/build.gradle | 2 +- android/app/src/main/AndroidManifest.xml | 4 + .../com/hmg/hmgDr/ui/VideoCallActivity.java | 12 +- ios/Podfile | 2 +- ios/Podfile.lock | 331 ------------------ ios/Runner/VideoViewController.swift | 35 +- lib/client/base_app_client.dart | 12 +- lib/config/config.dart | 4 +- lib/screens/qr_reader/QR_reader_screen.dart | 6 +- pubspec.lock | 12 +- pubspec.yaml | 2 +- 11 files changed, 63 insertions(+), 359 deletions(-) delete mode 100644 ios/Podfile.lock diff --git a/android/app/build.gradle b/android/app/build.gradle index fd6c7720..b7605ad0 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -70,7 +70,7 @@ dependencies { androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' //openTok - implementation 'com.opentok.android:opentok-android-sdk:2.16.5' + implementation 'com.opentok.android:opentok-android-sdk:2.20.1' //permissions implementation 'pub.devrel:easypermissions:0.4.0' //retrofit diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 57a59745..c656ebbf 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@