Merge branches 'development' and 'login_design_fixes' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into login_design_fixes

 Conflicts:
	lib/core/viewModel/authentication_view_model.dart
	lib/widgets/shared/app_drawer_widget.dart
login_design_fixes
Elham Rababah 5 years ago
commit 4dc72d6f35

@ -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

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.hmg.hmgDr">
<!--
io.flutter.app.FlutterApplication is an android.app.Application that
@ -11,6 +12,9 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<application
android:name="io.flutter.app.FlutterApplication"
android:icon="@mipmap/ic_launcher"

@ -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<SessionStatusModel> getSessionStatusModelData(@Body GetSessionStatusModel getSessionStatusModel);
}

@ -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);
}
}

@ -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

@ -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<ChangeCallStatusRequestModel> CREATOR = new Creator<ChangeCallStatusRequestModel>() {
@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);
}
}
}

@ -1,4 +1,4 @@
package com.example.doctor_app_flutter.Model;
package com.hmg.hmgDr.Model;
import android.os.Parcel;
import android.os.Parcelable;

@ -1,4 +1,4 @@
package com.example.doctor_app_flutter.Model;
package com.hmg.hmgDr.Model;
import android.os.Parcel;
import android.os.Parcelable;

@ -1,4 +1,4 @@
package com.example.doctor_app_flutter.Service;
package com.hmg.hmgDr.Service;
import android.app.Activity;
import android.app.Application;

@ -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<SessionStatusModel> getSessionStatusModelData(@Body GetSessionStatusModel getSessionStatusModel);
@POST("LiveCareApi/DoctorApp/ChangeCallStatus")
Call<SessionStatusModel> changeCallStatus(@Body ChangeCallStatusRequestModel changeCallStatusRequestModel);
}

@ -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;
@ -227,11 +228,15 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
@AfterPermissionGranted(RC_VIDEO_APP_PERM)
private void requestPermissions() {
String[] perms = {Manifest.permission.INTERNET, Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO};
String[] perms = {Manifest.permission.INTERNET, Manifest.permission.CAMERA,};
if (EasyPermissions.hasPermissions(this, perms)) {
mSession = new Session.Builder(VideoCallActivity.this, apiKey, sessionId).build();
mSession.setSessionListener(this);
mSession.connect(token);
try {
mSession = new Session.Builder(this, apiKey, sessionId).build();
mSession.setSessionListener(this);
mSession.connect(token);
} catch (Exception e) {
e.printStackTrace();
}
} else {
EasyPermissions.requestPermissions(this, getString(R.string.remaining_ar), RC_VIDEO_APP_PERM, perms);
}
@ -277,6 +282,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 +375,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 +430,11 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
}
}
@Override
public void onCallChangeCallStatusSuccessful(SessionStatusModel sessionStatusModel) {
}
@Override
public void onFailure() {

@ -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);
}
}

@ -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<SessionStatusModel> call = sessionStatusAPI.changeCallStatus(statusModel);
call.enqueue(new Callback<SessionStatusModel>() {
@Override
public void onResponse(@NotNull Call<SessionStatusModel> call, @NotNull Response<SessionStatusModel> response) {
if (!response.isSuccessful())
view.onFailure();
}
@Override
public void onFailure(@NotNull Call<SessionStatusModel> call, @NotNull Throwable t) {
view.onFailure();
}
});
}
}

@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
@ -64,7 +64,7 @@ target 'Runner' do
# Keep pod path relative so it can be checked into Podfile.lock.
pod 'Flutter', :path => 'Flutter'
pod 'OpenTok'
pod 'Alamofire'
pod 'Alamofire', '~> 5.2'
# Plugin Pods
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock

@ -1,9 +1,8 @@
PODS:
- Alamofire (4.9.1)
- barcode_scan (0.0.1):
- Alamofire (5.4.3)
- barcode_scan_fix (0.0.1):
- Flutter
- MTBBarcodeScanner
- SwiftProtobuf
- connectivity (0.0.1):
- Flutter
- Reachability
@ -102,8 +101,8 @@ PODS:
- Flutter
- "permission_handler (5.1.0+2)":
- Flutter
- PromisesObjC (1.2.11)
- Protobuf (3.13.0)
- PromisesObjC (1.2.12)
- Protobuf (3.17.0)
- Reachability (3.2)
- screen (0.0.1):
- Flutter
@ -120,7 +119,6 @@ PODS:
- speech_to_text (0.0.1):
- Flutter
- Try
- SwiftProtobuf (1.9.0)
- Try (2.1.1)
- url_launcher (0.0.1):
- Flutter
@ -142,8 +140,8 @@ PODS:
- Flutter
DEPENDENCIES:
- Alamofire
- barcode_scan (from `.symlinks/plugins/barcode_scan/ios`)
- Alamofire (~> 5.2)
- barcode_scan_fix (from `.symlinks/plugins/barcode_scan_fix/ios`)
- connectivity (from `.symlinks/plugins/connectivity/ios`)
- connectivity_for_web (from `.symlinks/plugins/connectivity_for_web/ios`)
- connectivity_macos (from `.symlinks/plugins/connectivity_macos/ios`)
@ -197,12 +195,11 @@ SPEC REPOS:
- PromisesObjC
- Protobuf
- Reachability
- SwiftProtobuf
- Try
EXTERNAL SOURCES:
barcode_scan:
:path: ".symlinks/plugins/barcode_scan/ios"
barcode_scan_fix:
:path: ".symlinks/plugins/barcode_scan_fix/ios"
connectivity:
:path: ".symlinks/plugins/connectivity/ios"
connectivity_for_web:
@ -273,8 +270,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter/ios"
SPEC CHECKSUMS:
Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18
barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479
Alamofire: e447a2774a40c996748296fa2c55112fdbbc42f9
barcode_scan_fix: 80dd65de55f27eec6591dd077c8b85f2b79e31f1
connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
connectivity_for_web: 2b8584556930d4bd490d82b836bcf45067ce345b
connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191
@ -304,8 +301,8 @@ SPEC CHECKSUMS:
path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4
path_provider_windows: a2b81600c677ac1959367280991971cb9a1edb3b
permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0
PromisesObjC: 8c196f5a328c2cba3e74624585467a557dcb482f
Protobuf: 3dac39b34a08151c6d949560efe3f86134a3f748
PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97
Protobuf: 7327d4444215b5f18e560a97f879ff5503c4581c
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
screen: abd91ca7bf3426e1cc3646d27e9b2358d6bf07b0
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
@ -314,7 +311,6 @@ SPEC CHECKSUMS:
shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9
shared_preferences_windows: 36b76d6f54e76ead957e60b49e2f124b4cd3e6ae
speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe
SwiftProtobuf: ecbec1be9036d15655f6b3443a1c4ea693c97932
Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
url_launcher_linux: ac237cb7a8058736e4aae38bdbcc748a4b394cc0
@ -326,6 +322,6 @@ SPEC CHECKSUMS:
wakelock: 0d4a70faf8950410735e3f61fb15d517c8a6efc4
webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96
PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69
PODFILE CHECKSUM: d0a3789a37635365b4345e456835ed9d30398217
COCOAPODS: 1.10.0.rc.1

@ -43,10 +43,33 @@ class ViewController: UIViewController {
requestCameraPermissionsIfNeeded()
hideVideoMuted()
setupSession()
// Do any additional setup after loading the view.
}
private func changeCallStatus(callStatus:Int){
let URL_USER_REGISTER = baseUrl+"LiveCareApi/DoctorApp/ChangeCallStatus"
let headers: HTTPHeaders = ["Content-Type":"application/json","Accept":"application/json",]
let parameters = [
"CallStatus":callStatus,
"VC_ID": VC_ID,
"TokenID": TokenID,
"generalid": generalid,
"DoctorId" : DoctorId ,
] as [String : Any]
AF.request(URL_USER_REGISTER, method: .post,parameters: parameters, encoding: JSONEncoding.default, headers: headers).responseJSON{
response in
if let result = response.value {
let jsonData = result as! NSObject
let resultVal = jsonData.value(forKey: "Result")
print(resultVal as Any)
}
}
}
private func getSessionStatus() {
let URL_USER_REGISTER = baseUrl+"LiveCareApi/DoctorApp/GetSessionStatus"
let headers: HTTPHeaders = [
@ -61,11 +84,11 @@ class ViewController: UIViewController {
"generalid": generalid,
"DoctorId" : DoctorId ,
] as [String : Any]
Alamofire.request(URL_USER_REGISTER, method: .post,parameters: parameters, encoding: JSONEncoding.default, headers: headers).responseJSON{
AF.request(URL_USER_REGISTER, method: .post,parameters: parameters, encoding: JSONEncoding.default, headers: headers).responseJSON{
response in
if self.isUserConnect {
} else {
if let result = response.result.value {
if let result = response.value {
let jsonData = result as! NSObject
if((jsonData.value(forKey: "SessionStatus")) as! Int == 2 || (jsonData.value(forKey: "SessionStatus")) as! Int == 3) {
//jsonData
@ -81,7 +104,6 @@ class ViewController: UIViewController {
self.sessionDisconnect();
self.timer.invalidate()
}
//getting json value from the server
}
}
@ -160,6 +182,7 @@ class ViewController: UIViewController {
func sessionDisconnect() {
changeCallStatus(callStatus: 16)
if (session != nil) {
print("disconnecting....")
session!.disconnect(nil)
@ -168,7 +191,7 @@ class ViewController: UIViewController {
}
dismiss(animated: true)
}
// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/
func requestCameraPermissionsIfNeeded() {
// check camera authorization status
@ -306,6 +329,7 @@ extension ViewController: OTSessionDelegate {
}
func session(_ session: OTSession, didFailWithError error: OTError) {
changeCallStatus(callStatus: 16)
print("The client failed to connect to the OpenTok session: \(error).")
}
@ -377,6 +401,7 @@ extension ViewController: OTSessionDelegate {
if let connectionId = connection?.connectionId {
print("session connectionCreated (\(connectionId))")
}
changeCallStatus(callStatus: 3)
isUserConnect = true
timer.invalidate()
}

@ -79,11 +79,13 @@ class BaseAppClient {
await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
}
//int projectID = await sharedPref.getInt(PROJECT_ID);
//if (projectID == 2 || projectID == 3)
// body['PatientOutSA'] = true;
//else
body['PatientOutSA'] = false;
int projectID = await sharedPref.getInt(PROJECT_ID);
if (projectID == 2 || projectID == 3)
body['PatientOutSA'] = true;
else if(body.containsKey('facilityId') && body['facilityId']==2 || body['facilityId']==3)
body['PatientOutSA'] = true;
else
body['PatientOutSA'] = false;
body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2;
print("URL : $url");

@ -17,9 +17,9 @@ class UcafService extends LookupService {
Future getPatientChiefComplaint(PatiantInformtion patient) async {
hasError = false;
Map<String, dynamic> body = Map();
body['PatientMRN'] = patient.patientMRN;
body['PatientMRN'] = patient.patientMRN ;
body['AppointmentNo'] = patient.appointmentNo;
body['EpisodeID'] = patient.episodeNo;
body['EpisodeID'] = patient.episodeNo ;
body['DoctorID'] = "";
await baseAppClient.post(GET_CHIEF_COMPLAINT,

@ -22,6 +22,7 @@ import 'package:doctor_app_flutter/models/doctor/clinic_model.dart';
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart';
import 'package:doctor_app_flutter/models/doctor/user_model.dart';
import 'package:doctor_app_flutter/root_page.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';
@ -296,7 +297,7 @@ class AuthenticationViewModel extends BaseViewModel {
clinicID: clinicInfo.clinicID,
license: true,
projectID: clinicInfo.projectID,
tokenID: '',);
tokenID: '',);//TODO change the lan
await _authService.getDoctorProfileBasedOnClinic(docInfo);
if (_authService.hasError) {
error = _authService.error;

@ -1,8 +1,10 @@
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/medicine_service.dart';
import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/prescription_service.dart';
import 'package:doctor_app_flutter/core/service/patient_medical_file/procedure/procedure_service.dart';
import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart';
@ -11,9 +13,12 @@ import '../../locator.dart';
import 'base_view_model.dart';
class MedicineViewModel extends BaseViewModel {
bool hasError = false;
MedicineService _medicineService = locator<MedicineService>();
ProcedureService _procedureService = locator<ProcedureService>();
PrescriptionService _prescriptionService = locator<PrescriptionService>();
List<ProcedureTempleteDetailsModel> get procedureTemplate => _procedureService.templateList;
List<ProcedureTempleteDetailsModelList> templateList = List();
get pharmacyItemsList => _medicineService.pharmacyItemsList;
get searchText => _medicineService.searchText;
get pharmaciesList => _medicineService.pharmaciesList;
@ -27,20 +32,15 @@ class MedicineViewModel extends BaseViewModel {
get medicationFrequencyList => _prescriptionService.medicationFrequencyList;
get boxQuintity => _prescriptionService.boxQuantity;
get medicationIndicationsList =>
_prescriptionService.medicationIndicationsList;
get medicationIndicationsList => _prescriptionService.medicationIndicationsList;
get medicationDoseTimeList => _prescriptionService.medicationDoseTimeList;
List<GetAssessmentResModel> get patientAssessmentList =>
_prescriptionService.patientAssessmentList;
List<GetAssessmentResModel> get patientAssessmentList => _prescriptionService.patientAssessmentList;
List<GetMedicationResponseModel> get allMedicationList =>
_prescriptionService.allMedicationList;
List<GetMedicationResponseModel> get allMedicationList => _prescriptionService.allMedicationList;
List<dynamic> get itemMedicineList => _prescriptionService.itemMedicineList;
List<dynamic> get itemMedicineListRoute =>
_prescriptionService.itemMedicineListRoute;
List<dynamic> get itemMedicineListUnit =>
_prescriptionService.itemMedicineListUnit;
List<dynamic> get itemMedicineListRoute => _prescriptionService.itemMedicineListRoute;
List<dynamic> get itemMedicineListUnit => _prescriptionService.itemMedicineListUnit;
Future getItem({int itemID}) async {
//hasError = false;
@ -54,6 +54,35 @@ class MedicineViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
setTemplateListDependOnId() {
procedureTemplate.forEach((element) {
List<ProcedureTempleteDetailsModelList> templateListData =
templateList.where((elementTemplate) => elementTemplate.templateId == element.templateID).toList();
if (templateListData.length != 0) {
templateList[templateList.indexOf(templateListData[0])].procedureTemplate.add(element);
} else {
var template = ProcedureTempleteDetailsModelList(
templateName: element.templateName, templateId: element.templateID, template: element);
if (!templateList.contains(template)) templateList.add(template);
}
});
print(templateList.length.toString());
}
Future getProcedureTemplate({String categoryID}) async {
hasError = false;
setState(ViewState.Busy);
await _procedureService.getProcedureTemplate(categoryID: categoryID);
if (_procedureService.hasError) {
error = _procedureService.error;
setState(ViewState.ErrorLocal);
} else {
setTemplateListDependOnId();
setState(ViewState.Idle);
}
}
Future getPrescription({int mrn}) async {
//hasError = false;
//_insuranceCardService.clearInsuranceCard();
@ -86,8 +115,7 @@ class MedicineViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getPatientAssessment(
GetAssessmentReqModel getAssessmentReqModel) async {
Future getPatientAssessment(GetAssessmentReqModel getAssessmentReqModel) async {
setState(ViewState.Busy);
await _prescriptionService.getPatientAssessment(getAssessmentReqModel);
if (_prescriptionService.hasError) {
@ -99,8 +127,7 @@ class MedicineViewModel extends BaseViewModel {
Future getMedicationStrength() async {
setState(ViewState.Busy);
await _prescriptionService
.getMasterLookup(MasterKeysService.MedicationStrength);
await _prescriptionService.getMasterLookup(MasterKeysService.MedicationStrength);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
@ -110,8 +137,7 @@ class MedicineViewModel extends BaseViewModel {
Future getMedicationRoute() async {
setState(ViewState.Busy);
await _prescriptionService
.getMasterLookup(MasterKeysService.MedicationRoute);
await _prescriptionService.getMasterLookup(MasterKeysService.MedicationRoute);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
@ -121,8 +147,7 @@ class MedicineViewModel extends BaseViewModel {
Future getMedicationIndications() async {
setState(ViewState.Busy);
await _prescriptionService
.getMasterLookup(MasterKeysService.MedicationIndications);
await _prescriptionService.getMasterLookup(MasterKeysService.MedicationIndications);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
@ -132,8 +157,7 @@ class MedicineViewModel extends BaseViewModel {
Future getMedicationDoseTime() async {
setState(ViewState.Busy);
await _prescriptionService
.getMasterLookup(MasterKeysService.MedicationDoseTime);
await _prescriptionService.getMasterLookup(MasterKeysService.MedicationDoseTime);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
@ -143,8 +167,7 @@ class MedicineViewModel extends BaseViewModel {
Future getMedicationFrequency() async {
setState(ViewState.Busy);
await _prescriptionService
.getMasterLookup(MasterKeysService.MedicationFrequency);
await _prescriptionService.getMasterLookup(MasterKeysService.MedicationFrequency);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
@ -154,8 +177,7 @@ class MedicineViewModel extends BaseViewModel {
Future getMedicationDuration() async {
setState(ViewState.Busy);
await _prescriptionService
.getMasterLookup(MasterKeysService.MedicationDuration);
await _prescriptionService.getMasterLookup(MasterKeysService.MedicationDuration);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
@ -163,8 +185,7 @@ class MedicineViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getBoxQuantity(
{int itemCode, int duration, double strength, int freq}) async {
Future getBoxQuantity({int itemCode, int duration, double strength, int freq}) async {
setState(ViewState.Busy);
await _prescriptionService.calculateBoxQuantity(
strength: strength, itemCode: itemCode, duration: duration, freq: freq);

@ -28,14 +28,11 @@ class ProcedureViewModel extends BaseViewModel {
bool hasError = false;
ProcedureService _procedureService = locator<ProcedureService>();
List<GetOrderedProcedureModel> get procedureList =>
_procedureService.procedureList;
List<GetOrderedProcedureModel> get procedureList => _procedureService.procedureList;
List<ProcedureValadteModel> get valadteProcedureList =>
_procedureService.valadteProcedureList;
List<ProcedureValadteModel> get valadteProcedureList => _procedureService.valadteProcedureList;
List<CategoriseProcedureModel> get categoriesList =>
_procedureService.categoriesList;
List<CategoriseProcedureModel> get categoriesList => _procedureService.categoriesList;
List<dynamic> get categoryList => _procedureService.categoryList;
RadiologyService _radiologyService = locator<RadiologyService>();
@ -44,25 +41,18 @@ class ProcedureViewModel extends BaseViewModel {
List<FinalRadiologyList> _finalRadiologyListHospital = List();
List<FinalRadiologyList> get finalRadiologyList =>
filterType == FilterType.Clinic
? _finalRadiologyListClinic
: _finalRadiologyListHospital;
filterType == FilterType.Clinic ? _finalRadiologyListClinic : _finalRadiologyListHospital;
List<FinalRadiology> get radiologyList =>
_radiologyService.finalRadiologyList;
List<FinalRadiology> get radiologyList => _radiologyService.finalRadiologyList;
List<PatientLabOrders> get patientLabOrdersList =>
_labsService.patientLabOrdersList;
List<PatientLabOrders> get patientLabOrdersList => _labsService.patientLabOrdersList;
List<LabOrderResult> get labOrdersResultsList =>
_labsService.labOrdersResultsList;
List<LabOrderResult> get labOrdersResultsList => _labsService.labOrdersResultsList;
List<ProcedureTempleteDetailsModel> get procedureTemplate =>
_procedureService.templateList;
List<ProcedureTempleteDetailsModel> get procedureTemplate => _procedureService.templateList;
List<ProcedureTempleteDetailsModelList> templateList = List();
List<ProcedureTempleteDetailsModel> get procedureTemplateDetails =>
_procedureService.templateDetailsList;
List<ProcedureTempleteDetailsModel> get procedureTemplateDetails => _procedureService.templateDetailsList;
List<PatientLabOrdersList> _patientLabOrdersListClinic = List();
List<PatientLabOrdersList> _patientLabOrdersListHospital = List();
@ -88,7 +78,7 @@ class ProcedureViewModel extends BaseViewModel {
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);
@ -123,22 +113,15 @@ class ProcedureViewModel extends BaseViewModel {
setTemplateListDependOnId() {
procedureTemplate.forEach((element) {
List<ProcedureTempleteDetailsModelList> templateListData = templateList
.where((elementTemplate) =>
elementTemplate.templateId == element.templateID)
.toList();
List<ProcedureTempleteDetailsModelList> templateListData =
templateList.where((elementTemplate) => elementTemplate.templateId == element.templateID).toList();
if (templateListData.length != 0) {
templateList[templateList.indexOf(templateListData[0])]
.procedureTemplate
.add(element);
templateList[templateList.indexOf(templateListData[0])].procedureTemplate.add(element);
} else {
var template = ProcedureTempleteDetailsModelList(
templateName: element.templateName,
templateId: element.templateID,
template: element);
if(!templateList.contains(template))
templateList.add(template);
templateName: element.templateName, templateId: element.templateID, template: element);
if (!templateList.contains(template)) templateList.add(template);
}
});
print(templateList.length.toString());
@ -159,8 +142,7 @@ class ProcedureViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future postProcedure(
PostProcedureReqModel postProcedureReqModel, int mrn) async {
Future postProcedure(PostProcedureReqModel postProcedureReqModel, int mrn) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
@ -174,8 +156,7 @@ class ProcedureViewModel extends BaseViewModel {
}
}
Future valadteProcedure(
ProcedureValadteRequestModel procedureValadteRequestModel) async {
Future valadteProcedure(ProcedureValadteRequestModel procedureValadteRequestModel) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
@ -188,9 +169,7 @@ class ProcedureViewModel extends BaseViewModel {
}
}
Future updateProcedure(
{UpdateProcedureRequestModel updateProcedureRequestModel,
int mrn}) async {
Future updateProcedure({UpdateProcedureRequestModel updateProcedureRequestModel, int mrn}) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
@ -203,11 +182,9 @@ class ProcedureViewModel extends BaseViewModel {
//await getProcedure(mrn: mrn);
}
void getPatientRadOrders(PatiantInformtion patient,
{String patientType, bool isInPatient = false}) async {
void getPatientRadOrders(PatiantInformtion patient, {String patientType, bool isInPatient = false}) async {
setState(ViewState.Busy);
await _radiologyService.getPatientRadOrders(patient,
isInPatient: isInPatient);
await _radiologyService.getPatientRadOrders(patient, isInPatient: isInPatient);
if (_radiologyService.hasError) {
error = _radiologyService.error;
if (patientType == "7")
@ -216,39 +193,32 @@ class ProcedureViewModel extends BaseViewModel {
setState(ViewState.ErrorLocal);
} else {
_radiologyService.finalRadiologyList.forEach((element) {
List<FinalRadiologyList> finalRadiologyListClinic =
_finalRadiologyListClinic
.where((elementClinic) =>
elementClinic.filterName == element.clinicDescription)
.toList();
List<FinalRadiologyList> finalRadiologyListClinic = _finalRadiologyListClinic
.where((elementClinic) => elementClinic.filterName == element.clinicDescription)
.toList();
if (finalRadiologyListClinic.length != 0) {
_finalRadiologyListClinic[
finalRadiologyListClinic.indexOf(finalRadiologyListClinic[0])]
_finalRadiologyListClinic[finalRadiologyListClinic.indexOf(finalRadiologyListClinic[0])]
.finalRadiologyList
.add(element);
} else {
_finalRadiologyListClinic.add(FinalRadiologyList(
filterName: element.clinicDescription, finalRadiology: element));
_finalRadiologyListClinic
.add(FinalRadiologyList(filterName: element.clinicDescription, finalRadiology: element));
}
// FinalRadiologyList list sort via project
List<FinalRadiologyList> finalRadiologyListHospital =
_finalRadiologyListHospital
.where(
(elementClinic) =>
elementClinic.filterName == element.projectName,
)
.toList();
List<FinalRadiologyList> finalRadiologyListHospital = _finalRadiologyListHospital
.where(
(elementClinic) => elementClinic.filterName == element.projectName,
)
.toList();
if (finalRadiologyListHospital.length != 0) {
_finalRadiologyListHospital[finalRadiologyListHospital
.indexOf(finalRadiologyListHospital[0])]
_finalRadiologyListHospital[finalRadiologyListHospital.indexOf(finalRadiologyListHospital[0])]
.finalRadiologyList
.add(element);
} else {
_finalRadiologyListHospital.add(FinalRadiologyList(
filterName: element.projectName, finalRadiology: element));
_finalRadiologyListHospital.add(FinalRadiologyList(filterName: element.projectName, finalRadiology: element));
}
});
@ -258,17 +228,10 @@ class ProcedureViewModel extends BaseViewModel {
String get radImageURL => _radiologyService.url;
getRadImageURL(
{int invoiceNo,
int lineItem,
int projectId,
@required PatiantInformtion patient}) async {
getRadImageURL({int invoiceNo, int lineItem, int projectId, @required PatiantInformtion patient}) async {
setState(ViewState.Busy);
await _radiologyService.getRadImageURL(
invoiceNo: invoiceNo,
lineItem: lineItem,
projectId: projectId,
patient: patient);
invoiceNo: invoiceNo, lineItem: lineItem, projectId: projectId, patient: patient);
if (_radiologyService.hasError) {
error = _radiologyService.error;
setState(ViewState.Error);
@ -281,8 +244,7 @@ class ProcedureViewModel extends BaseViewModel {
notifyListeners();
}
List<PatientLabSpecialResult> get patientLabSpecialResult =>
_labsService.patientLabSpecialResult;
List<PatientLabSpecialResult> get patientLabSpecialResult => _labsService.patientLabSpecialResult;
List<LabResult> get labResultList => _labsService.labResultList;
@ -304,18 +266,10 @@ class ProcedureViewModel extends BaseViewModel {
}
getLaboratoryResult(
{String projectID,
int clinicID,
String invoiceNo,
String orderNo,
PatiantInformtion patient}) async {
{String projectID, int clinicID, String invoiceNo, String orderNo, PatiantInformtion patient}) async {
setState(ViewState.Busy);
await _labsService.getLaboratoryResult(
invoiceNo: invoiceNo,
orderNo: orderNo,
projectID: projectID,
clinicID: clinicID,
patient: patient);
invoiceNo: invoiceNo, orderNo: orderNo, projectID: projectID, clinicID: clinicID, patient: patient);
if (_labsService.hasError) {
error = _labsService.error;
setState(ViewState.Error);
@ -324,15 +278,10 @@ class ProcedureViewModel extends BaseViewModel {
}
}
getPatientLabOrdersResults(
{PatientLabOrders patientLabOrder,
String procedure,
PatiantInformtion patient}) async {
getPatientLabOrdersResults({PatientLabOrders patientLabOrder, String procedure, PatiantInformtion patient}) async {
setState(ViewState.Busy);
await _labsService.getPatientLabOrdersResults(
patientLabOrder: patientLabOrder,
procedure: procedure,
patient: patient);
patientLabOrder: patientLabOrder, procedure: procedure, patient: patient);
if (_labsService.hasError) {
error = _labsService.error;
setState(ViewState.Error);
@ -340,9 +289,8 @@ class ProcedureViewModel extends BaseViewModel {
bool isShouldClear = false;
if (_labsService.labOrdersResultsList.length == 1) {
labOrdersResultsList.forEach((element) {
if (element.resultValue.contains('/') ||
element.resultValue.contains('*') ||
element.resultValue.isEmpty) isShouldClear = true;
if (element.resultValue.contains('/') || element.resultValue.contains('*') || element.resultValue.isEmpty)
isShouldClear = true;
});
}
if (isShouldClear) _labsService.labOrdersResultsList.clear();

@ -4,12 +4,14 @@ class StartCallRes {
String openTokenID;
bool isAuthenticated;
int messageStatus;
String appointmentNo;
StartCallRes(
{this.result,
this.openSessionID,
this.openTokenID,
this.isAuthenticated,
this.appointmentNo,
this.messageStatus});
StartCallRes.fromJson(Map<String, dynamic> json) {
@ -18,6 +20,7 @@ class StartCallRes {
openTokenID = json['OpenTokenID'];
isAuthenticated = json['IsAuthenticated'];
messageStatus = json['MessageStatus'];
appointmentNo = json['AppointmentNo'];
}
Map<String, dynamic> toJson() {
@ -27,6 +30,7 @@ class StartCallRes {
data['OpenTokenID'] = this.openTokenID;
data['IsAuthenticated'] = this.isAuthenticated;
data['MessageStatus'] = this.messageStatus;
data['AppointmentNo'] = this.appointmentNo;
return data;
}
}

@ -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<String, dynamic> 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;
}

@ -224,7 +224,10 @@ class PatiantInformtion {
isSigned: json['isSigned'],
medicationOrders: json['medicationOrders'],
nationality: json['nationality'] ?? json['NationalityNameN'],
patientMRN: json['patientMRN'] ?? json['PatientMRN'],
patientMRN: json['patientMRN'] ?? json['PatientMRN']?? (
json["PatientID"] != null ?
int.parse(json["PatientID"].toString())
: int.parse(json["patientID"].toString())),
visitType: json['visitType'] ?? json['visitType'] ?? json['visitType'],
nationalityFlagURL:
json['NationalityFlagURL'] ?? json['NationalityFlagURL'],

@ -428,10 +428,11 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
model.patientVitalSignsHistory.length > 0
model.patientVitalSignsHistory.length == 0
? TranslationBase.of(context).vitalSignEmptyMsg
: TranslationBase.of(context).chiefComplaintEmptyMsg,
fontWeight: FontWeight.normal,
textAlign: TextAlign.center,
color: HexColor("#B8382B"),
fontSize: SizeConfig.textMultiplier * 2.5,
),

@ -27,6 +27,9 @@ class _LabsHomePageState extends State<LabsHomePage> {
String arrivalType;
PatiantInformtion patient;
bool isInpatient;
bool isFromLiveCare;
@override
void didChangeDependencies() {
super.didChangeDependencies();
@ -35,6 +38,8 @@ class _LabsHomePageState extends State<LabsHomePage> {
patientType = routeArgs['patientType'];
arrivalType = routeArgs['arrivalType'];
isInpatient = routeArgs['isInpatient'];
isFromLiveCare = routeArgs['isFromLiveCare'];
print(arrivalType);
}
@ -105,8 +110,9 @@ class _LabsHomePageState extends State<LabsHomePage> {
],
),
),
if (patient.patientStatusType != null &&
patient.patientStatusType == 43)
if ((patient.patientStatusType != null &&
patient.patientStatusType == 43) ||
(isFromLiveCare && patient.appointmentNo != null))
AddNewOrder(
onTap: () {
Navigator.push(

@ -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,
)
],
),
),

@ -290,11 +290,15 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
} else {
GifLoaderDialogUtils.showMyDialog(context);
await model.startCall( isReCall : false, vCID: patient.vcId);
if(model.state == ViewState.ErrorLocal) {
GifLoaderDialogUtils.hideDialog(context);
Helpers.showErrorToast(model.error);
} else {
await model.getDoctorProfile();
patient.appointmentNo = model.startCallRes.appointmentNo;
patient.episodeNo = 0;
GifLoaderDialogUtils.hideDialog(context);
await VideoChannel.openVideoCallScreen(
kToken: model.startCallRes.openTokenID,

@ -107,8 +107,8 @@ class ProfileGridForOther extends StatelessWidget {
PATIENT_UCAF_REQUEST,
'patient/ucaf.png',
isInPatient: isInpatient,
isDisable: patient.patientStatusType != 43 ||
patient.appointmentNo == null ? true : false),
isDisable: isFromLiveCare?patient.appointmentNo == null:patient.patientStatusType != 43 ||
patient.appointmentNo == null ),
if (isFromLiveCare ||
(patient.appointmentNo != null && patient.appointmentNo != 0))
PatientProfileCardModel(
@ -121,8 +121,9 @@ class ProfileGridForOther extends StatelessWidget {
REFER_PATIENT_TO_DOCTOR,
'patient/refer_patient.png',
isInPatient: isInpatient,
isDisable: patient.patientStatusType != 43 ||
patient.appointmentNo == null ? true : false),
isDisable: isFromLiveCare?patient.appointmentNo == null:patient.patientStatusType != 43 ||
patient.appointmentNo == null ,
),
if (isFromLiveCare ||
(patient.appointmentNo != null && patient.appointmentNo != 0))
PatientProfileCardModel(
@ -135,8 +136,9 @@ class ProfileGridForOther extends StatelessWidget {
PATIENT_ADMISSION_REQUEST,
'patient/admission_req.png',
isInPatient: isInpatient,
isDisable: patient.patientStatusType != 43 ||
patient.appointmentNo == null ? true : false),
isDisable: isFromLiveCare?patient.appointmentNo == null:patient.patientStatusType != 43 ||
patient.appointmentNo == null
),
];
return Column(

@ -0,0 +1,118 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_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/prescription/prescription_checkout_screen.dart';
import 'package:doctor_app_flutter/screens/procedures/entity_list_fav_procedure.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:flutter/material.dart';
class AddFavPrescription extends StatefulWidget {
final PrescriptionViewModel model;
final PatiantInformtion patient;
final String categoryID;
const AddFavPrescription({Key key, this.model, this.patient, this.categoryID}) : super(key: key);
@override
_AddFavPrescriptionState createState() => _AddFavPrescriptionState();
}
class _AddFavPrescriptionState extends State<AddFavPrescription> {
MedicineViewModel model;
PatiantInformtion patient;
List<ProcedureTempleteDetailsModel> entityList = List();
ProcedureTempleteDetailsModel groupProcedures;
@override
Widget build(BuildContext context) {
return BaseView<ProcedureViewModel>(
onModelReady: (model) => model.getProcedureTemplate(categoryID: widget.categoryID),
builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold(
isShowAppBar: false,
baseViewModel: model,
body: Column(
children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
),
if (model.templateList.length != 0)
Expanded(
child: NetworkBaseView(
baseViewModel: model,
child: EntityListCheckboxSearchFavProceduresWidget(
isProcedure: false,
model: model,
removeFavProcedure: (item) {
setState(() {
entityList.remove(item);
});
},
addFavProcedure: (history) {
setState(() {
entityList.add(history);
});
},
isEntityFavListSelected: (master) => isEntityListSelected(master),
groupProcedures: groupProcedures,
selectProcedures: (valasd) {
setState(() {
groupProcedures = valasd;
});
},
),
),
),
Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: 'Add Selected Prescription',
color: Color(0xff359846),
fontWeight: FontWeight.w700,
onPressed: () {
if (groupProcedures == null) {
DrAppToastMsg.showErrorToast(
'Please Select item ',
);
return;
}
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PrescriptionCheckOutScreen(
patient: widget.patient,
model: widget.model,
groupProcedures: groupProcedures,
),
),
);
},
),
],
),
),
],
),
),
);
}
bool isEntityListSelected(ProcedureTempleteDetailsModel masterKey) {
Iterable<ProcedureTempleteDetailsModel> history = entityList.where(
(element) => masterKey.templateID == element.templateID && masterKey.procedureName == element.procedureName);
if (history.length > 0) {
return true;
}
return false;
}
}

@ -6,7 +6,6 @@ import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
@ -15,6 +14,7 @@ import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.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/prescription/drugtodrug.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_text_filed.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
@ -23,7 +23,6 @@ import 'package:doctor_app_flutter/widgets/medicine/medicine_item_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/TextFields.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/dialogs/dailog-list-select.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
@ -45,7 +44,7 @@ addPrescriptionForm(context, PrescriptionViewModel model, PatiantInformtion pati
});
}
postProcedure(
postPrescription(
{String duration,
String doseTimeIn,
String dose,
@ -62,14 +61,14 @@ postProcedure(
PatiantInformtion patient,
String patientType}) async {
PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel();
List<PrescriptionRequestModel> sss = List();
List<PrescriptionRequestModel> prescriptionList = List();
postProcedureReqModel.appointmentNo = patient.appointmentNo;
postProcedureReqModel.clinicID = patient.clinicId;
postProcedureReqModel.episodeID = patient.episodeNo;
postProcedureReqModel.patientMRN = patient.patientMRN;
sss.add(PrescriptionRequestModel(
prescriptionList.add(PrescriptionRequestModel(
covered: true,
dose: double.parse(dose),
itemId: drugId.isEmpty ? 1 : int.parse(drugId),
@ -82,9 +81,7 @@ postProcedure(
doseTime: doseTimeIn.isEmpty ? 1 : int.parse(doseTimeIn),
duration: duration.isEmpty ? 1 : int.parse(duration),
doseStartDate: doseTime.toIso8601String()));
postProcedureReqModel.prescriptionRequestModel = sss;
//postProcedureReqModel.procedures = controlsProcedure;
postProcedureReqModel.prescriptionRequestModel = prescriptionList;
await model.postPrescription(postProcedureReqModel, patient.patientMRN);
if (model.state == ViewState.ErrorLocal) {
@ -97,8 +94,9 @@ postProcedure(
class PrescriptionFormWidget extends StatefulWidget {
final PrescriptionViewModel model;
PatiantInformtion patient;
List<PrescriptionModel> prescriptionList;
final PatiantInformtion patient;
final List<PrescriptionModel> prescriptionList;
PrescriptionFormWidget(this.model, this.patient, this.prescriptionList);
@override
@ -114,10 +112,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
String strengthError;
int selectedType;
TextEditingController durationController = TextEditingController();
TextEditingController strengthController = TextEditingController();
TextEditingController routeController = TextEditingController();
TextEditingController frequencyController = TextEditingController();
TextEditingController indicationController = TextEditingController();
TextEditingController instructionController = TextEditingController();
@ -126,7 +122,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
final myController = TextEditingController();
DateTime selectedDate;
dynamic selectedDrug;
int strengthChar;
GetMedicationResponseModel _selectedMedication;
GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
@ -138,15 +133,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
var event = RobotProvider();
var reconizedWord;
var notesList;
var filteredNotesList;
String textSeartch = "Amoxicillin";
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
final double spaceBetweenTextFileds = 12;
List<dynamic> referToList;
dynamic type;
dynamic strength;
dynamic route;
dynamic frequency;
dynamic duration;
@ -157,39 +145,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
dynamic box;
dynamic x;
List<dynamic> indicationList;
String routeInatial = 'By Mouth';
//PatiantInformtion patient;
@override
void initState() {
super.initState();
selectedType = 1;
referToList = List();
indicationList = List();
dynamic indication1 = {"id": 545, "name": "Gingival Hyperplasia"};
dynamic indication2 = {"id": 546, "name": "Mild Drowsiness"};
dynamic indication3 = {"id": 547, "name": "Hypertrichosis"};
dynamic indication4 = {"id": 548, "name": "Mild Dizziness"};
dynamic indication5 = {"id": 549, "name": "Enlargement of Facial Features"};
dynamic indication6 = {"id": 550, "name": "Phenytoin Hypersensitivity Syndrome"};
dynamic indication7 = {"id": 551, "name": "Asterixis"};
dynamic indication8 = {"id": 552, "name": "Bullous Dermatitis"};
dynamic indication9 = {"id": 554, "name": "Purpuric Dermatitis"};
dynamic indication10 = {"id": 555, "name": "Systemic Lupus Erythematosus"};
indicationList.add(indication1);
indicationList.add(indication2);
indicationList.add(indication3);
indicationList.add(indication4);
indicationList.add(indication5);
indicationList.add(indication6);
indicationList.add(indication7);
indicationList.add(indication8);
indicationList.add(indication9);
indicationList.add(indication10);
}
setSelectedType(int val) {
@ -215,7 +174,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
void errorListener(SpeechRecognitionError error) {
event.setValue({"searchText": 'null'});
//SpeechToText.closeAlertDialog(context);
print(error);
}
@ -252,13 +210,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
@override
Widget build(BuildContext context) {
ListSelectDialog drugDialog;
final screenSize = MediaQuery.of(context).size;
ProjectViewModel projectViewModel = Provider.of(context);
// final routeArgs = ModalRoute.of(context).settings.arguments as Map;
// patient = routeArgs['patient'];
return BaseView<MedicineViewModel>(
onModelReady: (model) async {
x = model.patientAssessmentList.map((element) {
@ -270,22 +223,16 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
editedBy: '',
doctorID: '',
appointmentNo: widget.patient.appointmentNo);
//await model.getMedicationList();
if (model.medicationStrengthList.length == 0) {
await model.getMedicationStrength();
}
//await model.getPrescription(mrn: widget.patient.patientMRN);
if (model.medicationDurationList.length == 0) {
await model.getMedicationDuration();
}
//await model.getMedicationRoute();
//await model.getMedicationFrequency();
if (model.medicationDoseTimeList.length == 0) {
await model.getMedicationDoseTime();
}
//await model.getMedicationIndications();
await model.getPatientAssessment(getAssessmentReqModel);
//await model.getItem();
},
builder: (
BuildContext context,
@ -310,13 +257,11 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
child: Column(
//crossAxisAlignment: CrossAxisAlignment.start,
//mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Column(
children: [
SizedBox(
height: 15,
height: 60,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -346,7 +291,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: Form(
key: formKey,
child: Column(
//mainAxisAlignment: MainAxisAlignment.end,
children: [
FractionallySizedBox(
widthFactor: 0.9,
@ -401,20 +345,14 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
height: MediaQuery.of(context).size.height * 0.5,
child: ListView.builder(
padding: const EdgeInsets.only(top: 20),
scrollDirection: Axis.vertical,
// shrinkWrap: true,
itemCount: model.allMedicationList == null
? 0
: model.allMedicationList.length,
itemBuilder: (BuildContext context, int index) {
return InkWell(
child: MedicineItemWidget(
label: model.allMedicationList[index].description
// url: model
// .pharmacyItemsList[
// index]["ImageSRCUrl"],
),
label: model.allMedicationList[index].description),
onTap: () {
model.getItem(itemID: model.allMedicationList[index].itemId);
visbiltyPrescriptionForm = true;
@ -457,7 +395,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
setSelectedType(value);
},
),
Text('Regular'),
Text(TranslationBase.of(context).regular),
],
),
),
@ -467,12 +405,11 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: Row(
children: [
Container(
color: Colors.white,
width: MediaQuery.of(context).size.width * 0.35,
child: AppTextFieldCustom(
height: 40,
validationError: strengthError,
hintText: 'Strength' + "*",
hintText: 'Strength',
isTextFieldHasSuffix: false,
enabled: true,
controller: strengthController,
@ -489,217 +426,83 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
inputType: TextInputType.numberWithOptions(
decimal: true,
),
// keyboardType: TextInputType
// .numberWithOptions(
// decimal: true,
// ),
),
),
SizedBox(
width: 5.0,
),
Container(
color: Colors.white,
PrescriptionTextFiled(
width: MediaQuery.of(context).size.width * 0.560,
child: InkWell(
onTap: model.itemMedicineListUnit != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog(
list: model.itemMedicineListUnit,
attributeName: 'description',
attributeValueId: 'parameterCode',
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
units = selectedValue;
units['isDefault'] = true;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: AppTextFieldCustom(
hintText: 'Select',
isTextFieldHasSuffix: true,
dropDownText: model.itemMedicineListUnit.length == 1
? units = model.itemMedicineListUnit[0]['description']
: units != null
? units['description'].toString()
: null,
validationError:
model.itemMedicineListUnit.length != 1 ? unitError : null,
enabled: false),
),
element: units,
elementError: unitError,
keyName: 'description',
keyId: 'parameterCode',
hintText: 'Select',
elementList: model.itemMedicineListUnit,
okFunction: (selectedValue) {
setState(() {
units = selectedValue;
units['isDefault'] = true;
});
},
),
],
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
//height: screenSize.height * 0.070,
color: Colors.white,
child: InkWell(
onTap: model.itemMedicineListRoute != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog(
list: model.itemMedicineListRoute,
attributeName: 'description',
attributeValueId: 'parameterCode',
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
route = selectedValue;
route['isDefault'] = true;
});
if (route == null) {
Helpers.showErrorToast('plase fill');
}
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: AppTextFieldCustom(
// decoration:
// textFieldSelectorDecoration(
// TranslationBase.of(
// context)
// .route,
// model.itemMedicineListRoute
// .length ==
// 1
// ? model.itemMedicineListRoute[
// 0]
// ['description']
// : route != null
// ? route[
// 'description']
// : null,
// true),
hintText: TranslationBase.of(context).route + "*",
dropDownText: model.itemMedicineListRoute.length == 1
? model.itemMedicineListRoute[0]['description']
: route != null
? route['description']
: null,
isTextFieldHasSuffix: true,
//height: 45,
validationError:
model.itemMedicineListRoute.length != 1 ? routeError : null,
enabled: false,
),
),
PrescriptionTextFiled(
elementList: model.itemMedicineListRoute,
element: route,
elementError: routeError,
keyId: 'parameterCode',
keyName: 'description',
okFunction: (selectedValue) {
setState(() {
route = selectedValue;
route['isDefault'] = true;
});
},
hintText: TranslationBase.of(context).route,
),
SizedBox(height: spaceBetweenTextFileds),
Container(
//height: screenSize.height * 0.070,
color: Colors.white,
child: InkWell(
onTap: model.itemMedicineList != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog(
list: model.itemMedicineList,
attributeName: 'description',
attributeValueId: 'parameterCode',
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
frequency = selectedValue;
frequency['isDefault'] = true;
if (_selectedMedication != null &&
duration != null &&
frequency != null &&
strengthController.text != null) {
model.getBoxQuantity(
freq: frequency['parameterCode'],
duration: duration['id'],
itemCode: _selectedMedication.itemId,
strength: double.parse(strengthController.text));
return;
}
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: AppTextFieldCustom(
isTextFieldHasSuffix: true,
hintText: TranslationBase.of(context).frequency + "*",
dropDownText: model.itemMedicineList.length == 1
? model.itemMedicineList[0]['description']
: frequency != null
? frequency['description']
: null,
validationError:
model.itemMedicineList.length != 1 ? frequencyError : null,
enabled: false,
),
),
),
PrescriptionTextFiled(
hintText: TranslationBase.of(context).frequency,
elementError: frequencyError,
element: frequency,
elementList: model.itemMedicineList,
keyId: 'parameterCode',
keyName: 'description',
okFunction: (selectedValue) {
setState(() {
frequency = selectedValue;
frequency['isDefault'] = true;
if (_selectedMedication != null &&
duration != null &&
frequency != null &&
strengthController.text != null) {
model.getBoxQuantity(
freq: frequency['parameterCode'],
duration: duration['id'],
itemCode: _selectedMedication.itemId,
strength: double.parse(strengthController.text));
return;
}
});
}),
SizedBox(height: spaceBetweenTextFileds),
Container(
//height: screenSize.height * 0.070,
color: Colors.white,
child: InkWell(
onTap: model.medicationDoseTimeList != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog(
list: model.medicationDoseTimeList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
doseTime = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: AppTextFieldCustom(
hintText: TranslationBase.of(context).doseTime + "*",
isTextFieldHasSuffix: true,
dropDownText: doseTime != null ? doseTime['nameEn'] : null,
//height: 45,
enabled: false,
validationError: doseTimeError,
),
),
),
PrescriptionTextFiled(
hintText: TranslationBase.of(context).doseTime,
elementError: doseTimeError,
element: doseTime,
elementList: model.medicationDoseTimeList,
keyId: 'id',
keyName: 'nameEn',
okFunction: (selectedValue) {
setState(() {
doseTime = selectedValue;
});
}),
SizedBox(height: spaceBetweenTextFileds),
if (model.patientAssessmentList.isNotEmpty)
Container(
@ -710,40 +513,26 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
children: [
Container(
width: MediaQuery.of(context).size.width * 0.29,
child: InkWell(
onTap: indicationList != null
? () {
Helpers.hideKeyboard(context);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
model.patientAssessmentList[0].icdCode10ID.toString(),
indication != null ? indication['name'] : null,
false),
enabled: true,
readOnly: true,
),
child: TextField(
decoration: textFieldSelectorDecoration(
model.patientAssessmentList[0].icdCode10ID.toString(),
indication != null ? indication['name'] : null,
false),
enabled: true,
readOnly: true,
),
),
Container(
width: MediaQuery.of(context).size.width * 0.65,
color: Colors.white,
child: InkWell(
onTap: indicationList != null
? () {
Helpers.hideKeyboard(context);
}
: null,
child: TextField(
maxLines: 5,
decoration: textFieldSelectorDecoration(
model.patientAssessmentList[0].asciiDesc.toString(),
indication != null ? indication['name'] : null,
false),
enabled: true,
readOnly: true,
),
child: TextField(
maxLines: 5,
decoration: textFieldSelectorDecoration(
model.patientAssessmentList[0].asciiDesc.toString(),
indication != null ? indication['name'] : null,
false),
enabled: true,
readOnly: true,
),
),
],
@ -757,7 +546,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
onTap: () => selectDate(context, widget.model),
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).date + "*",
TranslationBase.of(context).date,
selectedDate != null
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
@ -771,132 +560,55 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
//height: screenSize.height * 0.070,
color: Colors.white,
child: InkWell(
onTap: model.medicationDurationList != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog(
list: model.medicationDurationList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
duration = selectedValue;
if (_selectedMedication != null &&
duration != null &&
frequency != null &&
strengthController.text != null) {
model.getBoxQuantity(
freq: frequency['parameterCode'],
duration: duration['id'],
itemCode: _selectedMedication.itemId,
strength: double.parse(strengthController.text),
);
box = model.boxQuintity;
PrescriptionTextFiled(
element: duration,
elementError: durationError,
hintText: TranslationBase.of(context).duration,
elementList: model.medicationDurationList,
keyName: 'nameEn',
keyId: 'id',
okFunction: (selectedValue) {
setState(() {
duration = selectedValue;
if (_selectedMedication != null &&
duration != null &&
frequency != null &&
strengthController.text != null) {
model.getBoxQuantity(
freq: frequency['parameterCode'],
duration: duration['id'],
itemCode: _selectedMedication.itemId,
strength: double.parse(strengthController.text),
);
box = model.boxQuintity;
return;
}
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: AppTextFieldCustom(
validationError: durationError,
isTextFieldHasSuffix: true,
dropDownText: duration != null ? duration['nameEn'] : null,
hintText: TranslationBase.of(context).duration + "*",
enabled: false,
),
),
return;
}
});
},
),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
color: Colors.white,
child: InkWell(
onTap: model.allMedicationList != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog(
list: model.allMedicationList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
duration = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration("UOM", uom != null ? uom : null, false),
//enabled: false,
readOnly: true,
),
child: AppTextFieldCustom(
hintText: "UOM",
isTextFieldHasSuffix: false,
dropDownText: uom != null ? uom : null,
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
color: Colors.white,
child: InkWell(
onTap: model.allMedicationList != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog(
list: model.allMedicationList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
duration = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
child: AppTextFieldCustom(
hintText: TranslationBase.of(context).boxQuantity,
isTextFieldHasSuffix: false,
dropDownText: box != null
? TranslationBase.of(context).boxQuantity +
": " +
model.boxQuintity.toString()
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).boxQuantity,
box != null
? TranslationBase.of(context).boxQuantity +
": " +
model.boxQuintity.toString()
: null,
false),
//enabled: false,
readOnly: true,
),
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFileds),
@ -914,7 +626,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
//keyboardType: TextInputType.number,
),
Positioned(
top: 0, //MediaQuery.of(context).size.height * 0,
top: 0,
right: 15,
child: IconButton(
icon: Icon(
@ -923,7 +635,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
size: 35,
),
onPressed: () {
initSpeechState().then((value) => {onVoiceText()});
setState(() {
initSpeechState().then((value) => {onVoiceText()});
});
},
),
),
@ -1087,30 +801,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
}
formKey.currentState.save();
// Navigator.pop(context);
// openDrugToDrug();
// if (frequency == null ||
// strengthController
// .text ==
// "" ||
// doseTime == null ||
// duration == null ||
// selectedDate == null) {
// DrAppToastMsg.showErrorToast(
// TranslationBase.of(
// context)
// .pleaseFillAllFields);
// return;
// }
{
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// NewPrescriptionScreen()),
// );
}
},
),
],
@ -1193,46 +883,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
);
}
InputDecoration textFieldSelectorDecorationStreangrh(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(0xFFEFEFEF), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFEFEFEF), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
suffixIcon: isDropDown
? suffixIcon != null
? suffixIcon
: Icon(
Icons.keyboard_arrow_down_sharp,
color: Color(0xff2E303A),
)
: null,
hintStyle: TextStyle(
fontSize: 13,
color: Color(0xff2E303A),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
),
hintText: selectedText == null || selectedText == "" ? hintText : null,
labelText: selectedText != null && selectedText != "" ? '\n$selectedText' : null,
labelStyle: TextStyle(
fontSize: 15,
color: Color(0xff2E303A),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
),
);
}
openDrugToDrug(model) {
showModalBottomSheet(
context: context,
@ -1253,19 +903,12 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
onPressed: () {
Navigator.pop(context);
postProcedure(
postPrescription(
icdCode: model.patientAssessmentList.isNotEmpty
? model.patientAssessmentList[0].icdCode10ID.isEmpty
? "test"
: model.patientAssessmentList[0].icdCode10ID.toString()
: "test",
// icdCode: model
// .patientAssessmentList
// .map((value) => value
// .icdCode10ID
// .trim())
// .toList()
// .join(' '),
dose: strengthController.text,
doseUnit: model.itemMedicineListUnit.length == 1
? model.itemMedicineListUnit[0]['parameterCode'].toString()
@ -1286,36 +929,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
instruction: instructionController.text,
doseTime: selectedDate,
);
// postProcedure(
// icdCode: model.patientAssessmentList.isNotEmpty
// ? model.patientAssessmentList[0].icdCode10ID
// .isEmpty
// ? "test"
// : model.patientAssessmentList[0].icdCode10ID
// .toString()
// : "test",
// // icdCode: model
// // .patientAssessmentList
// // .map((value) => value
// // .icdCode10ID
// // .trim())
// // .toList()
// // .join(' '),
// dose: strengthController.text,
// doseUnit: units['parameterCode'].toString(),
// patient: widget.patient,
// doseTimeIn: doseTime['id'].toString(),
// model: widget.model,
// duration: duration['id'].toString(),
// frequency: frequency['parameterCode'].toString(),
// route: route['parameterCode'].toString(),
// drugId: _selectedMedication.itemId.toString(),
// strength: strengthController.text,
// indication: indicationController.text,
// instruction: instructionController.text,
// doseTime: selectedDate,
// );
},
))
],
@ -1327,15 +940,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
});
}
// selectedValue(itemMdeicationList,key){
// // String selected = "";
// // units[key]=itemMdeicationList.length==1? itemMdeicationList[0][key]:units[key].toString();
// //
// // selected = units[key];
// //
// // return selected;
// // }
getPriscriptionforDrug(List<PrescriptionModel> prescriptionList, MedicineViewModel model) {
var prescriptionDetails = [];
if (prescriptionList.length > 0) {
@ -1381,19 +985,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
searchMedicine(context, MedicineViewModel model) async {
FocusScope.of(context).unfocus();
// if (myController.text.isEmpty()) {
// Helpers.showErrorToast(TranslationBase.of(context).typeMedicineName);
// //"Type Medicine Name")
// return;
// }
if (myController.text.length < 3) {
Helpers.showErrorToast(TranslationBase.of(context).moreThan3Letter);
return;
}
//GifLoaderDialogUtils.showMyDialog(context);
await model.getMedicationList(drug: myController.text);
//GifLoaderDialogUtils.hideDialog(context);
}
}

@ -0,0 +1,762 @@
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.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/prescription/prescription_text_filed.dart';
import 'package:doctor_app_flutter/util/date-utils.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/TextFields.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/speech-text-popup.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:speech_to_text/speech_recognition_error.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt;
class PrescriptionCheckOutScreen extends StatefulWidget {
final PrescriptionViewModel model;
final PatiantInformtion patient;
final List<PrescriptionModel> prescriptionList;
final ProcedureTempleteDetailsModel groupProcedures;
const PrescriptionCheckOutScreen({Key key, this.model, this.patient, this.prescriptionList, this.groupProcedures})
: super(key: key);
@override
_PrescriptionCheckOutScreenState createState() => _PrescriptionCheckOutScreenState();
}
class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen> {
postPrescription(
{String duration,
String doseTimeIn,
String dose,
String drugId,
String strength,
String route,
String frequency,
String indication,
String instruction,
PrescriptionViewModel model,
DateTime doseTime,
String doseUnit,
String icdCode,
PatiantInformtion patient,
String patientType}) async {
PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel();
List<PrescriptionRequestModel> prescriptionList = List();
postProcedureReqModel.appointmentNo = patient.appointmentNo;
postProcedureReqModel.clinicID = patient.clinicId;
postProcedureReqModel.episodeID = patient.episodeNo;
postProcedureReqModel.patientMRN = patient.patientMRN;
prescriptionList.add(PrescriptionRequestModel(
covered: true,
dose: double.parse(dose),
itemId: drugId.isEmpty ? 1 : int.parse(drugId),
doseUnitId: int.parse(doseUnit),
route: route.isEmpty ? 1 : int.parse(route),
frequency: frequency.isEmpty ? 1 : int.parse(frequency),
remarks: instruction,
approvalRequired: true,
icdcode10Id: icdCode.toString(),
doseTime: doseTimeIn.isEmpty ? 1 : int.parse(doseTimeIn),
duration: duration.isEmpty ? 1 : int.parse(duration),
doseStartDate: doseTime.toIso8601String()));
postProcedureReqModel.prescriptionRequestModel = prescriptionList;
await model.postPrescription(postProcedureReqModel, patient.patientMRN);
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
} else if (model.state == ViewState.Idle) {
model.getPrescriptions(patient);
DrAppToastMsg.showSuccesToast('Medication has been added');
}
}
String routeError;
String frequencyError;
String doseTimeError;
String durationError;
String unitError;
String strengthError;
int selectedType;
TextEditingController strengthController = TextEditingController();
TextEditingController indicationController = TextEditingController();
TextEditingController instructionController = TextEditingController();
bool visbiltyPrescriptionForm = true;
bool visbiltySearch = true;
final myController = TextEditingController();
DateTime selectedDate;
int strengthChar;
GetMedicationResponseModel _selectedMedication;
GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
TextEditingController drugIdController = TextEditingController();
TextEditingController doseController = TextEditingController();
final searchController = TextEditingController();
stt.SpeechToText speech = stt.SpeechToText();
var event = RobotProvider();
var reconizedWord;
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
final double spaceBetweenTextFileds = 12;
dynamic route;
dynamic frequency;
dynamic duration;
dynamic doseTime;
dynamic indication;
dynamic units;
dynamic uom;
dynamic box;
dynamic x;
@override
void initState() {
super.initState();
selectedType = 1;
}
onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speech.initialize(onStatus: statusListener, onError: errorListener);
if (available) {
speech.listen(
onResult: resultListener,
listenMode: stt.ListenMode.confirmation,
localeId: lang == 'en' ? 'en-US' : 'ar-SA',
);
} else {
print("The user has denied the use of speech recognition.");
}
}
void errorListener(SpeechRecognitionError error) {
event.setValue({"searchText": 'null'});
print(error);
}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
}
void requestPermissions() async {
Map<Permission, PermissionStatus> statuses = await [
Permission.microphone,
].request();
}
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speech.stop();
indicationController.text += reconizedWord + '\n';
});
} else {
print(result.finalResult);
}
}
Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener);
print(hasSpeech);
if (!mounted) return;
}
setSelectedType(int val) {
setState(() {
selectedType = val;
});
}
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
return BaseView<MedicineViewModel>(
onModelReady: (model) async {
model.getItem(itemID: int.parse(widget.groupProcedures.aliasN.replaceAll("item code ;", "")));
x = model.patientAssessmentList.map((element) {
return element.icdCode10ID;
});
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel(
patientMRN: widget.patient.patientMRN,
episodeID: widget.patient.episodeNo.toString(),
editedBy: '',
doctorID: '',
appointmentNo: widget.patient.appointmentNo);
if (model.medicationStrengthList.length == 0) {
await model.getMedicationStrength();
}
if (model.medicationDurationList.length == 0) {
await model.getMedicationDuration();
}
if (model.medicationDoseTimeList.length == 0) {
await model.getMedicationDoseTime();
}
await model.getPatientAssessment(getAssessmentReqModel);
},
builder: (
BuildContext context,
MedicineViewModel model,
Widget child,
) =>
AppScaffold(
backgroundColor: Color(0xffF8F8F8).withOpacity(0.9),
isShowAppBar: false,
body: NetworkBaseView(
baseViewModel: model,
child: GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(new FocusNode());
},
child: SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height * 1.35,
color: Color(0xffF8F8F8),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
child: Column(
children: [
Column(
children: [
SizedBox(
height: 60,
),
Row(
//mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
InkWell(
child: Icon(
Icons.arrow_back_ios,
size: 24.0,
),
onTap: () {
Navigator.pop(context);
},
),
SizedBox(
width: 7.0,
),
AppText(
TranslationBase.of(context).newPrescriptionOrder,
fontWeight: FontWeight.w700,
fontSize: 20,
),
],
),
],
),
SizedBox(
height: spaceBetweenTextFileds,
),
Container(
child: Form(
key: formKey,
child: Column(
children: [
Container(
child: Column(
children: [
SizedBox(
height: 14.5,
),
],
),
),
SizedBox(
height: spaceBetweenTextFileds,
),
Visibility(
visible: visbiltyPrescriptionForm,
child: Container(
child: Column(
children: [
AppText(
widget.groupProcedures.procedureName ?? "",
bold: true,
),
Container(
child: Row(
children: [
AppText(
TranslationBase.of(context).orderType,
fontWeight: FontWeight.w600,
),
Radio(
activeColor: Color(0xFFB9382C),
value: 1,
groupValue: selectedType,
onChanged: (value) {
setSelectedType(value);
},
),
Text(TranslationBase.of(context).regular),
],
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
width: double.infinity,
child: Row(
children: [
Container(
width: MediaQuery.of(context).size.width * 0.35,
child: AppTextFieldCustom(
height: 40,
validationError: strengthError,
hintText: 'Strength',
isTextFieldHasSuffix: false,
enabled: true,
controller: strengthController,
onChanged: (String value) {
setState(() {
strengthChar = value.length;
});
if (strengthChar >= 5) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).only5DigitsAllowedForStrength,
);
}
},
inputType: TextInputType.numberWithOptions(
decimal: true,
),
),
),
SizedBox(
width: 5.0,
),
PrescriptionTextFiled(
width: MediaQuery.of(context).size.width * 0.560,
element: units,
elementError: unitError,
keyName: 'description',
keyId: 'parameterCode',
hintText: 'Select',
elementList: model.itemMedicineListUnit,
okFunction: (selectedValue) {
setState(() {
units = selectedValue;
units['isDefault'] = true;
});
},
),
],
),
),
SizedBox(height: spaceBetweenTextFileds),
PrescriptionTextFiled(
elementList: model.itemMedicineListRoute,
element: route,
elementError: routeError,
keyId: 'parameterCode',
keyName: 'description',
okFunction: (selectedValue) {
setState(() {
route = selectedValue;
route['isDefault'] = true;
});
},
hintText: TranslationBase.of(context).route,
),
SizedBox(height: spaceBetweenTextFileds),
PrescriptionTextFiled(
hintText: TranslationBase.of(context).frequency,
elementError: frequencyError,
element: frequency,
elementList: model.itemMedicineList,
keyId: 'parameterCode',
keyName: 'description',
okFunction: (selectedValue) {
setState(() {
frequency = selectedValue;
frequency['isDefault'] = true;
if (_selectedMedication != null &&
duration != null &&
frequency != null &&
strengthController.text != null) {
model.getBoxQuantity(
freq: frequency['parameterCode'],
duration: duration['id'],
itemCode: _selectedMedication.itemId,
strength: double.parse(strengthController.text));
return;
}
});
}),
SizedBox(height: spaceBetweenTextFileds),
PrescriptionTextFiled(
hintText: TranslationBase.of(context).doseTime,
elementError: doseTimeError,
element: doseTime,
elementList: model.medicationDoseTimeList,
keyId: 'id',
keyName: 'nameEn',
okFunction: (selectedValue) {
setState(() {
doseTime = selectedValue;
});
}),
SizedBox(height: spaceBetweenTextFileds),
if (model.patientAssessmentList.isNotEmpty)
Container(
height: screenSize.height * 0.070,
width: double.infinity,
color: Colors.white,
child: Row(
children: [
Container(
width: MediaQuery.of(context).size.width * 0.29,
child: TextField(
decoration: textFieldSelectorDecoration(
model.patientAssessmentList[0].icdCode10ID.toString(),
indication != null ? indication['name'] : null,
false),
enabled: true,
readOnly: true,
),
),
Container(
width: MediaQuery.of(context).size.width * 0.65,
color: Colors.white,
child: TextField(
maxLines: 5,
decoration: textFieldSelectorDecoration(
model.patientAssessmentList[0].asciiDesc.toString(),
indication != null ? indication['name'] : null,
false),
enabled: true,
readOnly: true,
),
),
],
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
color: Colors.white,
child: InkWell(
onTap: () => selectDate(context, widget.model),
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).date,
selectedDate != null
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
true,
suffixIcon: Icon(
Icons.calendar_today,
color: Colors.black,
)),
enabled: false,
),
),
),
SizedBox(height: spaceBetweenTextFileds),
PrescriptionTextFiled(
element: duration,
elementError: durationError,
hintText: TranslationBase.of(context).duration,
elementList: model.medicationDurationList,
keyName: 'nameEn',
keyId: 'id',
okFunction: (selectedValue) {
setState(() {
duration = selectedValue;
if (_selectedMedication != null &&
duration != null &&
frequency != null &&
strengthController.text != null) {
model.getBoxQuantity(
freq: frequency['parameterCode'],
duration: duration['id'],
itemCode: _selectedMedication.itemId,
strength: double.parse(strengthController.text),
);
box = model.boxQuintity;
return;
}
});
},
),
SizedBox(height: spaceBetweenTextFileds),
// Container(
// color: Colors.white,
// child: AppTextFieldCustom(
// hintText: "UOM",
// isTextFieldHasSuffix: false,
// dropDownText: uom != null ? uom : null,
// enabled: false,
// ),
// ),
SizedBox(height: spaceBetweenTextFileds),
// Container(
// color: Colors.white,
// child: AppTextFieldCustom(
// hintText: TranslationBase.of(context).boxQuantity,
// isTextFieldHasSuffix: false,
// dropDownText: box != null
// ? TranslationBase.of(context).boxQuantity +
// ": " +
// model.boxQuintity.toString()
// : null,
// enabled: false,
// ),
// ),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
child: Stack(
children: [
TextFields(
maxLines: 6,
minLines: 4,
hintText: TranslationBase.of(context).instruction,
controller: instructionController,
//keyboardType: TextInputType.number,
),
Positioned(
top: 0,
right: 15,
child: IconButton(
icon: Icon(
DoctorApp.speechtotext,
color: Colors.black,
size: 35,
),
onPressed: () {
setState(() {
initSpeechState().then((value) => {onVoiceText()});
});
},
),
),
],
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
color: Color(0xff359846),
title: TranslationBase.of(context).addMedication,
fontWeight: FontWeight.w600,
onPressed: () async {
if (route != null &&
duration != null &&
doseTime != null &&
frequency != null &&
units != null &&
selectedDate != null &&
strengthController.text != "") {
// if (_selectedMedication.isNarcotic == true) {
// DrAppToastMsg.showErrorToast(TranslationBase.of(context)
// .narcoticMedicineCanOnlyBePrescribedFromVida);
// Navigator.pop(context);
// return;
// }
if (double.parse(strengthController.text) > 1000.0) {
DrAppToastMsg.showErrorToast("1000 is the MAX for the strength");
return;
}
if (double.parse(strengthController.text) < 0.0) {
DrAppToastMsg.showErrorToast("strength can't be zero");
return;
}
if (formKey.currentState.validate()) {
Navigator.pop(context);
// openDrugToDrug(model);
{
postPrescription(
icdCode: model.patientAssessmentList.isNotEmpty
? model.patientAssessmentList[0].icdCode10ID.isEmpty
? "test"
: model.patientAssessmentList[0].icdCode10ID.toString()
: "test",
// icdCode: model
// .patientAssessmentList
// .map((value) => value
// .icdCode10ID
// .trim())
// .toList()
// .join(' '),
dose: strengthController.text,
doseUnit: model.itemMedicineListUnit.length == 1
? model.itemMedicineListUnit[0]['parameterCode'].toString()
: units['parameterCode'].toString(),
patient: widget.patient,
doseTimeIn: doseTime['id'].toString(),
model: widget.model,
duration: duration['id'].toString(),
frequency: model.itemMedicineList.length == 1
? model.itemMedicineList[0]['parameterCode'].toString()
: frequency['parameterCode'].toString(),
route: model.itemMedicineListRoute.length == 1
? model.itemMedicineListRoute[0]['parameterCode'].toString()
: route['parameterCode'].toString(),
drugId: (widget.groupProcedures.aliasN
.replaceAll("item code ;", "")),
strength: strengthController.text,
indication: indicationController.text,
instruction: instructionController.text,
doseTime: selectedDate,
);
}
}
} else {
setState(() {
if (duration == null) {
durationError = TranslationBase.of(context).fieldRequired;
} else {
durationError = null;
}
if (doseTime == null) {
doseTimeError = TranslationBase.of(context).fieldRequired;
} else {
doseTimeError = null;
}
if (route == null) {
routeError = TranslationBase.of(context).fieldRequired;
} else {
routeError = null;
}
if (frequency == null) {
frequencyError = TranslationBase.of(context).fieldRequired;
} else {
frequencyError = null;
}
if (units == null) {
unitError = TranslationBase.of(context).fieldRequired;
} else {
unitError = null;
}
if (strengthController.text == "") {
strengthError = TranslationBase.of(context).fieldRequired;
} else {
strengthError = null;
}
});
}
formKey.currentState.save();
},
),
],
),
),
],
),
),
),
],
),
),
),
],
),
),
),
),
),
),
),
);
}
selectDate(BuildContext context, PrescriptionViewModel model) async {
Helpers.hideKeyboard(context);
DateTime selectedDate;
selectedDate = DateTime.now();
final DateTime picked = await showDatePicker(
context: context,
initialDate: selectedDate,
firstDate: DateTime.now(),
lastDate: DateTime(2040),
initialEntryMode: DatePickerEntryMode.calendar,
);
if (picked != null && picked != selectedDate) {
setState(() {
this.selectedDate = picked;
});
}
}
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(0xFFEFEFEF), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFEFEFEF), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
hintText: selectedText != null ? selectedText : hintText,
suffixIcon: isDropDown
? suffixIcon != null
? suffixIcon
: Icon(
Icons.keyboard_arrow_down_sharp,
color: Color(0xff2E303A),
)
: null,
hintStyle: TextStyle(
fontSize: 13,
color: Color(0xff2E303A),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
),
labelText: selectedText != null ? '$hintText\n$selectedText' : null,
labelStyle: TextStyle(
fontSize: 13,
color: Color(0xff2E303A),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
),
);
}
}

@ -0,0 +1,203 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_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/prescription/add_favourite_prescription.dart';
import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.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/material.dart';
class PrescriptionHomeScreen extends StatefulWidget {
final PrescriptionViewModel model;
final PatiantInformtion patient;
const PrescriptionHomeScreen({Key key, this.model, this.patient}) : super(key: key);
@override
_PrescriptionHomeScreenState createState() => _PrescriptionHomeScreenState();
}
class _PrescriptionHomeScreenState extends State<PrescriptionHomeScreen> with SingleTickerProviderStateMixin {
PrescriptionViewModel 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<ProcedureViewModel>(
//onModelReady: (model) => model.getCategory(),
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(children: [
InkWell(
child: Icon(
Icons.arrow_back_ios,
size: 24.0,
),
onTap: () {
Navigator.pop(context);
},
),
SizedBox(
width: 7.0,
),
AppText(
'Add prescription',
fontWeight: FontWeight.w700,
fontSize: 20,
),
]),
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 Prescription',
),
],
),
),
),
),
body: Column(
children: [
Expanded(
child: TabBarView(
physics: BouncingScrollPhysics(),
controller: _tabController,
children: [
AddFavPrescription(
model: widget.model,
patient: widget.patient,
categoryID: '55',
),
PrescriptionFormWidget(
widget.model, widget.patient, widget.model.prescriptionList),
],
),
),
],
),
),
),
],
),
),
);
}),
),
),
);
}
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,
),
),
),
),
],
),
),
);
}
}

@ -0,0 +1,76 @@
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.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/dialogs/dailog-list-select.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class PrescriptionTextFiled extends StatefulWidget {
dynamic element;
final String elementError;
final List<dynamic> elementList;
final String keyName;
final String keyId;
final String hintText;
final double width;
final Function(dynamic) okFunction;
PrescriptionTextFiled(
{Key key,
@required this.element,
@required this.elementError,
this.width,
this.elementList,
this.keyName,
this.keyId,
this.hintText,
this.okFunction})
: super(key: key);
@override
_PrescriptionTextFiledState createState() => _PrescriptionTextFiledState();
}
class _PrescriptionTextFiledState extends State<PrescriptionTextFiled> {
@override
Widget build(BuildContext context) {
return Container(
width: widget.width ?? null,
child: InkWell(
onTap: widget.elementList != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog(
list: widget.elementList,
attributeName: '${widget.keyName}',
attributeValueId: '${widget.keyId}',
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) =>
widget.okFunction(selectedValue),
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: AppTextFieldCustom(
hintText: widget.hintText,
dropDownText: widget.elementList.length == 1
? widget.elementList[0]['${widget.keyName}']
: widget.element != null
? widget.element['${widget.keyName}']
: null,
isTextFieldHasSuffix: true,
validationError:
widget.elementList.length != 1 ? widget.elementError : null,
enabled: false,
),
),
);
}
}

@ -1,8 +1,8 @@
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
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/prescription/add_prescription_form.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_home_screen.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_item_in_patient_page.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_items_page.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
@ -16,7 +16,6 @@ import 'package:doctor_app_flutter/widgets/shared/user-guid/in_patient_doctor_ca
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PrescriptionsPage extends StatelessWidget {
@override
@ -51,8 +50,7 @@ class PrescriptionsPage extends StatelessWidget {
SizedBox(
height: 12,
),
if (model.prescriptionsList.isNotEmpty &&
patient.patientStatusType != 43)
if (model.prescriptionsList.isNotEmpty && patient.patientStatusType != 43)
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
@ -72,8 +70,7 @@ class PrescriptionsPage extends StatelessWidget {
],
),
),
if (patient.patientStatusType != null &&
patient.patientStatusType == 43)
if (patient.patientStatusType != null && patient.patientStatusType == 43)
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
@ -86,26 +83,27 @@ class PrescriptionsPage extends StatelessWidget {
fontSize: 13,
),
AppText(
TranslationBase
.of(context)
.prescriptions,
TranslationBase.of(context).prescriptions,
bold: true,
fontSize: 22,
),
],
),
),
if ((patient.patientStatusType != null &&
patient.patientStatusType == 43) ||
if ((patient.patientStatusType != null && patient.patientStatusType == 43) ||
(isFromLiveCare && patient.appointmentNo != null))
AddNewOrder(
onTap: () {
addPrescriptionForm(context, model, patient,
model.prescriptionList);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PrescriptionHomeScreen(
patient: patient,
model: model,
)),
);
},
label: TranslationBase
.of(context)
.applyForNewPrescriptionsOrder,
label: TranslationBase.of(context).applyForNewPrescriptionsOrder,
),
...List.generate(
model.prescriptionsList.length,
@ -114,8 +112,7 @@ class PrescriptionsPage extends StatelessWidget {
context,
FadePage(
page: PrescriptionItemsPage(
prescriptions:
model.prescriptionsList[index],
prescriptions: model.prescriptionsList[index],
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
@ -123,22 +120,16 @@ class PrescriptionsPage extends StatelessWidget {
),
),
child: DoctorCard(
doctorName:
model.prescriptionsList[index].doctorName,
profileUrl: model
.prescriptionsList[index].doctorImageURL,
doctorName: model.prescriptionsList[index].doctorName,
profileUrl: model.prescriptionsList[index].doctorImageURL,
branch: model.prescriptionsList[index].name,
clinic: model.prescriptionsList[index]
.clinicDescription,
clinic: model.prescriptionsList[index].clinicDescription,
isPrescriptions: true,
appointmentDate:
AppDateUtils.getDateTimeFromServerFormat(
model.prescriptionsList[index]
.appointmentDate,
appointmentDate: AppDateUtils.getDateTimeFromServerFormat(
model.prescriptionsList[index].appointmentDate,
),
))),
if (model.prescriptionsList.isEmpty &&
patient.patientStatusType != 43)
if (model.prescriptionsList.isEmpty && patient.patientStatusType != 43)
Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
@ -149,8 +140,7 @@ class PrescriptionsPage extends StatelessWidget {
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(TranslationBase.of(context)
.noPrescriptionsFound),
child: AppText(TranslationBase.of(context).noPrescriptionsFound),
)
],
),
@ -175,38 +165,29 @@ class PrescriptionsPage extends StatelessWidget {
FadePage(
page: PrescriptionItemsInPatientPage(
prescriptionIndex: index,
prescriptions: model
.inPatientPrescription[index],
prescriptions: model.inPatientPrescription[index],
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
startOn: AppDateUtils
.getDateTimeFromServerFormat(
model.inPatientPrescription[index]
.startDatetime,
startOn: AppDateUtils.getDateTimeFromServerFormat(
model.inPatientPrescription[index].startDatetime,
),
stopOn: AppDateUtils
.getDateTimeFromServerFormat(
model.inPatientPrescription[index]
.stopDatetime,
stopOn: AppDateUtils.getDateTimeFromServerFormat(
model.inPatientPrescription[index].stopDatetime,
),
),
),
),
child: InPatientDoctorCard(
doctorName: model.inPatientPrescription[index]
.itemDescription,
doctorName: model.inPatientPrescription[index].itemDescription,
profileUrl: 'sss',
branch: 'hamza',
clinic: 'basheer',
isPrescriptions: true,
appointmentDate:
AppDateUtils.getDateTimeFromServerFormat(
model.inPatientPrescription[index]
.prescriptionDatetime,
appointmentDate: AppDateUtils.getDateTimeFromServerFormat(
model.inPatientPrescription[index].prescriptionDatetime,
),
createdBy: model.inPatientPrescription[index]
.createdByName,
createdBy: model.inPatientPrescription[index].createdByName,
))),
if (model.inPatientPrescription.length == 0)
Center(
@ -219,8 +200,7 @@ class PrescriptionsPage extends StatelessWidget {
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(TranslationBase.of(context)
.noPrescriptionsFound),
child: AppText(TranslationBase.of(context).noPrescriptionsFound),
)
],
),

@ -15,10 +15,12 @@ class ExpansionProcedure extends StatefulWidget {
final ProcedureViewModel model;
final Function(ProcedureTempleteDetailsModel) removeFavProcedure;
final Function(ProcedureTempleteDetailsModel) addFavProcedure;
final Function(ProcedureTempleteDetailsModel) addProceduresRemarks;
final Function(ProcedureTempleteDetailsModel) selectProcedures;
final bool Function(ProcedureTempleteModel) isEntityListSelected;
final bool Function(ProcedureTempleteDetailsModel) isEntityFavListSelected;
final bool isProcedure;
final ProcedureTempleteDetailsModel groupProcedures;
const ExpansionProcedure(
{Key key,
@ -26,9 +28,11 @@ class ExpansionProcedure extends StatefulWidget {
this.model,
this.removeFavProcedure,
this.addFavProcedure,
this.addProceduresRemarks,
this.selectProcedures,
this.isEntityListSelected,
this.isEntityFavListSelected})
this.isEntityFavListSelected,
this.isProcedure = true,
this.groupProcedures})
: super(key: key);
@override
@ -70,11 +74,11 @@ class _ExpansionProcedureState extends State<ExpansionProcedure> {
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 0),
child: AppText(
"Procedures for " +
widget.procedureTempleteModel.templateName,
widget.isProcedure == true
? "Procedures for " + widget.procedureTempleteModel.templateName
: "Prescription for " + widget.procedureTempleteModel.templateName,
fontSize: 16.0,
variant: "bodyText",
bold: true,
@ -87,9 +91,7 @@ class _ExpansionProcedureState extends State<ExpansionProcedure> {
width: 25,
height: 25,
child: Icon(
_isShowMore
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down,
_isShowMore ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
color: Colors.grey[800],
size: 22,
),
@ -111,48 +113,62 @@ class _ExpansionProcedureState extends State<ExpansionProcedure> {
)),
duration: Duration(milliseconds: 7000),
child: Column(
children: widget.procedureTempleteModel.procedureTemplate
.map((itemProcedure) {
return Container(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 11),
child: Checkbox(
value: widget
.isEntityFavListSelected(itemProcedure),
activeColor: Color(0xffD02127),
onChanged: (bool newValue) {
setState(() {
if (widget.isEntityFavListSelected(
itemProcedure)) {
widget
.removeFavProcedure(itemProcedure);
} else {
widget.addFavProcedure(itemProcedure);
}
});
}),
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 0),
child: AppText(itemProcedure.procedureName,
fontSize: 14.0,
variant: "bodyText",
bold: true,
color: Color(0xff575757)),
children: widget.procedureTempleteModel.procedureTemplate.map((itemProcedure) {
return InkWell(
onTap: () {
if (widget.isProcedure) {
setState(() {
if (widget.isEntityFavListSelected(itemProcedure)) {
widget.removeFavProcedure(itemProcedure);
} else {
widget.addFavProcedure(itemProcedure);
}
});
} else {
widget.selectProcedures(itemProcedure);
}
},
child: Container(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 11),
child: widget.isProcedure
? Checkbox(
value: widget.isEntityFavListSelected(itemProcedure),
activeColor: Color(0xffD02127),
onChanged: (bool newValue) {
setState(() {
if (widget.isEntityFavListSelected(itemProcedure)) {
widget.removeFavProcedure(itemProcedure);
} else {
widget.addFavProcedure(itemProcedure);
}
});
})
: Radio(
value: itemProcedure,
groupValue: widget.groupProcedures,
activeColor: Color(0xffD02127),
onChanged: (newValue) {
widget.selectProcedures(newValue);
})),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 0),
child: AppText(itemProcedure.procedureName,
fontSize: 14.0, variant: "bodyText", bold: true, color: Color(0xff575757)),
),
),
),
],
),
],
],
),
],
),
),
),
);

@ -22,12 +22,15 @@ class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget {
final Function(ProcedureTempleteDetailsModel) removeFavProcedure;
final Function(ProcedureTempleteDetailsModel) addFavProcedure;
final Function(ProcedureTempleteDetailsModel) addProceduresRemarks;
final Function(ProcedureTempleteDetailsModel) selectProcedures;
final ProcedureTempleteDetailsModel groupProcedures;
final bool Function(ProcedureTempleteModel) isEntityListSelected;
final bool Function(ProcedureTempleteDetailsModel) isEntityFavListSelected;
final List<ProcedureTempleteModel> masterList;
final bool isProcedure;
EntityListCheckboxSearchFavProceduresWidget(
{Key key,
this.model,
@ -36,11 +39,13 @@ class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget {
this.masterList,
this.addHistory,
this.addFavProcedure,
this.addProceduresRemarks,
this.selectProcedures,
this.removeFavProcedure,
this.isEntityListSelected,
this.isEntityFavListSelected,
this.addRemarks})
this.addRemarks,
this.isProcedure = true,
this.groupProcedures})
: super(key: key);
@override
@ -48,8 +53,7 @@ class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget {
_EntityListCheckboxSearchFavProceduresWidgetState();
}
class _EntityListCheckboxSearchFavProceduresWidgetState
extends State<EntityListCheckboxSearchFavProceduresWidget> {
class _EntityListCheckboxSearchFavProceduresWidgetState extends State<EntityListCheckboxSearchFavProceduresWidget> {
int selectedType = 0;
int typeUrgent;
int typeRegular;
@ -85,9 +89,7 @@ class _EntityListCheckboxSearchFavProceduresWidgetState
child: Center(
child: Container(
margin: EdgeInsets.only(top: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.white),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(8), color: Colors.white),
child: ListView(
children: [
TextFields(
@ -106,20 +108,20 @@ class _EntityListCheckboxSearchFavProceduresWidgetState
? Column(
children: widget.model.templateList.map((historyInfo) {
return ExpansionProcedure(
procedureTempleteModel: historyInfo,
model: widget.model,
removeFavProcedure: widget.removeFavProcedure,
addFavProcedure: widget.addFavProcedure,
addProceduresRemarks: widget.addProceduresRemarks,
isEntityListSelected: widget.isEntityListSelected,
isEntityFavListSelected: widget.isEntityFavListSelected,
);
procedureTempleteModel: historyInfo,
model: widget.model,
removeFavProcedure: widget.removeFavProcedure,
addFavProcedure: widget.addFavProcedure,
selectProcedures: widget.selectProcedures,
isEntityListSelected: widget.isEntityListSelected,
isEntityFavListSelected: widget.isEntityFavListSelected,
isProcedure: widget.isProcedure,
groupProcedures: widget.groupProcedures);
}).toList(),
)
: Center(
child: Container(
child: AppText("Sorry , No Match",
color: Color(0xFFB9382C)),
child: AppText("Sorry , No Match", color: Color(0xFFB9382C)),
),
)
],

@ -1,4 +1,4 @@
import 'package:barcode_scan/platform_wrapper.dart';
import 'package:barcode_scan_fix/barcode_scan.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
@ -137,8 +137,8 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
/// var result = await BarcodeScanner.scan();
/// int patientID = get from qr result
var result = await BarcodeScanner.scan();
if (result.rawContent != "") {
List<String> listOfParams = result.rawContent.split(',');
if (result != "") {
List<String> listOfParams = result.split(',');
String patientType = "1";
setState(() {
isLoading = true;

@ -7,7 +7,7 @@ class AppDateUtils {
return DateFormat(dateFormat).format(dateTime);
}
static DateTime convertISOStringToDateTime(String date){
static DateTime convertISOStringToDateTime(String date) {
DateTime newDate;
newDate = DateTime.parse(date);
@ -27,22 +27,20 @@ class AppDateUtils {
}
static DateTime getDateTimeFromServerFormat(String str) {
DateTime date= DateTime.now();
if (str!=null) {
DateTime date = DateTime.now();
if (str != null) {
const start = "/Date(";
const end = "+0300)";
if(str.contains("/Date")){
final startIndex = str.indexOf(start);
if (str.contains("/Date")) {
final startIndex = str.indexOf(start);
final endIndex = str.indexOf(end, startIndex + start.length);
date = new DateTime.fromMillisecondsSinceEpoch(
int.parse(str.substring(startIndex + start.length, endIndex)));
} else {
date = DateTime.now();
}
final endIndex = str.indexOf(end, startIndex + start.length);
date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex)));
} else {
date = DateTime.now();
}
} else {
date = DateTime.parse(str);
}
@ -50,8 +48,7 @@ class AppDateUtils {
return date;
}
static String differenceBetweenDateAndCurrentInYearMonthDay(
DateTime firstDate, BuildContext context) {
static String differenceBetweenDateAndCurrentInYearMonthDay(DateTime firstDate, BuildContext context) {
DateTime now = DateTime.now();
// now = now.add(Duration(days: 400, minutes: 0));
var difference = firstDate.difference(now);
@ -71,15 +68,13 @@ class AppDateUtils {
return "$days ${TranslationBase.of(context).days}, $months ${TranslationBase.of(context).months}, $years ${TranslationBase.of(context).years}";
}
static String differenceBetweenDateAndCurrent(
DateTime firstDate, BuildContext context) {
static String differenceBetweenDateAndCurrent(DateTime firstDate, BuildContext context) {
DateTime now = DateTime.now();
// DateTime now = nows.add(Duration(days: 400, minutes: 25, hours: 0));
var difference = now.difference(firstDate);
int minutesInDays = difference.inMinutes;
int hoursInDays =
minutesInDays ~/ 60; // ~/ : truncating division to make the result int
int hoursInDays = minutesInDays ~/ 60; // ~/ : truncating division to make the result int
int minutes = minutesInDays % 60;
int days = hoursInDays ~/ 24;
int hours = hoursInDays % 24;
@ -89,8 +84,7 @@ class AppDateUtils {
return "$days ${TranslationBase.of(context).days}, $hours ${TranslationBase.of(context).hr}, $minutes ${TranslationBase.of(context).min}";
}
static String differenceBetweenServerDateAndCurrent(
String str, BuildContext context) {
static String differenceBetweenServerDateAndCurrent(String str, BuildContext context) {
const start = "/Date(";
const end = "+0300)";
@ -99,8 +93,7 @@ class AppDateUtils {
final endIndex = str.indexOf(end, startIndex + start.length);
var date = new DateTime.fromMillisecondsSinceEpoch(
int.parse(str.substring(startIndex + start.length, endIndex)));
var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex)));
return differenceBetweenDateAndCurrent(date, context);
}
@ -246,7 +239,10 @@ class AppDateUtils {
final startIndex = date.indexOf(start);
final endIndex = date.indexOf(end, startIndex + start.length);
DateTime newDate = DateTime.fromMillisecondsSinceEpoch(
int.parse(date.substring(startIndex + start.length, endIndex),),);
int.parse(
date.substring(startIndex + start.length, endIndex),
),
);
return newDate;
} else
return DateTime.now();
@ -256,35 +252,30 @@ class AppDateUtils {
/// [dateTime] convert DateTime to data formatted Arabic
static String getMonthDayYearDateFormattedAr(DateTime dateTime) {
if (dateTime != null)
return getMonthArabic(dateTime.month) +
" " +
dateTime.day.toString() +
", " +
dateTime.year.toString();
return getMonthArabic(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString();
else
return "";
}
/// get data formatted like Apr 26,2020
/// [dateTime] convert DateTime to data formatted
static String getMonthDayYearDateFormatted(DateTime dateTime,{bool isArabic = false}) {
static String getMonthDayYearDateFormatted(DateTime dateTime, {bool isArabic = false}) {
if (dateTime != null)
return isArabic? getMonthArabic(dateTime.month): getMonth(dateTime.month) +
" " +
dateTime.day.toString() +
", " +
dateTime.year.toString();
return isArabic
? getMonthArabic(dateTime.month)
: getMonth(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString();
else
return "";
}
/// get data formatted like 26 Apr 2020
/// [dateTime] convert DateTime to data formatted
static String getDayMonthYearDateFormatted(DateTime dateTime,{bool isArabic = false}) {
static String getDayMonthYearDateFormatted(DateTime dateTime, {bool isArabic = false}) {
if (dateTime != null)
return dateTime.day.toString()+" "+ "${isArabic? getMonthArabic(dateTime.month): getMonth(dateTime.month) }"+
return dateTime.day.toString() +
" " +
"${isArabic ? getMonthArabic(dateTime.month) : getMonth(dateTime.month)}" +
" " +
dateTime.year.toString();
else
return "";
@ -292,9 +283,9 @@ class AppDateUtils {
/// get data formatted like 26/4/2020
/// [dateTime] convert DateTime to data formatted
static String getDayMonthYearDate(DateTime dateTime,{bool isArabic = false}) {
static String getDayMonthYearDate(DateTime dateTime, {bool isArabic = false}) {
if (dateTime != null)
return dateTime.day.toString()+"/"+ "${dateTime.month}"+ "/" + dateTime.year.toString();
return dateTime.day.toString() + "/" + "${dateTime.month}" + "/" + dateTime.year.toString();
else
return "";
}
@ -302,15 +293,15 @@ class AppDateUtils {
/// get data formatted like 10:45 PM
/// [dateTime] convert DateTime to data formatted
static String getHour(DateTime dateTime) {
return DateFormat('hh:mm a').format(dateTime);
return DateFormat('hh:mm a').format(dateTime);
}
static String getAgeByBirthday(String birthOfDate, BuildContext context, { bool isServerFormat = true}) {
static String getAgeByBirthday(String birthOfDate, BuildContext context, {bool isServerFormat = true}) {
// https://leechy.dev/calculate-dates-diff-in-dart
DateTime birthDate;
if(birthOfDate.contains("/Date")) {
if (birthOfDate.contains("/Date")) {
birthDate = AppDateUtils.getDateTimeFromServerFormat(birthOfDate);
}else{
} else {
birthDate = DateTime.parse(birthOfDate);
}
final now = DateTime.now();
@ -328,24 +319,18 @@ class AppDateUtils {
return "$years ${TranslationBase.of(context).years} $months ${TranslationBase.of(context).months} $days ${TranslationBase.of(context).days}";
}
static bool isToday(DateTime dateTime){
static bool isToday(DateTime dateTime) {
DateTime todayDate = DateTime.now().toUtc();
if(dateTime.day == todayDate.day && dateTime.month == todayDate.month && dateTime.year == todayDate.year) {
if (dateTime.day == todayDate.day && dateTime.month == todayDate.month && dateTime.year == todayDate.year) {
return true;
}
return false;
}
static String getDate(DateTime dateTime) {
print(dateTime);
if (dateTime != null)
return getMonth(dateTime.month) +
" " +
dateTime.day.toString() +
"," +
dateTime.year.toString();
return getMonth(dateTime.month) + " " + dateTime.day.toString() + "," + dateTime.year.toString();
else
return "";
}
@ -353,28 +338,23 @@ class AppDateUtils {
static String getDateFormatted(DateTime dateTime) {
print(dateTime);
if (dateTime != null)
return dateTime.day.toString() +
"/" +
dateTime.month.toString() +
"/" +
dateTime.year.toString();
return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString();
else
return "";
}
static String getTimeHHMMA(DateTime dateTime){
static String getTimeHHMMA(DateTime dateTime) {
return DateFormat('hh:mm a').format(dateTime);
}
static String getTimeHHMMA2 (DateTime dateTime){
static String getTimeHHMMA2(DateTime dateTime) {
return DateFormat('hh:mm').format(dateTime);
}
static String getStartTime(String dateTime){
String time=dateTime;
static String getStartTime(String dateTime) {
String time = dateTime;
if(dateTime.length>7)
time = dateTime.substring(0,5);
if (dateTime.length > 7) time = dateTime.substring(0, 5);
return time;
}

@ -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: <TextSpan>[
new TextSpan(
text:
TranslationBase.of(context).clinic +
" : ",
style: TextStyle(fontSize: 12)),
new TextSpan(
text:
patientInfo.clinicName,
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 13)),
],
),
),
),
],
),
]))
]),
isFromLiveCare

@ -203,8 +203,9 @@ class _AppDrawerState extends State<AppDrawer> {
),
onTap: () async {
Navigator.pop(context);
await authenticationViewModel.logout(isFromLogin: false);
Navigator.pop(context);
await authenticationViewModel.logout(isFromLogin: false);
},
),
],

@ -105,37 +105,36 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
? widget.height - 22
: null,
child: TextField(
textAlign: projectViewModel.isArabic
? TextAlign.right
: TextAlign.left,
decoration: TextFieldsUtils
.textFieldSelectorDecoration(
widget.hintText, null, true),
style: TextStyle(
fontSize: SizeConfig.textMultiplier * 1.7,
fontFamily: 'Poppins',
color: Color(0xFF575757),
),
controller: widget.controller,
keyboardType: widget.inputType ??
(widget.maxLines == 1
? TextInputType.text
: TextInputType.multiline),
enabled: widget.enabled,
minLines: widget.minLines,
maxLines: widget.maxLines,
inputFormatters:
widget.inputFormatters != null
? widget.inputFormatters
: [],
onChanged: (value) {
setState(() {});
if (widget.onChanged != null) {
widget.onChanged(value);
}
},
obscureText: widget.isSecure
),
textAlign: projectViewModel.isArabic
? TextAlign.right
: TextAlign.left,
decoration: TextFieldsUtils
.textFieldSelectorDecoration(
widget.hintText, null, true),
style: TextStyle(
fontSize: SizeConfig.textMultiplier * 1.7,
fontFamily: 'Poppins',
color: Color(0xFF575757),
),
controller: widget.controller,
keyboardType: widget.inputType ??
(widget.maxLines == 1
? TextInputType.text
: TextInputType.multiline),
enabled: widget.enabled,
minLines: widget.minLines,
maxLines: widget.maxLines,
inputFormatters:
widget.inputFormatters != null
? widget.inputFormatters
: [],
onChanged: (value) {
setState(() {});
if (widget.onChanged != null) {
widget.onChanged(value);
}
},
obscureText: widget.isSecure),
)
: AppText(
widget.dropDownText,

@ -7,12 +7,11 @@ import '../app_texts_widget.dart';
class TextFieldsError extends StatelessWidget {
const TextFieldsError({
Key key,
@required this.error,
@required this.error,
}) : super(key: key);
final String error;
@override
Widget build(BuildContext context) {
return Container(
@ -27,12 +26,14 @@ class TextFieldsError extends StatelessWidget {
SizedBox(
width: 12,
),
AppText(
error,
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.7,
color: Colors.red.shade700,
fontWeight: FontWeight.w700,
Expanded(
child: AppText(
error,
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.7,
color: Colors.red.shade700,
fontWeight: FontWeight.w700,
),
),
],
),

@ -43,13 +43,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.3"
barcode_scan:
barcode_scan_fix:
dependency: "direct main"
description:
name: barcode_scan
name: barcode_scan_fix
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "1.0.2"
bazel_worker:
dependency: transitive
description:

@ -51,7 +51,7 @@ dependencies:
expandable: ^4.1.4
# Qr code Scanner
barcode_scan: ^3.0.1
barcode_scan_fix: ^1.0.2
# permissions
permission_handler: ^5.0.0+hotfix.3
device_info: ^0.4.2+4

Loading…
Cancel
Save