Merge branch 'development' into videocall_popup

* development: (72 commits)
  Enable iOS AirPlay
  fix the end call
  fix timer issue
  fix timer issue
  fix disconected stream
  fix circle video stream
  Add App Permissions Utils
  add video call permissions
  fix drop video call issue
  circle screen fix bug, and mini screen design
  video fix bugs
  fix header from lab
  fix header from lab result details
  fix header
  fix the video call issues
  Add video call service
  video fix bugs
  video fix bugs
  add loader
  video fix bugs
  ...
videocall_popup
Zohaib Iqbal Kambrani 5 years ago
commit 157fc6fc29

@ -39,7 +39,7 @@ android {
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.hmg.hmgDr" applicationId "com.hmg.hmgDr"
minSdkVersion 18 minSdkVersion 21
targetSdkVersion 30 targetSdkVersion 30
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
@ -54,6 +54,11 @@ android {
signingConfig signingConfigs.debug signingConfig signingConfigs.debug
} }
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
} }
flutter { flutter {
@ -65,6 +70,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
@ -74,9 +80,10 @@ dependencies {
//permissions //permissions
implementation 'pub.devrel:easypermissions:0.4.0' implementation 'pub.devrel:easypermissions:0.4.0'
//retrofit //retrofit
implementation 'com.squareup.retrofit2:retrofit:2.6.2' implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.6.2' implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.14.1' implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
} }
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'

@ -9,18 +9,24 @@
additional functionality it is fine to subclass or reimplement additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. FlutterApplication and put your custom class here.
--> -->
<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" /> <uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<application <application
android:name="io.flutter.app.FlutterApplication" android:name="io.flutter.app.FlutterApplication"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:label="HMG Doctor"> android:label="HMG Doctor">
<activity android:name=".ui.VideoCallActivity"></activity>
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"

@ -2,38 +2,46 @@ package com.hmg.hmgDr
import android.app.Activity import android.app.Activity
import android.content.Intent import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.widget.Toast
import androidx.annotation.NonNull import androidx.annotation.NonNull
import com.google.gson.GsonBuilder
import com.hmg.hmgDr.Model.GetSessionStatusModel import com.hmg.hmgDr.Model.GetSessionStatusModel
import com.hmg.hmgDr.Model.SessionStatusModel import com.hmg.hmgDr.Model.SessionStatusModel
import com.hmg.hmgDr.ui.VideoCallActivity import com.hmg.hmgDr.ui.VideoCallResponseListener
import com.google.gson.GsonBuilder import com.hmg.hmgDr.ui.fragment.VideoCallFragment
import io.flutter.embedding.android.FlutterFragmentActivity import io.flutter.embedding.android.FlutterFragmentActivity
import io.flutter.embedding.engine.FlutterEngine import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel import io.flutter.plugin.common.MethodChannel
import io.flutter.plugins.GeneratedPluginRegistrant import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler {
class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler, VideoCallResponseListener {
private val CHANNEL = "Dr.cloudSolution/videoCall" private val CHANNEL = "Dr.cloudSolution/videoCall"
private lateinit var methodChannel: MethodChannel
private var result: MethodChannel.Result? = null private var result: MethodChannel.Result? = null
private var call: MethodCall? = null private var call: MethodCall? = null
private val LAUNCH_VIDEO: Int = 1 private val LAUNCH_VIDEO: Int = 1
private var dialogFragment: VideoCallFragment? = null
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine) GeneratedPluginRegistrant.registerWith(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler(this) methodChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
methodChannel.setMethodCallHandler(this)
} }
override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) { override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
this.result = result this.result = result
this.call = call this.call = call
if (call.method == "openVideoCall") { when (call.method) {
"openVideoCall" -> {
val apiKey = call.argument<String>("kApiKey") val apiKey = call.argument<String>("kApiKey")
val sessionId = call.argument<String>("kSessionId") val sessionId = call.argument<String>("kSessionId")
val token = call.argument<String>("kToken") val token = call.argument<String>("kToken")
@ -45,33 +53,57 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler
val tokenID = call.argument<String>("TokenID") val tokenID = call.argument<String>("TokenID")
val generalId = call.argument<String>("generalId") val generalId = call.argument<String>("generalId")
val doctorId = call.argument<Int>("DoctorId") val doctorId = call.argument<Int>("DoctorId")
val patientName = call.argument<String>("patientName")
val sessionStatusModel = GetSessionStatusModel(VC_ID, tokenID, generalId, doctorId) val sessionStatusModel = GetSessionStatusModel(VC_ID, tokenID, generalId, doctorId, patientName)
openVideoCall(apiKey, sessionId, token, appLang, baseUrl, sessionStatusModel) openVideoCall(apiKey, sessionId, token, appLang, baseUrl, sessionStatusModel)
} else { }
"closeVideoCall" -> {
dialogFragment?.onCallClicked()
}
"onCallConnected" -> {
}
else -> {
result.notImplemented() result.notImplemented()
} }
} }
}
private fun openVideoCall(apiKey: String?, sessionId: String?, token: String?, appLang: String?, baseUrl: String?, sessionStatusModel: GetSessionStatusModel) { private fun openVideoCall(apiKey: String?, sessionId: String?, token: String?, appLang: String?, baseUrl: String?, sessionStatusModel: GetSessionStatusModel) {
// val videoCallActivity = VideoCallActivity() if (dialogFragment == null) {
val arguments = Bundle()
arguments.putString("apiKey", apiKey)
arguments.putString("sessionId", sessionId)
arguments.putString("token", token)
arguments.putString("appLang", appLang)
arguments.putString("baseUrl", baseUrl)
arguments.putParcelable("sessionStatusModel", sessionStatusModel)
val transaction = supportFragmentManager.beginTransaction()
dialogFragment = VideoCallFragment.newInstance(arguments)
dialogFragment?.let {
it.setCallListener(this)
it.isCancelable = true
if (it.isAdded){
it.dismiss()
}else {
it.show(transaction, "dialog")
}
val intent = Intent(this, VideoCallActivity::class.java)
intent.putExtra("apiKey", apiKey)
intent.putExtra("sessionId", sessionId)
intent.putExtra("token", token)
intent.putExtra("appLang", appLang)
intent.putExtra("baseUrl", baseUrl)
intent.putExtra("sessionStatusModel", sessionStatusModel)
startActivityForResult(intent, LAUNCH_VIDEO)
} }
} else if (!dialogFragment!!.isVisible) {
val transaction = supportFragmentManager.beginTransaction()
dialogFragment!!.show(transaction, "dialog")
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { /* override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)
var asd = ""; var asd = "";
if (requestCode == LAUNCH_VIDEO) { if (requestCode == LAUNCH_VIDEO) {
@ -95,7 +127,52 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler
result?.success(callResponse) result?.success(callResponse)
} }
} }
}*/
override fun onCallFinished(resultCode: Int, intent: Intent?) {
dialogFragment = null
if (resultCode == Activity.RESULT_OK) {
val result: SessionStatusModel? = intent?.getParcelableExtra("sessionStatusNotRespond")
val callResponse: HashMap<String, String> = HashMap()
val sessionStatus: HashMap<String, String> = HashMap()
val gson = GsonBuilder().serializeNulls().create()
callResponse["callResponse"] = "CallNotRespond"
val jsonRes = gson.toJson(result)
callResponse["sessionStatus"] = jsonRes
try {
this.result?.success(callResponse)
} catch (e : Exception){
Log.e("onVideoCallFinished", "${e.message}.")
}
} else if (resultCode == Activity.RESULT_CANCELED) {
val callResponse: HashMap<String, String> = HashMap()
callResponse["callResponse"] = "CallEnd"
try {
result?.success(callResponse)
} catch (e : Exception){
Log.e("onVideoCallFinished", "${e.message}.")
}
}
} }
override fun errorHandle(message: String) {
dialogFragment = null
// Toast.makeText(this, message, Toast.LENGTH_LONG).show()
}
override fun minimizeVideoEvent(isMinimize: Boolean) {
if (isMinimize)
methodChannel.invokeMethod("onCallConnected", null)
else
methodChannel.invokeMethod("onCallDisconnected", null)
}
override fun onBackPressed() {
super.onBackPressed()
}
} }

@ -20,15 +20,19 @@ public class GetSessionStatusModel implements Parcelable {
@SerializedName("DoctorId") @SerializedName("DoctorId")
@Expose @Expose
private Integer doctorId; private Integer doctorId;
@SerializedName("PatientName")
@Expose
private String patientName;
public GetSessionStatusModel() { public GetSessionStatusModel() {
} }
public GetSessionStatusModel(Integer vCID, String tokenID, String generalid, Integer doctorId) { public GetSessionStatusModel(Integer vCID, String tokenID, String generalid, Integer doctorId, String patientName) {
this.vCID = vCID; this.vCID = vCID;
this.tokenID = tokenID; this.tokenID = tokenID;
this.generalid = generalid; this.generalid = generalid;
this.doctorId = doctorId; this.doctorId = doctorId;
this.patientName = patientName;
} }
protected GetSessionStatusModel(Parcel in) { protected GetSessionStatusModel(Parcel in) {
@ -44,6 +48,7 @@ public class GetSessionStatusModel implements Parcelable {
} else { } else {
doctorId = in.readInt(); doctorId = in.readInt();
} }
patientName = in.readString();
} }
public static final Creator<GetSessionStatusModel> CREATOR = new Creator<GetSessionStatusModel>() { public static final Creator<GetSessionStatusModel> CREATOR = new Creator<GetSessionStatusModel>() {
@ -90,6 +95,16 @@ public class GetSessionStatusModel implements Parcelable {
this.doctorId = doctorId; this.doctorId = doctorId;
} }
public String getPatientName() {
if (patientName == null)
patientName = "-";
return patientName;
}
public void setPatientName(String patientName) {
this.patientName = patientName;
}
@Override @Override
public int describeContents() { public int describeContents() {
return 0; return 0;
@ -111,5 +126,6 @@ public class GetSessionStatusModel implements Parcelable {
dest.writeByte((byte) 1); dest.writeByte((byte) 1);
dest.writeInt(doctorId); dest.writeInt(doctorId);
} }
dest.writeString(patientName);
} }
} }

@ -1,442 +0,0 @@
package com.hmg.hmgDr.ui;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
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;
import com.opentok.android.Publisher;
import com.opentok.android.PublisherKit;
import com.opentok.android.Subscriber;
import com.opentok.android.BaseVideoRenderer;
import com.opentok.android.OpentokError;
import com.opentok.android.SubscriberKit;
import java.util.List;
import java.util.Objects;
import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.AppSettingsDialog;
import pub.devrel.easypermissions.EasyPermissions;
public class VideoCallActivity extends AppCompatActivity implements EasyPermissions.PermissionCallbacks,
Session.SessionListener,
Publisher.PublisherListener,
Subscriber.VideoListener, VideoCallContract.VideoCallView {
private static final String TAG = VideoCallActivity.class.getSimpleName();
VideoCallContract.VideoCallPresenter videoCallPresenter;
private static final int RC_SETTINGS_SCREEN_PERM = 123;
private static final int RC_VIDEO_APP_PERM = 124;
private Session mSession;
private Publisher mPublisher;
private Subscriber mSubscriber;
private Handler mVolHandler, mConnectedHandler;
private Runnable mVolRunnable, mConnectedRunnable;
private FrameLayout mPublisherViewContainer;
private RelativeLayout mSubscriberViewContainer;
private RelativeLayout controlPanel;
private String apiKey;
private String sessionId;
private String token;
private String appLang;
private String baseUrl;
private boolean isSwitchCameraClicked;
private boolean isCameraClicked;
private boolean isSpeckerClicked;
private boolean isMicClicked;
private ImageView mCallBtn;
private ImageView mCameraBtn;
private ImageView mSwitchCameraBtn;
private ImageView mspeckerBtn;
private ImageView mMicBtn;
private ProgressBar progressBar;
private CountDownTimer countDownTimer;
private TextView progressBarTextView;
private RelativeLayout progressBarLayout;
private boolean isConnected = false;
private GetSessionStatusModel sessionStatusModel;
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(R.style.AppTheme);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_call);
Objects.requireNonNull(getSupportActionBar()).hide();
initUI();
requestPermissions();
}
@Override
protected void onPause() {
super.onPause();
if (mSession == null) {
return;
}
mSession.onPause();
if (isFinishing()) {
disconnectSession();
}
}
@Override
protected void onResume() {
super.onResume();
if (mSession == null) {
return;
}
mSession.onResume();
}
@Override
protected void onDestroy() {
disconnectSession();
super.onDestroy();
}
@SuppressLint("ClickableViewAccessibility")
private void initUI() {
mPublisherViewContainer = (FrameLayout) findViewById(R.id.local_video_view_container);
mSubscriberViewContainer = (RelativeLayout) findViewById(R.id.remote_video_view_container);
apiKey = getIntent().getStringExtra("apiKey");
sessionId = getIntent().getStringExtra("sessionId");
token = getIntent().getStringExtra("token");
appLang = getIntent().getStringExtra("appLang");
baseUrl = getIntent().getStringExtra("baseUrl");
sessionStatusModel = getIntent().getParcelableExtra("sessionStatusModel");
controlPanel = findViewById(R.id.control_panel);
videoCallPresenter = new VideoCallPresenterImpl(this, baseUrl);
mCallBtn = findViewById(R.id.btn_call);
mCameraBtn = findViewById(R.id.btn_camera);
mSwitchCameraBtn = findViewById(R.id.btn_switch_camera);
mspeckerBtn = findViewById(R.id.btn_specker);
mMicBtn = findViewById(R.id.btn_mic);
// progressBarLayout=findViewById(R.id.progressBar);
// progressBar=findViewById(R.id.progress_bar);
// progressBarTextView=findViewById(R.id.progress_bar_text);
// progressBar.setVisibility(View.GONE);
hiddenButtons();
checkClientConnected();
mSubscriberViewContainer.setOnTouchListener((v, event) -> {
controlPanel.setVisibility(View.VISIBLE);
mVolHandler.removeCallbacks(mVolRunnable);
mVolHandler.postDelayed(mVolRunnable, 5 * 1000);
return true;
});
if (appLang.equals("ar")) {
progressBarLayout.setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
}
}
private void checkClientConnected() {
mConnectedHandler = new Handler();
mConnectedRunnable = () -> {
if (!isConnected) {
videoCallPresenter.callClintConnected(sessionStatusModel);
}
};
mConnectedHandler.postDelayed(mConnectedRunnable, 30 * 1000);
}
private void hiddenButtons() {
mVolHandler = new Handler();
mVolRunnable = new Runnable() {
public void run() {
controlPanel.setVisibility(View.GONE);
}
};
mVolHandler.postDelayed(mVolRunnable, 5 * 1000);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
}
@Override
public void onPermissionsGranted(int requestCode, List<String> perms) {
Log.d(TAG, "onPermissionsGranted:" + requestCode + ":" + perms.size());
}
@Override
public void onPermissionsDenied(int requestCode, List<String> perms) {
Log.d(TAG, "onPermissionsDenied:" + requestCode + ":" + perms.size());
if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
new AppSettingsDialog.Builder(this)
.setTitle(getString(R.string.title_settings_dialog))
.setRationale(getString(R.string.rationale_ask_again))
.setPositiveButton(getString(R.string.setting))
.setNegativeButton(getString(R.string.cancel))
.setRequestCode(RC_SETTINGS_SCREEN_PERM)
.build()
.show();
}
}
@AfterPermissionGranted(RC_VIDEO_APP_PERM)
private void requestPermissions() {
String[] perms = {Manifest.permission.INTERNET, Manifest.permission.CAMERA,};
if (EasyPermissions.hasPermissions(this, perms)) {
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);
}
}
@Override
public void onConnected(Session session) {
Log.i(TAG, "Session Connected");
mPublisher = new Publisher.Builder(this).build();
mPublisher.setPublisherListener(this);
mPublisherViewContainer.addView(mPublisher.getView());
if (mPublisher.getView() instanceof GLSurfaceView) {
((GLSurfaceView) mPublisher.getView()).setZOrderOnTop(true);
}
mSession.publish(mPublisher);
}
@Override
public void onDisconnected(Session session) {
Log.d(TAG, "onDisconnected: disconnected from session " + session.getSessionId());
mSession = null;
}
@Override
public void onError(Session session, OpentokError opentokError) {
Log.d(TAG, "onError: Error (" + opentokError.getMessage() + ") in session " + session.getSessionId());
Toast.makeText(this, "Session error. See the logcat please.", Toast.LENGTH_LONG).show();
finish();
}
@Override
public void onStreamReceived(Session session, Stream stream) {
Log.d(TAG, "onStreamReceived: New stream " + stream.getStreamId() + " in session " + session.getSessionId());
if (mSubscriber != null) {
isConnected = true;
return;
}
isConnected = true;
subscribeToStream(stream);
videoCallPresenter.callChangeCallStatus(new ChangeCallStatusRequestModel(3,sessionStatusModel.getDoctorId(), sessionStatusModel.getGeneralid(),token,sessionStatusModel.getVCID()));
}
@Override
public void onStreamDropped(Session session, Stream stream) {
Log.d(TAG, "onStreamDropped: Stream " + stream.getStreamId() + " dropped from session " + session.getSessionId());
if (mSubscriber == null) {
return;
}
if (mSubscriber.getStream().equals(stream)) {
mSubscriberViewContainer.removeView(mSubscriber.getView());
mSubscriber.destroy();
mSubscriber = null;
}
disconnectSession();
}
@Override
public void onStreamCreated(PublisherKit publisherKit, Stream stream) {
Log.d(TAG, "onStreamCreated: Own stream " + stream.getStreamId() + " created");
}
@Override
public void onStreamDestroyed(PublisherKit publisherKit, Stream stream) {
Log.d(TAG, "onStreamDestroyed: Own stream " + stream.getStreamId() + " destroyed");
}
@Override
public void onError(PublisherKit publisherKit, OpentokError opentokError) {
Log.d(TAG, "onError: Error (" + opentokError.getMessage() + ") in publisher");
Toast.makeText(this, "Session error. See the logcat please.", Toast.LENGTH_LONG).show();
finish();
}
@Override
public void onVideoDataReceived(SubscriberKit subscriberKit) {
mSubscriber.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL);
mSubscriberViewContainer.addView(mSubscriber.getView());
}
@Override
public void onVideoDisabled(SubscriberKit subscriberKit, String s) {
}
@Override
public void onVideoEnabled(SubscriberKit subscriberKit, String s) {
}
@Override
public void onVideoDisableWarning(SubscriberKit subscriberKit) {
}
@Override
public void onVideoDisableWarningLifted(SubscriberKit subscriberKit) {
}
private void subscribeToStream(Stream stream) {
mSubscriber = new Subscriber.Builder(VideoCallActivity.this, stream).build();
mSubscriber.setVideoListener(this);
mSession.subscribe(mSubscriber);
}
private void disconnectSession() {
if (mSession == null) {
setResult(Activity.RESULT_CANCELED);
finish();
return;
}
if (mSubscriber != null) {
mSubscriberViewContainer.removeView(mSubscriber.getView());
mSession.unsubscribe(mSubscriber);
mSubscriber.destroy();
mSubscriber = null;
}
if (mPublisher != null) {
mPublisherViewContainer.removeView(mPublisher.getView());
mSession.unpublish(mPublisher);
mPublisher.destroy();
mPublisher = null;
}
mSession.disconnect();
if (countDownTimer != null) {
countDownTimer.cancel();
}
videoCallPresenter.callChangeCallStatus(new ChangeCallStatusRequestModel(16,sessionStatusModel.getDoctorId(), sessionStatusModel.getGeneralid(),token,sessionStatusModel.getVCID()));
finish();
}
public void onSwitchCameraClicked(View view) {
if (mPublisher != null) {
isSwitchCameraClicked = !isSwitchCameraClicked;
mPublisher.cycleCamera();
int res = isSwitchCameraClicked ? R.drawable.flip_disapled : R.drawable.flip_enabled;
mSwitchCameraBtn.setImageResource(res);
}
}
public void onCameraClicked(View view) {
if (mPublisher != null) {
isCameraClicked = !isCameraClicked;
mPublisher.setPublishVideo(!isCameraClicked);
int res = isCameraClicked ? R.drawable.video_disanabled : R.drawable.video_enabled;
mCameraBtn.setImageResource(res);
}
}
public void onSpeckerClicked(View view) {
if (mSubscriber != null) {
isSpeckerClicked = !isSpeckerClicked;
mSubscriber.setSubscribeToAudio(!isSpeckerClicked);
int res = isSpeckerClicked ? R.drawable.audio_disabled : R.drawable.audio_enabled;
mspeckerBtn.setImageResource(res);
}
}
public void onMicClicked(View view) {
if (mPublisher != null) {
isMicClicked = !isMicClicked;
mPublisher.setPublishAudio(!isMicClicked);
int res = isMicClicked ? R.drawable.mic_disabled : R.drawable.mic_enabled;
mMicBtn.setImageResource(res);
}
}
public void onCallClicked(View view) {
disconnectSession();
}
@Override
public void onCallSuccessful(SessionStatusModel sessionStatusModel) {
if (sessionStatusModel.getSessionStatus() == 2 || sessionStatusModel.getSessionStatus() == 3) {
Intent returnIntent = new Intent();
returnIntent.putExtra("sessionStatusNotRespond", sessionStatusModel);
setResult(Activity.RESULT_OK, returnIntent);
finish();
}
}
@Override
public void onCallChangeCallStatusSuccessful(SessionStatusModel sessionStatusModel) {
}
@Override
public void onFailure() {
}
}

@ -0,0 +1,14 @@
package com.hmg.hmgDr.ui
import android.content.Intent
interface VideoCallResponseListener {
fun onCallFinished(resultCode : Int, intent: Intent? = null)
fun errorHandle(message: String)
fun minimizeVideoEvent(isMinimize : Boolean)
fun onBackHandle(){}
}

@ -0,0 +1,893 @@
package com.hmg.hmgDr.ui.fragment
import android.Manifest
import android.annotation.SuppressLint
import android.app.Activity
import android.app.Dialog
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.graphics.Point
import android.graphics.drawable.ColorDrawable
import android.opengl.GLSurfaceView
import android.os.*
import android.util.Log
import android.view.*
import android.widget.*
import androidx.annotation.Nullable
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.core.view.GestureDetectorCompat
import androidx.fragment.app.DialogFragment
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.hmg.hmgDr.ui.VideoCallContract.VideoCallPresenter
import com.hmg.hmgDr.ui.VideoCallContract.VideoCallView
import com.hmg.hmgDr.ui.VideoCallPresenterImpl
import com.hmg.hmgDr.ui.VideoCallResponseListener
import com.hmg.hmgDr.util.DynamicVideoRenderer
import com.hmg.hmgDr.util.ThumbnailCircleVideoRenderer
import com.opentok.android.*
import com.opentok.android.PublisherKit.PublisherListener
import pub.devrel.easypermissions.AfterPermissionGranted
import pub.devrel.easypermissions.AppSettingsDialog
import pub.devrel.easypermissions.EasyPermissions
import pub.devrel.easypermissions.EasyPermissions.PermissionCallbacks
import kotlin.math.ceil
class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.SessionListener, PublisherListener,
SubscriberKit.VideoListener, VideoCallView {
private var isFullScreen: Boolean = true
private var isCircle: Boolean = false
private var x_init_cord = 0
private var y_init_cord: Int = 0
private var x_init_margin: Int = 0
private var y_init_margin: Int = 0
private val szWindow: Point = Point()
private lateinit var mWindowManager: WindowManager
private var isLeft = true
private lateinit var videoCallPresenter: VideoCallPresenter
private var mSession: Session? = null
private var mPublisher: Publisher? = null
private var mSubscriber: Subscriber? = null
private var mVolHandler: Handler? = null
private var mConnectedHandler: Handler? = null
private var mVolRunnable: Runnable? = null
private var mConnectedRunnable: Runnable? = null
private lateinit var thumbnail_container: FrameLayout
private lateinit var mPublisherViewContainer: FrameLayout
private lateinit var mPublisherViewIcon: View
private lateinit var mSubscriberViewContainer: FrameLayout
private lateinit var mSubscriberViewIcon: ImageView
private lateinit var controlPanel: ConstraintLayout
private var apiKey: String? = null
private var sessionId: String? = null
private var token: String? = null
private var appLang: String? = null
private var baseUrl: String? = null
private var isSwitchCameraClicked = false
private var isCameraClicked = false
private var isSpeckerClicked = false
private var isMicClicked = false
private lateinit var parentView: View
private lateinit var videoCallContainer: ConstraintLayout
private lateinit var layoutName: RelativeLayout
private lateinit var layoutMini: RelativeLayout
private lateinit var icMini: ImageButton
private lateinit var mCallBtn: ImageView
private lateinit var btnMinimize: ImageView
private lateinit var mCameraBtn: ImageView
private lateinit var mSwitchCameraBtn: ImageView
private lateinit var mspeckerBtn: ImageView
private lateinit var mMicBtn: ImageView
private lateinit var patientName: TextView
private lateinit var cmTimer: Chronometer
private var elapsedTime: Long = 0
private var resume = false
private val progressBar: ProgressBar? = null
private val countDownTimer: CountDownTimer? = null
private val progressBarTextView: TextView? = null
private val progressBarLayout: RelativeLayout? = null
private var isConnected = false
private var sessionStatusModel: GetSessionStatusModel? = null
private var videoCallResponseListener: VideoCallResponseListener? = null
private lateinit var mDetector: GestureDetectorCompat
override fun onCreate(savedInstanceState: Bundle?) {
requireActivity().setTheme(R.style.AppTheme)
super.onCreate(savedInstanceState)
}
override fun onStart() {
super.onStart()
dialog?.window?.setLayout(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT
)
}
override fun getTheme(): Int {
return R.style.dialogTheme
}
override fun onCreateDialog(@Nullable savedInstanceState: Bundle?): Dialog {
val dialog: Dialog = super.onCreateDialog(savedInstanceState)
// Add back button listener
// Add back button listener
dialog.setOnKeyListener { _, keyCode, keyEvent ->
// getAction to make sure this doesn't double fire
if (keyCode == KeyEvent.KEYCODE_BACK && keyEvent.action == KeyEvent.ACTION_UP) {
videoCallResponseListener?.onBackHandle()
false // Capture onKey
} else true
// Don't capture
}
return dialog
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// This is done in a post() since the dialog must be drawn before locating.
requireView().post {
val dialogWindow = dialog!!.window
if (dialog != null && dialogWindow != null) {
dialogWindow.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT));
}
// Make the dialog possible to be outside touch
dialogWindow!!.setFlags(
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
)
dialogWindow.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
requireView().invalidate()
}
}
fun setCallListener(videoCallResponseListener: VideoCallResponseListener) {
this.videoCallResponseListener = videoCallResponseListener
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View {
parentView = inflater.inflate(R.layout.activity_video_call, container, false)
// Objects.requireNonNull(requireActivity().actionBar)!!.hide()
arguments?.run {
apiKey = getString("apiKey")
sessionId = getString("sessionId")
token = getString("token")
appLang = getString("appLang")
baseUrl = getString("baseUrl")
sessionStatusModel = getParcelable("sessionStatusModel")
}
initUI(parentView)
requestPermissions()
handleDragDialog()
mDetector = GestureDetectorCompat(context, MyGestureListener({ showControlPanelTemporarily() }, { miniCircleDoubleTap() }))
return parentView
}
override fun onPause() {
super.onPause()
if (mSession == null) {
return
}
mSession!!.onPause()
if (requireActivity().isFinishing) {
disconnectSession()
}
}
override fun onResume() {
super.onResume()
if (mSession == null) {
return
}
mSession!!.onResume()
}
override fun onDestroy() {
disconnectSession()
cmTimer.stop()
super.onDestroy()
}
@SuppressLint("ClickableViewAccessibility")
private fun initUI(view: View) {
videoCallContainer = view.findViewById(R.id.video_call_ll)
layoutName = view.findViewById(R.id.layout_name)
layoutMini = view.findViewById(R.id.layout_mini)
icMini = view.findViewById(R.id.ic_mini)
thumbnail_container = view.findViewById(R.id.thumbnail_container)
mPublisherViewContainer = view.findViewById(R.id.local_video_view_container)
mPublisherViewIcon = view.findViewById(R.id.local_video_view_icon)
mSubscriberViewIcon = view.findViewById(R.id.remote_video_view_icon)
mSubscriberViewContainer = view.findViewById(R.id.remote_video_view_container)
patientName = view.findViewById<TextView>(R.id.patient_name)
patientName.text = sessionStatusModel!!.patientName
cmTimer = view.findViewById<Chronometer>(R.id.cmTimer)
cmTimer.format = "mm:ss"
cmTimer.onChronometerTickListener = Chronometer.OnChronometerTickListener { arg0: Chronometer? ->
val minutes: Long
val seconds: Long
if (!resume) {
minutes = (SystemClock.elapsedRealtime() - cmTimer.base) / 1000 / 60
seconds = (SystemClock.elapsedRealtime() - cmTimer.base) / 1000 % 60
elapsedTime = SystemClock.elapsedRealtime()
} else {
minutes = (elapsedTime - cmTimer.base) / 1000 / 60
seconds = (elapsedTime - cmTimer.base) / 1000 % 60
elapsedTime += 1000
}
arg0?.text = "$minutes:$seconds"
Log.d(VideoCallFragment.TAG, "onChronometerTick: $minutes : $seconds")
}
icMini.setOnClickListener {
onMiniCircleClicked()
}
controlPanel = view.findViewById(R.id.control_panel)
videoCallPresenter = VideoCallPresenterImpl(this, baseUrl)
mCallBtn = view.findViewById<ImageView>(R.id.btn_call)
mCallBtn.setOnClickListener {
onCallClicked()
}
btnMinimize = view.findViewById<ImageView>(R.id.btn_minimize)
btnMinimize.setOnClickListener {
onMinimizedClicked(it)
}
mCameraBtn = view.findViewById<ImageView>(R.id.btn_camera)
mCameraBtn.setOnClickListener {
onCameraClicked(it)
}
mSwitchCameraBtn = view.findViewById<ImageView>(R.id.btn_switch_camera)
mSwitchCameraBtn.setOnClickListener {
onSwitchCameraClicked(it)
}
mspeckerBtn = view.findViewById<ImageView>(R.id.btn_specker)
mspeckerBtn.setOnClickListener {
onSpeckerClicked(it)
}
mMicBtn = view.findViewById<ImageView>(R.id.btn_mic)
mMicBtn.setOnClickListener {
onMicClicked(it)
}
// progressBarLayout=findViewById(R.id.progressBar);
// progressBar=findViewById(R.id.progress_bar);
// progressBarTextView=findViewById(R.id.progress_bar_text);
// progressBar.setVisibility(View.GONE);
hiddenButtons()
checkClientConnected()
if (appLang == "ar") {
progressBarLayout!!.layoutDirection = View.LAYOUT_DIRECTION_RTL
}
}
private fun checkClientConnected() {
mConnectedHandler = Handler((Looper.getMainLooper()))
mConnectedRunnable = Runnable {
if (!isConnected) {
videoCallPresenter.callClintConnected(sessionStatusModel)
}
}
mConnectedHandler!!.postDelayed(mConnectedRunnable!!, (55 * 1000).toLong())
}
private fun hiddenButtons() {
mVolHandler = Handler()
mVolRunnable = Runnable { controlPanel.visibility = View.GONE }
mVolHandler!!.postDelayed(mVolRunnable!!, (5 * 1000).toLong())
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String?>, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this)
}
override fun onPermissionsGranted(requestCode: Int, perms: List<String?>) {
Log.d(TAG, "onPermissionsGranted:" + requestCode + ":" + perms.size)
}
override fun onPermissionsDenied(requestCode: Int, perms: List<String?>) {
Log.d(TAG, "onPermissionsDenied:" + requestCode + ":" + perms.size)
if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
AppSettingsDialog.Builder(this)
.setTitle(getString(R.string.title_settings_dialog))
.setRationale(getString(R.string.rationale_ask_again))
.setPositiveButton(getString(R.string.setting))
.setNegativeButton(getString(R.string.cancel))
.setRequestCode(RC_SETTINGS_SCREEN_PERM)
.build()
.show()
}
}
@AfterPermissionGranted(RC_VIDEO_APP_PERM)
private fun requestPermissions() {
val perms = arrayOf(Manifest.permission.INTERNET, Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO, Manifest.permission.MODIFY_AUDIO_SETTINGS, Manifest.permission.CALL_PHONE)
if (EasyPermissions.hasPermissions(requireContext(), *perms)) {
try {
mSession = Session.Builder(context, apiKey, sessionId).build()
mSession!!.setSessionListener(this)
mSession!!.connect(token)
} catch (e: Exception) {
e.printStackTrace()
}
} else {
EasyPermissions.requestPermissions(this, getString(R.string.remaining_ar), RC_VIDEO_APP_PERM, *perms)
}
}
override fun onConnected(session: Session?) {
Log.i(TAG, "Session Connected")
mPublisher = Publisher.Builder(requireContext())
// .name("publisher")
// .renderer(ThumbnailCircleVideoRenderer(requireContext()))
.build()
mPublisher!!.setPublisherListener(this)
if (mPublisher!!.view is GLSurfaceView) {
(mPublisher!!.view as GLSurfaceView).setZOrderOnTop(true)
}
mPublisherViewContainer.addView(mPublisher!!.view)
mSession!!.publish(mPublisher)
if (!resume) {
cmTimer.base = SystemClock.elapsedRealtime()
}
cmTimer.start()
videoCallResponseListener?.minimizeVideoEvent(true)
}
override fun onDisconnected(session: Session) {
Log.d(TAG, "onDisconnected: disconnected from session " + session.sessionId)
mSession = null
cmTimer.stop()
disconnectSession()
videoCallResponseListener?.minimizeVideoEvent(false)
}
override fun onError(session: Session, opentokError: OpentokError) {
Log.d(TAG, "onError: Error (" + opentokError.message + ") in session " + session.sessionId)
// videoCallResponseListener?.errorHandle("Error (" + opentokError.message + ") in session ")
// dialog?.dismiss()
}
override fun onStreamReceived(session: Session, stream: Stream) {
Log.d(TAG, "onStreamReceived: New stream " + stream.streamId + " in session " + session.sessionId)
if (mSubscriber != null) {
isConnected = true
return
}
isConnected = true
subscribeToStream(stream)
if (mConnectedHandler != null && mConnectedRunnable != null)
mConnectedHandler!!.removeCallbacks(mConnectedRunnable!!)
videoCallPresenter.callChangeCallStatus(ChangeCallStatusRequestModel(3, sessionStatusModel!!.doctorId, sessionStatusModel!!.generalid, token, sessionStatusModel!!.vcid))
}
override fun onStreamDropped(session: Session, stream: Stream) {
Log.d(TAG, "onStreamDropped: Stream " + stream.streamId + " dropped from session " + session.sessionId)
if (mSubscriber == null) {
return
}
if (mSubscriber!!.stream == stream) {
mSubscriberViewContainer.removeView(mSubscriber!!.view)
mSubscriber!!.destroy()
mSubscriber = null
}
disconnectSession()
}
override fun onStreamCreated(publisherKit: PublisherKit?, stream: Stream) {
Log.d(TAG, "onStreamCreated: Own stream " + stream.streamId + " created")
}
override fun onStreamDestroyed(publisherKit: PublisherKit?, stream: Stream) {
Log.d(TAG, "onStreamDestroyed: Own stream " + stream.streamId + " destroyed")
}
override fun onError(publisherKit: PublisherKit?, opentokError: OpentokError) {
Log.d(VideoCallFragment.TAG, "onError: Error (" + opentokError.message + ") in publisher")
// videoCallResponseListener?.errorHandle("Error (" + opentokError.message + ") in publisher")
// dialog?.dismiss()
}
override fun onVideoDataReceived(subscriberKit: SubscriberKit?) {
mSubscriber!!.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL)
(mSubscriber!!.renderer as DynamicVideoRenderer).enableThumbnailCircle(false)
mSubscriberViewContainer.addView(mSubscriber!!.view)
// switchToThumbnailCircle()
}
fun switchToThumbnailCircle() {
thumbnail_container.postDelayed({
val view = mSubscriber!!.view
if (view.parent != null) {
(view.parent as ViewGroup).removeView(view)
}
if (view is GLSurfaceView) {
view.setZOrderOnTop(true)
if (mSubscriber!!.renderer is DynamicVideoRenderer) {
(mSubscriber!!.renderer as DynamicVideoRenderer).enableThumbnailCircle(true)
thumbnail_container.addView(view)
}
}
switchToFullScreenView()
}, 4000)
}
fun switchToFullScreenView() {
mSubscriberViewContainer.postDelayed({
val view = mSubscriber!!.view
if (view.parent != null) {
(view.parent as ViewGroup).removeView(view)
}
if (view is GLSurfaceView) {
view.setZOrderOnTop(false)
if (mSubscriber!!.renderer is DynamicVideoRenderer) {
(mSubscriber!!.renderer as DynamicVideoRenderer).enableThumbnailCircle(false)
mSubscriberViewContainer.addView(view)
}
}
switchToThumbnailCircle()
}, 4000)
}
override fun onVideoDisabled(subscriberKit: SubscriberKit?, s: String?) {}
override fun onVideoEnabled(subscriberKit: SubscriberKit?, s: String?) {}
override fun onVideoDisableWarning(subscriberKit: SubscriberKit?) {}
override fun onVideoDisableWarningLifted(subscriberKit: SubscriberKit?) {}
private fun subscribeToStream(stream: Stream) {
mSubscriber = Subscriber.Builder(requireContext(), stream)
.renderer(DynamicVideoRenderer(requireContext()))
.build()
mSubscriber!!.setVideoListener(this)
mSession!!.subscribe(mSubscriber)
}
private fun disconnectSession() {
if (mSession == null) {
videoCallResponseListener?.onCallFinished(Activity.RESULT_CANCELED)
// requireActivity().setResult(Activity.RESULT_CANCELED)
dialog?.dismiss()
return
}
if (mSubscriber != null) {
mSubscriberViewContainer.removeView(mSubscriber!!.view)
mSession!!.unsubscribe(mSubscriber)
mSubscriber!!.destroy()
mSubscriber = null
}
if (mPublisher != null) {
mPublisherViewContainer.removeView(mPublisher!!.view)
mSession!!.unpublish(mPublisher)
mPublisher!!.destroy()
mPublisher = null
}
mSession!!.disconnect()
countDownTimer?.cancel()
videoCallPresenter.callChangeCallStatus(ChangeCallStatusRequestModel(16, sessionStatusModel!!.doctorId, sessionStatusModel!!.generalid, token, sessionStatusModel!!.vcid))
dialog?.dismiss()
}
override fun onCallSuccessful(sessionStatusModel: SessionStatusModel) {
if (sessionStatusModel.sessionStatus == 2 || sessionStatusModel.sessionStatus == 3) {
val returnIntent = Intent()
returnIntent.putExtra("sessionStatusNotRespond", sessionStatusModel)
videoCallResponseListener?.onCallFinished(Activity.RESULT_OK, returnIntent)
// requireActivity().setResult(Activity.RESULT_OK, returnIntent)
dialog?.dismiss()
}
}
override fun onCallChangeCallStatusSuccessful(sessionStatusModel: SessionStatusModel?) {}
override fun onFailure() {}
private fun onSwitchCameraClicked(view: View?) {
if (mPublisher != null) {
isSwitchCameraClicked = !isSwitchCameraClicked
mPublisher!!.cycleCamera()
val res = if (isSwitchCameraClicked) R.drawable.camera_front else R.drawable.camera_back
mSwitchCameraBtn.setImageResource(res)
}
}
fun onCallClicked() {
disconnectSession()
}
private fun miniCircleDoubleTap() {
if (isCircle) {
onMiniCircleClicked()
}
}
private fun onMiniCircleClicked() {
if (isCircle) {
dialog?.window?.setLayout(
400,
600
)
} else {
dialog?.window?.setLayout(
300,
300
)
}
isCircle = !isCircle
if (mSubscriber != null) {
(mSubscriber!!.renderer as DynamicVideoRenderer).enableThumbnailCircle(isCircle)
} else {
if (isCircle) {
videoCallContainer.background = ContextCompat.getDrawable(requireContext(), R.drawable.circle_shape)
mSubscriberViewContainer.background = ContextCompat.getDrawable(requireContext(), R.drawable.circle_shape)
} else {
videoCallContainer.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.text_color))
mSubscriberViewContainer.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.text_color))
}
}
if (isCircle) {
controlPanel.visibility = View.GONE
layoutMini.visibility = View.GONE
} else {
controlPanel.visibility = View.VISIBLE
layoutMini.visibility = View.VISIBLE
}
}
private fun onMinimizedClicked(view: View?) {
if (isFullScreen) {
dialog?.window?.setLayout(
400,
600
)
} else {
dialog?.window?.setLayout(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT
)
}
isFullScreen = !isFullScreen
val res = if (isFullScreen) R.drawable.reducing else R.drawable.expand
btnMinimize.setImageResource(res)
setViewsVisibility()
// videoCallResponseListener?.minimizeVideoEvent(!isFullScreen)
}
private fun setViewsVisibility() {
val iconSize: Int = context!!.resources.getDimension(R.dimen.video_icon_size).toInt()
val iconSizeSmall: Int = context!!.resources.getDimension(R.dimen.video_icon_size_small).toInt()
val btnMinimizeLayoutParam: ConstraintLayout.LayoutParams = btnMinimize.layoutParams as ConstraintLayout.LayoutParams
val mCallBtnLayoutParam: ConstraintLayout.LayoutParams = mCallBtn.layoutParams as ConstraintLayout.LayoutParams
val localPreviewMargin: Int = context!!.resources.getDimension(R.dimen.local_preview_margin_top).toInt()
val localPreviewWidth: Int = context!!.resources.getDimension(R.dimen.local_preview_width).toInt()
val localPreviewHeight: Int = context!!.resources.getDimension(R.dimen.local_preview_height).toInt()
// val localPreviewIconSize: Int = context!!.resources.getDimension(R.dimen.local_back_icon_size).toInt()
// val localPreviewMarginSmall : Int = context!!.resources.getDimension(R.dimen.local_preview_margin_small).toInt()
// val localPreviewWidthSmall : Int = context!!.resources.getDimension(R.dimen.local_preview_width_small).toInt()
// val localPreviewHeightSmall : Int = context!!.resources.getDimension(R.dimen.local_preview_height_small).toInt()
// val localPreviewIconSmall: Int = context!!.resources.getDimension(R.dimen.local_back_icon_size_small).toInt()
// val localPreviewLayoutIconParam : FrameLayout.LayoutParams
val localPreviewLayoutParam: RelativeLayout.LayoutParams = mPublisherViewContainer.layoutParams as RelativeLayout.LayoutParams
val remotePreviewIconSize: Int = context!!.resources.getDimension(R.dimen.remote_back_icon_size).toInt()
val remotePreviewIconSizeSmall: Int = context!!.resources.getDimension(R.dimen.remote_back_icon_size_small).toInt()
val remotePreviewLayoutParam: FrameLayout.LayoutParams = mSubscriberViewIcon.layoutParams as FrameLayout.LayoutParams
if (isFullScreen) {
layoutName.visibility = View.VISIBLE
layoutMini.visibility = View.GONE
mCameraBtn.visibility = View.VISIBLE
mSwitchCameraBtn.visibility = View.VISIBLE
// mspeckerBtn.visibility = View.VISIBLE
mMicBtn.visibility = View.VISIBLE
btnMinimizeLayoutParam.width = iconSize
btnMinimizeLayoutParam.height = iconSize
mCallBtnLayoutParam.width = iconSize
mCallBtnLayoutParam.height = iconSize
// localPreviewLayoutIconParam = FrameLayout.LayoutParams(localPreviewIconSize, localPreviewIconSize)
//// localPreviewLayoutParam = RelativeLayout.LayoutParams(localPreviewWidth, localPreviewHeight)
localPreviewLayoutParam.width = localPreviewWidth
localPreviewLayoutParam.height = localPreviewHeight
localPreviewLayoutParam.setMargins(0, localPreviewMargin, localPreviewMargin, 0)
// remotePreviewLayoutParam = FrameLayout.LayoutParams(remotePreviewIconSize, remotePreviewIconSize)
remotePreviewLayoutParam.width = remotePreviewIconSize
remotePreviewLayoutParam.height = remotePreviewIconSize
} else {
layoutName.visibility = View.GONE
layoutMini.visibility = View.VISIBLE
mCameraBtn.visibility = View.GONE
mSwitchCameraBtn.visibility = View.GONE
// mspeckerBtn.visibility = View.GONE
mMicBtn.visibility = View.GONE
// mPublisherViewContainer.visibility = View.GONE
// mPublisherViewIcon.visibility = View.GONE
// layoutParam = ConstraintLayout.LayoutParams(iconSizeSmall, iconSizeSmall)
btnMinimizeLayoutParam.width = iconSizeSmall
btnMinimizeLayoutParam.height = iconSizeSmall
mCallBtnLayoutParam.width = iconSizeSmall
mCallBtnLayoutParam.height = iconSizeSmall
localPreviewLayoutParam.width = 0
localPreviewLayoutParam.height = 0
localPreviewLayoutParam.setMargins(0, localPreviewMargin / 2, localPreviewMargin / 2, 0)
// localPreviewLayoutIconParam = FrameLayout.LayoutParams(localPreviewIconSmall, localPreviewIconSmall)
//// localPreviewLayoutParam = RelativeLayout.LayoutParams(localPreviewWidthSmall, localPreviewHeightSmall)
// localPreviewLayoutParam.width = localPreviewWidthSmall
// localPreviewLayoutParam.height = localPreviewWidthSmall
// localPreviewLayoutParam.setMargins(0,localPreviewMarginSmall, localPreviewMarginSmall, 0)
// remotePreviewLayoutParam = FrameLayout.LayoutParams(remotePreviewIconSizeSmall, remotePreviewIconSizeSmall)
remotePreviewLayoutParam.width = remotePreviewIconSizeSmall
remotePreviewLayoutParam.height = remotePreviewIconSizeSmall
if (isCircle) {
controlPanel.visibility = View.GONE
layoutMini.visibility = View.GONE
} else {
controlPanel.visibility = View.VISIBLE
layoutMini.visibility = View.VISIBLE
}
}
mPublisherViewContainer.layoutParams = localPreviewLayoutParam
// mPublisherViewIcon.layoutParams = localPreviewLayoutIconParam
mSubscriberViewIcon.layoutParams = remotePreviewLayoutParam
btnMinimize.layoutParams = btnMinimizeLayoutParam
mCallBtn.layoutParams = mCallBtnLayoutParam
}
private fun onCameraClicked(view: View?) {
if (mPublisher != null) {
isCameraClicked = !isCameraClicked
mPublisher!!.publishVideo = !isCameraClicked
val res = if (isCameraClicked) R.drawable.video_disabled else R.drawable.video_enabled
mCameraBtn!!.setImageResource(res)
}
}
private fun onMicClicked(view: View?) {
if (mPublisher != null) {
isMicClicked = !isMicClicked
mPublisher!!.publishAudio = !isMicClicked
val res = if (isMicClicked) R.drawable.mic_disabled else R.drawable.mic_enabled
mMicBtn!!.setImageResource(res)
}
}
private fun onSpeckerClicked(view: View?) {
if (mSubscriber != null) {
isSpeckerClicked = !isSpeckerClicked
mSubscriber!!.subscribeToAudio = !isSpeckerClicked
val res = if (isSpeckerClicked) R.drawable.audio_disabled else R.drawable.audio_enabled
mspeckerBtn.setImageResource(res)
}
}
@SuppressLint("ClickableViewAccessibility")
private fun handleDragDialog() {
mWindowManager = requireActivity().getSystemService(Context.WINDOW_SERVICE) as WindowManager
getWindowManagerDefaultDisplay()
videoCallContainer.setOnTouchListener(dragListener)
mSubscriberViewContainer.setOnTouchListener(dragListener)
}
@SuppressLint("ClickableViewAccessibility")
private val dragListener: View.OnTouchListener = View.OnTouchListener { _, event ->
mDetector.onTouchEvent(event)
//Get Floating widget view params
val layoutParams: WindowManager.LayoutParams = dialog!!.window!!.attributes
//get the touch location coordinates
val x_cord = event.rawX.toInt()
val y_cord = event.rawY.toInt()
val x_cord_Destination: Int
var y_cord_Destination: Int
when (event.action) {
MotionEvent.ACTION_DOWN -> {
x_init_cord = x_cord
y_init_cord = y_cord
//remember the initial position.
x_init_margin = layoutParams.x
y_init_margin = layoutParams.y
}
MotionEvent.ACTION_UP -> {
//Get the difference between initial coordinate and current coordinate
val x_diff: Int = x_cord - x_init_cord
val y_diff: Int = y_cord - y_init_cord
y_cord_Destination = y_init_margin + y_diff
val barHeight: Int = getStatusBarHeight()
if (y_cord_Destination < 0) {
// y_cord_Destination = 0
// y_cord_Destination =
// -(szWindow.y - (videoCallContainer.height /*+ barHeight*/))
y_cord_Destination = -(szWindow.y / 2)
} else if (y_cord_Destination + (videoCallContainer.height + barHeight) > szWindow.y) {
// y_cord_Destination = szWindow.y - (videoCallContainer.height + barHeight)
y_cord_Destination = (szWindow.y / 2)
}
layoutParams.y = y_cord_Destination
//reset position if user drags the floating view
resetPosition(x_cord)
}
MotionEvent.ACTION_MOVE -> {
val x_diff_move: Int = x_cord - x_init_cord
val y_diff_move: Int = y_cord - y_init_cord
x_cord_Destination = x_init_margin + x_diff_move
y_cord_Destination = y_init_margin + y_diff_move
layoutParams.x = x_cord_Destination
layoutParams.y = y_cord_Destination
dialog!!.window!!.attributes = layoutParams
}
}
true
}
private fun showControlPanelTemporarily() {
if (!isCircle) {
controlPanel.visibility = View.VISIBLE
mVolHandler!!.removeCallbacks(mVolRunnable!!)
mVolHandler!!.postDelayed(mVolRunnable!!, (5 * 1000).toLong())
}
}
/* Reset position of Floating Widget view on dragging */
private fun resetPosition(x_cord_now: Int) {
if (x_cord_now <= szWindow.x / 2) {
isLeft = true
moveToLeft(x_cord_now)
} else {
isLeft = false
moveToRight(x_cord_now)
}
}
/* Method to move the Floating widget view to Left */
private fun moveToLeft(current_x_cord: Int) {
var mParams: WindowManager.LayoutParams = dialog!!.window!!.attributes
mParams.x =
(szWindow.x - current_x_cord * current_x_cord - videoCallContainer.width).toInt()
dialog!!.window!!.attributes = mParams
val x = szWindow.x - current_x_cord
object : CountDownTimer(500, 5) {
//get params of Floating Widget view
var mParams: WindowManager.LayoutParams = dialog!!.window!!.attributes
override fun onTick(t: Long) {
val step = (500 - t) / 5
// mParams.x = 0 - (current_x_cord * current_x_cord * step).toInt()
mParams.x =
(szWindow.x - current_x_cord * current_x_cord * step - videoCallContainer.width).toInt()
dialog!!.window!!.attributes = mParams
}
override fun onFinish() {
mParams.x = -(szWindow.x - videoCallContainer.width)
dialog!!.window!!.attributes = mParams
}
}.start()
}
/* Method to move the Floating widget view to Right */
private fun moveToRight(current_x_cord: Int) {
// var mParams : WindowManager.LayoutParams = dialog!!.window!!.attributes
// mParams.x =
// (szWindow.x + current_x_cord * current_x_cord - videoCallContainer.width).toInt()
//
// dialog!!.window!!.attributes = mParams
object : CountDownTimer(500, 5) {
//get params of Floating Widget view
var mParams: WindowManager.LayoutParams = dialog!!.window!!.attributes
override fun onTick(t: Long) {
val step = (500 - t) / 5
mParams.x =
(szWindow.x + current_x_cord * current_x_cord * step - videoCallContainer.width).toInt()
dialog!!.window!!.attributes = mParams
}
override fun onFinish() {
mParams.x = szWindow.x - videoCallContainer.width
dialog!!.window!!.attributes = mParams
}
}.start()
}
private fun getWindowManagerDefaultDisplay() {
mWindowManager.getDefaultDisplay()
.getSize(szWindow)
}
/* return status bar height on basis of device display metrics */
private fun getStatusBarHeight(): Int {
return ceil(
(25 * requireActivity().applicationContext.resources.displayMetrics.density).toDouble()
).toInt()
}
private class MyGestureListener(val onTabCall: () -> Unit, val miniCircleDoubleTap: () -> Unit) : GestureDetector.SimpleOnGestureListener() {
override fun onSingleTapConfirmed(event: MotionEvent): Boolean {
onTabCall()
return true
}
override fun onDoubleTap(e: MotionEvent?): Boolean {
miniCircleDoubleTap()
return super.onDoubleTap(e)
}
}
companion object {
@JvmStatic
fun newInstance(args: Bundle) =
VideoCallFragment().apply {
arguments = args
}
private val TAG = VideoCallFragment::class.java.simpleName
private const val RC_SETTINGS_SCREEN_PERM = 123
private const val RC_VIDEO_APP_PERM = 124
}
}

@ -0,0 +1,379 @@
package com.hmg.hmgDr.util
import android.content.Context
import android.content.res.Resources
import android.graphics.PixelFormat
import android.opengl.GLES20
import android.opengl.GLSurfaceView
import android.opengl.Matrix
import android.view.View
import com.opentok.android.BaseVideoRenderer
import java.nio.ByteBuffer
import java.nio.ByteOrder
import java.nio.FloatBuffer
import java.nio.ShortBuffer
import java.util.concurrent.locks.ReentrantLock
import javax.microedition.khronos.egl.EGLConfig
import javax.microedition.khronos.opengles.GL10
/*
* https://nhancv.medium.com/android-how-to-make-a-circular-view-as-a-thumbnail-of-opentok-27992aee15c9
* to solve make circle video stream
* */
class DynamicVideoRenderer(private val mContext: Context) : BaseVideoRenderer() {
private val mView: GLSurfaceView = GLSurfaceView(mContext)
private val mRenderer: MyRenderer
interface DynamicVideoRendererMetadataListener {
fun onMetadataReady(metadata: ByteArray?)
}
fun setDynamicVideoRendererMetadataListener(metadataListener: DynamicVideoRendererMetadataListener?) {
mRenderer.metadataListener = metadataListener
}
fun enableThumbnailCircle(enable: Boolean) {
mRenderer.requestEnableThumbnailCircle = enable
}
internal class MyRenderer : GLSurfaceView.Renderer {
var mTextureIds = IntArray(3)
var mScaleMatrix = FloatArray(16)
private val mVertexBuffer: FloatBuffer
private val mTextureBuffer: FloatBuffer
private val mDrawListBuffer: ShortBuffer
var requestEnableThumbnailCircle = false
var mVideoFitEnabled = true
var mVideoDisabled = false
private val mVertexIndex = shortArrayOf(0, 1, 2, 0, 2, 3) // order to draw
// vertices
private val vertexShaderCode = """uniform mat4 uMVPMatrix;attribute vec4 aPosition;
attribute vec2 aTextureCoord;
varying vec2 vTextureCoord;
void main() {
gl_Position = uMVPMatrix * aPosition;
vTextureCoord = aTextureCoord;
}
"""
private val fragmentShaderCode = """precision mediump float;
uniform sampler2D Ytex;
uniform sampler2D Utex,Vtex;
uniform int enableCircle;
uniform vec2 radiusDp;
varying vec2 vTextureCoord;
void main(void) {
float nx,ny,r,g,b,y,u,v;
mediump vec4 txl,ux,vx; nx=vTextureCoord[0];
ny=vTextureCoord[1];
y=texture2D(Ytex,vec2(nx,ny)).r;
u=texture2D(Utex,vec2(nx,ny)).r;
v=texture2D(Vtex,vec2(nx,ny)).r;
y=1.1643*(y-0.0625);
u=u-0.5;
v=v-0.5;
r=y+1.5958*v;
g=y-0.39173*u-0.81290*v;
b=y+2.017*u;
if (enableCircle > 0) {
float radius = 0.5;
vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);
vec4 color1 = vec4(r, g, b, 1.0);
vec2 st = (gl_FragCoord.xy/radiusDp.xy); float dist = radius - distance(st,vec2(0.5));
float t = 1.0;
if (dist < 0.0) t = 0.0;
gl_FragColor = mix(color0, color1, t);
}
else {
gl_FragColor = vec4(r, g, b, 1.0);
}
}
"""
var mFrameLock = ReentrantLock()
var mCurrentFrame: Frame? = null
private var mProgram = 0
private var mTextureWidth = 0
private var mTextureHeight = 0
private var mViewportWidth = 0
private var mViewportHeight = 0
override fun onSurfaceCreated(gl: GL10, config: EGLConfig) {
gl.glClearColor(0f, 0f, 0f, 1f)
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)
val vertexShader = loadShader(GLES20.GL_VERTEX_SHADER,
vertexShaderCode)
val fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER,
fragmentShaderCode)
mProgram = GLES20.glCreateProgram() // create empty OpenGL ES
// Program
GLES20.glAttachShader(mProgram, vertexShader) // add the vertex
// shader to program
GLES20.glAttachShader(mProgram, fragmentShader) // add the fragment
// shader to
// program
GLES20.glLinkProgram(mProgram)
val positionHandle = GLES20.glGetAttribLocation(mProgram,
"aPosition")
val textureHandle = GLES20.glGetAttribLocation(mProgram,
"aTextureCoord")
GLES20.glVertexAttribPointer(positionHandle, COORDS_PER_VERTEX,
GLES20.GL_FLOAT, false, COORDS_PER_VERTEX * 4,
mVertexBuffer)
GLES20.glEnableVertexAttribArray(positionHandle)
GLES20.glVertexAttribPointer(textureHandle,
TEXTURECOORDS_PER_VERTEX, GLES20.GL_FLOAT, false,
TEXTURECOORDS_PER_VERTEX * 4, mTextureBuffer)
GLES20.glEnableVertexAttribArray(textureHandle)
GLES20.glUseProgram(mProgram)
var i = GLES20.glGetUniformLocation(mProgram, "Ytex")
GLES20.glUniform1i(i, 0) /* Bind Ytex to texture unit 0 */
i = GLES20.glGetUniformLocation(mProgram, "Utex")
GLES20.glUniform1i(i, 1) /* Bind Utex to texture unit 1 */
i = GLES20.glGetUniformLocation(mProgram, "Vtex")
GLES20.glUniform1i(i, 2) /* Bind Vtex to texture unit 2 */
val radiusDpLocation = GLES20.glGetUniformLocation(mProgram, "radiusDp")
val radiusDp = (Resources.getSystem().displayMetrics.density * THUMBNAIL_SIZE).toInt()
GLES20.glUniform2f(radiusDpLocation, radiusDp.toFloat(), radiusDp.toFloat())
mTextureWidth = 0
mTextureHeight = 0
}
fun enableThumbnailCircle(enable: Boolean) {
GLES20.glUseProgram(mProgram)
val enableCircleLocation = GLES20.glGetUniformLocation(mProgram, "enableCircle")
GLES20.glUniform1i(enableCircleLocation, if (enable) 1 else 0)
}
fun setupTextures(frame: Frame) {
if (mTextureIds[0] != 0) {
GLES20.glDeleteTextures(3, mTextureIds, 0)
}
GLES20.glGenTextures(3, mTextureIds, 0)
val w = frame.width
val h = frame.height
val hw = w + 1 shr 1
val hh = h + 1 shr 1
initializeTexture(GLES20.GL_TEXTURE0, mTextureIds[0], w, h)
initializeTexture(GLES20.GL_TEXTURE1, mTextureIds[1], hw, hh)
initializeTexture(GLES20.GL_TEXTURE2, mTextureIds[2], hw, hh)
mTextureWidth = frame.width
mTextureHeight = frame.height
}
fun updateTextures(frame: Frame) {
val width = frame.width
val height = frame.height
val half_width = width + 1 shr 1
val half_height = height + 1 shr 1
val y_size = width * height
val uv_size = half_width * half_height
val bb = frame.buffer
// If we are reusing this frame, make sure we reset position and
// limit
bb.clear()
if (bb.remaining() == y_size + uv_size * 2) {
bb.position(0)
GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1)
GLES20.glPixelStorei(GLES20.GL_PACK_ALIGNMENT, 1)
GLES20.glActiveTexture(GLES20.GL_TEXTURE0)
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureIds[0])
GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, width,
height, GLES20.GL_LUMINANCE, GLES20.GL_UNSIGNED_BYTE,
bb)
bb.position(y_size)
GLES20.glActiveTexture(GLES20.GL_TEXTURE1)
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureIds[1])
GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0,
half_width, half_height, GLES20.GL_LUMINANCE,
GLES20.GL_UNSIGNED_BYTE, bb)
bb.position(y_size + uv_size)
GLES20.glActiveTexture(GLES20.GL_TEXTURE2)
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureIds[2])
GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0,
half_width, half_height, GLES20.GL_LUMINANCE,
GLES20.GL_UNSIGNED_BYTE, bb)
} else {
mTextureWidth = 0
mTextureHeight = 0
}
}
override fun onSurfaceChanged(gl: GL10, width: Int, height: Int) {
GLES20.glViewport(0, 0, width, height)
mViewportWidth = width
mViewportHeight = height
}
var metadataListener: DynamicVideoRendererMetadataListener? = null
override fun onDrawFrame(gl: GL10) {
gl.glClearColor(0f, 0f, 0f, 0f)
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)
mFrameLock.lock()
if (mCurrentFrame != null && !mVideoDisabled) {
GLES20.glUseProgram(mProgram)
if (mTextureWidth != mCurrentFrame!!.width
|| mTextureHeight != mCurrentFrame!!.height) {
setupTextures(mCurrentFrame!!)
}
updateTextures(mCurrentFrame!!)
Matrix.setIdentityM(mScaleMatrix, 0)
var scaleX = 1.0f
var scaleY = 1.0f
val ratio = (mCurrentFrame!!.width.toFloat()
/ mCurrentFrame!!.height)
val vratio = mViewportWidth.toFloat() / mViewportHeight
if (mVideoFitEnabled) {
if (ratio > vratio) {
scaleY = vratio / ratio
} else {
scaleX = ratio / vratio
}
} else {
if (ratio < vratio) {
scaleY = vratio / ratio
} else {
scaleX = ratio / vratio
}
}
Matrix.scaleM(mScaleMatrix, 0,
scaleX * if (mCurrentFrame!!.isMirroredX) -1.0f else 1.0f,
scaleY, 1f)
metadataListener?.onMetadataReady(mCurrentFrame!!.metadata)
val mMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram,
"uMVPMatrix")
GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false,
mScaleMatrix, 0)
enableThumbnailCircle(requestEnableThumbnailCircle)
GLES20.glDrawElements(GLES20.GL_TRIANGLES, mVertexIndex.size,
GLES20.GL_UNSIGNED_SHORT, mDrawListBuffer)
} else {
//black frame when video is disabled
gl.glClearColor(0f, 0f, 0f, 1f)
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)
}
mFrameLock.unlock()
}
fun displayFrame(frame: Frame?) {
mFrameLock.lock()
if (mCurrentFrame != null) {
mCurrentFrame!!.recycle()
}
mCurrentFrame = frame
mFrameLock.unlock()
}
fun disableVideo(b: Boolean) {
mFrameLock.lock()
mVideoDisabled = b
if (mVideoDisabled) {
if (mCurrentFrame != null) {
mCurrentFrame!!.recycle()
}
mCurrentFrame = null
}
mFrameLock.unlock()
}
fun enableVideoFit(enableVideoFit: Boolean) {
mVideoFitEnabled = enableVideoFit
}
companion object {
// number of coordinates per vertex in this array
const val COORDS_PER_VERTEX = 3
const val TEXTURECOORDS_PER_VERTEX = 2
var mXYZCoords = floatArrayOf(
-1.0f, 1.0f, 0.0f, // top left
-1.0f, -1.0f, 0.0f, // bottom left
1.0f, -1.0f, 0.0f, // bottom right
1.0f, 1.0f, 0.0f // top right
)
var mUVCoords = floatArrayOf(0f, 0f, 0f, 1f, 1f, 1f, 1f, 0f)
fun initializeTexture(name: Int, id: Int, width: Int, height: Int) {
GLES20.glActiveTexture(name)
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, id)
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST.toFloat())
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR.toFloat())
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE.toFloat())
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE.toFloat())
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_LUMINANCE,
width, height, 0, GLES20.GL_LUMINANCE,
GLES20.GL_UNSIGNED_BYTE, null)
}
fun loadShader(type: Int, shaderCode: String?): Int {
val shader = GLES20.glCreateShader(type)
GLES20.glShaderSource(shader, shaderCode)
GLES20.glCompileShader(shader)
return shader
}
}
init {
val bb = ByteBuffer.allocateDirect(mXYZCoords.size * 4)
bb.order(ByteOrder.nativeOrder())
mVertexBuffer = bb.asFloatBuffer()
mVertexBuffer.put(mXYZCoords)
mVertexBuffer.position(0)
val tb = ByteBuffer.allocateDirect(mUVCoords.size * 4)
tb.order(ByteOrder.nativeOrder())
mTextureBuffer = tb.asFloatBuffer()
mTextureBuffer.put(mUVCoords)
mTextureBuffer.position(0)
val dlb = ByteBuffer.allocateDirect(mVertexIndex.size * 2)
dlb.order(ByteOrder.nativeOrder())
mDrawListBuffer = dlb.asShortBuffer()
mDrawListBuffer.put(mVertexIndex)
mDrawListBuffer.position(0)
}
}
override fun onFrame(frame: Frame) {
mRenderer.displayFrame(frame)
mView.requestRender()
}
override fun setStyle(key: String, value: String) {
if (STYLE_VIDEO_SCALE == key) {
if (STYLE_VIDEO_FIT == value) {
mRenderer.enableVideoFit(true)
} else if (STYLE_VIDEO_FILL == value) {
mRenderer.enableVideoFit(false)
}
}
}
override fun onVideoPropertiesChanged(videoEnabled: Boolean) {
mRenderer.disableVideo(!videoEnabled)
}
override fun getView(): View {
return mView
}
override fun onPause() {
mView.onPause()
}
override fun onResume() {
mView.onResume()
}
companion object {
private const val THUMBNAIL_SIZE = 90 //in dp
}
init {
mView.setEGLContextClientVersion(2)
mView.setEGLConfigChooser(8, 8, 8, 8, 16, 0)
mView.holder.setFormat(PixelFormat.TRANSLUCENT)
mRenderer = MyRenderer()
mView.setRenderer(mRenderer)
mView.renderMode = GLSurfaceView.RENDERMODE_WHEN_DIRTY
}
}

@ -0,0 +1,357 @@
package com.hmg.hmgDr.util
import android.content.Context
import android.content.res.Resources
import android.graphics.PixelFormat
import android.opengl.GLES20
import android.opengl.GLSurfaceView
import android.opengl.Matrix
import android.view.View
import com.opentok.android.BaseVideoRenderer
import java.nio.ByteBuffer
import java.nio.ByteOrder
import java.nio.FloatBuffer
import java.nio.ShortBuffer
import java.util.concurrent.locks.ReentrantLock
import javax.microedition.khronos.egl.EGLConfig
import javax.microedition.khronos.opengles.GL10
class ThumbnailCircleVideoRenderer(private val mContext: Context) : BaseVideoRenderer() {
private val mView: GLSurfaceView = GLSurfaceView(mContext)
private val mRenderer: MyRenderer
interface ThumbnailCircleVideoRendererMetadataListener {
fun onMetadataReady(metadata: ByteArray?)
}
fun setThumbnailCircleVideoRendererMetadataListener(metadataListener: ThumbnailCircleVideoRendererMetadataListener?) {
mRenderer.metadataListener = metadataListener
}
internal class MyRenderer : GLSurfaceView.Renderer {
var mTextureIds = IntArray(3)
var mScaleMatrix = FloatArray(16)
private val mVertexBuffer: FloatBuffer
private val mTextureBuffer: FloatBuffer
private val mDrawListBuffer: ShortBuffer
var mVideoFitEnabled = true
var mVideoDisabled = false
private val mVertexIndex = shortArrayOf(0, 1, 2, 0, 2, 3) // order to draw
// vertices
private val vertexShaderCode = """uniform mat4 uMVPMatrix;attribute vec4 aPosition;
attribute vec2 aTextureCoord;
varying vec2 vTextureCoord;
void main() {
gl_Position = uMVPMatrix * aPosition;
vTextureCoord = aTextureCoord;
}
"""
private val fragmentShaderCode = """precision mediump float;
uniform sampler2D Ytex;
uniform sampler2D Utex,Vtex;
uniform vec2 radiusDp;
varying vec2 vTextureCoord;
void main(void) {
float nx,ny,r,g,b,y,u,v;
mediump vec4 txl,ux,vx; nx=vTextureCoord[0];
ny=vTextureCoord[1];
y=texture2D(Ytex,vec2(nx,ny)).r;
u=texture2D(Utex,vec2(nx,ny)).r;
v=texture2D(Vtex,vec2(nx,ny)).r;
y=1.1643*(y-0.0625);
u=u-0.5;
v=v-0.5;
r=y+1.5958*v;
g=y-0.39173*u-0.81290*v;
b=y+2.017*u;
float radius = 0.5;
vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);
vec4 color1 = vec4(r, g, b, 1.0);
vec2 st = (gl_FragCoord.xy/radiusDp.xy); float dist = radius - distance(st,vec2(0.5));
float t = 1.0;
if (dist < 0.0) t = 0.0;
gl_FragColor = mix(color0, color1, t);
}
"""
var mFrameLock = ReentrantLock()
var mCurrentFrame: Frame? = null
private var mProgram = 0
private var mTextureWidth = 0
private var mTextureHeight = 0
private var mViewportWidth = 0
private var mViewportHeight = 0
override fun onSurfaceCreated(gl: GL10, config: EGLConfig) {
gl.glClearColor(0f, 0f, 0f, 1f)
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)
val vertexShader = loadShader(GLES20.GL_VERTEX_SHADER,
vertexShaderCode)
val fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER,
fragmentShaderCode)
mProgram = GLES20.glCreateProgram() // create empty OpenGL ES
// Program
GLES20.glAttachShader(mProgram, vertexShader) // add the vertex
// shader to program
GLES20.glAttachShader(mProgram, fragmentShader) // add the fragment
// shader to
// program
GLES20.glLinkProgram(mProgram)
val positionHandle = GLES20.glGetAttribLocation(mProgram,
"aPosition")
val textureHandle = GLES20.glGetAttribLocation(mProgram,
"aTextureCoord")
GLES20.glVertexAttribPointer(positionHandle, COORDS_PER_VERTEX,
GLES20.GL_FLOAT, false, COORDS_PER_VERTEX * 4,
mVertexBuffer)
GLES20.glEnableVertexAttribArray(positionHandle)
GLES20.glVertexAttribPointer(textureHandle,
TEXTURECOORDS_PER_VERTEX, GLES20.GL_FLOAT, false,
TEXTURECOORDS_PER_VERTEX * 4, mTextureBuffer)
GLES20.glEnableVertexAttribArray(textureHandle)
GLES20.glUseProgram(mProgram)
var i = GLES20.glGetUniformLocation(mProgram, "Ytex")
GLES20.glUniform1i(i, 0) /* Bind Ytex to texture unit 0 */
i = GLES20.glGetUniformLocation(mProgram, "Utex")
GLES20.glUniform1i(i, 1) /* Bind Utex to texture unit 1 */
i = GLES20.glGetUniformLocation(mProgram, "Vtex")
GLES20.glUniform1i(i, 2) /* Bind Vtex to texture unit 2 */
val radiusDpLocation = GLES20.glGetUniformLocation(mProgram, "radiusDp")
val radiusDp = (Resources.getSystem().displayMetrics.density * THUMBNAIL_SIZE).toInt()
GLES20.glUniform2f(radiusDpLocation, radiusDp.toFloat(), radiusDp.toFloat())
mTextureWidth = 0
mTextureHeight = 0
}
fun setupTextures(frame: Frame) {
if (mTextureIds[0] != 0) {
GLES20.glDeleteTextures(3, mTextureIds, 0)
}
GLES20.glGenTextures(3, mTextureIds, 0)
val w = frame.width
val h = frame.height
val hw = w + 1 shr 1
val hh = h + 1 shr 1
initializeTexture(GLES20.GL_TEXTURE0, mTextureIds[0], w, h)
initializeTexture(GLES20.GL_TEXTURE1, mTextureIds[1], hw, hh)
initializeTexture(GLES20.GL_TEXTURE2, mTextureIds[2], hw, hh)
mTextureWidth = frame.width
mTextureHeight = frame.height
}
fun updateTextures(frame: Frame) {
val width = frame.width
val height = frame.height
val half_width = width + 1 shr 1
val half_height = height + 1 shr 1
val y_size = width * height
val uv_size = half_width * half_height
val bb = frame.buffer
// If we are reusing this frame, make sure we reset position and
// limit
bb.clear()
if (bb.remaining() == y_size + uv_size * 2) {
bb.position(0)
GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1)
GLES20.glPixelStorei(GLES20.GL_PACK_ALIGNMENT, 1)
GLES20.glActiveTexture(GLES20.GL_TEXTURE0)
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureIds[0])
GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, width,
height, GLES20.GL_LUMINANCE, GLES20.GL_UNSIGNED_BYTE,
bb)
bb.position(y_size)
GLES20.glActiveTexture(GLES20.GL_TEXTURE1)
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureIds[1])
GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0,
half_width, half_height, GLES20.GL_LUMINANCE,
GLES20.GL_UNSIGNED_BYTE, bb)
bb.position(y_size + uv_size)
GLES20.glActiveTexture(GLES20.GL_TEXTURE2)
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureIds[2])
GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0,
half_width, half_height, GLES20.GL_LUMINANCE,
GLES20.GL_UNSIGNED_BYTE, bb)
} else {
mTextureWidth = 0
mTextureHeight = 0
}
}
override fun onSurfaceChanged(gl: GL10, width: Int, height: Int) {
GLES20.glViewport(0, 0, width, height)
mViewportWidth = width
mViewportHeight = height
}
var metadataListener: ThumbnailCircleVideoRendererMetadataListener? = null
override fun onDrawFrame(gl: GL10) {
gl.glClearColor(0f, 0f, 0f, 0f)
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)
mFrameLock.lock()
if (mCurrentFrame != null && !mVideoDisabled) {
GLES20.glUseProgram(mProgram)
if (mTextureWidth != mCurrentFrame!!.width
|| mTextureHeight != mCurrentFrame!!.height) {
setupTextures(mCurrentFrame!!)
}
updateTextures(mCurrentFrame!!)
Matrix.setIdentityM(mScaleMatrix, 0)
var scaleX = 1.0f
var scaleY = 1.0f
val ratio = (mCurrentFrame!!.width.toFloat()
/ mCurrentFrame!!.height)
val vratio = mViewportWidth.toFloat() / mViewportHeight
if (mVideoFitEnabled) {
if (ratio > vratio) {
scaleY = vratio / ratio
} else {
scaleX = ratio / vratio
}
} else {
if (ratio < vratio) {
scaleY = vratio / ratio
} else {
scaleX = ratio / vratio
}
}
Matrix.scaleM(mScaleMatrix, 0,
scaleX * if (mCurrentFrame!!.isMirroredX) -1.0f else 1.0f,
scaleY, 1f)
metadataListener?.onMetadataReady(mCurrentFrame!!.metadata)
val mMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram,
"uMVPMatrix")
GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false,
mScaleMatrix, 0)
GLES20.glDrawElements(GLES20.GL_TRIANGLES, mVertexIndex.size,
GLES20.GL_UNSIGNED_SHORT, mDrawListBuffer)
} else {
//black frame when video is disabled
gl.glClearColor(0f, 0f, 0f, 1f)
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)
}
mFrameLock.unlock()
}
fun displayFrame(frame: Frame?) {
mFrameLock.lock()
if (mCurrentFrame != null) {
mCurrentFrame!!.recycle()
}
mCurrentFrame = frame
mFrameLock.unlock()
}
fun disableVideo(b: Boolean) {
mFrameLock.lock()
mVideoDisabled = b
if (mVideoDisabled) {
if (mCurrentFrame != null) {
mCurrentFrame!!.recycle()
}
mCurrentFrame = null
}
mFrameLock.unlock()
}
fun enableVideoFit(enableVideoFit: Boolean) {
mVideoFitEnabled = enableVideoFit
}
companion object {
// number of coordinates per vertex in this array
const val COORDS_PER_VERTEX = 3
const val TEXTURECOORDS_PER_VERTEX = 2
var mXYZCoords = floatArrayOf(
-1.0f, 1.0f, 0.0f, // top left
-1.0f, -1.0f, 0.0f, // bottom left
1.0f, -1.0f, 0.0f, // bottom right
1.0f, 1.0f, 0.0f // top right
)
var mUVCoords = floatArrayOf(0f, 0f, 0f, 1f, 1f, 1f, 1f, 0f)
fun initializeTexture(name: Int, id: Int, width: Int, height: Int) {
GLES20.glActiveTexture(name)
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, id)
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST.toFloat())
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR.toFloat())
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE.toFloat())
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE.toFloat())
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_LUMINANCE,
width, height, 0, GLES20.GL_LUMINANCE,
GLES20.GL_UNSIGNED_BYTE, null)
}
fun loadShader(type: Int, shaderCode: String?): Int {
val shader = GLES20.glCreateShader(type)
GLES20.glShaderSource(shader, shaderCode)
GLES20.glCompileShader(shader)
return shader
}
}
init {
val bb = ByteBuffer.allocateDirect(mXYZCoords.size * 4)
bb.order(ByteOrder.nativeOrder())
mVertexBuffer = bb.asFloatBuffer()
mVertexBuffer.put(mXYZCoords)
mVertexBuffer.position(0)
val tb = ByteBuffer.allocateDirect(mUVCoords.size * 4)
tb.order(ByteOrder.nativeOrder())
mTextureBuffer = tb.asFloatBuffer()
mTextureBuffer.put(mUVCoords)
mTextureBuffer.position(0)
val dlb = ByteBuffer.allocateDirect(mVertexIndex.size * 2)
dlb.order(ByteOrder.nativeOrder())
mDrawListBuffer = dlb.asShortBuffer()
mDrawListBuffer.put(mVertexIndex)
mDrawListBuffer.position(0)
}
}
override fun onFrame(frame: Frame) {
mRenderer.displayFrame(frame)
mView.requestRender()
}
override fun setStyle(key: String, value: String) {
if (STYLE_VIDEO_SCALE == key) {
if (STYLE_VIDEO_FIT == value) {
mRenderer.enableVideoFit(true)
} else if (STYLE_VIDEO_FILL == value) {
mRenderer.enableVideoFit(false)
}
}
}
override fun onVideoPropertiesChanged(videoEnabled: Boolean) {
mRenderer.disableVideo(!videoEnabled)
}
override fun getView(): View {
return mView
}
override fun onPause() {
mView.onPause()
}
override fun onResume() {
mView.onResume()
}
companion object {
private const val THUMBNAIL_SIZE = 90 //in dp
}
init {
mView.setEGLContextClientVersion(2)
mView.setEGLConfigChooser(8, 8, 8, 8, 16, 0)
mView.holder.setFormat(PixelFormat.TRANSLUCENT)
mRenderer = MyRenderer()
mView.setRenderer(mRenderer)
mView.renderMode = GLSurfaceView.RENDERMODE_WHEN_DIRTY
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid
android:color="@color/remoteBackground"/>
<stroke android:width="2dp" android:color="@color/text_color" />
<size
android:width="120dp"
android:height="120dp"/>
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M19,13H5v-2h14v2z"/>
</vector>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/text_color" />
<stroke
android:width="3dp"
android:color="@color/text_color" />
<corners android:radius="10dp" />
<padding
android:bottom="0dp"
android:left="0dp"
android:right="0dp"
android:top="0dp" />
</shape>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="1000dp"/>
<solid android:color="@color/green_dark"/>
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

@ -1,71 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_clingo_video_call" android:id="@+id/video_call_ll"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.VideoCallActivity"> android:background="@color/text_color"
android:orientation="vertical">
<RelativeLayout <RelativeLayout
android:layout_width="fill_parent" android:id="@+id/layout_name"
android:layout_height="fill_parent" android:layout_width="match_parent"
android:gravity="center_horizontal" android:layout_height="wrap_content"
android:keepScreenOn="true" android:padding="@dimen/padding_space_medium"
android:clickable="true"> app:layout_constraintTop_toTopOf="parent">
<LinearLayout <TextView
android:id="@+id/subscriberview" android:id="@+id/patient_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toStartOf="@+id/video_counter_fl"
android:textColor="@color/white"
android:textSize="@dimen/text_size_big"
android:textStyle="bold"
tools:text="Mousa Abuzaid" />
<FrameLayout
android:id="@+id/video_counter_fl"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true" android:background="@drawable/shape_capsule"
android:orientation="horizontal"/> android:padding="@dimen/padding_space_small">
<Chronometer
android:id="@+id/cmTimer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
tools:text="25:45" />
</FrameLayout>
<RelativeLayout
android:id="@+id/publisherview"
android:layout_height="200dp"
android:layout_width="150dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/remote_video_view_container" android:id="@+id/activity_clingo_video_call"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="0dp"
android:background="@color/remoteBackground"> app:layout_constraintBottom_toTopOf="@id/control_panel"
app:layout_constraintTop_toBottomOf="@+id/layout_name">
<RelativeLayout <RelativeLayout
android:id="@+id/layout_mini"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/remoteBackground"
android:alpha="0.5"
android:visibility="gone">
<ImageButton
android:id="@+id/ic_mini"
style="@style/Widget.MaterialComponents.Button.Icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_margin="@dimen/padding_space_medium"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@null"
android:src="@drawable/ic_mini" />
</RelativeLayout>
<FrameLayout
android:id="@+id/remote_video_view_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_above="@id/icon_padding"> android:layout_below="@+id/layout_mini"
android:background="@color/remoteBackground">
<ImageView <ImageView
android:id="@+id/remote_video_view_icon"
android:layout_width="@dimen/remote_back_icon_size" android:layout_width="@dimen/remote_back_icon_size"
android:layout_height="@dimen/remote_back_icon_size" android:layout_height="@dimen/remote_back_icon_size"
android:layout_centerInParent="true" android:layout_gravity="center"
android:src="@drawable/video_off_fill" /> android:src="@drawable/video_off_fill" />
</RelativeLayout>
<RelativeLayout </FrameLayout>
android:id="@+id/icon_padding"
android:layout_width="match_parent"
android:layout_height="@dimen/remote_back_icon_margin_bottom"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
<FrameLayout <FrameLayout
android:id="@+id/local_video_view_container" android:id="@+id/local_video_view_container"
android:layout_width="@dimen/local_preview_width" android:layout_width="@dimen/local_preview_width"
android:layout_height="@dimen/local_preview_height" android:layout_height="@dimen/local_preview_height"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_marginEnd="@dimen/local_preview_margin_right" android:layout_alignParentEnd="true"
android:layout_marginRight="@dimen/local_preview_margin_right"
android:layout_marginTop="@dimen/local_preview_margin_top" android:layout_marginTop="@dimen/local_preview_margin_top"
android:background="@color/localBackground"> android:layout_marginEnd="@dimen/local_preview_margin_top">
<ImageView <ImageView
android:id="@+id/local_video_view_icon"
android:layout_width="@dimen/local_back_icon_size" android:layout_width="@dimen/local_back_icon_size"
android:layout_height="@dimen/local_back_icon_size" android:layout_height="@dimen/local_back_icon_size"
android:layout_gravity="center" android:layout_gravity="center"
@ -73,97 +108,90 @@
android:src="@drawable/video_off_fill" /> android:src="@drawable/video_off_fill" />
</FrameLayout> </FrameLayout>
<RelativeLayout <FrameLayout
android:id="@+id/thumbnail_container"
android:layout_width="90dp"
android:layout_height="90dp"
android:visibility="gone"
android:layout_alignParentBottom="true"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
/>
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/control_panel" android:id="@+id/control_panel"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:padding="@dimen/padding_space_big"
android:layout_marginBottom="60dp"> app:layout_constraintBottom_toBottomOf="parent">
<ImageView <ImageView
android:id="@+id/btn_call" android:id="@+id/btn_call"
android:layout_width="71dp" android:layout_width="@dimen/video_icon_size"
android:layout_height="71dp" android:layout_height="@dimen/video_icon_size"
android:layout_centerInParent="true"
android:onClick="onCallClicked"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/call" /> android:src="@drawable/call"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView
android:id="@+id/btn_switch_camera" android:id="@+id/btn_minimize"
android:layout_width="39dp" android:layout_width="@dimen/video_icon_size"
android:layout_height="39dp" android:layout_height="@dimen/video_icon_size"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/control_bottom_horizontal_margin"
android:layout_toEndOf="@id/btn_camera"
android:layout_toRightOf="@id/btn_camera"
android:onClick="onSwitchCameraClicked"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/flip_enabled" /> android:src="@drawable/reducing"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView
android:id="@+id/btn_camera" android:id="@+id/btn_camera"
android:layout_width="39dp" android:layout_width="@dimen/video_icon_size"
android:layout_height="39dp" android:layout_height="@dimen/video_icon_size"
android:layout_centerVertical="true" android:layout_marginStart="@dimen/padding_space_medium"
android:layout_marginLeft="@dimen/control_bottom_horizontal_margin"
android:layout_toEndOf="@id/btn_call"
android:layout_toRightOf="@id/btn_call"
android:onClick="onCameraClicked"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/video_enabled" /> android:src="@drawable/video_enabled"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/btn_minimize"
app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView
android:id="@+id/btn_mic" android:id="@+id/btn_mic"
android:layout_width="39dp" android:layout_width="@dimen/video_icon_size"
android:layout_height="39dp" android:layout_height="@dimen/video_icon_size"
android:layout_centerVertical="true" android:layout_marginStart="@dimen/padding_space_medium"
android:layout_marginRight="@dimen/control_bottom_horizontal_margin"
android:layout_toStartOf="@id/btn_call"
android:layout_toLeftOf="@id/btn_call"
android:onClick="onMicClicked"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/mic_enabled" /> android:src="@drawable/mic_enabled"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/btn_camera"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/btn_switch_camera"
android:layout_width="@dimen/video_icon_size"
android:layout_height="@dimen/video_icon_size"
android:layout_marginStart="@dimen/padding_space_medium"
android:scaleType="centerCrop"
android:src="@drawable/camera_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/btn_mic"
app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView
android:id="@+id/btn_specker" android:id="@+id/btn_specker"
android:layout_width="39dp" android:layout_width="@dimen/video_icon_size"
android:layout_height="39dp" android:layout_height="@dimen/video_icon_size"
android:layout_centerVertical="true" android:layout_marginStart="@dimen/padding_space_medium"
android:layout_marginRight="@dimen/control_bottom_horizontal_margin"
android:layout_toStartOf="@id/btn_mic"
android:layout_toLeftOf="@id/btn_mic"
android:onClick="onSpeckerClicked"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/audio_enabled" /> android:src="@drawable/audio_enabled"
</RelativeLayout> android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/btn_mic"
app:layout_constraintTop_toTopOf="parent" />
<!-- <RelativeLayout--> </androidx.constraintlayout.widget.ConstraintLayout>
<!-- android:id="@+id/progressBar"--> </androidx.constraintlayout.widget.ConstraintLayout>
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="40dp"-->
<!-- android:layout_alignParentBottom="true">-->
<!-- <ProgressBar-->
<!-- android:id="@+id/progress_bar"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="31dp"-->
<!-- android:layout_alignParentEnd="true"-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:layout_marginEnd="0dp"-->
<!-- android:layout_marginBottom="0dp"-->
<!-- android:progressBackgroundTint="@color/colorProgressBarBackground"-->
<!-- style="@android:style/Widget.ProgressBar.Horizontal" />-->
<!-- <TextView-->
<!-- android:id="@+id/progress_bar_text"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginLeft="9dp"-->
<!-- android:gravity="center_vertical"-->
<!-- android:textColor="@color/colorPrimary"-->
<!-- android:layout_centerInParent="true"/>-->
<!-- </RelativeLayout>-->
</RelativeLayout>

@ -5,7 +5,17 @@
<color name="colorAccent">#fc3850</color> <color name="colorAccent">#fc3850</color>
<color name="colorProgressBarBackground">#e4e9f2</color> <color name="colorProgressBarBackground">#e4e9f2</color>
<color name="transparent">#80757575</color>
<color name="transparent_full_opacity">#00ffffff</color>
<!-- Chat Activity --> <!-- Chat Activity -->
<color name="localBackground">#827b92</color> <color name="localBackground">#827b92</color>
<color name="remoteBackground">#484258</color> <color name="remoteBackground">#484258</color>
<color name="text_color">#FF2E303A</color>
<color name="white">#fff</color>
<color name="black">#000</color>
<color name="green_dark">#389842</color>
<color name="red_dark">#d51e26</color>
</resources> </resources>

@ -3,20 +3,39 @@
<dimen name="activity_horizontal_margin">16dp</dimen> <dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen> <dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="local_preview_margin_top">28dp</dimen> <dimen name="local_preview_margin_top">28dp</dimen>
<dimen name="local_preview_margin_small">12dp</dimen>
<dimen name="local_preview_margin_right">24dp</dimen> <dimen name="local_preview_margin_right">24dp</dimen>
<!-- buttons --> <!-- buttons -->
<dimen name="call_button_size">60dp</dimen> <dimen name="call_button_size">60dp</dimen>
<dimen name="other_button_size">54dp</dimen> <dimen name="other_button_size">54dp</dimen>
<dimen name="video_icon_size">52dp</dimen>
<dimen name="video_icon_size_small">24dp</dimen>
<!-- buttons -->
<dimen name="control_bottom_margin">24dp</dimen>
<dimen name="control_bottom_horizontal_margin">25dp</dimen>
<dimen name="local_preview_width">88dp</dimen> <dimen name="local_preview_width">88dp</dimen>
<dimen name="local_preview_width_small">40dp</dimen>
<dimen name="local_preview_height">117dp</dimen> <dimen name="local_preview_height">117dp</dimen>
<dimen name="local_preview_height_small">50dp</dimen>
<dimen name="local_back_icon_size">50dp</dimen> <dimen name="local_back_icon_size">50dp</dimen>
<dimen name="local_back_icon_size_small">25dp</dimen>
<dimen name="remote_back_icon_size">100dp</dimen> <dimen name="remote_back_icon_size">100dp</dimen>
<dimen name="remote_back_icon_size_small">40dp</dimen>
<dimen name="remote_back_icon_margin_bottom">90dp</dimen> <dimen name="remote_back_icon_margin_bottom">90dp</dimen>
<!-- buttons --> <!-- text-->
<dimen name="control_bottom_margin">24dp</dimen> <dimen name="text_size_small">14sp</dimen>
<dimen name="control_bottom_horizontal_margin">25dp</dimen> <dimen name="text_size_medium">16sp</dimen>
<dimen name="text_size_big">22sp</dimen>
<!-- padding/margin-->
<dimen name="padding_space_small">4dp</dimen>
<dimen name="padding_space_medium">8sp</dimen>
<dimen name="padding_space_big">16dp</dimen>
<dimen name="padding_space_big_2">24dp</dimen>
</resources> </resources>

@ -4,5 +4,7 @@
<string name="remaining_ar">الوقت المتبقي بالثانيه: </string> <string name="remaining_ar">الوقت المتبقي بالثانيه: </string>
<string name="setting">Settings</string> <string name="setting">Settings</string>
<string name="cancel">Cancel</string> <string name="cancel">Cancel</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources> </resources>

@ -16,4 +16,21 @@
<item name="android:windowFullscreen">true</item> <item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item> <item name="android:windowContentOverlay">@null</item>
</style> </style>
<style name="dialogTheme" parent="Theme.AppCompat.DayNight.Dialog.Alert">
<!-- title encapsulating main part (backgroud) of custom alertdialog -->
<item name="android:windowFrame">@null</item>
<!-- turn off any drawable used to draw a frame on the window -->
<item name="android:windowBackground">@null</item>
<!-- turn off any drawable used to draw a frame on the window -->
<item name="android:windowIsFloating">true</item>
<!-- float the window so it does not fill the screen -->
<item name="android:windowNoTitle">true</item>
<!-- remove the title bar we make our own-->
<item name="android:windowContentOverlay">@null</item>
<!-- remove the shadow from under the title bar -->
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
</style>
</resources> </resources>

@ -16,10 +16,12 @@ allprojects {
repositories { repositories {
google() google()
jcenter() jcenter()
mavenCentral()
maven { url 'https://tokbox.bintray.com/maven' } maven { url 'https://tokbox.bintray.com/maven' }
} }
} }
rootProject.buildDir = '../build' rootProject.buildDir = '../build'
subprojects { subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}" project.buildDir = "${rootProject.buildDir}/${project.name}"

@ -46,6 +46,10 @@
<string>Need to upload image</string> <string>Need to upload image</string>
<key>NSSpeechRecognitionUsageDescription</key> <key>NSSpeechRecognitionUsageDescription</key>
<string>This permission is not needed by the app, but it is required by an underlying API. If you see this dialog, contact us.</string> <string>This permission is not needed by the app, but it is required by an underlying API. If you see this dialog, contact us.</string>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>

@ -31,7 +31,7 @@ class VideoCallViewController: UIViewController {
var callBack: ICallProtocol? var callBack: ICallProtocol?
var timer = Timer() var timer = Timer()
var seconds = 30 var seconds = 55
var isUserConnect : Bool = false var isUserConnect : Bool = false
var onRectFloat:((Bool)->Void)? = nil var onRectFloat:((Bool)->Void)? = nil

@ -3,6 +3,7 @@ import 'dart:io' show Platform;
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/core/service/NavigationService.dart';
import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart';
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
@ -12,6 +13,9 @@ import 'package:flutter/cupertino.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../locator.dart';
import '../routes.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
Helpers helpers = new Helpers(); Helpers helpers = new Helpers();
@ -116,7 +120,9 @@ class BaseAppClient {
await Provider.of<AuthenticationViewModel>(AppGlobal.CONTEX, await Provider.of<AuthenticationViewModel>(AppGlobal.CONTEX,
listen: false) listen: false)
.logout(); .logout();
Helpers.showErrorToast('Your session expired Please login again'); Helpers.showErrorToast('Your session expired Please login again');
locator<NavigationService>().pushNamedAndRemoveUntil(ROOT);
} }
if (isAllowAny) { if (isAllowAny) {
onFailure(getError(parsed), statusCode); onFailure(getError(parsed), statusCode);

@ -56,6 +56,8 @@ const ADD_REFERRED_DOCTOR_REMARKS = 'Services/DoctorApplication.svc/REST/AddRefe
const GET_MY_REFERRED_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferredPatient'; const GET_MY_REFERRED_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferredPatient';
const GET_MY_REFERRED_OUT_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferredOutPatient';
const GET_PENDING_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/PendingReferrals'; const GET_PENDING_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/PendingReferrals';
const CREATE_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/CreateReferral'; const CREATE_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/CreateReferral';
@ -89,6 +91,7 @@ const CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP = 'Services/DoctorApplication.svc/RES
const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles'; const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles';
const TRANSFERT_TO_ADMIN = 'LiveCareApi/DoctorApp/TransferToAdmin'; const TRANSFERT_TO_ADMIN = 'LiveCareApi/DoctorApp/TransferToAdmin';
const SEND_SMS_INSTRUCTIONS = 'LiveCareApi/DoctorApp/SendSMSInstruction';
const GET_ALTERNATIVE_SERVICE = 'LiveCareApi/DoctorApp/GetAlternativeServices'; const GET_ALTERNATIVE_SERVICE = 'LiveCareApi/DoctorApp/GetAlternativeServices';
const END_CALL = 'LiveCareApi/DoctorApp/EndCall'; const END_CALL = 'LiveCareApi/DoctorApp/EndCall';
const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge'; const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge';
@ -178,6 +181,8 @@ const GET_ECG = "Services/Patients.svc/REST/HIS_GetPatientMuseResults";
const GET_MY_REFERRAL_INPATIENT = "Services/DoctorApplication.svc/REST/GtMyReferralPatient"; const GET_MY_REFERRAL_INPATIENT = "Services/DoctorApplication.svc/REST/GtMyReferralPatient";
const GET_MY_REFERRAL_OUT_PATIENT = "Services/DoctorApplication.svc/REST/GtMyReferralForOutPatient";
const GET_MY_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargeReferralPatient"; const GET_MY_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargeReferralPatient";
const GET_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargePatient"; const GET_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargePatient";
@ -219,6 +224,9 @@ const GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP = 'Services/DoctorApplication.svc/RE
const DOCTOR_CHECK_HAS_LIVE_CARE = "Services/DoctorApplication.svc/REST/CheckDoctorHasLiveCare"; const DOCTOR_CHECK_HAS_LIVE_CARE = "Services/DoctorApplication.svc/REST/CheckDoctorHasLiveCare";
const LIVE_CARE_IS_LOGIN = "LiveCareApi/DoctorApp/UseIsLogin"; const LIVE_CARE_IS_LOGIN = "LiveCareApi/DoctorApp/UseIsLogin";
const ADD_REFERRED_REMARKS_NEW = "Services/DoctorApplication.svc/REST/AddReferredDoctorRemarks_New";
const GET_SPECIAL_CLINICAL_CARE_LIST = "Services/DoctorApplication.svc/REST/GetSpecialClinicalCareList";
const GET_SPECIAL_CLINICAL_CARE_MAPPING_LIST = "Services/DoctorApplication.svc/REST/GetSpecialClinicalCareMappingList";
var selectedPatientType = 1; var selectedPatientType = 1;

@ -712,7 +712,7 @@ const Map<String, Map<String, String>> localizedValues = {
'days': {'en': "Days", 'ar': "أيام"}, 'days': {'en': "Days", 'ar': "أيام"},
'months': {'en': "Months", 'ar': "أشهر"}, 'months': {'en': "Months", 'ar': "أشهر"},
'years': {'en': "Years", 'ar': "سنين"}, 'years': {'en': "Years", 'ar': "سنين"},
'hr': {'en': "HR", 'ar': "س"}, 'hr': {'en': "Hr", 'ar': "س"},
'min': {'en': "Min", 'ar': "د"}, 'min': {'en': "Min", 'ar': "د"},
'appointmentNumber': {'en': "Appointment Number", 'ar': "رقم الموعد"}, 'appointmentNumber': {'en': "Appointment Number", 'ar': "رقم الموعد"},
'referralStatusHold': {'en': "Hold", 'ar': "معلق"}, 'referralStatusHold': {'en': "Hold", 'ar': "معلق"},
@ -1008,4 +1008,6 @@ const Map<String, Map<String, String>> localizedValues = {
"allLab": {"en": "All Lab", "ar": "جميع المختبرات"}, "allLab": {"en": "All Lab", "ar": "جميع المختبرات"},
"allPrescription": {"en": "All Prescription", "ar": "جميع الوصفات"}, "allPrescription": {"en": "All Prescription", "ar": "جميع الوصفات"},
"addPrescription": {"en": "Add prescription", "ar": "إضافة الوصفات"}, "addPrescription": {"en": "Add prescription", "ar": "إضافة الوصفات"},
"edit": {"en": "Edit", "ar": "تعديل"},
"summeryReply": {"en": "Summary Reply", "ar": "موجز الرد"},
}; };

@ -0,0 +1,4 @@
enum PatientType{
IN_PATIENT,
OUT_PATIENT,
}

@ -11,6 +11,7 @@ class AlternativeService {
AlternativeService.fromJson(Map<String, dynamic> json) { AlternativeService.fromJson(Map<String, dynamic> json) {
serviceID = json['ServicID']; serviceID = json['ServicID'];
serviceName = json['ServiceName']; serviceName = json['ServiceName'];
isSelected = false;
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {

@ -11,6 +11,8 @@ class PatientSearchRequestModel {
int searchType; int searchType;
String mobileNo; String mobileNo;
String identificationNo; String identificationNo;
int nursingStationID;
int clinicID=0;
PatientSearchRequestModel( PatientSearchRequestModel(
{this.doctorID = 0, {this.doctorID = 0,
@ -24,7 +26,9 @@ class PatientSearchRequestModel {
this.mobileNo = "", this.mobileNo = "",
this.identificationNo = "0", this.identificationNo = "0",
this.from = "0", this.from = "0",
this.to ="0"}); this.to = "0",
this.clinicID,
this.nursingStationID = 0});
PatientSearchRequestModel.fromJson(Map<String, dynamic> json) { PatientSearchRequestModel.fromJson(Map<String, dynamic> json) {
doctorID = json['DoctorID']; doctorID = json['DoctorID'];
@ -39,6 +43,8 @@ class PatientSearchRequestModel {
searchType = json['SearchType']; searchType = json['SearchType'];
mobileNo = json['MobileNo']; mobileNo = json['MobileNo'];
identificationNo = json['IdentificationNo']; identificationNo = json['IdentificationNo'];
nursingStationID = json['NursingStationID'];
clinicID = json['ClinicID'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -55,6 +61,9 @@ class PatientSearchRequestModel {
data['SearchType'] = this.searchType; data['SearchType'] = this.searchType;
data['MobileNo'] = this.mobileNo; data['MobileNo'] = this.mobileNo;
data['IdentificationNo'] = this.identificationNo; data['IdentificationNo'] = this.identificationNo;
data['NursingStationID'] = this.nursingStationID;
data['ClinicID'] = this.clinicID;
data['ProjectID'] = 0;
return data; return data;
} }
} }

@ -61,6 +61,7 @@ class MyReferralPatientModel {
String priorityDescription; String priorityDescription;
String referringClinicDescription; String referringClinicDescription;
String referringDoctorName; String referringDoctorName;
int referalStatus;
MyReferralPatientModel( MyReferralPatientModel(
{this.rowID, {this.rowID,
@ -122,10 +123,12 @@ class MyReferralPatientModel {
this.nursingStationName, this.nursingStationName,
this.priorityDescription, this.priorityDescription,
this.referringClinicDescription, this.referringClinicDescription,
this.referringDoctorName}); this.referringDoctorName,
this.referalStatus});
MyReferralPatientModel.fromJson(Map<String, dynamic> json) { MyReferralPatientModel.fromJson(Map<String, dynamic> json) {
rowID = json['RowID']; rowID = json['RowID'];
referalStatus = json['ReferalStatus'];
projectID = json['ProjectID']; projectID = json['ProjectID'];
lineItemNo = json['LineItemNo']; lineItemNo = json['LineItemNo'];
doctorID = json['DoctorID']; doctorID = json['DoctorID'];
@ -158,8 +161,21 @@ class MyReferralPatientModel {
referringDoctor = json['ReferringDoctor']; referringDoctor = json['ReferringDoctor'];
referralClinic = json['ReferralClinic']; referralClinic = json['ReferralClinic'];
referringClinic = json['ReferringClinic']; referringClinic = json['ReferringClinic'];
referralStatus = json['ReferralStatus']; referralStatus = json["ReferralStatus"] is String
? json['ReferralStatus'] == "Accepted"
? 46
: json['ReferralStatus'] == "Pending"
? 1
: 0
: json["ReferralStatus"];
try {
referralDate = AppDateUtils.getDateTimeFromString(json['ReferralDate']);
} catch (e) {
referralDate = AppDateUtils.convertStringToDate(json['ReferralDate']); referralDate = AppDateUtils.convertStringToDate(json['ReferralDate']);
} finally {
referralDate = DateTime.now();
}
referringDoctorRemarks = json['ReferringDoctorRemarks']; referringDoctorRemarks = json['ReferringDoctorRemarks'];
referredDoctorRemarks = json['ReferredDoctorRemarks']; referredDoctorRemarks = json['ReferredDoctorRemarks'];
referralResponseOn = json['ReferralResponseOn']; referralResponseOn = json['ReferralResponseOn'];
@ -190,6 +206,7 @@ class MyReferralPatientModel {
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['RowID'] = this.rowID; data['RowID'] = this.rowID;
data['ReferalStatus'] = this.referalStatus;
data['ProjectID'] = this.projectID; data['ProjectID'] = this.projectID;
data['LineItemNo'] = this.lineItemNo; data['LineItemNo'] = this.lineItemNo;
data['DoctorID'] = this.doctorID; data['DoctorID'] = this.doctorID;

@ -0,0 +1,104 @@
class MyReferralPatientRequestModel {
int channel;
int clinicID;
int doctorID;
int editedBy;
String firstName;
String from;
String iPAdress;
bool isLoginForDoctorApp;
int languageID;
String lastName;
String middleName;
int patientID;
String patientIdentificationID;
String patientMobileNumber;
bool patientOutSA;
int patientTypeID;
int projectID;
String sessionID;
String stamp;
String to;
String tokenID;
double versionID;
String vidaAuthTokenID;
MyReferralPatientRequestModel(
{this.channel,
this.clinicID,
this.doctorID,
this.editedBy,
this.firstName,
this.from,
this.iPAdress,
this.isLoginForDoctorApp,
this.languageID,
this.lastName,
this.middleName,
this.patientID,
this.patientIdentificationID,
this.patientMobileNumber,
this.patientOutSA,
this.patientTypeID,
this.projectID,
this.sessionID,
this.stamp,
this.to,
this.tokenID,
this.versionID,
this.vidaAuthTokenID});
MyReferralPatientRequestModel.fromJson(Map<String, dynamic> json) {
channel = json['Channel'];
clinicID = json['ClinicID'];
doctorID = json['DoctorID'];
editedBy = json['EditedBy'];
firstName = json['FirstName'];
from = json['From'];
iPAdress = json['IPAdress'];
isLoginForDoctorApp = json['IsLoginForDoctorApp'];
languageID = json['LanguageID'];
lastName = json['LastName'];
middleName = json['MiddleName'];
patientID = json['PatientID'];
patientIdentificationID = json['PatientIdentificationID'];
patientMobileNumber = json['PatientMobileNumber'];
patientOutSA = json['PatientOutSA'];
patientTypeID = json['PatientTypeID'];
projectID = json['ProjectID'];
sessionID = json['SessionID'];
stamp = json['stamp'];
to = json['To'];
tokenID = json['TokenID'];
versionID = json['VersionID'];
vidaAuthTokenID = json['VidaAuthTokenID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Channel'] = this.channel;
data['ClinicID'] = this.clinicID;
data['DoctorID'] = this.doctorID;
data['EditedBy'] = this.editedBy;
data['FirstName'] = this.firstName;
data['From'] = this.from;
data['IPAdress'] = this.iPAdress;
data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp;
data['LanguageID'] = this.languageID;
data['LastName'] = this.lastName;
data['MiddleName'] = this.middleName;
data['PatientID'] = this.patientID;
data['PatientIdentificationID'] = this.patientIdentificationID;
data['PatientMobileNumber'] = this.patientMobileNumber;
data['PatientOutSA'] = this.patientOutSA;
data['PatientTypeID'] = this.patientTypeID;
data['ProjectID'] = this.projectID;
data['SessionID'] = this.sessionID;
data['stamp'] = this.stamp;
data['To'] = this.to;
data['TokenID'] = this.tokenID;
data['VersionID'] = this.versionID;
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
return data;
}
}

@ -0,0 +1,72 @@
class AddReferredRemarksRequestModel {
int projectID;
int admissionNo;
int lineItemNo;
String referredDoctorRemarks;
int editedBy;
int referalStatus;
bool isLoginForDoctorApp;
String iPAdress;
bool patientOutSA;
String tokenID;
int languageID;
double versionID;
int channel;
String sessionID;
int deviceTypeID;
AddReferredRemarksRequestModel(
{this.projectID,
this.admissionNo,
this.lineItemNo,
this.referredDoctorRemarks,
this.editedBy,
this.referalStatus,
this.isLoginForDoctorApp,
this.iPAdress,
this.patientOutSA,
this.tokenID,
this.languageID,
this.versionID,
this.channel,
this.sessionID,
this.deviceTypeID});
AddReferredRemarksRequestModel.fromJson(Map<String, dynamic> json) {
projectID = json['ProjectID'];
admissionNo = json['AdmissionNo'];
lineItemNo = json['LineItemNo'];
referredDoctorRemarks = json['ReferredDoctorRemarks'];
editedBy = json['EditedBy'];
referalStatus = json['ReferalStatus'];
isLoginForDoctorApp = json['IsLoginForDoctorApp'];
iPAdress = json['IPAdress'];
patientOutSA = json['PatientOutSA'];
tokenID = json['TokenID'];
languageID = json['LanguageID'];
versionID = json['VersionID'];
channel = json['Channel'];
sessionID = json['SessionID'];
deviceTypeID = json['DeviceTypeID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ProjectID'] = this.projectID;
data['AdmissionNo'] = this.admissionNo;
data['LineItemNo'] = this.lineItemNo;
data['ReferredDoctorRemarks'] = this.referredDoctorRemarks;
data['EditedBy'] = this.editedBy;
data['ReferalStatus'] = this.referalStatus;
data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp;
data['IPAdress'] = this.iPAdress;
data['PatientOutSA'] = this.patientOutSA;
data['TokenID'] = this.tokenID;
data['LanguageID'] = this.languageID;
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['SessionID'] = this.sessionID;
data['DeviceTypeID'] = this.deviceTypeID;
return data;
}
}

@ -0,0 +1,18 @@
import 'package:flutter/material.dart';
class NavigationService {
final GlobalKey<NavigatorState> navigatorKey =
new GlobalKey<NavigatorState>();
Future<dynamic> navigateTo(String routeName,{Object arguments}) {
return navigatorKey.currentState.pushNamed(routeName,arguments: arguments);
}
Future<dynamic> pushReplacementNamed(String routeName,{Object arguments}) {
return navigatorKey.currentState.pushReplacementNamed(routeName,arguments: arguments);
}
Future<dynamic> pushNamedAndRemoveUntil(String routeName) {
return navigatorKey.currentState.pushNamedAndRemoveUntil(routeName,(asd)=>false);
}
}

@ -0,0 +1,89 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/core/service/patient/LiveCarePatientServices.dart';
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/livecare/end_call_req.dart';
import 'package:doctor_app_flutter/models/livecare/session_status_model.dart';
import 'package:doctor_app_flutter/models/livecare/start_call_res.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/util/VideoChannel.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:flutter/cupertino.dart';
import '../../locator.dart';
import '../../routes.dart';
import 'NavigationService.dart';
class VideoCallService extends BaseService{
StartCallRes startCallRes;
PatiantInformtion patient;
LiveCarePatientServices _liveCarePatientServices = locator<LiveCarePatientServices>();
openVideo(StartCallRes startModel,PatiantInformtion patientModel,VoidCallback onCallConnected, VoidCallback onCallDisconnected)async{
this.startCallRes = startModel;
this.patient = patientModel;
DoctorProfileModel doctorProfile = await getDoctorProfile(isGetProfile: true);
await VideoChannel.openVideoCallScreen(
kToken: startCallRes.openTokenID,//"T1==cGFydG5lcl9pZD00NzI0Nzk1NCZzaWc9NGIyZDljOTY3YjFiNWU1YzUzNzFmMjIyNjJmNmEzY2Y5NzZjOTdlYzpzZXNzaW9uX2lkPTFfTVg0ME56STBOemsxTkg1LU1UWXlNekEyTlRRMU9EVXhObjVrVFRoMFlVdFJXaXRYTWpadFZGZHFhSGxZVGpOdE1UVi1mZyZjcmVhdGVfdGltZT0xNjIzMDY1NDk1Jm5vbmNlPTAuMjM2Mjk0NTIwMTkyOTA4OTcmcm9sZT1wdWJsaXNoZXImZXhwaXJlX3RpbWU9MTYyNTY1NzQ5NCZpbml0aWFsX2xheW91dF9jbGFzc19saXN0PQ==",
kSessionId:startCallRes.openSessionID,//1_MX40NzI0Nzk1NH5-MTYyMzA2NTQ1ODUxNn5kTTh0YUtRWitXMjZtVFdqaHlYTjNtMTV-fg
kApiKey: '46209962',//'47247954'
vcId: patient.vcId,
patientName: patient.fullName ?? (patient.firstName != null ? "${patient.firstName} ${patient.lastName}" : "-"),
tokenID: await sharedPref.getString(TOKEN),
generalId: GENERAL_ID,
doctorId: doctorProfile.doctorID,
onFailure: (String error) {
DrAppToastMsg.showErrorToast(error);
},onCallConnected: onCallConnected,
onCallEnd: () {
WidgetsBinding.instance.addPostFrameCallback((_) async {
GifLoaderDialogUtils.showMyDialog(locator<NavigationService>().navigatorKey.currentContext);
endCall(patient.vcId, false,).then((value) {
GifLoaderDialogUtils.hideDialog(locator<NavigationService>().navigatorKey.currentContext);
if (hasError) {
DrAppToastMsg.showErrorToast(error);
}else
locator<NavigationService>().navigateTo(PATIENTS_END_Call,arguments: {
"patient": patient,
});
});
});
},
onCallNotRespond: (SessionStatusModel sessionStatusModel) {
WidgetsBinding.instance.addPostFrameCallback((_) {
GifLoaderDialogUtils.showMyDialog(locator<NavigationService>().navigatorKey.currentContext);
endCall(patient.vcId, sessionStatusModel.sessionStatus == 3,).then((value) {
GifLoaderDialogUtils.hideDialog(locator<NavigationService>().navigatorKey.currentContext);
if (hasError) {
DrAppToastMsg.showErrorToast(error);
} else {
locator<NavigationService>().navigateTo(PATIENTS_END_Call,arguments: {
"patient": patient,
});
}
});
});
});
}
Future endCall(int vCID, bool isPatient) async {
hasError = false;
await getDoctorProfile(isGetProfile: true);
EndCallReq endCallReq = new EndCallReq();
endCallReq.doctorId = doctorProfile.doctorID;
endCallReq.generalid = 'Cs2020@2016\$2958';
endCallReq.vCID = vCID;
endCallReq.isDestroy = isPatient;
await _liveCarePatientServices.endCall(endCallReq);
if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error;
}
}
}

@ -1,11 +1,13 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart';
import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart';
class DashboardService extends BaseService { class DashboardService extends BaseService {
List<DashboardModel> _dashboardItemsList = []; List<DashboardModel> _dashboardItemsList = [];
List<DashboardModel> get dashboardItemsList => _dashboardItemsList; List<DashboardModel> get dashboardItemsList => _dashboardItemsList;
bool hasVirtualClinic = false; bool hasVirtualClinic = false;
String sServiceID; String sServiceID;
@ -24,8 +26,6 @@ class DashboardService extends BaseService {
super.error = error; super.error = error;
}, },
body: { body: {
// "VidaAuthTokenID":
// "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiZDYxZmM5MTQtZWFhYy00YjQ4LTgyMmEtMmE3OTNlZDMzZGYwIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTgwOCIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgwMjg0NzQsImV4cCI6MTYwODg5MjQ3NCwiaWF0IjoxNjA4MDI4NDc0fQ.8OJcy6vUuPnNTi_qSjip8YCrFdaRLtJKbNKXcMtnQxk"
}, },
); );
} }
@ -48,4 +48,5 @@ class DashboardService extends BaseService {
}, },
); );
} }
} }

@ -0,0 +1,41 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
class ScanQrService extends BaseService {
List<PatiantInformtion> myInPatientList = List();
List<PatiantInformtion> inPatientList = List();
Future getInPatient(PatientSearchRequestModel requestModel, bool isMyInpatient) async {
hasError = false;
await getDoctorProfile();
if (isMyInpatient) {
requestModel.doctorID = doctorProfile.doctorID;
} else {
requestModel.doctorID = 0;
}
await baseAppClient.post(
GET_PATIENT_IN_PATIENT_LIST,
onSuccess: (dynamic response, int statusCode) {
inPatientList.clear();
myInPatientList.clear();
response['List_MyInPatient'].forEach((v) {
PatiantInformtion patient = PatiantInformtion.fromJson(v);
inPatientList.add(patient);
if (patient.doctorId == doctorProfile.doctorID) {
myInPatientList.add(patient);
}
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: requestModel.toJson(),
);
}
}

@ -1,4 +1,3 @@
import 'dart:collection';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/live_care/AlternativeServicesList.dart'; import 'package:doctor_app_flutter/core/model/live_care/AlternativeServicesList.dart';
@ -19,7 +18,7 @@ class LiveCarePatientServices extends BaseService {
bool _isFinished = false; bool _isFinished = false;
bool _isLive = false; bool _isLive = true;
bool get isFinished => _isFinished; bool get isFinished => _isFinished;
@ -75,7 +74,7 @@ class LiveCarePatientServices extends BaseService {
}, body: startCallReq.toJson(), isLiveCare: _isLive); }, body: startCallReq.toJson(), isLiveCare: _isLive);
} }
Future endCallWithCharge(int vcID, String altServiceList) async { Future endCallWithCharge(int vcID, List<int> altServiceList) async {
hasError = false; hasError = false;
await baseAppClient.post(END_CALL_WITH_CHARGE, onSuccess: (dynamic response, int statusCode) { await baseAppClient.post(END_CALL_WITH_CHARGE, onSuccess: (dynamic response, int statusCode) {
endCallResponse = response; endCallResponse = response;
@ -85,6 +84,7 @@ class LiveCarePatientServices extends BaseService {
}, body: { }, body: {
"VC_ID": vcID, "VC_ID": vcID,
"AltServiceList": altServiceList, "AltServiceList": altServiceList,
"generalid":GENERAL_ID
}, isLiveCare: _isLive); }, isLiveCare: _isLive);
} }
@ -102,8 +102,23 @@ class LiveCarePatientServices extends BaseService {
}, isLiveCare: _isLive); }, isLiveCare: _isLive);
} }
Future sendSMSInstruction(int vcID) async {
hasError = false;
await baseAppClient.post(SEND_SMS_INSTRUCTIONS,
onSuccess: (dynamic response, int statusCode) {
transferToAdminResponse = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {
"VC_ID": vcID, "generalid": GENERAL_ID
}, isLiveCare: _isLive);
}
Future isLogin({LiveCareUserLoginRequestModel isLoginRequestModel, int loginStatus}) async { Future isLogin({LiveCareUserLoginRequestModel isLoginRequestModel, int loginStatus}) async {
hasError = false; hasError = false;
await getDoctorProfile( );
isLoginRequestModel.doctorId = super.doctorProfile.doctorID;
await baseAppClient.post(LIVE_CARE_IS_LOGIN, onSuccess: (response, statusCode) async { await baseAppClient.post(LIVE_CARE_IS_LOGIN, onSuccess: (response, statusCode) async {
isLoginResponse = response; isLoginResponse = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
@ -126,6 +141,7 @@ class LiveCarePatientServices extends BaseService {
super.error = error; super.error = error;
}, body: { }, body: {
"VC_ID": vcID, "VC_ID": vcID,
"generalid": GENERAL_ID
}, isLiveCare: _isLive); }, isLiveCare: _isLive);
} }
} }

@ -1,5 +1,7 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientModel.dart'; import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientModel.dart';
import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientRequestModel.dart';
import 'package:doctor_app_flutter/core/model/referral/add_referred_remarks_request.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/doctor/request_add_referred_doctor_remarks.dart'; import 'package:doctor_app_flutter/models/doctor/request_add_referred_doctor_remarks.dart';
@ -8,22 +10,21 @@ class MyReferralInPatientService extends BaseService {
Future getMyReferralPatientService() async { Future getMyReferralPatientService() async {
hasError = false; hasError = false;
Map<String, dynamic> body = Map();
await getDoctorProfile(); await getDoctorProfile();
body['DoctorID'] = doctorProfile.doctorID;
body['FirstName'] = "0"; MyReferralPatientRequestModel myReferralPatientRequestModel = MyReferralPatientRequestModel(
body['MiddleName'] = "0"; doctorID: doctorProfile.doctorID,
body['LastName'] = "0"; firstName: "0",
body['PatientMobileNumber'] = "0"; middleName: "0",
body['PatientIdentificationID'] = "0"; lastName: "0",
body['PatientID'] = 0; patientMobileNumber: "0",
body['From'] = "0"; patientIdentificationID: "0",
body['To'] = "0"; patientID: 0,
body['stamp'] = DateTime.now().toIso8601String(); from: "0",
body['IsLoginForDoctorApp'] = true; to: "0",
body['IPAdress'] = "11.11.11.11"; stamp: DateTime.now().toIso8601String(),
body['PatientOutSA'] = false; isLoginForDoctorApp: true,
body['PatientTypeID'] = 1; patientTypeID: 1);
myReferralPatients.clear(); myReferralPatients.clear();
await baseAppClient.post( await baseAppClient.post(
GET_MY_REFERRAL_INPATIENT, GET_MY_REFERRAL_INPATIENT,
@ -38,22 +39,53 @@ class MyReferralInPatientService extends BaseService {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, },
body: body, body: myReferralPatientRequestModel.toJson(),
);
}
Future getMyReferralOutPatientService() async {
hasError = false;
await getDoctorProfile();
MyReferralPatientRequestModel myReferralPatientRequestModel = MyReferralPatientRequestModel(
doctorID: doctorProfile.doctorID,
firstName: "0",
middleName: "0",
lastName: "0",
patientMobileNumber: "0",
patientIdentificationID: "0",
patientID: 0,
from: "0",
to: "0",
stamp: DateTime.now().toIso8601String(),
isLoginForDoctorApp: true,
patientTypeID: 1);
myReferralPatients.clear();
await baseAppClient.post(
GET_MY_REFERRAL_OUT_PATIENT,
onSuccess: (dynamic response, int statusCode) {
if (response['List_MyOutPatientReferral'] != null) {
response['List_MyOutPatientReferral'].forEach((v) {
myReferralPatients.add(MyReferralPatientModel.fromJson(v));
});
}
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: myReferralPatientRequestModel.toJson(),
); );
} }
Future replay( Future replay(String referredDoctorRemarks, MyReferralPatientModel referral) async {
String referredDoctorRemarks, MyReferralPatientModel referral) async {
hasError = false; hasError = false;
await getDoctorProfile(); await getDoctorProfile();
RequestAddReferredDoctorRemarks _requestAddReferredDoctorRemarks = RequestAddReferredDoctorRemarks _requestAddReferredDoctorRemarks = RequestAddReferredDoctorRemarks();
RequestAddReferredDoctorRemarks();
_requestAddReferredDoctorRemarks.projectID = referral.projectID; _requestAddReferredDoctorRemarks.projectID = referral.projectID;
_requestAddReferredDoctorRemarks.admissionNo = _requestAddReferredDoctorRemarks.admissionNo = referral.admissionNo.toString();
referral.admissionNo.toString();
_requestAddReferredDoctorRemarks.lineItemNo = referral.lineItemNo; _requestAddReferredDoctorRemarks.lineItemNo = referral.lineItemNo;
_requestAddReferredDoctorRemarks.referredDoctorRemarks = _requestAddReferredDoctorRemarks.referredDoctorRemarks = referredDoctorRemarks;
referredDoctorRemarks;
_requestAddReferredDoctorRemarks.editedBy = doctorProfile.doctorID; _requestAddReferredDoctorRemarks.editedBy = doctorProfile.doctorID;
_requestAddReferredDoctorRemarks.patientID = referral.patientID; _requestAddReferredDoctorRemarks.patientID = referral.patientID;
_requestAddReferredDoctorRemarks.referringDoctor = referral.referringDoctor; _requestAddReferredDoctorRemarks.referringDoctor = referral.referringDoctor;
@ -67,4 +99,32 @@ class MyReferralInPatientService extends BaseService {
}, },
); );
} }
Future replayReferred(String referredDoctorRemarks, MyReferralPatientModel referral, int referalStatus) async {
hasError = false;
await getDoctorProfile();
AddReferredRemarksRequestModel _requestAddReferredDoctorRemarks = AddReferredRemarksRequestModel(
editedBy: doctorProfile.doctorID,
projectID: doctorProfile.projectID,
referredDoctorRemarks: referredDoctorRemarks,
referalStatus: referalStatus);
_requestAddReferredDoctorRemarks.projectID = referral.projectID;
_requestAddReferredDoctorRemarks.admissionNo = int.parse(referral.admissionNo);
_requestAddReferredDoctorRemarks.lineItemNo = referral.lineItemNo;
_requestAddReferredDoctorRemarks.referredDoctorRemarks = referredDoctorRemarks;
_requestAddReferredDoctorRemarks.editedBy = doctorProfile.doctorID;
_requestAddReferredDoctorRemarks.referalStatus = referalStatus;
// _requestAddReferredDoctorRemarks.patientID = referral.patientID;
// _requestAddReferredDoctorRemarks.referringDoctor = referral.referringDoctor;
await baseAppClient.post(
ADD_REFERRED_REMARKS_NEW,
body: _requestAddReferredDoctorRemarks.toJson(),
onSuccess: (dynamic body, int statusCode) {},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
);
}
} }

@ -157,6 +157,36 @@ class PatientReferralService extends LookupService {
); );
} }
Future getMyReferredOutPatient() async {
hasError = false;
RequestMyReferralPatientModel _requestMyReferralPatient =
RequestMyReferralPatientModel();
DoctorProfileModel doctorProfile = await getDoctorProfile();
await baseAppClient.post(
GET_MY_REFERRED_OUT_PATIENT,
onSuccess: (dynamic response, int statusCode) {
listMyReferredPatientModel.clear();
response['List_MyReferredOutPatient'].forEach((v) {
MyReferredPatientModel item = MyReferredPatientModel.fromJson(v);
if (doctorProfile != null) {
item.isReferralDoctorSameBranch =
doctorProfile.projectID == item.projectID;
} else {
item.isReferralDoctorSameBranch = false;
}
listMyReferredPatientModel.add(item);
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: _requestMyReferralPatient.toJson(),
);
}
Future getPendingReferralList() async { Future getPendingReferralList() async {
hasError = false; hasError = false;
DoctorProfileModel doctorProfile = await getDoctorProfile(); DoctorProfileModel doctorProfile = await getDoctorProfile();

@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart';
import 'package:doctor_app_flutter/core/model/note/note_model.dart'; import 'package:doctor_app_flutter/core/model/note/note_model.dart';
import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; import 'package:doctor_app_flutter/core/model/note/update_note_model.dart';
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/patient/get_clinic_by_project_id_request.dart'; import 'package:doctor_app_flutter/models/patient/get_clinic_by_project_id_request.dart';
@ -12,6 +13,7 @@ import 'package:doctor_app_flutter/models/patient/get_list_stp_referral_frequenc
import 'package:doctor_app_flutter/models/patient/lab_orders/lab_orders_res_model.dart'; import 'package:doctor_app_flutter/models/patient/lab_orders/lab_orders_res_model.dart';
import 'package:doctor_app_flutter/models/patient/lab_result/lab_result.dart'; import 'package:doctor_app_flutter/models/patient/lab_result/lab_result.dart';
import 'package:doctor_app_flutter/models/patient/lab_result/lab_result_req_model.dart'; import 'package:doctor_app_flutter/models/patient/lab_result/lab_result_req_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/models/patient/prescription/prescription_report.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report.dart';
import 'package:doctor_app_flutter/models/patient/prescription/prescription_report_for_in_patient.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report_for_in_patient.dart';
import 'package:doctor_app_flutter/models/patient/prescription/prescription_res_model.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_res_model.dart';
@ -22,20 +24,19 @@ import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_mode
class PatientService extends BaseService { class PatientService extends BaseService {
List<VitalSignResModel> _patientVitalSignList = []; List<VitalSignResModel> _patientVitalSignList = [];
List<VitalSignResModel> patientVitalSignOrderdSubList = []; List<VitalSignResModel> patientVitalSignOrderdSubList = [];
List<PatiantInformtion> inPatientList = List();
List<PatiantInformtion> myInPatientList = List();
List<VitalSignResModel> get patientVitalSignList => _patientVitalSignList; List<VitalSignResModel> get patientVitalSignList => _patientVitalSignList;
List<LabOrdersResModel> _patientLabResultOrdersList = []; List<LabOrdersResModel> _patientLabResultOrdersList = [];
List<LabOrdersResModel> get patientLabResultOrdersList => List<LabOrdersResModel> get patientLabResultOrdersList => _patientLabResultOrdersList;
_patientLabResultOrdersList;
List<PrescriptionResModel> get patientPrescriptionsList => List<PrescriptionResModel> get patientPrescriptionsList => _patientPrescriptionsList;
_patientPrescriptionsList;
List<PrescriptionResModel> _patientPrescriptionsList = []; List<PrescriptionResModel> _patientPrescriptionsList = [];
List<PrescriptionReportForInPatient> get prescriptionReportForInPatientList => List<PrescriptionReportForInPatient> get prescriptionReportForInPatientList => _prescriptionReportForInPatientList;
_prescriptionReportForInPatientList;
List<PrescriptionReportForInPatient> _prescriptionReportForInPatientList = []; List<PrescriptionReportForInPatient> _prescriptionReportForInPatientList = [];
List<RadiologyResModel> _patientRadiologyList = []; List<RadiologyResModel> _patientRadiologyList = [];
@ -79,12 +80,9 @@ class PatientService extends BaseService {
get referalFrequancyList => _referalFrequancyList; get referalFrequancyList => _referalFrequancyList;
DoctorsByClinicIdRequest _doctorsByClinicIdRequest = DoctorsByClinicIdRequest _doctorsByClinicIdRequest = DoctorsByClinicIdRequest();
DoctorsByClinicIdRequest(); STPReferralFrequencyRequest _referralFrequencyRequest = STPReferralFrequencyRequest();
STPReferralFrequencyRequest _referralFrequencyRequest = ClinicByProjectIdRequest _clinicByProjectIdRequest = ClinicByProjectIdRequest();
STPReferralFrequencyRequest();
ClinicByProjectIdRequest _clinicByProjectIdRequest =
ClinicByProjectIdRequest();
ReferToDoctorRequest _referToDoctorRequest; ReferToDoctorRequest _referToDoctorRequest;
Future<dynamic> getPatientList(patient, patientType, {isView}) async { Future<dynamic> getPatientList(patient, patientType, {isView}) async {
@ -138,6 +136,38 @@ class PatientService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future getInPatient(PatientSearchRequestModel requestModel, bool isMyInpatient) async {
hasError = false;
await getDoctorProfile();
if (isMyInpatient) {
requestModel.doctorID = doctorProfile.doctorID;
} else {
requestModel.doctorID = 0;
}
await baseAppClient.post(
GET_PATIENT_IN_PATIENT_LIST,
onSuccess: (dynamic response, int statusCode) {
inPatientList.clear();
myInPatientList.clear();
response['List_MyInPatient'].forEach((v) {
PatiantInformtion patient = PatiantInformtion.fromJson(v);
inPatientList.add(patient);
if (patient.doctorId == doctorProfile.doctorID) {
myInPatientList.add(patient);
}
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: requestModel.toJson(),
);
}
Future getLabResultOrders(patient) async { Future getLabResultOrders(patient) async {
hasError = false; hasError = false;
await baseAppClient.post( await baseAppClient.post(
@ -181,8 +211,7 @@ class PatientService extends BaseService {
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_prescriptionReportForInPatientList = []; _prescriptionReportForInPatientList = [];
response['List_PrescriptionReportForInPatient'].forEach((v) { response['List_PrescriptionReportForInPatient'].forEach((v) {
prescriptionReportForInPatientList prescriptionReportForInPatientList.add(PrescriptionReportForInPatient.fromJson(v));
.add(PrescriptionReportForInPatient.fromJson(v));
}); });
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {

@ -1,36 +0,0 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/doctor/verify_referral_doctor_remarks.dart';
import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart';
import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart';
class ReferredPatientService extends BaseService {
List<MyReferredPatientModel> _listMyReferredPatientModel = [];
List<MyReferredPatientModel> get listMyReferredPatientModel =>
_listMyReferredPatientModel;
RequestMyReferralPatientModel _requestMyReferralPatient =
RequestMyReferralPatientModel();
VerifyReferralDoctorRemarks _verifyreferraldoctorremarks =
VerifyReferralDoctorRemarks();
Future getMyReferredPatient() async {
await baseAppClient.post(
GET_MY_REFERRED_PATIENT,
onSuccess: (dynamic response, int statusCode) {
_listMyReferredPatientModel.clear();
response['List_MyReferredPatient'].forEach((v) {
listMyReferredPatientModel.add(MyReferredPatientModel.fromJson(v));
});
// print(response['List_MyReferredPatient']);
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: _requestMyReferralPatient.toJson(),
);
}
}

@ -0,0 +1,57 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart';
import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart';
import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart';
class SpecialClinicsService extends BaseService {
List<GetSpecialClinicalCareListResponseModel> _specialClinicalCareList = [];
List<GetSpecialClinicalCareListResponseModel> get specialClinicalCareList => _specialClinicalCareList;
List<GetSpecialClinicalCareMappingListResponseModel> _specialClinicalCareMappingList = [];
List<GetSpecialClinicalCareMappingListResponseModel> get specialClinicalCareMappingList => _specialClinicalCareMappingList;
Future getSpecialClinicalCareList() async {
hasError = false;
await baseAppClient.post(
GET_SPECIAL_CLINICAL_CARE_LIST,
onSuccess: (dynamic response, int statusCode) {
_specialClinicalCareList.clear();
response['List_SpecialClinicalCareList'].forEach((v) {
_specialClinicalCareList.add(GetSpecialClinicalCareListResponseModel.fromJson(v));
});},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: {
},
);
}
Future getSpecialClinicalCareMappingList(int clinicId) async {
hasError = false;
await baseAppClient.post(
GET_SPECIAL_CLINICAL_CARE_MAPPING_LIST,
onSuccess: (dynamic response, int statusCode) {
_specialClinicalCareMappingList.clear();
response['List_SpecialClinicalCareMappingList'].forEach((v) {
_specialClinicalCareMappingList.add(GetSpecialClinicalCareMappingListResponseModel.fromJson(v));
});},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: {
"ClinicID": clinicId,
"DoctorID":0,
"EditedBy":0
},
);
}
}

@ -101,13 +101,13 @@ class LiveCarePatientViewModel extends BaseViewModel {
Future endCallWithCharge(int vcID, bool isConfirmed) async { Future endCallWithCharge(int vcID, bool isConfirmed) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
String selectedServicesString = ""; List<int> selectedServices = [];
if (isConfirmed) { if (isConfirmed) {
selectedServicesString = getSelectedAlternativeServices(); selectedServices = getSelectedAlternativeServices();
} }
await _liveCarePatientServices.endCallWithCharge( await _liveCarePatientServices.endCallWithCharge(
vcID, selectedServicesString); vcID, selectedServices);
if (_liveCarePatientServices.hasError) { if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error; error = _liveCarePatientServices.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -117,14 +117,14 @@ class LiveCarePatientViewModel extends BaseViewModel {
} }
} }
String getSelectedAlternativeServices() { List<int> getSelectedAlternativeServices() {
List<int> selectedServices = List(); List<int> selectedServices = List();
for (AlternativeService service in alternativeServicesList) { for (AlternativeService service in alternativeServicesList) {
if (service.isSelected) { if (service.isSelected) {
selectedServices.add(service.serviceID); selectedServices.add(service.serviceID);
} }
} }
return selectedServices.toString(); return selectedServices;
} }
Future getAlternativeServices(int vcID) async { Future getAlternativeServices(int vcID) async {
@ -150,6 +150,18 @@ class LiveCarePatientViewModel extends BaseViewModel {
} }
} }
Future sendSMSInstruction(int vcID) async {
setState(ViewState.BusyLocal);
await _liveCarePatientServices.sendSMSInstruction(vcID);
if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error;
setState(ViewState.ErrorLocal);
} else {
await getPendingPatientERForDoctorApp();
setState(ViewState.Idle);
}
}
searchData(String str) { searchData(String str) {
var strExist = str.length > 0 ? true : false; var strExist = str.length > 0 ? true : false;
if (strExist) { if (strExist) {

@ -25,12 +25,24 @@ class PatientMedicalReportViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
bool hasOnHold(){
bool hasHold = false;
medicalReportList.forEach((element) {
if(element.status == 1){
hasHold = true;
}
});
return hasHold;
}
Future getMedicalReportTemplate() async { Future getMedicalReportTemplate() async {
setState(ViewState.Busy); setState(ViewState.BusyLocal);
await _service.getMedicalReportTemplate(); await _service.getMedicalReportTemplate();
if (_service.hasError) { if (_service.hasError) {
error = _service.error; error = _service.error;
setState(ViewState.Error); setState(ViewState.ErrorLocal);
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }

@ -4,6 +4,8 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/service/patient/out_patient_service.dart'; import 'package:doctor_app_flutter/core/service/patient/out_patient_service.dart';
import 'package:doctor_app_flutter/core/service/patient/patientInPatientService.dart'; import 'package:doctor_app_flutter/core/service/patient/patientInPatientService.dart';
import 'package:doctor_app_flutter/core/service/special_clinics/special_clinic_service.dart';
import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
@ -12,8 +14,10 @@ import 'base_view_model.dart';
class PatientSearchViewModel extends BaseViewModel { class PatientSearchViewModel extends BaseViewModel {
OutPatientService _outPatientService = locator<OutPatientService>(); OutPatientService _outPatientService = locator<OutPatientService>();
SpecialClinicsService _specialClinicsService = locator<SpecialClinicsService>();
List<PatiantInformtion> get patientList => _outPatientService.patientList; List<PatiantInformtion> get patientList => _outPatientService.patientList;
List<GetSpecialClinicalCareMappingListResponseModel> get specialClinicalCareMappingList => _specialClinicsService.specialClinicalCareMappingList;
List<PatiantInformtion> filterData = []; List<PatiantInformtion> filterData = [];
@ -143,15 +147,22 @@ class PatientSearchViewModel extends BaseViewModel {
List<PatiantInformtion> filteredInPatientItems = List(); List<PatiantInformtion> filteredInPatientItems = List();
Future getInPatientList(PatientSearchRequestModel requestModel, Future getInPatientList(PatientSearchRequestModel requestModel,
{bool isMyInpatient = false}) async { {bool isMyInpatient = false, bool isLocalBusy = false}) async {
await getDoctorProfile(); await getDoctorProfile();
if(isLocalBusy) {
setState(ViewState.BusyLocal);
} else{
setState(ViewState.Busy); setState(ViewState.Busy);
}
if (inPatientList.length == 0) if (inPatientList.length == 0)
await _inPatientService.getInPatientList(requestModel, false); await _inPatientService.getInPatientList(requestModel, false);
if (_inPatientService.hasError) { if (_inPatientService.hasError) {
error = _inPatientService.error; error = _inPatientService.error;
if(isLocalBusy) {
setState(ViewState.ErrorLocal);
} else{
setState(ViewState.Error); setState(ViewState.Error);
}
} else { } else {
// setDefaultInPatientList(); // setDefaultInPatientList();
setState(ViewState.Idle); setState(ViewState.Idle);
@ -166,6 +177,9 @@ class PatientSearchViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
void clearPatientList() { void clearPatientList() {
_inPatientService.inPatientList = []; _inPatientService.inPatientList = [];
_inPatientService.myInPatientList = []; _inPatientService.myInPatientList = [];
@ -195,4 +209,25 @@ class PatientSearchViewModel extends BaseViewModel {
notifyListeners(); notifyListeners();
} }
} }
getSpecialClinicalCareMappingList(clinicId,
{bool isLocalBusy = false}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
}
await _specialClinicsService.getSpecialClinicalCareMappingList(clinicId);
if (_specialClinicsService.hasError) {
error = _specialClinicsService.error;
if (isLocalBusy) {
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Error);
}
} else {
setState(ViewState.Idle);
}
}
} }

@ -254,8 +254,8 @@ class AuthenticationViewModel extends BaseViewModel {
/// add  token to shared preferences in case of send activation code is success /// add  token to shared preferences in case of send activation code is success
setDataAfterSendActivationSuccess(SendActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel) { setDataAfterSendActivationSuccess(SendActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel) {
print("VerificationCode : " + print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode);
sendActivationCodeForDoctorAppResponseModel.verificationCode); // DrAppToastMsg.showSuccesToast("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode);
sharedPref.setString(VIDA_AUTH_TOKEN_ID, sharedPref.setString(VIDA_AUTH_TOKEN_ID,
sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID); sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID);
sharedPref.setString(VIDA_REFRESH_TOKEN_ID, sharedPref.setString(VIDA_REFRESH_TOKEN_ID,

@ -2,8 +2,10 @@ import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart'; import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart';
import 'package:doctor_app_flutter/core/service/special_clinics/special_clinic_service.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart';
import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart';
import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart';
import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart';
import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:firebase_messaging/firebase_messaging.dart';
@ -14,6 +16,7 @@ import 'base_view_model.dart';
class DashboardViewModel extends BaseViewModel { class DashboardViewModel extends BaseViewModel {
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
DashboardService _dashboardService = locator<DashboardService>(); DashboardService _dashboardService = locator<DashboardService>();
SpecialClinicsService _specialClinicsService = locator<SpecialClinicsService>();
List<DashboardModel> get dashboardItemsList => List<DashboardModel> get dashboardItemsList =>
_dashboardService.dashboardItemsList; _dashboardService.dashboardItemsList;
@ -22,6 +25,9 @@ class DashboardViewModel extends BaseViewModel {
String get sServiceID => _dashboardService.sServiceID; String get sServiceID => _dashboardService.sServiceID;
List<GetSpecialClinicalCareListResponseModel> get specialClinicalCareList => _specialClinicsService.specialClinicalCareList;
Future setFirebaseNotification(ProjectViewModel projectsProvider, Future setFirebaseNotification(ProjectViewModel projectsProvider,
AuthenticationViewModel authProvider) async { AuthenticationViewModel authProvider) async {
setState(ViewState.Busy); setState(ViewState.Busy);
@ -64,6 +70,16 @@ class DashboardViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getSpecialClinicalCareList() async {
setState(ViewState.Busy);
await _specialClinicsService.getSpecialClinicalCareList();
if (_specialClinicsService.hasError) {
error = _specialClinicsService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future changeClinic( Future changeClinic(
int clinicId, AuthenticationViewModel authProvider) async { int clinicId, AuthenticationViewModel authProvider) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
@ -85,4 +101,17 @@ class DashboardViewModel extends BaseViewModel {
return value.toString(); return value.toString();
} }
GetSpecialClinicalCareListResponseModel getSpecialClinic(clinicId){
GetSpecialClinicalCareListResponseModel special ;
specialClinicalCareList.forEach((element) {
if(element.clinicID == 1){
special = element;
}
});
return special;
}
} }

@ -2,6 +2,7 @@ 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/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/referral/DischargeReferralPatient.dart'; import 'package:doctor_app_flutter/core/model/referral/DischargeReferralPatient.dart';
import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientModel.dart'; import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientModel.dart';
import 'package:doctor_app_flutter/core/model/referral/add_referred_remarks_request.dart';
import 'package:doctor_app_flutter/core/service/patient/DischargedPatientService.dart'; import 'package:doctor_app_flutter/core/service/patient/DischargedPatientService.dart';
import 'package:doctor_app_flutter/core/service/patient/MyReferralPatientService.dart'; import 'package:doctor_app_flutter/core/service/patient/MyReferralPatientService.dart';
import 'package:doctor_app_flutter/core/service/patient/ReferralService.dart'; import 'package:doctor_app_flutter/core/service/patient/ReferralService.dart';
@ -18,16 +19,14 @@ import 'package:flutter/cupertino.dart';
import '../../locator.dart'; import '../../locator.dart';
class PatientReferralViewModel extends BaseViewModel { class PatientReferralViewModel extends BaseViewModel {
PatientReferralService _referralPatientService = PatientReferralService _referralPatientService = locator<PatientReferralService>();
locator<PatientReferralService>();
ReferralService _referralService = locator<ReferralService>(); ReferralService _referralService = locator<ReferralService>();
MyReferralInPatientService _myReferralService = MyReferralInPatientService _myReferralService = locator<MyReferralInPatientService>();
locator<MyReferralInPatientService>();
DischargedPatientService _dischargedPatientService = locator<DischargedPatientService>();
DischargedPatientService _dischargedPatientService =
locator<DischargedPatientService>();
List<DischargeReferralPatient> get myDischargeReferralPatient => List<DischargeReferralPatient> get myDischargeReferralPatient =>
_dischargedPatientService.myDischargeReferralPatients; _dischargedPatientService.myDischargeReferralPatients;
@ -35,28 +34,21 @@ class PatientReferralViewModel extends BaseViewModel {
List<dynamic> get clinicsList => _referralPatientService.clinicsList; List<dynamic> get clinicsList => _referralPatientService.clinicsList;
List<dynamic> get referralFrequencyList => List<dynamic> get referralFrequencyList => _referralPatientService.frequencyList;
_referralPatientService.frequencyList;
List<dynamic> doctorsList = []; List<dynamic> doctorsList = [];
List<ClinicDoctor> get clinicDoctorsList => List<ClinicDoctor> get clinicDoctorsList => _referralPatientService.doctorsList;
_referralPatientService.doctorsList;
List<MyReferralPatientModel> get myReferralPatients => List<MyReferralPatientModel> get myReferralPatients => _myReferralService.myReferralPatients;
_myReferralService.myReferralPatients;
List<MyReferredPatientModel> get listMyReferredPatientModel => List<MyReferredPatientModel> get listMyReferredPatientModel => _referralPatientService.listMyReferredPatientModel;
_referralPatientService.listMyReferredPatientModel;
List<PendingReferral> get pendingReferral => List<PendingReferral> get pendingReferral => _referralPatientService.pendingReferralList;
_referralPatientService.pendingReferralList;
List<PendingReferral> get patientReferral => List<PendingReferral> get patientReferral => _referralPatientService.patientReferralList;
_referralPatientService.patientReferralList;
List<PatiantInformtion> get patientArrivalList => List<PatiantInformtion> get patientArrivalList => _referralPatientService.patientArrivalList;
_referralPatientService.patientArrivalList;
Future getPatientReferral(PatiantInformtion patient) async { Future getPatientReferral(PatiantInformtion patient) async {
setState(ViewState.Busy); setState(ViewState.Busy);
@ -105,8 +97,7 @@ class PatientReferralViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getClinicDoctors( Future getClinicDoctors(PatiantInformtion patient, int clinicId, int branchId) async {
PatiantInformtion patient, int clinicId, int branchId) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _referralPatientService.getDoctorsList(patient, clinicId, branchId); await _referralPatientService.getDoctorsList(patient, clinicId, branchId);
if (_referralPatientService.hasError) { if (_referralPatientService.hasError) {
@ -124,17 +115,17 @@ class PatientReferralViewModel extends BaseViewModel {
Future<dynamic> getDoctorBranch() async { Future<dynamic> getDoctorBranch() async {
DoctorProfileModel doctorProfile = await getDoctorProfile(); DoctorProfileModel doctorProfile = await getDoctorProfile();
if (doctorProfile != null) { if (doctorProfile != null) {
dynamic _selectedBranch = { dynamic _selectedBranch = {"facilityId": doctorProfile.projectID, "facilityName": doctorProfile.projectName};
"facilityId": doctorProfile.projectID,
"facilityName": doctorProfile.projectName
};
return _selectedBranch; return _selectedBranch;
} }
return null; return null;
} }
Future getMyReferredPatient() async { Future getMyReferredPatient({bool isFirstTime = true}) async {
if (isFirstTime)
setState(ViewState.Busy); setState(ViewState.Busy);
else
setState(ViewState.BusyLocal);
await _referralPatientService.getMyReferredPatient(); await _referralPatientService.getMyReferredPatient();
if (_referralPatientService.hasError) { if (_referralPatientService.hasError) {
error = _referralPatientService.error; error = _referralPatientService.error;
@ -143,6 +134,19 @@ class PatientReferralViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getMyReferredOutPatient({bool isFirstTime = true}) async {
if (isFirstTime)
setState(ViewState.Busy);
else
setState(ViewState.BusyLocal);
await _referralPatientService.getMyReferredOutPatient();
if (_referralPatientService.hasError) {
error = _referralPatientService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
MyReferredPatientModel getReferredPatientItem(int index) { MyReferredPatientModel getReferredPatientItem(int index) {
return listMyReferredPatientModel[index]; return listMyReferredPatientModel[index];
} }
@ -157,18 +161,39 @@ class PatientReferralViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getMyReferralPatientService() async { Future getMyReferralPatientService({bool localBusy = false}) async {
if (localBusy)
setState(ViewState.BusyLocal);
else
setState(ViewState.Busy); setState(ViewState.Busy);
await _myReferralService.getMyReferralPatientService(); await _myReferralService.getMyReferralPatientService();
if (_myReferralService.hasError) { if (_myReferralService.hasError) {
error = _myReferralService.error; error = _myReferralService.error;
if (localBusy)
setState(ViewState.ErrorLocal);
else
setState(ViewState.Error); setState(ViewState.Error);
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future replay( Future getMyReferralOutPatientService({bool localBusy = false}) async {
String referredDoctorRemarks, MyReferralPatientModel referral) async { if (localBusy)
setState(ViewState.BusyLocal);
else
setState(ViewState.Busy);
await _myReferralService.getMyReferralOutPatientService();
if (_myReferralService.hasError) {
error = _myReferralService.error;
if (localBusy)
setState(ViewState.ErrorLocal);
else
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future replay(String referredDoctorRemarks, MyReferralPatientModel referral) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _myReferralService.replay(referredDoctorRemarks, referral); await _myReferralService.replay(referredDoctorRemarks, referral);
if (_myReferralService.hasError) { if (_myReferralService.hasError) {
@ -178,8 +203,7 @@ class PatientReferralViewModel extends BaseViewModel {
getMyReferralPatientService(); getMyReferralPatientService();
} }
Future responseReferral( Future responseReferral(PendingReferral pendingReferral, bool isAccepted) async {
PendingReferral pendingReferral, bool isAccepted) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _referralPatientService.responseReferral(pendingReferral, isAccepted); await _referralPatientService.responseReferral(pendingReferral, isAccepted);
if (_referralPatientService.hasError) { if (_referralPatientService.hasError) {
@ -189,11 +213,10 @@ class PatientReferralViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future makeReferral(PatiantInformtion patient, String isoStringDate, Future makeReferral(PatiantInformtion patient, String isoStringDate, int projectID, int clinicID, int doctorID,
int projectID, int clinicID, int doctorID, String remarks) async { String remarks) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _referralPatientService.makeReferral( await _referralPatientService.makeReferral(patient, isoStringDate, projectID, clinicID, doctorID, remarks);
patient, isoStringDate, projectID, clinicID, doctorID, remarks);
if (_referralPatientService.hasError) { if (_referralPatientService.hasError) {
error = _referralPatientService.error; error = _referralPatientService.error;
setState(ViewState.Error); setState(ViewState.Error);
@ -217,7 +240,7 @@ class PatientReferralViewModel extends BaseViewModel {
patientID: patient.patientId, patientID: patient.patientId,
roomID: patient.roomId, roomID: patient.roomId,
referralClinic: clinicID, referralClinic: clinicID,
admissionNo: patient.appointmentNo, admissionNo: int.parse(patient.admissionNo),
referralDoctor: doctorID, referralDoctor: doctorID,
patientTypeID: patient.patientType, patientTypeID: patient.patientType,
referringDoctorRemarks: remarks, referringDoctorRemarks: remarks,
@ -233,12 +256,10 @@ class PatientReferralViewModel extends BaseViewModel {
} }
} }
Future getPatientDetails( Future getPatientDetails(String fromDate, String toDate, int patientMrn, int appointmentNo) async {
String fromDate, String toDate, int patientMrn, int appointmentNo) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _referralPatientService.getPatientArrivalList(toDate, await _referralPatientService.getPatientArrivalList(toDate, fromDate: fromDate, patientMrn: patientMrn);
fromDate: fromDate, patientMrn: patientMrn);
if (_referralPatientService.hasError) { if (_referralPatientService.hasError) {
error = _referralPatientService.error; error = _referralPatientService.error;
setState(ViewState.Error); setState(ViewState.Error);
@ -257,8 +278,7 @@ class PatientReferralViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future verifyReferralDoctorRemarks( Future verifyReferralDoctorRemarks(MyReferredPatientModel referredPatient) async {
MyReferredPatientModel referredPatient) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _referralPatientService.verifyReferralDoctorRemarks(referredPatient); await _referralPatientService.verifyReferralDoctorRemarks(referredPatient);
if (_referralPatientService.hasError) { if (_referralPatientService.hasError) {
@ -297,8 +317,7 @@ class PatientReferralViewModel extends BaseViewModel {
} }
} }
PatiantInformtion getPatientFromReferral( PatiantInformtion getPatientFromReferral(MyReferredPatientModel referredPatient) {
MyReferredPatientModel referredPatient) {
PatiantInformtion patient = PatiantInformtion(); PatiantInformtion patient = PatiantInformtion();
patient.doctorId = referredPatient.doctorID; patient.doctorId = referredPatient.doctorID;
patient.doctorName = referredPatient.doctorName; patient.doctorName = referredPatient.doctorName;
@ -323,8 +342,7 @@ class PatientReferralViewModel extends BaseViewModel {
return patient; return patient;
} }
PatiantInformtion getPatientFromReferralO( PatiantInformtion getPatientFromReferralO(MyReferralPatientModel referredPatient) {
MyReferralPatientModel referredPatient) {
PatiantInformtion patient = PatiantInformtion(); PatiantInformtion patient = PatiantInformtion();
patient.doctorId = referredPatient.doctorID; patient.doctorId = referredPatient.doctorID;
patient.doctorName = referredPatient.doctorName; patient.doctorName = referredPatient.doctorName;
@ -349,8 +367,7 @@ class PatientReferralViewModel extends BaseViewModel {
return patient; return patient;
} }
PatiantInformtion getPatientFromDischargeReferralPatient( PatiantInformtion getPatientFromDischargeReferralPatient(DischargeReferralPatient referredPatient) {
DischargeReferralPatient referredPatient) {
PatiantInformtion patient = PatiantInformtion(); PatiantInformtion patient = PatiantInformtion();
patient.doctorId = referredPatient.doctorID; patient.doctorId = referredPatient.doctorID;
patient.doctorName = referredPatient.doctorName; patient.doctorName = referredPatient.doctorName;
@ -369,10 +386,19 @@ class PatientReferralViewModel extends BaseViewModel {
patient.roomId = referredPatient.roomID; patient.roomId = referredPatient.roomID;
patient.bedId = referredPatient.bedID; patient.bedId = referredPatient.bedID;
patient.nationalityName = referredPatient.nationalityName; patient.nationalityName = referredPatient.nationalityName;
patient.nationalityFlagURL = patient.nationalityFlagURL = ''; // TODO from backend referredPatient.nationalityFlagURL;
''; // TODO from backend referredPatient.nationalityFlagURL;
patient.age = referredPatient.age; patient.age = referredPatient.age;
patient.clinicDescription = referredPatient.clinicDescription; patient.clinicDescription = referredPatient.clinicDescription;
return patient; return patient;
} }
Future replayReferred(String referredDoctorRemarks, MyReferralPatientModel referral, int referalStatus) async {
setState(ViewState.Busy);
await _myReferralService.replayReferred(referredDoctorRemarks, referral, referalStatus);
if (_myReferralService.hasError) {
error = _myReferralService.error;
setState(ViewState.ErrorLocal);
} else
getMyReferralPatientService();
}
} }

@ -2,9 +2,11 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart';
import 'package:doctor_app_flutter/core/model/note/note_model.dart'; import 'package:doctor_app_flutter/core/model/note/note_model.dart';
import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; import 'package:doctor_app_flutter/core/model/note/update_note_model.dart';
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/service/patient/patient_service.dart'; import 'package:doctor_app_flutter/core/service/patient/patient_service.dart';
import 'package:doctor_app_flutter/models/patient/lab_orders/lab_orders_res_model.dart'; import 'package:doctor_app_flutter/models/patient/lab_orders/lab_orders_res_model.dart';
import 'package:doctor_app_flutter/models/patient/lab_result/lab_result.dart'; import 'package:doctor_app_flutter/models/patient/lab_result/lab_result.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/models/patient/prescription/prescription_report.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report.dart';
import 'package:doctor_app_flutter/models/patient/prescription/prescription_report_for_in_patient.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report_for_in_patient.dart';
import 'package:doctor_app_flutter/models/patient/prescription/prescription_res_model.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_res_model.dart';
@ -17,51 +19,43 @@ import 'base_view_model.dart';
class PatientViewModel extends BaseViewModel { class PatientViewModel extends BaseViewModel {
PatientService _patientService = locator<PatientService>(); PatientService _patientService = locator<PatientService>();
List<VitalSignResModel> get patientVitalSignList => List<PatiantInformtion> get inPatientList => _patientService.inPatientList;
_patientService.patientVitalSignList;
List<VitalSignResModel> get patientVitalSignOrderdSubList => List<VitalSignResModel> get patientVitalSignList => _patientService.patientVitalSignList;
_patientService.patientVitalSignOrderdSubList;
List<LabOrdersResModel> get patientLabResultOrdersList => List<VitalSignResModel> get patientVitalSignOrderdSubList => _patientService.patientVitalSignOrderdSubList;
_patientService.patientLabResultOrdersList;
List<PrescriptionResModel> get patientPrescriptionsList => List<LabOrdersResModel> get patientLabResultOrdersList => _patientService.patientLabResultOrdersList;
_patientService.patientPrescriptionsList;
List<PrescriptionResModel> get patientPrescriptionsList => _patientService.patientPrescriptionsList;
List<PrescriptionReportForInPatient> get prescriptionReportForInPatientList => List<PrescriptionReportForInPatient> get prescriptionReportForInPatientList =>
_patientService.prescriptionReportForInPatientList; _patientService.prescriptionReportForInPatientList;
List<PrescriptionReport> get prescriptionReport => List<PrescriptionReport> get prescriptionReport => _patientService.prescriptionReport;
_patientService.prescriptionReport;
List<RadiologyResModel> get patientRadiologyList => List<RadiologyResModel> get patientRadiologyList => _patientService.patientRadiologyList;
_patientService.patientRadiologyList;
List<LabResult> get labResultList => _patientService.labResultList; List<LabResult> get labResultList => _patientService.labResultList;
get insuranceApporvalsList => _patientService.insuranceApporvalsList; get insuranceApporvalsList => _patientService.insuranceApporvalsList;
List<NoteModel> get patientProgressNoteList => List<NoteModel> get patientProgressNoteList => _patientService.patientProgressNoteList;
_patientService.patientProgressNoteList;
List<dynamic> get clinicsList => _patientService.clinicsList; List<dynamic> get clinicsList => _patientService.clinicsList;
List<dynamic> get doctorsList => _patientService.doctorsList; List<dynamic> get doctorsList => _patientService.doctorsList;
List<dynamic> get referralFrequencyList => List<dynamic> get referralFrequencyList => _patientService.referalFrequancyList;
_patientService.referalFrequancyList;
Future getPatientList(patient, patientType, Future getPatientList(patient, patientType, {bool isBusyLocal = false, isView}) async {
{bool isBusyLocal = false, isView}) async {
var localRes; var localRes;
if (isBusyLocal) { if (isBusyLocal) {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
} else { } else {
setState(ViewState.Busy); setState(ViewState.Busy);
} }
localRes = await _patientService.getPatientList(patient, patientType, localRes = await _patientService.getPatientList(patient, patientType, isView: isView);
isView: isView);
if (_patientService.hasError) { if (_patientService.hasError) {
error = _patientService.error; error = _patientService.error;
@ -210,16 +204,12 @@ class PatientViewModel extends BaseViewModel {
} }
List getDoctorNameList() { List getDoctorNameList() {
var doctorNamelist = _patientService.doctorsList var doctorNamelist = _patientService.doctorsList.map((value) => value['DoctorName'].toString()).toList();
.map((value) => value['DoctorName'].toString())
.toList();
return doctorNamelist; return doctorNamelist;
} }
List getClinicNameList() { List getClinicNameList() {
var clinicsNameslist = _patientService.clinicsList var clinicsNameslist = _patientService.clinicsList.map((value) => value['ClinicDescription'].toString()).toList();
.map((value) => value['ClinicDescription'].toString())
.toList();
return clinicsNameslist; return clinicsNameslist;
} }
@ -234,9 +224,8 @@ class PatientViewModel extends BaseViewModel {
} }
List getReferralNamesList() { List getReferralNamesList() {
var referralNamesList = _patientService.referalFrequancyList var referralNamesList =
.map((value) => value['Description'].toString()) _patientService.referalFrequancyList.map((value) => value['Description'].toString()).toList();
.toList();
return referralNamesList; return referralNamesList;
} }
@ -281,4 +270,18 @@ class PatientViewModel extends BaseViewModel {
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getInPatientList(PatientSearchRequestModel requestModel, {bool isMyInpatient = false}) async {
await getDoctorProfile();
setState(ViewState.Busy);
await _patientService.getInPatient(requestModel, false);
if (_patientService.hasError) {
error = _patientService.error;
setState(ViewState.ErrorLocal);
} else {
// setDefaultInPatientList();
setState(ViewState.Idle);
}
}
} }

@ -1,24 +0,0 @@
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/service/patient/referred_patient_service.dart';
import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart';
import '../../locator.dart';
import 'base_view_model.dart';
class ReferredPatientViewModel extends BaseViewModel {
ReferredPatientService _referralPatientService =
locator<ReferredPatientService>();
List<MyReferredPatientModel> get listMyReferredPatientModel =>
_referralPatientService.listMyReferredPatientModel;
Future getMyReferredPatient() async {
setState(ViewState.Busy);
await _referralPatientService.getMyReferredPatient();
if (_referralPatientService.hasError) {
error = _referralPatientService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
}

@ -0,0 +1,26 @@
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/service/home/scan_qr_service.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/locator.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
class ScanQrViewModel extends BaseViewModel {
ScanQrService _scanQrService = locator<ScanQrService>();
List<PatiantInformtion> get inPatientList => _scanQrService.inPatientList;
Future getInPatientList(PatientSearchRequestModel requestModel, {bool isMyInpatient = false}) async {
await getDoctorProfile();
setState(ViewState.Busy);
await _scanQrService.getInPatient(requestModel, true);
if (_scanQrService.hasError) {
error = _scanQrService.error;
setState(ViewState.ErrorLocal);
} else {
// setDefaultInPatientList();
setState(ViewState.Idle);
}
}
}

@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/screens/home/home_screen.dart';
import 'package:doctor_app_flutter/screens/qr_reader/QR_reader_screen.dart'; import 'package:doctor_app_flutter/screens/qr_reader/QR_reader_screen.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_drawer_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_drawer_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/bottom_nav_bar.dart'; import 'package:doctor_app_flutter/widgets/shared/bottom_nav_bar.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/app_showcase_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/user-guid/app_showcase_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -33,7 +34,7 @@ class _LandingPageState extends State<LandingPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return AppScaffold(
appBar: currentTab != 0 appBar: currentTab != 0
? AppBar( ? AppBar(
elevation: 0, elevation: 0,

@ -1,42 +1,46 @@
import 'package:doctor_app_flutter/core/service/authentication_service.dart'; import 'package:doctor_app_flutter/core/service/authentication_service.dart';
import 'package:doctor_app_flutter/core/service/home/scan_qr_service.dart';
import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/hospitals_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/hospitals_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_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/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart';
import 'package:get_it/get_it.dart'; import 'package:get_it/get_it.dart';
import 'core/service/NavigationService.dart';
import 'core/service/VideoCallService.dart';
import 'core/service/home/dasboard_service.dart'; import 'core/service/home/dasboard_service.dart';
import 'core/service/home/doctor_reply_service.dart';
import 'core/service/home/schedule_service.dart';
import 'core/service/hospitals/hospitals_service.dart';
import 'core/service/patient/DischargedPatientService.dart'; import 'core/service/patient/DischargedPatientService.dart';
import 'core/service/patient/LiveCarePatientServices.dart'; import 'core/service/patient/LiveCarePatientServices.dart';
import 'core/service/patient/patient_service.dart';
import 'core/service/patient_medical_file/insurance/InsuranceCardService.dart';
import 'core/service/patient/MyReferralPatientService.dart'; import 'core/service/patient/MyReferralPatientService.dart';
import 'core/service/patient/PatientMuseService.dart'; import 'core/service/patient/PatientMuseService.dart';
import 'core/service/patient/ReferralService.dart'; import 'core/service/patient/ReferralService.dart';
import 'core/service/patient/out_patient_service.dart';
import 'core/service/patient/patient-doctor-referral-service.dart';
import 'core/service/patient/patientInPatientService.dart';
import 'core/service/patient/patient_service.dart';
import 'core/service/patient/referral_patient_service.dart';
import 'core/service/patient_medical_file/admission_request/patient-admission-request-service.dart';
import 'core/service/patient_medical_file/insurance/InsuranceCardService.dart';
import 'core/service/patient_medical_file/lab_order/labs_service.dart';
import 'core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart'; import 'core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart';
import 'core/service/patient_medical_file/medical_report/medical_file_service.dart'; import 'core/service/patient_medical_file/medical_report/medical_file_service.dart';
import 'core/service/patient_medical_file/prescription/medicine_service.dart';
import 'core/service/patient_medical_file/prescription/prescription_service.dart'; import 'core/service/patient_medical_file/prescription/prescription_service.dart';
import 'core/service/patient_medical_file/prescription/prescriptions_service.dart';
import 'core/service/patient_medical_file/procedure/procedure_service.dart'; import 'core/service/patient_medical_file/procedure/procedure_service.dart';
import 'core/service/patient_medical_file/radiology/radiology_service.dart';
import 'core/service/patient_medical_file/sick_leave/sickleave_service.dart'; import 'core/service/patient_medical_file/sick_leave/sickleave_service.dart';
import 'core/service/patient_medical_file/soap/SOAP_service.dart'; import 'core/service/patient_medical_file/soap/SOAP_service.dart';
import 'core/service/home/doctor_reply_service.dart';
import 'core/service/hospitals/hospitals_service.dart';
import 'core/service/patient_medical_file/lab_order/labs_service.dart';
import 'core/service/patient_medical_file/prescription/medicine_service.dart';
import 'core/service/patient_medical_file/admission_request/patient-admission-request-service.dart';
import 'core/service/patient/patient-doctor-referral-service.dart';
import 'core/service/patient_medical_file/ucaf/patient-ucaf-service.dart'; import 'core/service/patient_medical_file/ucaf/patient-ucaf-service.dart';
import 'core/service/patient_medical_file/vital_sign/patient-vital-signs-service.dart'; import 'core/service/patient_medical_file/vital_sign/patient-vital-signs-service.dart';
import 'core/service/patient/out_patient_service.dart'; import 'core/service/special_clinics/special_clinic_service.dart';
import 'core/service/patient/patientInPatientService.dart';
import 'core/service/patient_medical_file/prescription/prescriptions_service.dart';
import 'core/service/patient_medical_file/radiology/radiology_service.dart';
import 'core/service/patient/referral_patient_service.dart';
import 'core/service/patient/referred_patient_service.dart';
import 'core/service/home/schedule_service.dart';
import 'core/viewModel/DischargedPatientViewModel.dart'; import 'core/viewModel/DischargedPatientViewModel.dart';
import 'core/viewModel/InsuranceViewModel.dart'; import 'core/viewModel/InsuranceViewModel.dart';
import 'core/viewModel/LiveCarePatientViewModel.dart'; import 'core/viewModel/LiveCarePatientViewModel.dart';
@ -54,7 +58,6 @@ import 'core/viewModel/patient-vital-sign-viewmodel.dart';
import 'core/viewModel/prescriptions_view_model.dart'; import 'core/viewModel/prescriptions_view_model.dart';
import 'core/viewModel/radiology_view_model.dart'; import 'core/viewModel/radiology_view_model.dart';
import 'core/viewModel/referral_view_model.dart'; import 'core/viewModel/referral_view_model.dart';
import 'core/viewModel/referred_view_model.dart';
import 'core/viewModel/schedule_view_model.dart'; import 'core/viewModel/schedule_view_model.dart';
GetIt locator = GetIt.instance; GetIt locator = GetIt.instance;
@ -65,7 +68,6 @@ void setupLocator() {
locator.registerLazySingleton(() => DoctorReplyService()); locator.registerLazySingleton(() => DoctorReplyService());
locator.registerLazySingleton(() => ScheduleService()); locator.registerLazySingleton(() => ScheduleService());
locator.registerLazySingleton(() => ReferralPatientService()); locator.registerLazySingleton(() => ReferralPatientService());
locator.registerLazySingleton(() => ReferredPatientService());
locator.registerLazySingleton(() => MedicineService()); locator.registerLazySingleton(() => MedicineService());
locator.registerLazySingleton(() => PatientService()); locator.registerLazySingleton(() => PatientService());
locator.registerLazySingleton(() => DashboardService()); locator.registerLazySingleton(() => DashboardService());
@ -92,12 +94,15 @@ void setupLocator() {
locator.registerLazySingleton(() => HospitalsService()); locator.registerLazySingleton(() => HospitalsService());
locator.registerLazySingleton(() => PatientMedicalReportService()); locator.registerLazySingleton(() => PatientMedicalReportService());
locator.registerLazySingleton(() => LiveCarePatientServices()); locator.registerLazySingleton(() => LiveCarePatientServices());
locator.registerLazySingleton(() => NavigationService());
locator.registerLazySingleton(() => ScanQrService());
locator.registerLazySingleton(() => SpecialClinicsService());
locator.registerLazySingleton(() => VideoCallService());
/// View Model /// View Model
locator.registerFactory(() => DoctorReplayViewModel()); locator.registerFactory(() => DoctorReplayViewModel());
locator.registerFactory(() => ScheduleViewModel()); locator.registerFactory(() => ScheduleViewModel());
locator.registerFactory(() => ReferralPatientViewModel()); locator.registerFactory(() => ReferralPatientViewModel());
locator.registerFactory(() => ReferredPatientViewModel());
locator.registerFactory(() => MedicineViewModel()); locator.registerFactory(() => MedicineViewModel());
locator.registerFactory(() => PatientViewModel()); locator.registerFactory(() => PatientViewModel());
locator.registerFactory(() => DashboardViewModel()); locator.registerFactory(() => DashboardViewModel());
@ -120,4 +125,5 @@ void setupLocator() {
locator.registerFactory(() => HospitalViewModel()); locator.registerFactory(() => HospitalViewModel());
locator.registerFactory(() => LiveCarePatientViewModel()); locator.registerFactory(() => LiveCarePatientViewModel());
locator.registerFactory(() => PatientMedicalReportViewModel()); locator.registerFactory(() => PatientMedicalReportViewModel());
locator.registerFactory(() => ScanQrViewModel());
} }

@ -11,6 +11,7 @@ import 'package:provider/provider.dart';
import './config/size_config.dart'; import './config/size_config.dart';
import './routes.dart'; import './routes.dart';
import 'config/config.dart'; import 'config/config.dart';
import 'core/service/NavigationService.dart';
import 'core/viewModel/authentication_view_model.dart'; import 'core/viewModel/authentication_view_model.dart';
import 'locator.dart'; import 'locator.dart';
@ -66,6 +67,7 @@ class MyApp extends StatelessWidget {
dividerColor: Colors.grey[350], dividerColor: Colors.grey[350],
backgroundColor: Color.fromRGBO(255, 255, 255, 1), backgroundColor: Color.fromRGBO(255, 255, 255, 1),
), ),
navigatorKey: locator<NavigationService>().navigatorKey,
initialRoute: INIT_ROUTE, initialRoute: INIT_ROUTE,
routes: routes, routes: routes,
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,

@ -0,0 +1,32 @@
class GetSpecialClinicalCareListResponseModel {
int projectID;
int clinicID;
String clinicDescription;
String clinicDescriptionN;
bool isActive;
GetSpecialClinicalCareListResponseModel(
{this.projectID,
this.clinicID,
this.clinicDescription,
this.clinicDescriptionN,
this.isActive});
GetSpecialClinicalCareListResponseModel.fromJson(Map<String, dynamic> json) {
projectID = json['ProjectID'];
clinicID = json['ClinicID'];
clinicDescription = json['ClinicDescription'];
clinicDescriptionN = json['ClinicDescriptionN'];
isActive = json['IsActive'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ProjectID'] = this.projectID;
data['ClinicID'] = this.clinicID;
data['ClinicDescription'] = this.clinicDescription;
data['ClinicDescriptionN'] = this.clinicDescriptionN;
data['IsActive'] = this.isActive;
return data;
}
}

@ -0,0 +1,37 @@
class GetSpecialClinicalCareMappingListResponseModel {
int mappingProjectID;
int clinicID;
int nursingStationID;
bool isActive;
int projectID;
String description;
GetSpecialClinicalCareMappingListResponseModel(
{this.mappingProjectID,
this.clinicID,
this.nursingStationID,
this.isActive,
this.projectID,
this.description});
GetSpecialClinicalCareMappingListResponseModel.fromJson(
Map<String, dynamic> json) {
mappingProjectID = json['MappingProjectID'];
clinicID = json['ClinicID'];
nursingStationID = json['NursingStationID'];
isActive = json['IsActive'];
projectID = json['ProjectID'];
description = json['Description'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['MappingProjectID'] = this.mappingProjectID;
data['ClinicID'] = this.clinicID;
data['NursingStationID'] = this.nursingStationID;
data['IsActive'] = this.isActive;
data['ProjectID'] = this.projectID;
data['Description'] = this.description;
return data;
}
}

@ -1,56 +1,56 @@
class StartCallReq { class StartCallReq {
int vCID; String clincName;
bool isrecall; int clinicId;
String tokenID; String docSpec;
String generalid; String docotrName;
int doctorId; int doctorId;
String generalid;
bool isOutKsa; bool isOutKsa;
bool isrecall;
String projectName; String projectName;
String docotrName; String tokenID;
String clincName; int vCID;
String docSpec;
int clinicId;
StartCallReq( StartCallReq(
{this.vCID, {this.clincName,
this.isrecall, this.clinicId,
this.tokenID, this.docSpec,
this.generalid, this.docotrName,
this.doctorId, this.doctorId,
this.generalid,
this.isOutKsa, this.isOutKsa,
this.isrecall,
this.projectName, this.projectName,
this.docotrName, this.tokenID,
this.clincName, this.vCID});
this.docSpec,
this.clinicId});
StartCallReq.fromJson(Map<String, dynamic> json) { StartCallReq.fromJson(Map<String, dynamic> json) {
vCID = json['VC_ID']; clincName = json['clincName'];
isrecall = json['isrecall']; clinicId = json['ClinicId'];
tokenID = json['TokenID']; docSpec = json['Doc_Spec'];
generalid = json['generalid']; docotrName = json['DocotrName'];
doctorId = json['DoctorId']; doctorId = json['DoctorId'];
generalid = json['generalid'];
isOutKsa = json['IsOutKsa']; isOutKsa = json['IsOutKsa'];
isrecall = json['isrecall'];
projectName = json['projectName']; projectName = json['projectName'];
docotrName = json['DocotrName']; tokenID = json['TokenID'];
clincName = json['clincName']; vCID = json['VC_ID'];
docSpec = json['Doc_Spec'];
clinicId = json['ClinicId'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['VC_ID'] = this.vCID; data['clincName'] = this.clincName;
data['isrecall'] = this.isrecall; data['ClinicId'] = this.clinicId;
data['TokenID'] = this.tokenID; data['Doc_Spec'] = this.docSpec;
data['generalid'] = this.generalid; data['DocotrName'] = this.docotrName;
data['DoctorId'] = this.doctorId; data['DoctorId'] = this.doctorId;
data['generalid'] = this.generalid;
data['IsOutKsa'] = this.isOutKsa; data['IsOutKsa'] = this.isOutKsa;
data['isrecall'] = this.isrecall;
data['projectName'] = this.projectName; data['projectName'] = this.projectName;
data['DocotrName'] = this.docotrName; data['TokenID'] = this.tokenID;
data['clincName'] = this.clincName; data['VC_ID'] = this.vCID;
data['Doc_Spec'] = this.docSpec;
data['ClinicId'] = this.clinicId;
return data; return data;
} }
} }

@ -166,8 +166,9 @@ class MyReferredPatientModel {
referringDoctor = json['ReferringDoctor']; referringDoctor = json['ReferringDoctor'];
referralClinic = json['ReferralClinic']; referralClinic = json['ReferralClinic'];
referringClinic = json['ReferringClinic']; referringClinic = json['ReferringClinic'];
referralStatus = json['ReferralStatus']; createdOn = json['CreatedOn'];
referralDate = json['ReferralDate']; referralStatus = json["ReferralStatus"] is String?json['ReferralStatus']== "Accepted"?46:json['ReferralStatus']=="Pending"?1:0 : json['ReferralStatus'];
referralDate = json['ReferralDate'] ?? createdOn;
referringDoctorRemarks = json['ReferringDoctorRemarks']; referringDoctorRemarks = json['ReferringDoctorRemarks'];
referredDoctorRemarks = json['ReferredDoctorRemarks']; referredDoctorRemarks = json['ReferredDoctorRemarks'];
referralResponseOn = json['ReferralResponseOn']; referralResponseOn = json['ReferralResponseOn'];
@ -179,7 +180,6 @@ class MyReferredPatientModel {
appointmentDate = json['AppointmentDate']; appointmentDate = json['AppointmentDate'];
appointmentType = json['AppointmentType']; appointmentType = json['AppointmentType'];
patientMRN = json['PatientMRN']; patientMRN = json['PatientMRN'];
createdOn = json['CreatedOn'];
clinicID = json['ClinicID']; clinicID = json['ClinicID'];
nationalityID = json['NationalityID']; nationalityID = json['NationalityID'];
age = json['Age']; age = json['Age'];

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

@ -1,4 +1,5 @@
import 'package:doctor_app_flutter/root_page.dart'; import 'package:doctor_app_flutter/root_page.dart';
import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart';
import 'package:doctor_app_flutter/screens/medical-file/health_summary_page.dart'; import 'package:doctor_app_flutter/screens/medical-file/health_summary_page.dart';
import 'package:doctor_app_flutter/screens/patients/ECGPage.dart'; import 'package:doctor_app_flutter/screens/patients/ECGPage.dart';
import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart';
@ -37,6 +38,7 @@ const String LOGIN = 'login';
const String VERIFICATION_METHODS = 'verification-methods'; const String VERIFICATION_METHODS = 'verification-methods';
const String PATIENTS = 'patients/patients'; const String PATIENTS = 'patients/patients';
const String PATIENTS_PROFILE = 'patients/patients-profile'; const String PATIENTS_PROFILE = 'patients/patients-profile';
const String PATIENTS_END_Call = 'patients/patients-profile/endCall';
const String IN_PATIENTS_PROFILE = 'inpatients/patients-profile'; const String IN_PATIENTS_PROFILE = 'inpatients/patients-profile';
const String LAB_RESULT = 'patients/lab_result'; const String LAB_RESULT = 'patients/lab_result';
const String HEALTH_SUMMARY = 'patients/health-summary'; const String HEALTH_SUMMARY = 'patients/health-summary';
@ -88,6 +90,7 @@ var routes = {
PATIENT_MEDICAL_REPORT: (_) => MedicalReportPage(), PATIENT_MEDICAL_REPORT: (_) => MedicalReportPage(),
PATIENT_MEDICAL_REPORT_INSERT: (_) => AddVerifyMedicalReport(), PATIENT_MEDICAL_REPORT_INSERT: (_) => AddVerifyMedicalReport(),
PATIENT_MEDICAL_REPORT_DETAIL: (_) => MedicalReportDetailPage(), PATIENT_MEDICAL_REPORT_DETAIL: (_) => MedicalReportDetailPage(),
PATIENTS_END_Call: (_) => EndCallScreen(),
CREATE_EPISODE: (_) => UpdateSoapIndex( CREATE_EPISODE: (_) => UpdateSoapIndex(
isUpdate: true, isUpdate: true,
), ),

@ -10,6 +10,7 @@ class HomePatientCard extends StatelessWidget {
final String text; final String text;
final Color textColor; final Color textColor;
final Function onTap; final Function onTap;
final double iconSize;
HomePatientCard({ HomePatientCard({
@required this.backgroundColor, @required this.backgroundColor,
@ -18,6 +19,7 @@ class HomePatientCard extends StatelessWidget {
@required this.text, @required this.text,
@required this.textColor, @required this.textColor,
@required this.onTap, @required this.onTap,
this.iconSize = 30,
}); });
@override @override
@ -34,14 +36,13 @@ class HomePatientCard extends StatelessWidget {
Expanded( Expanded(
child: Stack( child: Stack(
children: [ children: [
Positioned( Container(
bottom: 0.1, margin: EdgeInsets.only(top: 18, left: 10),
right: 0.5, color:Colors.transparent,
width: 23.0,
height: 25.0,
child: Icon( child: Icon(
cardIcon, cardIcon,
size: 60, size: iconSize * 2,
color: backgroundIconColor, color: backgroundIconColor,
), ),
), ),
@ -52,7 +53,7 @@ class HomePatientCard extends StatelessWidget {
children: [ children: [
Icon( Icon(
cardIcon, cardIcon,
size: 30, size: iconSize,
color: textColor, color: textColor,
), ),
SizedBox( SizedBox(

@ -69,6 +69,7 @@ class _HomeScreenState extends State<HomeScreen> {
await model.getDashboard(); await model.getDashboard();
await model.getDoctorProfile(isGetProfile: true); await model.getDoctorProfile(isGetProfile: true);
await model.checkDoctorHasLiveCare(); await model.checkDoctorHasLiveCare();
// await model.getSpecialClinicalCareList();
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
@ -287,7 +288,7 @@ class _HomeScreenState extends State<HomeScreen> {
child: ListView( child: ListView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: [ children: [
...homePatientsCardsWidget(model), ...homePatientsCardsWidget(model, projectsProvider),
])), ])),
SizedBox( SizedBox(
height: 20, height: 20,
@ -305,7 +306,7 @@ class _HomeScreenState extends State<HomeScreen> {
); );
} }
List<Widget> homePatientsCardsWidget(DashboardViewModel model) { List<Widget> homePatientsCardsWidget(DashboardViewModel model,projectsProvider) {
colorIndex = 0; colorIndex = 0;
List<Color> backgroundColors = List(3); List<Color> backgroundColors = List(3);
@ -329,6 +330,7 @@ class _HomeScreenState extends State<HomeScreen> {
backgroundIconColor: backgroundIconColors[colorIndex], backgroundIconColor: backgroundIconColors[colorIndex],
cardIcon: DoctorApp.livecare, cardIcon: DoctorApp.livecare,
textColor: textColors[colorIndex], textColor: textColors[colorIndex],
iconSize: 21,
text: text:
"${TranslationBase.of(context).liveCare}\n${TranslationBase.of(context).patients}", "${TranslationBase.of(context).liveCare}\n${TranslationBase.of(context).patients}",
onTap: () { onTap: () {
@ -353,7 +355,8 @@ class _HomeScreenState extends State<HomeScreen> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: PatientInPatientScreen(), page: PatientInPatientScreen(specialClinic: model.getSpecialClinic(clinicId??projectsProvider
.doctorClinicsList[0].clinicID),),
), ),
); );
}, },

@ -13,7 +13,7 @@ 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/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
@ -25,7 +25,7 @@ import 'package:hexcolor/hexcolor.dart';
class EndCallScreen extends StatefulWidget { class EndCallScreen extends StatefulWidget {
final PatiantInformtion patient; final PatiantInformtion patient;
const EndCallScreen({Key key, this.patient}) : super(key: key); const EndCallScreen({Key key, this.patient,}) : super(key: key);
@override @override
_EndCallScreenState createState() => _EndCallScreenState(); _EndCallScreenState createState() => _EndCallScreenState();
@ -33,7 +33,7 @@ class EndCallScreen extends StatefulWidget {
class _EndCallScreenState extends State<EndCallScreen> { class _EndCallScreenState extends State<EndCallScreen> {
bool isInpatient = false; bool isInpatient = false;
PatiantInformtion patient;
bool isDischargedPatient = false; bool isDischargedPatient = false;
bool isSearchAndOut = false; bool isSearchAndOut = false;
String patientType; String patientType;
@ -42,16 +42,32 @@ class _EndCallScreenState extends State<EndCallScreen> {
String to; String to;
LiveCarePatientViewModel liveCareModel; LiveCarePatientViewModel liveCareModel;
@override
void initState() {
super.initState();
if(widget.patient!=null)
patient = widget.patient;
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
if(routeArgs.containsKey('patient'))
patient = routeArgs['patient'];
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final List<PatientProfileCardModel> cardsList = [ final List<PatientProfileCardModel> cardsList = [
PatientProfileCardModel(TranslationBase.of(context).resume, PatientProfileCardModel(TranslationBase.of(context).resume,
TranslationBase.of(context).theCall, '', 'patient/vital_signs.png', TranslationBase.of(context).theCall, '', 'patient/vital_signs.png',
isInPatient: isInpatient, onTap: () async { isInPatient: isInpatient,
color: Colors.green[800],
onTap: () async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await liveCareModel await liveCareModel
.startCall(isReCall: false, vCID: widget.patient.vcId) .startCall(isReCall: false, vCID: patient.vcId)
.then((value) async { .then((value) async {
await liveCareModel.getDoctorProfile(); await liveCareModel.getDoctorProfile();
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
@ -62,7 +78,8 @@ class _EndCallScreenState extends State<EndCallScreen> {
kToken: liveCareModel.startCallRes.openTokenID, kToken: liveCareModel.startCallRes.openTokenID,
kSessionId: liveCareModel.startCallRes.openSessionID, kSessionId: liveCareModel.startCallRes.openSessionID,
kApiKey: '46209962', kApiKey: '46209962',
vcId: widget.patient.vcId, vcId: patient.vcId,
patientName: patient.fullName ?? (patient.firstName != null ? "${patient.firstName} ${patient.lastName}" : "-"),
tokenID: await liveCareModel.getToken(), tokenID: await liveCareModel.getToken(),
generalId: GENERAL_ID, generalId: GENERAL_ID,
doctorId: liveCareModel.doctorProfile.doctorID, doctorId: liveCareModel.doctorProfile.doctorID,
@ -73,7 +90,7 @@ class _EndCallScreenState extends State<EndCallScreen> {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await liveCareModel.endCall( await liveCareModel.endCall(
widget.patient.vcId, patient.vcId,
false, false,
); );
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
@ -86,7 +103,7 @@ class _EndCallScreenState extends State<EndCallScreen> {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await liveCareModel.endCall( await liveCareModel.endCall(
widget.patient.vcId, patient.vcId,
sessionStatusModel.sessionStatus == 3, sessionStatusModel.sessionStatus == 3,
); );
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
@ -105,20 +122,22 @@ class _EndCallScreenState extends State<EndCallScreen> {
TranslationBase.of(context).consultation, TranslationBase.of(context).consultation,
'', '',
'patient/vital_signs.png', 'patient/vital_signs.png',
isInPatient: isInpatient, onTap: () { isInPatient: isInpatient,
color: Colors.red[800],
onTap: () {
Helpers.showConfirmationDialog(context, Helpers.showConfirmationDialog(context,
"${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).endLC} ${TranslationBase.of(context).consultation} ?", "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).endLC} ${TranslationBase.of(context).consultation} ?",
() async { () async {
Navigator.of(context).pop(); Navigator.of(context).pop();
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await liveCareModel.getAlternativeServices(widget.patient.vcId); await liveCareModel.getAlternativeServices(patient.vcId);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) { if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error); DrAppToastMsg.showErrorToast(liveCareModel.error);
} else { } else {
showAlternativesDialog(context, liveCareModel, (bool isConfirmed) async { showAlternativesDialog(context, liveCareModel, (bool isConfirmed) async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await liveCareModel.endCallWithCharge(widget.patient.vcId, isConfirmed); await liveCareModel.endCallWithCharge(patient.vcId, isConfirmed);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) { if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error); DrAppToastMsg.showErrorToast(liveCareModel.error);
@ -136,10 +155,24 @@ class _EndCallScreenState extends State<EndCallScreen> {
TranslationBase.of(context).instruction, TranslationBase.of(context).instruction,
"", "",
'patient/health_summary.png', 'patient/health_summary.png',
onTap: () {}, onTap: () {
Helpers.showConfirmationDialog(context,
"${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).sendLC} ${TranslationBase.of(context).instruction} ?",
() async {
Navigator.of(context).pop();
GifLoaderDialogUtils.showMyDialog(context);
await liveCareModel.sendSMSInstruction(patient.vcId);
GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error);
} else {
DrAppToastMsg.showSuccesToast("You successfully sent SMS instructions");
}
});
},
isInPatient: isInpatient, isInPatient: isInpatient,
isDartIcon: true, isDartIcon: true,
isDisable: true, // isDisable: true,
dartIcon: DoctorApp.send_instruction), dartIcon: DoctorApp.send_instruction),
PatientProfileCardModel( PatientProfileCardModel(
TranslationBase.of(context).transferTo, TranslationBase.of(context).transferTo,
@ -150,7 +183,7 @@ class _EndCallScreenState extends State<EndCallScreen> {
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) => builder: (BuildContext context) =>
LivaCareTransferToAdmin(patient: widget.patient))); LivaCareTransferToAdmin(patient: patient)));
}, },
isInPatient: isInpatient, isInPatient: isInpatient,
isDartIcon: true, isDartIcon: true,
@ -166,11 +199,15 @@ class _EndCallScreenState extends State<EndCallScreen> {
appBarTitle: TranslationBase.of(context).patientProfile, appBarTitle: TranslationBase.of(context).patientProfile,
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar( appBar: PatientProfileAppBar(
widget.patient, arrivalType ?? '7', '1', patient,
onPressed: (){
Navigator.pop(context);
},
isInpatient: isInpatient, isInpatient: isInpatient,
height: (widget.patient.patientStatusType != null && height: (patient.patientStatusType != null &&
widget.patient.patientStatusType == 43) patient.patientStatusType == 43)
? 210 ? 210
: isDischargedPatient : isDischargedPatient
? 240 ? 240
@ -213,7 +250,7 @@ class _EndCallScreenState extends State<EndCallScreen> {
staggeredTileBuilder: (int index) => StaggeredTile.fit(1), staggeredTileBuilder: (int index) => StaggeredTile.fit(1),
itemBuilder: (BuildContext context, int index) => itemBuilder: (BuildContext context, int index) =>
PatientProfileButton( PatientProfileButton(
patient: widget.patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
from: from, from: from,
@ -230,6 +267,7 @@ class _EndCallScreenState extends State<EndCallScreen> {
isLoading: cardsList[index].isLoading, isLoading: cardsList[index].isLoading,
isDartIcon: cardsList[index].isDartIcon, isDartIcon: cardsList[index].isDartIcon,
dartIcon: cardsList[index].dartIcon, dartIcon: cardsList[index].dartIcon,
color: cardsList[index].color,
), ),
), ),
], ],
@ -311,6 +349,7 @@ class _EndCallScreenState extends State<EndCallScreen> {
), ),
AppButton( AppButton(
onPressed: () { onPressed: () {
Navigator.of(context).pop();
Navigator.of(context).pop(); Navigator.of(context).pop();
okFunction(false); okFunction(false);
}, },

@ -120,7 +120,7 @@ class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
() async { () async {
Navigator.of(context).pop(); Navigator.of(context).pop();
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
model.transferToAdmin(widget.patient.vcId, noteController.text); await model.transferToAdmin(widget.patient.vcId, noteController.text);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);

@ -6,7 +6,7 @@ import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/PatientCard.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart';
import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';

@ -66,6 +66,7 @@ class _VideoCallPageState extends State<VideoCallPage> {
//'1_MX40NjgwMzIyNH5-MTU5MzY4MzYzODYwM35ucExWYVRVSm5Hcy9uWGZmM1lOa3czZHV-fg', //'1_MX40NjgwMzIyNH5-MTU5MzY4MzYzODYwM35ucExWYVRVSm5Hcy9uWGZmM1lOa3czZHV-fg',
kApiKey: '46209962', kApiKey: '46209962',
vcId: widget.patientData.vcId, vcId: widget.patientData.vcId,
patientName: widget.patientData.fullName ?? widget.patientData.firstName != null ? "${widget.patientData.firstName} ${widget.patientData.lastName}" : "-",
tokenID: token, //"hfkjshdf347r8743", tokenID: token, //"hfkjshdf347r8743",
generalId: "Cs2020@2016\$2958", generalId: "Cs2020@2016\$2958",
doctorId: doctorprofile['DoctorID'], doctorId: doctorprofile['DoctorID'],

@ -4,7 +4,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/medical-file/medical_file_details.dart'; import 'package:doctor_app_flutter/screens/medical-file/medical_file_details.dart';
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart';
@ -30,10 +30,8 @@ class _HealthSummaryPageState extends State<HealthSummaryPage> {
builder: builder:
(BuildContext context, MedicalFileViewModel model, Widget child) => (BuildContext context, MedicalFileViewModel model, Widget child) =>
AppScaffold( AppScaffold(
appBar: PatientProfileHeaderNewDesignAppBar( appBar: PatientProfileAppBar(
patient, patient,
patientType.toString() ?? "0",
arrivalType,
isInpatient: isInpatient, isInpatient: isInpatient,
), ),
isShowAppBar: true, isShowAppBar: true,

@ -4,7 +4,7 @@ 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/base/base_view.dart';
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart';
@ -102,20 +102,19 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
builder: builder:
(BuildContext context, MedicalFileViewModel model, Widget child) => (BuildContext context, MedicalFileViewModel model, Widget child) =>
AppScaffold( AppScaffold(
appBar: PatientProfileHeaderWhitAppointmentAppBar( appBar: PatientProfileAppBar(
patient: patient, patient,
patientType: patient.patientType.toString() ?? "0",
arrivalType: patient.arrivedOn.toString() ?? 0,
doctorName: doctorName, doctorName: doctorName,
profileUrl: doctorImage, profileUrl: doctorImage,
clinic: clinicName, clinic: clinicName,
isPrescriptions: true, isPrescriptions: true,
isMedicalFile: true, isMedicalFile: true,
episode: episode, episode: episode,
vistDate: visitDate:
'${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat( '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(
vistDate, vistDate,
), isArabic: projectViewModel.isArabic)}', ), isArabic: projectViewModel.isArabic)}',
isAppointmentHeader: true,
), ),
isShowAppBar: true, isShowAppBar: true,
appBarTitle: TranslationBase.of(context).medicalReport.toUpperCase(), appBarTitle: TranslationBase.of(context).medicalReport.toUpperCase(),

@ -6,7 +6,7 @@ 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/base/base_view.dart';
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -31,7 +31,7 @@ class ECGPage extends StatelessWidget {
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Color(0xffF8F8F8), backgroundColor: Color(0xffF8F8F8),
appBar: PatientProfileHeaderNewDesignAppBar(patient,arrivalType??'0',patientType), appBar: PatientProfileAppBar(patient),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),

@ -1,10 +1,12 @@
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/PatientCard.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart';
import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_container.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -60,7 +62,7 @@ class _InPatientPageState extends State<InPatientPage> {
model.filterSearchResults(value); model.filterSearchResults(value);
}), }),
), ),
model.filteredInPatientItems.length > 0 model.state == ViewState.Idle?model.filteredInPatientItems.length > 0
? Expanded( ? Expanded(
child: Container( child: Container(
margin: EdgeInsets.symmetric(horizontal: 16.0), margin: EdgeInsets.symmetric(horizontal: 16.0),
@ -155,6 +157,13 @@ class _InPatientPageState extends State<InPatientPage> {
error: error:
TranslationBase.of(context).noDataAvailable)), TranslationBase.of(context).noDataAvailable)),
), ),
): Center(
child: Container(
height: 300,
width: 300,
child: Image.asset(
"assets/images/progress-loading-red.gif"),
),
), ),
], ],
), ),

@ -1,17 +1,27 @@
import 'package:doctor_app_flutter/config/size_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/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'DischargedPatientPage.dart'; import 'DischargedPatientPage.dart';
import 'InPatientPage.dart'; import 'InPatientPage.dart';
class PatientInPatientScreen extends StatefulWidget { class PatientInPatientScreen extends StatefulWidget {
GetSpecialClinicalCareListResponseModel specialClinic;
PatientInPatientScreen({Key key, this.specialClinic});
@override @override
_PatientInPatientScreenState createState() => _PatientInPatientScreenState(); _PatientInPatientScreenState createState() => _PatientInPatientScreenState();
} }
@ -21,6 +31,9 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen>
TabController _tabController; TabController _tabController;
int _activeTab = 0; int _activeTab = 0;
int selectedMapId;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -42,15 +55,26 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery
.of(context)
.size;
PatientSearchRequestModel requestModel = PatientSearchRequestModel(); PatientSearchRequestModel requestModel = PatientSearchRequestModel();
ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context);
return BaseView<PatientSearchViewModel>( return BaseView<PatientSearchViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
model.clearPatientList(); model.clearPatientList();
// if (widget.specialClinic != null) {
// await model.getSpecialClinicalCareMappingList(widget.specialClinic.clinicID);
// requestModel.nursingStationID =
// model.specialClinicalCareMappingList[0].nursingStationID;
// requestModel.clinicID = 0;
// }
model.getInPatientList(requestModel); model.getInPatientList(requestModel);
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) =>
AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: false,
body: Column( body: Column(
@ -72,12 +96,125 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen>
), ),
Expanded( Expanded(
child: AppText( child: AppText(
TranslationBase.of(context).inPatient, TranslationBase
.of(context)
.inPatient,
fontSize: SizeConfig.textMultiplier * 2.8, fontSize: SizeConfig.textMultiplier * 2.8,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Color(0xFF2B353E), color: Color(0xFF2B353E),
), ),
), ),
if (model.specialClinicalCareMappingList.isNotEmpty &&
widget.specialClinic != null &&
_activeTab != 2)
Container(
width: MediaQuery.of(context).size.width * .3,
child: DropdownButtonHideUnderline(
child: DropdownButton(
dropdownColor: Colors.white,
iconEnabledColor: Colors.black,
isExpanded: true,
value: selectedMapId == null ? model
.specialClinicalCareMappingList[0]
.nursingStationID : selectedMapId,
iconSize: 25,
elevation: 16,
selectedItemBuilder:
(BuildContext context) {
return model
.specialClinicalCareMappingList
.map((item) {
return Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.end,
children: <Widget>[
Column(
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
Container(
padding:
EdgeInsets.all(2),
margin:
EdgeInsets.all(2),
decoration:
new BoxDecoration(
color:
Colors.red[800],
borderRadius:
BorderRadius
.circular(
20),
),
constraints:
BoxConstraints(
minWidth: 20,
minHeight: 20,
),
child: Center(
child: AppText(
model
.specialClinicalCareMappingList
.length
.toString(),
color:
Colors.white,
fontSize:
projectsProvider
.isArabic
? 10
: 11,
textAlign:
TextAlign
.center,
),
)),
],
),
AppText(item.description,
fontSize: 12,
color: Colors.black,
fontWeight:
FontWeight.bold,
textAlign: TextAlign.end),
],
);
}).toList();
},
onChanged: (newValue) async {
setState(() {
selectedMapId = newValue;
});
model.clearPatientList();
GifLoaderDialogUtils.showMyDialog(
context);
PatientSearchRequestModel requestModel = PatientSearchRequestModel(
nursingStationID: selectedMapId, clinicID: 0);
await model.getInPatientList(requestModel, isLocalBusy: true);
GifLoaderDialogUtils.hideDialog(
context);
if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
}
},
items: model
.specialClinicalCareMappingList
.map((item) {
return DropdownMenuItem(
child: AppText(
item.description,
textAlign: TextAlign.left,
),
value: item.nursingStationID,
);
}).toList(),
)),
)
]), ]),
), ),
), ),

@ -4,7 +4,7 @@ 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/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/patients/insurance_approvals_details.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approvals_details.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/doctor_card_insurance.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card_insurance.dart';
@ -44,10 +44,8 @@ class _InsuranceApprovalScreenNewState
: (model) => model.getInsuranceApproval(patient), : (model) => model.getInsuranceApproval(patient),
builder: (BuildContext context, InsuranceViewModel model, Widget child) => builder: (BuildContext context, InsuranceViewModel model, Widget child) =>
AppScaffold( AppScaffold(
appBar: PatientProfileHeaderNewDesignAppBar( appBar: PatientProfileAppBar(
patient, patient,
patientType.toString() ?? "0",
patientType,
isInpatient: isInpatient, isInpatient: isInpatient,
), ),
isShowAppBar: true, isShowAppBar: true,

@ -5,7 +5,7 @@ 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/base/base_view.dart';
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -54,8 +54,8 @@ class _InsuranceApprovalsDetailsState extends State<InsuranceApprovalsDetails> {
AppScaffold( AppScaffold(
isShowAppBar: true, isShowAppBar: true,
baseViewModel: model, baseViewModel: model,
appBar: PatientProfileHeaderNewDesignAppBar( appBar: PatientProfileAppBar(
patient, patient.patientType.toString(), patient.arrivedOn), patient),
body: patient.admissionNo != null body: patient.admissionNo != null
? SingleChildScrollView( ? SingleChildScrollView(
child: Container( child: Container(

@ -1,10 +1,8 @@
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/filter_type.dart'; import 'package:doctor_app_flutter/core/enum/filter_type.dart';
import 'package:doctor_app_flutter/core/enum/patient_type.dart'; import 'package:doctor_app_flutter/core/enum/patient_type.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart';
import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
@ -14,7 +12,7 @@ import 'package:doctor_app_flutter/routes.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/PatientCard.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';

@ -10,13 +10,11 @@ import 'package:doctor_app_flutter/routes.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/PatientCard.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';

@ -12,7 +12,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page-stepper-wi
import 'package:doctor_app_flutter/util/dr_app_toast_msg.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/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
@ -47,8 +47,8 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar( appBar: PatientProfileAppBar(
patient, patientType, arrivalType), patient),
appBarTitle: TranslationBase.of(context).ucaf, appBarTitle: TranslationBase.of(context).ucaf,
body: Column( body: Column(
children: [ children: [

@ -7,7 +7,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page-stepper-widget.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page-stepper-widget.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
@ -65,8 +65,8 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar( appBar: PatientProfileAppBar(
patient, patientType, arrivalType), patient),
appBarTitle: TranslationBase.of(context).ucaf, appBarTitle: TranslationBase.of(context).ucaf,
body: model.patientVitalSignsHistory.length > 0 && body: model.patientVitalSignsHistory.length > 0 &&
model.patientChiefComplaintList != null && model.patientChiefComplaintList != null &&

@ -7,7 +7,7 @@ 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/base/base_view.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
@ -61,8 +61,8 @@ class _AdmissionRequestThirdScreenState
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar( appBar: PatientProfileAppBar(
patient, patientType, arrivalType), patient),
appBarTitle: TranslationBase.of(context).admissionRequest, appBarTitle: TranslationBase.of(context).admissionRequest,
body: GestureDetector( body: GestureDetector(
onTap: () { onTap: () {

@ -8,7 +8,7 @@ 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/base/base_view.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
@ -52,8 +52,8 @@ class _AdmissionRequestThirdScreenState
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar( appBar: PatientProfileAppBar(
patient, patientType, arrivalType), patient),
appBarTitle: TranslationBase.of(context).admissionRequest, appBarTitle: TranslationBase.of(context).admissionRequest,
body: GestureDetector( body: GestureDetector(
onTap: () { onTap: () {

@ -10,7 +10,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/date-utils.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/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
@ -74,8 +74,8 @@ class _AdmissionRequestSecondScreenState
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar( appBar: PatientProfileAppBar(
patient, patientType, arrivalType), patient),
appBarTitle: TranslationBase.of(context).admissionRequest, appBarTitle: TranslationBase.of(context).admissionRequest,
body: GestureDetector( body: GestureDetector(
onTap: () { onTap: () {

@ -2,7 +2,7 @@ import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart';
import 'package:doctor_app_flutter/core/viewModel/labs_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/labs_view_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_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/base/base_view.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -32,31 +32,19 @@ class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<LabsViewModel>( return BaseView<LabsViewModel>(
// onModelReady: (model) => model.getLaboratoryResult(
// invoiceNo: widget.patientLabOrders.invoiceNo,
// clinicID: widget.patientLabOrders.clinicID,
// projectID: widget.patientLabOrders.projectID,
// orderNo: widget.patientLabOrders.orderNo,
// patient: widget.patient,
// isInpatient: widget.patientType == "1"),
onModelReady: (model) => model.getPatientLabResult( onModelReady: (model) => model.getPatientLabResult(
patientLabOrder: widget.patientLabOrders, patientLabOrder: widget.patientLabOrders,
patient: widget.patient, patient: widget.patient,
isInpatient: true), isInpatient: true),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileHeaderWhitAppointmentAppBar( appBar: PatientProfileAppBar(
patient: widget.patient, widget.patient,
patientType: widget.patientType ?? "0", isInpatient:widget.isInpatient,
arrivalType: widget.arrivalType ?? "0", isFromLabResult: true,
orderNo: widget.patientLabOrders.orderNo,
appointmentDate: widget.patientLabOrders.orderDate, appointmentDate: widget.patientLabOrders.orderDate,
doctorName: widget.patientLabOrders.doctorName,
branch: widget.patientLabOrders.projectName,
clinic: widget.patientLabOrders.clinicDescription,
profileUrl: widget.patientLabOrders.doctorImageURL,
invoiceNO: widget.patientLabOrders.invoiceNo,
), ),
baseViewModel: model, baseViewModel: model,
body: AppScaffold( body: AppScaffold(
isShowAppBar: false, isShowAppBar: false,

@ -7,7 +7,7 @@ import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart';
import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.dart'; import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart';
@ -52,10 +52,8 @@ class _LabsHomePageState extends State<LabsHomePage> {
baseViewModel: model, baseViewModel: model,
backgroundColor: Colors.grey[100], backgroundColor: Colors.grey[100],
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar( appBar: PatientProfileAppBar(
patient, patient,
patient.patientType.toString() ?? '0',
patientType,
isInpatient: isInpatient, isInpatient: isInpatient,
), ),
body: SingleChildScrollView( body: SingleChildScrollView(

@ -6,6 +6,7 @@ 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/base/base_view.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
@ -40,7 +41,9 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
? TranslationBase.of(context).medicalReportAdd ? TranslationBase.of(context).medicalReportAdd
: TranslationBase.of(context).medicalReportVerify, : TranslationBase.of(context).medicalReportVerify,
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: Column( body: model.state == ViewState.BusyLocal
? AppLoaderWidget()
: Column(
children: [ children: [
Expanded( Expanded(
child: Container( child: Container(
@ -53,13 +56,19 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (model.medicalReportTemplate.length > 0) // if (model.medicalReportTemplate.length > 0)
HtmlRichEditor( HtmlRichEditor(
initialText: model initialText: (medicalReport != null
.medicalReportTemplate[0] ? medicalReport.reportDataHtml
.templateTextHtml, : model.medicalReportTemplate
.length > 0 ? model
.medicalReportTemplate[0] : ""),
hint: "Write the medical report ",
height: height:
MediaQuery.of(context).size.height * MediaQuery
.of(context)
.size
.height *
0.75, 0.75,
), ),
], ],

@ -7,7 +7,7 @@ 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/base/base_view.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
@ -31,10 +31,8 @@ class MedicalReportDetailPage extends StatelessWidget {
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: PatientProfileHeaderNewDesignAppBar( appBar: PatientProfileAppBar(
patient, patient,
patientType,
arrivalType,
), ),
body: Container( body: Container(
child: SingleChildScrollView( child: SingleChildScrollView(

@ -7,17 +7,17 @@ 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/base/base_view.dart';
import 'package:doctor_app_flutter/util/date-utils.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/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/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../../../routes.dart'; import '../../../../routes.dart';
@ -43,10 +43,8 @@ class MedicalReportPage extends StatelessWidget {
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: PatientProfileHeaderNewDesignAppBar( appBar: PatientProfileAppBar(
patient, patient,
patientType,
arrivalType,
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
@ -75,6 +73,10 @@ class MedicalReportPage extends StatelessWidget {
), ),
AddNewOrder( AddNewOrder(
onTap: () { onTap: () {
if (model.hasOnHold()) {
Helpers.showErrorToast(
"Please Verified the on hold report to be able to add new one");
} else {
Navigator.of(context) Navigator.of(context)
.pushNamed(PATIENT_MEDICAL_REPORT_INSERT, arguments: { .pushNamed(PATIENT_MEDICAL_REPORT_INSERT, arguments: {
'patient': patient, 'patient': patient,
@ -82,6 +84,7 @@ class MedicalReportPage extends StatelessWidget {
'arrivalType': arrivalType, 'arrivalType': arrivalType,
'type': MedicalReportStatus.ADD 'type': MedicalReportStatus.ADD
}); });
}
}, },
label: TranslationBase.of(context).createNewMedicalReport, label: TranslationBase.of(context).createNewMedicalReport,
), ),
@ -92,7 +95,7 @@ class MedicalReportPage extends StatelessWidget {
onTap: () { onTap: () {
if (model.medicalReportList[index].status == 1) { if (model.medicalReportList[index].status == 1) {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
PATIENT_MEDICAL_REPORT_DETAIL, PATIENT_MEDICAL_REPORT_INSERT,
arguments: { arguments: {
'patient': patient, 'patient': patient,
'patientType': patientType, 'patientType': patientType,
@ -101,7 +104,7 @@ class MedicalReportPage extends StatelessWidget {
}); });
} else { } else {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
PATIENT_MEDICAL_REPORT_INSERT, PATIENT_MEDICAL_REPORT_DETAIL,
arguments: { arguments: {
'patient': patient, 'patient': patient,
'patientType': patientType, 'patientType': patientType,
@ -116,7 +119,7 @@ class MedicalReportPage extends StatelessWidget {
child: CardWithBgWidget( child: CardWithBgWidget(
hasBorder: false, hasBorder: false,
bgColor: model.medicalReportList[index].status == 1 bgColor: model.medicalReportList[index].status == 1
? Colors.red[700] ? Color(0xFFCC9B14)
: Colors.green[700], : Colors.green[700],
widget: Column( widget: Column(
children: [ children: [
@ -134,7 +137,7 @@ class MedicalReportPage extends StatelessWidget {
color: model.medicalReportList[index] color: model.medicalReportList[index]
.status == .status ==
1 1
? Colors.red[700] ? Color(0xFFCC9B14)
: Colors.green[700], : Colors.green[700],
fontSize: 1.4 * SizeConfig.textMultiplier, fontSize: 1.4 * SizeConfig.textMultiplier,
bold: true, bold: true,
@ -226,8 +229,8 @@ class MedicalReportPage extends StatelessWidget {
Icon( Icon(
model.medicalReportList[index].status == model.medicalReportList[index].status ==
1 1
? EvaIcons.eye ? DoctorApp.edit_1
: DoctorApp.edit_1, :EvaIcons.eye ,
), ),
], ],
), ),

@ -10,7 +10,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/note/update_note.dar
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
@ -88,10 +88,8 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
.of(context) .of(context)
.scaffoldBackgroundColor, .scaffoldBackgroundColor,
// appBarTitle: TranslationBase.of(context).progressNote, // appBarTitle: TranslationBase.of(context).progressNote,
appBar: PatientProfileHeaderNewDesignAppBar( appBar: PatientProfileAppBar(
patient, patient,
patient.patientType.toString() ?? '0',
arrivalType,
isInpatient: true, isInpatient: true,
), ),
body: model.patientProgressNoteList == null || body: model.patientProgressNoteList == null ||

@ -13,6 +13,7 @@ class PatientProfileCardModel {
final bool isSelectInpatient; final bool isSelectInpatient;
final bool isDartIcon; final bool isDartIcon;
final IconData dartIcon; final IconData dartIcon;
final Color color;
PatientProfileCardModel( PatientProfileCardModel(
this.nameLine1, this.nameLine1,
@ -25,6 +26,8 @@ class PatientProfileCardModel {
this.onTap, this.onTap,
this.isDischargedPatient = false, this.isDischargedPatient = false,
this.isSelectInpatient = false, this.isSelectInpatient = false,
this.isDartIcon = false,this.dartIcon this.isDartIcon = false,
this.dartIcon,
this.color,
}); });
} }

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/service/VideoCallService.dart';
import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart';
@ -12,10 +13,12 @@ import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_other.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_other.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_search.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_search.dart';
import 'package:doctor_app_flutter/util/NotificationPermissionUtils.dart';
import 'package:doctor_app_flutter/util/VideoChannel.dart'; import 'package:doctor_app_flutter/util/VideoChannel.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.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/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/buttons/app_buttons_widget.dart';
@ -24,6 +27,7 @@ import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:quiver/async.dart'; import 'package:quiver/async.dart';
import '../../../../locator.dart';
import '../../../../routes.dart'; import '../../../../routes.dart';
class PatientProfileScreen extends StatefulWidget { class PatientProfileScreen extends StatefulWidget {
@ -90,6 +94,9 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
if(routeArgs.containsKey("isFromLiveCare")) { if(routeArgs.containsKey("isFromLiveCare")) {
isFromLiveCare = routeArgs['isFromLiveCare']; isFromLiveCare = routeArgs['isFromLiveCare'];
} }
if(routeArgs.containsKey("isCallFinished")) {
isCallFinished = routeArgs['isCallFinished'];
}
if (isInpatient) if (isInpatient)
_activeTab = 0; _activeTab = 0;
else else
@ -98,7 +105,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
StreamSubscription callTimer; StreamSubscription callTimer;
callConnected(){ callConnected(){
callTimer = CountdownTimer(Duration(minutes: 1), Duration(seconds: 1)).listen(null) callTimer = CountdownTimer(Duration(minutes: 90), Duration(seconds: 1)).listen(null)
..onDone(() { ..onDone(() {
callTimer.cancel(); callTimer.cancel();
}) })
@ -185,10 +192,11 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
], ],
), ),
), ),
], ],
), ),
if (patient.patientStatusType != null && if (isFromLiveCare
? patient.episodeNo != null
: patient.patientStatusType != null &&
patient.patientStatusType == 43) patient.patientStatusType == 43)
BaseView<SOAPViewModel>( BaseView<SOAPViewModel>(
onModelReady: (model) async {}, onModelReady: (model) async {},
@ -203,7 +211,9 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
AppButton( AppButton(
title: title:
"${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}", "${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}",
color: patient.patientStatusType == 43 color: isFromLiveCare
? Colors.red.shade700
: patient.patientStatusType == 43
? Colors.red.shade700 ? Colors.red.shade700
: Colors.grey.shade700, : Colors.grey.shade700,
fontColor: Colors.white, fontColor: Colors.white,
@ -218,7 +228,10 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
height: 30, height: 30,
), ),
onPressed: () async { onPressed: () async {
if (patient.patientStatusType == if ((isFromLiveCare &&
patient.appointmentNo != null &&
patient.appointmentNo != 0) ||
patient.patientStatusType ==
43) { 43) {
PostEpisodeReqModel PostEpisodeReqModel
postEpisodeReqModel = postEpisodeReqModel =
@ -246,9 +259,16 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
if (patient.episodeNo != 0) if (patient.episodeNo != 0)
AppButton( AppButton(
title: title:
"${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}", "${TranslationBase
.of(context)
.update}\n${TranslationBase
.of(context)
.episode}",
color: color:
patient.patientStatusType == 43 isFromLiveCare
? Colors.red.shade700
: patient.patientStatusType ==
43
? Colors.red.shade700 ? Colors.red.shade700
: Colors.grey.shade700, : Colors.grey.shade700,
fontColor: Colors.white, fontColor: Colors.white,
@ -263,7 +283,11 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
height: 30, height: 30,
), ),
onPressed: () { onPressed: () {
if (patient.patientStatusType == if ((isFromLiveCare &&
patient.appointmentNo !=
null &&
patient.appointmentNo != 0) ||
patient.patientStatusType ==
43) { 43) {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
UPDATE_EPISODE, UPDATE_EPISODE,
@ -309,67 +333,32 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
TranslationBase.of(context).initiateCall, TranslationBase.of(context).initiateCall,
disabled: model.state == ViewState.BusyLocal, disabled: model.state == ViewState.BusyLocal,
onPressed: () async { onPressed: () async {
// Navigator.push(context, MaterialPageRoute(
// builder: (BuildContext context) =>
// EndCallScreen(patient:patient)));
if(isCallFinished) { if(isCallFinished) {
Navigator.push(context, MaterialPageRoute( Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) => builder: (BuildContext context) => EndCallScreen(patient:patient)));
EndCallScreen(patient:patient)));
} else { } else {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
// await model.startCall( isReCall : false, vCID: patient.vcId); await model.startCall( isReCall : false, vCID: patient.vcId);
if(model.state == ViewState.ErrorLocal) { if(model.state == ViewState.ErrorLocal) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
} else { } else {
await model.getDoctorProfile(); await model.getDoctorProfile();
// patient.appointmentNo = model.startCallRes.appointmentNo; patient.appointmentNo = model.startCallRes.appointmentNo;
patient.episodeNo = 0; patient.episodeNo = 0;
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
await VideoChannel.openVideoCallScreen( AppPermissionsUtils.requestVideoCallPermission(context: context,onTapGrant: (){
kToken: "T1==cGFydG5lcl9pZD00NzI0Nzk1NCZzaWc9NGIyZDljOTY3YjFiNWU1YzUzNzFmMjIyNjJmNmEzY2Y5NzZjOTdlYzpzZXNzaW9uX2lkPTFfTVg0ME56STBOemsxTkg1LU1UWXlNekEyTlRRMU9EVXhObjVrVFRoMFlVdFJXaXRYTWpadFZGZHFhSGxZVGpOdE1UVi1mZyZjcmVhdGVfdGltZT0xNjIzMDY1NDk1Jm5vbmNlPTAuMjM2Mjk0NTIwMTkyOTA4OTcmcm9sZT1wdWJsaXNoZXImZXhwaXJlX3RpbWU9MTYyNTY1NzQ5NCZpbml0aWFsX2xheW91dF9jbGFzc19saXN0PQ==",//model.startCallRes.openTokenID, locator<VideoCallService>().openVideo(model.startCallRes, patient, callConnected, callDisconnected);
kSessionId:"1_MX40NzI0Nzk1NH5-MTYyMzA2NTQ1ODUxNn5kTTh0YUtRWitXMjZtVFdqaHlYTjNtMTV-fg",// model.startCallRes.openSessionID,
kApiKey: '47247954',//46209962
vcId: patient.vcId,
tokenID: await model.getToken(),
generalId: GENERAL_ID,
doctorId: model.doctorProfile.doctorID,
onFailure: (String error) {
DrAppToastMsg.showErrorToast(error);
},
onCallConnected: callConnected,
onCallEnd: () {
var asd="";
// WidgetsBinding.instance.addPostFrameCallback((_) {
// GifLoaderDialogUtils.showMyDialog(context);
// model.endCall(patient.vcId, false,).then((value) {
// GifLoaderDialogUtils.hideDialog(context);
// if (model.state == ViewState.ErrorLocal) {
// DrAppToastMsg.showErrorToast(model.error);
// }
// setState(() {
// isCallFinished = true;
// });
// });
// });
},
onCallNotRespond: (SessionStatusModel sessionStatusModel) {
var asd="";
// WidgetsBinding.instance.addPostFrameCallback((_) {
// GifLoaderDialogUtils.showMyDialog(context);
// model.endCall(patient.vcId, sessionStatusModel.sessionStatus == 3,).then((value) {
// GifLoaderDialogUtils.hideDialog(context);
// if (model.state == ViewState.ErrorLocal) {
// DrAppToastMsg.showErrorToast(model.error);
// }
// setState(() {
// isCallFinished = true;
// });
// });
//
// });
}); });
} }
} }

@ -3,7 +3,7 @@ import 'package:doctor_app_flutter/core/viewModel/radiology_view_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_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/base/base_view.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/secondary_button.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/secondary_button.dart';
@ -16,13 +16,15 @@ class RadiologyDetailsPage extends StatelessWidget {
final PatiantInformtion patient; final PatiantInformtion patient;
final String patientType; final String patientType;
final String arrivalType; final String arrivalType;
final bool isInpatient;
RadiologyDetailsPage( RadiologyDetailsPage(
{Key key, {Key key,
this.finalRadiology, this.finalRadiology,
this.patient, this.patient,
this.patientType, this.patientType,
this.arrivalType}); this.arrivalType,
this.isInpatient = false});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -33,16 +35,16 @@ class RadiologyDetailsPage extends StatelessWidget {
lineItem: finalRadiology.invoiceLineItemNo, lineItem: finalRadiology.invoiceLineItemNo,
invoiceNo: finalRadiology.invoiceNo), invoiceNo: finalRadiology.invoiceNo),
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
appBar: PatientProfileHeaderWhitAppointmentAppBar( appBar: PatientProfileAppBar(
patient: patient, patient,
patientType: patientType ?? "0",
arrivalType: arrivalType ?? "0",
appointmentDate: finalRadiology.orderDate, appointmentDate: finalRadiology.orderDate,
doctorName: finalRadiology.doctorName, doctorName: finalRadiology.doctorName,
clinic: finalRadiology.clinicDescription, clinic: finalRadiology.clinicDescription,
branch: finalRadiology.projectName, branch: finalRadiology.projectName,
profileUrl: finalRadiology.doctorImageURL, profileUrl: finalRadiology.doctorImageURL,
invoiceNO: finalRadiology.invoiceNo.toString(), invoiceNO: finalRadiology.invoiceNo.toString(),
isAppointmentHeader: true,
), ),
isShowAppBar: true, isShowAppBar: true,
baseViewModel: model, baseViewModel: model,

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save