Merge branch 'development' into 'master'

Release 6.4

See merge request Cloud_Solution/doctor_app_flutter!853
merge-requests/940/merge
Mohammad Aljammal 5 years ago
commit 4039b3c370

@ -108,6 +108,8 @@ dependencies {
implementation 'com.squareup.okhttp3:okhttp:4.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:4.9.1' implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
implementation 'com.google.firebase:firebase-analytics:17.4.1' implementation 'com.google.firebase:firebase-analytics:17.4.1'
} }
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'

@ -1,7 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hmg.hmgDr">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

@ -10,22 +10,30 @@
FlutterApplication and put your custom class here. FlutterApplication and put your custom class here.
--> -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.CALL_PHONE" />
<!-- Permission required to draw floating widget over other apps -->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <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-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28"
tools:ignore="ScopedStorage"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" /> <uses-feature android:name="android.hardware.camera.autofocus" />
<application <application
android:name="io.flutter.app.FlutterApplication" android:name="AppApplication"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
tools:replace="android:name"
android:label="HMG Doctor"> android:label="HMG Doctor">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
@ -41,7 +49,9 @@
</intent-filter> </intent-filter>
</activity> </activity>
<service android:name = ".Service.VideoStreamContainerService"/> <service android:name = ".Service.VideoStreamFloatingWidgetService"
android:enabled="true"
android:exported="false"/>
<!-- <!--
Don't delete the meta-data below. Don't delete the meta-data below.
@ -50,6 +60,22 @@
<meta-data <meta-data
android:name="flutterEmbedding" android:name="flutterEmbedding"
android:value="2" /> android:value="2" />
<activity
android:name="com.hmg.hmgDr.globalErrorHandler.UCEDefaultActivity"
android:process=":error_activity" />
<provider
android:name="com.hmg.hmgDr.globalErrorHandler.UCEFileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
</application> </application>
</manifest> </manifest>

@ -0,0 +1,12 @@
package com.hmg.hmgDr
import com.hmg.hmgDr.globalErrorHandler.LoggingExceptionHandler
import io.flutter.app.FlutterApplication
class AppApplication : FlutterApplication() {
override fun onCreate() {
super.onCreate()
// LoggingExceptionHandler(this, "ErrorFile")
}
}

@ -1,43 +1,55 @@
package com.hmg.hmgDr package com.hmg.hmgDr
import android.Manifest
import android.app.Activity import android.app.Activity
import android.content.ComponentName import android.content.ComponentName
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.ServiceConnection import android.content.ServiceConnection
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.IBinder import android.os.IBinder
import android.provider.Settings
import android.util.Log import android.util.Log
import android.view.inputmethod.InputMethodManager import android.widget.Toast
import android.widget.EditText
import androidx.annotation.NonNull import androidx.annotation.NonNull
import com.google.gson.GsonBuilder import com.google.gson.GsonBuilder
import com.hmg.hmgDr.Model.GetSessionStatusModel import com.hmg.hmgDr.Service.VideoStreamFloatingWidgetService
import com.hmg.hmgDr.Model.SessionStatusModel import com.hmg.hmgDr.model.GetSessionStatusModel
import com.hmg.hmgDr.Service.VideoStreamContainerService import com.hmg.hmgDr.model.SessionStatusModel
import com.hmg.hmgDr.ui.VideoCallResponseListener import com.hmg.hmgDr.ui.VideoCallResponseListener
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
import pub.devrel.easypermissions.AfterPermissionGranted
import pub.devrel.easypermissions.AppSettingsDialog
import pub.devrel.easypermissions.EasyPermissions
class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler, class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler,
VideoCallResponseListener { VideoCallResponseListener {
/* Permission request code to draw over other apps */
private val DRAW_OVER_OTHER_APP_PERMISSION_REQUEST_CODE = 1222
private val CHANNEL = "Dr.cloudSolution/videoCall" private val CHANNEL = "Dr.cloudSolution/videoCall"
private lateinit var methodChannel: MethodChannel 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
private var serviceIntent: Intent? = null private var serviceIntent: Intent? = null
private var videoStreamService: VideoStreamContainerService? = null private var videoStreamService: VideoStreamFloatingWidgetService? = null
private var bound = false private var bound = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine) GeneratedPluginRegistrant.registerWith(flutterEngine)
@ -67,18 +79,21 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler,
val isRecording = call.argument<Boolean>("isRecording") val isRecording = call.argument<Boolean>("isRecording")
val sessionStatusModel = val sessionStatusModel =
GetSessionStatusModel(VC_ID, tokenID, generalId, doctorId, patientName, isRecording!!) GetSessionStatusModel(
VC_ID,
tokenID,
generalId,
doctorId,
patientName,
isRecording!!
)
openVideoCall(apiKey, sessionId, token, appLang, baseUrl, sessionStatusModel) openVideoCall(apiKey, sessionId, token, appLang, baseUrl, sessionStatusModel)
} }
"closeVideoCall" -> { "closeVideoCall" -> {
dialogFragment?.onCallClicked() videoStreamService?.closeVideoCall()
// videoStreamService?.closeVideoCall()
}
"onCallConnected" -> {
} }
else -> { else -> {
result.notImplemented() result.notImplemented()
@ -86,91 +101,87 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler,
} }
} }
private fun openVideoCall(apiKey: String?, sessionId: String?, token: String?, appLang: String?, baseUrl: String?, sessionStatusModel: GetSessionStatusModel) { private fun openVideoCall(
if (dialogFragment == null) { apiKey: String?,
val arguments = Bundle() sessionId: String?,
arguments.putString("apiKey", apiKey) token: String?,
arguments.putString("sessionId", sessionId) appLang: String?,
arguments.putString("token", token) baseUrl: String?,
arguments.putString("appLang", appLang) sessionStatusModel: GetSessionStatusModel
arguments.putString("baseUrl", baseUrl) ) {
arguments.putParcelable("sessionStatusModel", sessionStatusModel)
val arguments = Bundle()
val transaction = supportFragmentManager.beginTransaction() arguments.putString("apiKey", apiKey)
dialogFragment = VideoCallFragment.newInstance(arguments) arguments.putString("sessionId", sessionId)
dialogFragment?.let { arguments.putString("token", token)
it.setCallListener(this) arguments.putString("appLang", appLang)
it.isCancelable = true arguments.putString("baseUrl", baseUrl)
if (it.isAdded){ arguments.putParcelable("sessionStatusModel", sessionStatusModel)
it.dismiss()
}else { // start service
it.show(transaction, "dialog") // serviceIntent = Intent(this@MainActivity, VideoStreamContainerService::class.java)
} if (videoStreamService == null || videoStreamService?.serviceRunning == false) {
serviceIntent = Intent(this@MainActivity, VideoStreamFloatingWidgetService::class.java)
serviceIntent?.run {
putExtras(arguments)
action = VideoStreamFloatingWidgetService.ACTION_START_CALL
} }
} else if (!dialogFragment!!.isVisible) { checkFloatingWidgetPermission()
val transaction = supportFragmentManager.beginTransaction()
dialogFragment!!.show(transaction, "dialog")
} }
} }
// private fun openVideoCall( private fun checkFloatingWidgetPermission() {
// apiKey: String?, // Check if the application has draw over other apps permission or not?
// sessionId: String?, // This permission is by default available for API<23. But for API > 23
// token: String?, // you have to ask for the permission in runtime.
// appLang: String?, if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !Settings.canDrawOverlays(this)) {
// baseUrl: String?, //If the draw over permission is not available open the settings screen
// sessionStatusModel: GetSessionStatusModel //to grant the permission.
// ) { val intent = Intent(
// Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
// val arguments = Bundle() Uri.parse("package:$packageName")
// arguments.putString("apiKey", apiKey) )
// arguments.putString("sessionId", sessionId) startActivityForResult(intent, DRAW_OVER_OTHER_APP_PERMISSION_REQUEST_CODE)
// arguments.putString("token", token) } else { //If permission is granted start floating widget service
// arguments.putString("appLang", appLang) startFloatingWidgetService()
// arguments.putString("baseUrl", baseUrl) }
// arguments.putParcelable("sessionStatusModel", sessionStatusModel) }
//
//// showSoftKeyBoard(null)
// // start service
// serviceIntent = Intent(this@MainActivity, VideoStreamContainerService::class.java)
// serviceIntent?.run {
// putExtras(arguments)
// startService(this)
// }
//// bindService()
// }
/* override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
var asd = "";
if (requestCode == LAUNCH_VIDEO) {
if (resultCode == Activity.RESULT_OK) {
val result : SessionStatusModel? = data?.getParcelableExtra("sessionStatusNotRespond")
val callResponse : HashMap<String, String> = HashMap()
val sessionStatus : HashMap<String, String> = HashMap()
val gson = GsonBuilder().serializeNulls().create()
callResponse["callResponse"] = "CallNotRespond" private fun startFloatingWidgetService() {
val jsonRes = gson.toJson(result) startService(serviceIntent)
callResponse["sessionStatus"] = jsonRes bindService()
}
this.result?.success(callResponse) override fun onDestroy() {
} super.onDestroy()
if (resultCode == Activity.RESULT_CANCELED) { if (bound) {
val callResponse : HashMap<String, String> = HashMap() unbindService()
callResponse["callResponse"] = "CallEnd" }
}
result?.success(callResponse) override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
} if (requestCode == DRAW_OVER_OTHER_APP_PERMISSION_REQUEST_CODE) {
} //Check if the permission is granted or not.
}*/ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (Settings.canDrawOverlays(this)) {
startFloatingWidgetService()
} else {
//Permission is not available then display toast
Toast.makeText(
this,
"Draw over other app permission not available. App won\\'t work without permission. Please try again.",
Toast.LENGTH_SHORT
).show()
}
} else {
startFloatingWidgetService()
}
} else {
super.onActivityResult(requestCode, resultCode, data)
}
}
override fun onCallFinished(resultCode: Int, intent: Intent?) { override fun onCallFinished(resultCode: Int, intent: Intent?) {
dialogFragment = null
if (resultCode == Activity.RESULT_OK) { if (resultCode == Activity.RESULT_OK) {
val result: SessionStatusModel? = intent?.getParcelableExtra("sessionStatusNotRespond") val result: SessionStatusModel? = intent?.getParcelableExtra("sessionStatusNotRespond")
val callResponse: HashMap<String, String> = HashMap() val callResponse: HashMap<String, String> = HashMap()
@ -197,25 +208,33 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler,
} }
} }
// stopService(serviceIntent) stopService(serviceIntent)
// unbindService()
// videoStreamService!!.serviceRunning = false
}
override fun errorHandle(message: String) {
dialogFragment = null
// Toast.makeText(this, message, Toast.LENGTH_LONG).show()
} }
override fun minimizeVideoEvent(isMinimize: Boolean) { override fun minimizeVideoEvent(isMinimize: Boolean) {
if (isMinimize) if (isMinimize)
methodChannel.invokeMethod("onCallConnected", null) methodChannel.invokeMethod("onCallConnected", null)
else else {
methodChannel.invokeMethod("onCallDisconnected", null) methodChannel.invokeMethod("onCallDisconnected", null)
unbindService()
videoStreamService?.serviceRunning = false
videoStreamService = null
}
} }
override fun onBackPressed() { override fun onBackPressed() {
super.onBackPressed() if (videoStreamService != null && videoStreamService?.serviceRunning == true && videoStreamService?.isFullScreen!!) {
videoStreamService!!.onMinimizedClicked()
} else {
super.onBackPressed()
}
}
override fun onPause() {
if (videoStreamService != null && videoStreamService?.serviceRunning == true && videoStreamService?.isFullScreen!!) {
videoStreamService!!.onMinimizedClicked()
}
super.onPause()
} }
// override fun onStart() { // override fun onStart() {
@ -228,53 +247,38 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler,
// unbindService() // unbindService()
// } // }
// private fun bindService() { private fun bindService() {
// serviceIntent?.run { serviceIntent?.run {
// if (videoStreamService != null && !videoStreamService!!.serviceRunning){ if (videoStreamService != null && !videoStreamService!!.serviceRunning) {
// startService(this) startService(this)
// } }
// bindService(this, serviceConnection, Context.BIND_AUTO_CREATE) bindService(this, serviceConnection, Context.BIND_AUTO_CREATE)
// videoStreamService?.serviceRunning = true }
// } }
// }
//
// private fun unbindService() {
// if (bound) {
// videoStreamService!!.videoCallResponseListener = null // unregister
// videoStreamService!!.mActivity = null
// unbindService(serviceConnection)
// bound = false
// }
// }
//
// private val serviceConnection: ServiceConnection = object : ServiceConnection {
// override fun onServiceConnected(name: ComponentName?, service: IBinder?) {
// val binder: VideoStreamContainerService.VideoStreamBinder =
// service as VideoStreamContainerService.VideoStreamBinder
// videoStreamService = binder.service
// bound = true
// videoStreamService!!.videoCallResponseListener = this@MainActivity // register
// videoStreamService!!.mActivity = this@MainActivity // register
// }
//
// override fun onServiceDisconnected(name: ComponentName?) {
// bound = false
// }
//
// }
// code to hide soft keyboard private fun unbindService() {
fun hideSoftKeyBoard(editBox: EditText?) { if (bound) {
val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager videoStreamService?.videoCallResponseListener = null // unregister
imm.hideSoftInputFromWindow(editBox?.windowToken, 0) unbindService(serviceConnection)
bound = false
}
} }
private val serviceConnection: ServiceConnection = object : ServiceConnection {
override fun onServiceConnected(name: ComponentName?, service: IBinder?) {
// val binder: VideoStreamContainerService.VideoStreamBinder =
// service as VideoStreamContainerService.VideoStreamBinder
val binder: VideoStreamFloatingWidgetService.VideoStreamBinder =
service as VideoStreamFloatingWidgetService.VideoStreamBinder
videoStreamService = binder.service
bound = true
videoStreamService!!.videoCallResponseListener = this@MainActivity // register
videoStreamService?.serviceRunning = true
}
// code to show soft keyboard override fun onServiceDisconnected(name: ComponentName?) {
private fun showSoftKeyBoard(editBox: EditText?) { bound = false
val inputMethodManager = this.getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager }
editBox?.requestFocus()
inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0)
}
}
} }

@ -0,0 +1,234 @@
package com.hmg.hmgDr.Service
import android.annotation.SuppressLint
import android.app.Service
import android.content.Context
import android.graphics.PixelFormat
import android.graphics.Point
import android.os.Build
import android.os.CountDownTimer
import android.util.Log
import android.view.*
import androidx.core.view.GestureDetectorCompat
import com.hmg.hmgDr.R
import com.hmg.hmgDr.util.ViewsUtil
abstract class BaseMovingFloatingWidget : Service() {
val szWindow = Point()
lateinit var windowManagerParams: WindowManager.LayoutParams
var mWindowManager: WindowManager? = null
var floatingWidgetView: View? = null
lateinit var floatingViewContainer: View
lateinit var mDetector: GestureDetectorCompat
private var xInitCord = 0
private var yInitCord: Int = 0
private var xInitMargin: Int = 0
private var yInitMargin: Int = 0
/* Add Floating Widget View to Window Manager */
open fun addFloatingWidgetView() {
mWindowManager = getSystemService(Context.WINDOW_SERVICE) as WindowManager
//Init LayoutInflater
val inflater = getSystemService(LAYOUT_INFLATER_SERVICE) as LayoutInflater
//Inflate the removing view layout we created
floatingWidgetView = inflater.inflate(R.layout.activity_video_call, null)
//Add the view to the window.
windowManagerParams =
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT
)
} else {
WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT
)
}
//Specify the view position
windowManagerParams.gravity = Gravity.TOP or Gravity.START
}
@SuppressLint("ClickableViewAccessibility")
val dragListener: View.OnTouchListener = View.OnTouchListener { _, event ->
mDetector.onTouchEvent(event)
//Get Floating widget view params
val layoutParams: WindowManager.LayoutParams =
floatingWidgetView!!.layoutParams as WindowManager.LayoutParams
//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 -> {
xInitCord = x_cord
yInitCord = y_cord
//remember the initial position.
xInitMargin = layoutParams.x
yInitMargin = layoutParams.y
}
MotionEvent.ACTION_UP -> {
//Get the difference between initial coordinate and current coordinate
val x_diff: Int = x_cord - xInitCord
val y_diff: Int = y_cord - yInitCord
y_cord_Destination = yInitMargin + y_diff
val barHeight: Int = ViewsUtil.getStatusBarHeight(applicationContext)
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 + (floatingViewContainer.height + barHeight) > szWindow.y) {
y_cord_Destination = szWindow.y - (floatingViewContainer.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 - xInitCord
val y_diff_move: Int = y_cord - yInitCord
x_cord_Destination = xInitMargin + x_diff_move
y_cord_Destination = yInitMargin + y_diff_move
layoutParams.x = x_cord_Destination
layoutParams.y = y_cord_Destination
//Update the layout with new X & Y coordinate
mWindowManager?.updateViewLayout(floatingWidgetView, layoutParams)
}
}
true
}
/**
* OnTouch actions
*/
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)
}
}
/* Reset position of Floating Widget view on dragging */
fun resetPosition(x_cord_now: Int) {
if (x_cord_now <= szWindow.x / 2) {
moveToLeft(x_cord_now)
} else {
moveToRight(x_cord_now)
}
}
/* Method to move the Floating widget view to Left */
private fun moveToLeft(current_x_cord: Int) {
val mParams: WindowManager.LayoutParams =
floatingWidgetView!!.layoutParams as WindowManager.LayoutParams
mParams.x =
(szWindow.x - current_x_cord * current_x_cord - floatingViewContainer.width).toInt()
try {
mWindowManager?.updateViewLayout(floatingWidgetView, mParams)
} catch (e: Exception) {
Log.e("windowManagerUpdate", "${e.localizedMessage}.")
}
val x = szWindow.x - current_x_cord
object : CountDownTimer(500, 5) {
//get params of Floating Widget view
val mParams: WindowManager.LayoutParams =
floatingWidgetView!!.layoutParams as WindowManager.LayoutParams
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 - floatingViewContainer.width).toInt()
try {
mWindowManager?.updateViewLayout(floatingWidgetView, mParams)
} catch (e: Exception) {
Log.e("windowManagerUpdate", "${e.localizedMessage}.")
}
}
override fun onFinish() {
mParams.x = -(szWindow.x - floatingViewContainer.width)
try {
mWindowManager?.updateViewLayout(floatingWidgetView, mParams)
} catch (e: Exception) {
Log.e("windowManagerUpdate", "${e.localizedMessage}.")
}
}
}.start()
}
/* Method to move the Floating widget view to Right */
private fun moveToRight(current_x_cord: Int) {
object : CountDownTimer(500, 5) {
//get params of Floating Widget view
val mParams: WindowManager.LayoutParams =
floatingWidgetView!!.layoutParams as WindowManager.LayoutParams
override fun onTick(t: Long) {
val step = (500 - t) / 5
mParams.x =
(szWindow.x + current_x_cord * current_x_cord * step - floatingViewContainer.width).toInt()
try {
mWindowManager?.updateViewLayout(floatingWidgetView, mParams)
} catch (e: Exception) {
Log.e("windowManagerUpdate", "${e.localizedMessage}.")
}
}
override fun onFinish() {
mParams.x = szWindow.x - floatingViewContainer.width
mWindowManager?.updateViewLayout(floatingWidgetView, mParams)
}
}.start()
}
/***
* Utils
*/
fun getWindowManagerDefaultDisplay() {
val w = mWindowManager!!.defaultDisplay.width
val h = mWindowManager!!.defaultDisplay.height
szWindow[w] = h
}
}

@ -1,8 +1,8 @@
package com.hmg.hmgDr.Service; package com.hmg.hmgDr.Service;
import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel; import com.hmg.hmgDr.model.ChangeCallStatusRequestModel;
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 retrofit2.Call; import retrofit2.Call;

@ -0,0 +1,39 @@
package com.hmg.hmgDr.globalErrorHandler
import android.os.Environment
import java.io.BufferedWriter
import java.io.File
import java.io.FileWriter
import java.io.IOException
import java.text.SimpleDateFormat
import java.util.*
object FileUtil {
val sdf = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS")
fun pushLog(body: String?) {
try {
val date = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(Date())
val time = SimpleDateFormat("HH:MM:SS", Locale.getDefault()).format(Date())
val root =
File(Environment.getExternalStorageDirectory(),"error_log_dir")
// if external memory exists and folder with name Notes
if (!root.exists()) {
root.mkdirs() // this will create folder.
}
val oldFile = File(root, "error" + sdf.format(Date()).toString() + ".txt") // old file
if (oldFile.exists()) oldFile.delete()
val filepath = File(root, "error$date.txt") // file path to save
val bufferedWriter = BufferedWriter(FileWriter(filepath, true))
bufferedWriter.append("\r\n")
bufferedWriter.append("\r\n").append(body).append(" Time : ").append(time)
bufferedWriter.flush()
} catch (e: IOException) {
e.printStackTrace()
} catch (e: IllegalStateException) {
e.printStackTrace()
}
}
}

@ -0,0 +1,39 @@
package com.hmg.hmgDr.globalErrorHandler
import android.content.Context
import android.content.Intent
import com.hmg.hmgDr.MainActivity
import com.hmg.hmgDr.globalErrorHandler.FileUtil.pushLog
class LoggingExceptionHandler(private val context: Context, ErrorFile: String) :
Thread.UncaughtExceptionHandler {
private val rootHandler: Thread.UncaughtExceptionHandler
override fun uncaughtException(t: Thread, e: Throwable) {
object : Thread() {
override fun run() {
pushLog("UnCaught Exception is thrown in $error$e")
try {
sleep(500)
val intent = Intent(context, MainActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
context.startActivity(intent)
} catch (e1: Exception) {
e1.printStackTrace()
}
}
}.start()
rootHandler.uncaughtException(t, e)
}
companion object {
private val TAG = LoggingExceptionHandler::class.java.simpleName
lateinit var error: String
}
init {
error = "$ErrorFile.error "
rootHandler = Thread.getDefaultUncaughtExceptionHandler()
Thread.setDefaultUncaughtExceptionHandler(this)
}
}

@ -0,0 +1,6 @@
package com.hmg.hmgDr.globalErrorHandler
import androidx.appcompat.app.AppCompatActivity
class UCEDefaultActivity : AppCompatActivity() {
}

@ -0,0 +1,6 @@
package com.hmg.hmgDr.globalErrorHandler
import androidx.core.content.FileProvider
class UCEFileProvider : FileProvider() {
}

@ -0,0 +1,280 @@
package com.hmg.hmgDr.globalErrorHandler
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.ref.WeakReference;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayDeque;
import java.util.Date;
import java.util.Deque;
import java.util.Locale;
import kotlin.system.exitProcess
class UCEHandler(val builder: Builder) {
val EXTRA_STACK_TRACE = "EXTRA_STACK_TRACE"
val EXTRA_ACTIVITY_LOG = "EXTRA_ACTIVITY_LOG"
private val TAG = "UCEHandler"
private val UCE_HANDLER_PACKAGE_NAME = "com.rohitss.uceh"
private val DEFAULT_HANDLER_PACKAGE_NAME = "com.android.internal.os"
private val MAX_STACK_TRACE_SIZE = 131071 //128 KB - 1
private val MAX_ACTIVITIES_IN_LOG = 50
private val SHARED_PREFERENCES_FILE = "uceh_preferences"
private val SHARED_PREFERENCES_FIELD_TIMESTAMP = "last_crash_timestamp"
private val activityLog: Deque<String> = ArrayDeque(MAX_ACTIVITIES_IN_LOG)
var COMMA_SEPARATED_EMAIL_ADDRESSES: String? = null
@SuppressLint("StaticFieldLeak")
private var application: Application? = null
private var isInBackground = true
private var isBackgroundMode = false
private var isUCEHEnabled = false
private var isTrackActivitiesEnabled = false
private var lastActivityCreated: WeakReference<Activity?> = WeakReference(null)
fun UCEHandler(builder: Builder) {
isUCEHEnabled = builder.isUCEHEnabled
isTrackActivitiesEnabled = builder.isTrackActivitiesEnabled
isBackgroundMode = builder.isBackgroundModeEnabled
COMMA_SEPARATED_EMAIL_ADDRESSES = builder.commaSeparatedEmailAddresses
setUCEHandler(builder.context)
}
private fun setUCEHandler(context: Context?) {
try {
if (context != null) {
val oldHandler = Thread.getDefaultUncaughtExceptionHandler()
if (oldHandler != null && oldHandler.javaClass.name.startsWith(
UCE_HANDLER_PACKAGE_NAME
)
) {
Log.e(TAG, "UCEHandler was already installed, doing nothing!")
} else {
if (oldHandler != null && !oldHandler.javaClass.name.startsWith(
DEFAULT_HANDLER_PACKAGE_NAME
)
) {
Log.e(
TAG,
"You already have an UncaughtExceptionHandler. If you use a custom UncaughtExceptionHandler, it should be initialized after UCEHandler! Installing anyway, but your original handler will not be called."
)
}
application = context.getApplicationContext() as Application
//Setup UCE Handler.
Thread.setDefaultUncaughtExceptionHandler(Thread.UncaughtExceptionHandler { thread, throwable ->
if (isUCEHEnabled) {
Log.e(
TAG,
"App crashed, executing UCEHandler's UncaughtExceptionHandler",
throwable
)
if (hasCrashedInTheLastSeconds(application!!)) {
Log.e(
TAG,
"App already crashed recently, not starting custom error activity because we could enter a restart loop. Are you sure that your app does not crash directly on init?",
throwable
)
if (oldHandler != null) {
oldHandler.uncaughtException(thread, throwable)
return@UncaughtExceptionHandler
}
} else {
setLastCrashTimestamp(application!!, Date().getTime())
if (!isInBackground || isBackgroundMode) {
val intent = Intent(application, UCEDefaultActivity::class.java)
val sw = StringWriter()
val pw = PrintWriter(sw)
throwable.printStackTrace(pw)
var stackTraceString: String = sw.toString()
if (stackTraceString.length > MAX_STACK_TRACE_SIZE) {
val disclaimer = " [stack trace too large]"
stackTraceString = stackTraceString.substring(
0,
MAX_STACK_TRACE_SIZE - disclaimer.length
) + disclaimer
}
intent.putExtra(EXTRA_STACK_TRACE, stackTraceString)
if (isTrackActivitiesEnabled) {
val activityLogStringBuilder = StringBuilder()
while (!activityLog.isEmpty()) {
activityLogStringBuilder.append(activityLog.poll())
}
intent.putExtra(
EXTRA_ACTIVITY_LOG,
activityLogStringBuilder.toString()
)
}
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
application!!.startActivity(intent)
} else {
if (oldHandler != null) {
oldHandler.uncaughtException(thread, throwable)
return@UncaughtExceptionHandler
}
//If it is null (should not be), we let it continue and kill the process or it will be stuck
}
}
val lastActivity: Activity? = lastActivityCreated.get()
if (lastActivity != null) {
lastActivity.finish()
lastActivityCreated.clear()
}
killCurrentProcess()
} else oldHandler?.uncaughtException(thread, throwable)
})
application!!.registerActivityLifecycleCallbacks(object :
Application.ActivityLifecycleCallbacks {
val dateFormat: DateFormat =
SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US)
var currentlyStartedActivities = 0
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
if (activity.javaClass !== UCEDefaultActivity::class.java) {
lastActivityCreated = WeakReference(activity)
}
if (isTrackActivitiesEnabled) {
activityLog.add(
dateFormat.format(Date())
.toString() + ": " + activity.javaClass
.getSimpleName() + " created\n"
)
}
}
override fun onActivityStarted(activity: Activity) {
currentlyStartedActivities++
isInBackground = currentlyStartedActivities == 0
}
override fun onActivityResumed(activity: Activity) {
if (isTrackActivitiesEnabled) {
activityLog.add(
dateFormat.format(Date())
.toString() + ": " + activity.javaClass
.simpleName + " resumed\n"
)
}
}
override fun onActivityPaused(activity: Activity) {
if (isTrackActivitiesEnabled) {
activityLog.add(
dateFormat.format(Date())
.toString() + ": " + activity.javaClass
.simpleName + " paused\n"
)
}
}
override fun onActivityStopped(activity: Activity) {
currentlyStartedActivities--
isInBackground = currentlyStartedActivities == 0
}
override fun onActivitySaveInstanceState(
activity: Activity,
outState: Bundle
) {}
override fun onActivityDestroyed(activity: Activity) {
if (isTrackActivitiesEnabled) {
activityLog.add(
dateFormat.format(Date())
.toString() + ": " + activity.javaClass
.simpleName + " destroyed\n"
)
}
}
})
}
Log.i(TAG, "UCEHandler has been installed.")
} else {
Log.e(TAG, "Context can not be null")
}
} catch (throwable: Throwable) {
Log.e(
TAG,
"UCEHandler can not be initialized. Help making it better by reporting this as a bug.",
throwable
)
}
}
/**
* INTERNAL method that tells if the app has crashed in the last seconds.
* This is used to avoid restart loops.
*
* @return true if the app has crashed in the last seconds, false otherwise.
*/
private fun hasCrashedInTheLastSeconds(context: Context): Boolean {
val lastTimestamp = getLastCrashTimestamp(context)
val currentTimestamp: Long = Date().getTime()
return lastTimestamp <= currentTimestamp && currentTimestamp - lastTimestamp < 3000
}
@SuppressLint("ApplySharedPref")
private fun setLastCrashTimestamp(context: Context, timestamp: Long) {
context.getSharedPreferences(SHARED_PREFERENCES_FILE, Context.MODE_PRIVATE).edit()
.putLong(SHARED_PREFERENCES_FIELD_TIMESTAMP, timestamp).commit()
}
private fun killCurrentProcess() {
// Process.killProcess(Process.myPid())
exitProcess(10)
}
private fun getLastCrashTimestamp(context: Context): Long {
return context.getSharedPreferences(SHARED_PREFERENCES_FILE, Context.MODE_PRIVATE)
.getLong(SHARED_PREFERENCES_FIELD_TIMESTAMP, -1)
}
fun closeApplication(activity: Activity) {
activity.finish()
killCurrentProcess()
}
inner class Builder(context: Context) {
val context: Context
var isUCEHEnabled = true
var commaSeparatedEmailAddresses: String? = null
var isTrackActivitiesEnabled = false
var isBackgroundModeEnabled = true
fun setUCEHEnabled(isUCEHEnabled: Boolean): Builder {
this.isUCEHEnabled = isUCEHEnabled
return this
}
fun setTrackActivitiesEnabled(isTrackActivitiesEnabled: Boolean): Builder {
this.isTrackActivitiesEnabled = isTrackActivitiesEnabled
return this
}
fun setBackgroundModeEnabled(isBackgroundModeEnabled: Boolean): Builder {
this.isBackgroundModeEnabled = isBackgroundModeEnabled
return this
}
fun addCommaSeparatedEmailAddresses(commaSeparatedEmailAddresses: String?): Builder {
this.commaSeparatedEmailAddresses = commaSeparatedEmailAddresses ?: ""
return this
}
fun build() {
return UCEHandler(this)
}
init {
this.context = context
}
}
}

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

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

@ -0,0 +1,16 @@
package com.hmg.hmgDr.model
/** Represents standard data needed for a Notification. */
open class NotificationDataModel(
// Standard notification values:
var mContentTitle: String,
var mContentText: String,
var mPriority: Int ,
// Notification channel values (O and above):
var mChannelId: String,
var mChannelName: CharSequence,
var mChannelDescription: String,
var mChannelImportance: Int ,
var mChannelEnableVibrate: Boolean ,
var mChannelLockscreenVisibility: Int
)

@ -0,0 +1,35 @@
package com.hmg.hmgDr.model
import android.app.Notification
import android.app.NotificationManager
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat
class NotificationVideoModel constructor(
mContentTitle: String,
mContentText: String,
mChannelId: String,
mChannelName: CharSequence,
mChannelDescription: String,
mPriority: Int = Notification.PRIORITY_MAX,
mChannelImportance: Int = NotificationManager.IMPORTANCE_LOW,
mChannelEnableVibrate: Boolean = true,
mChannelLockscreenVisibility: Int = NotificationCompat.VISIBILITY_PUBLIC,
// Unique data for this Notification.Style:
var mBigContentTitle: String = mContentTitle,
val mBigText: String = mContentText,
var mSummaryText: String
) : NotificationDataModel(
mContentTitle,
mContentText,
mPriority,
mChannelId,
mChannelName,
mChannelDescription,
mChannelImportance,
mChannelEnableVibrate,
mChannelLockscreenVisibility
) {
}

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

@ -1,8 +1,8 @@
package com.hmg.hmgDr.ui; package com.hmg.hmgDr.ui;
import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel; import com.hmg.hmgDr.model.ChangeCallStatusRequestModel;
import com.hmg.hmgDr.Model.GetSessionStatusModel; import com.hmg.hmgDr.model.GetSessionStatusModel;
import com.hmg.hmgDr.Model.SessionStatusModel; import com.hmg.hmgDr.model.SessionStatusModel;
public interface VideoCallContract { public interface VideoCallContract {

@ -1,8 +1,8 @@
package com.hmg.hmgDr.ui; package com.hmg.hmgDr.ui;
import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel; import com.hmg.hmgDr.model.ChangeCallStatusRequestModel;
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.Service.AppRetrofit; import com.hmg.hmgDr.Service.AppRetrofit;
import com.hmg.hmgDr.Service.SessionStatusAPI; import com.hmg.hmgDr.Service.SessionStatusAPI;

@ -11,7 +11,6 @@ import android.graphics.Point
import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
import android.opengl.GLSurfaceView import android.opengl.GLSurfaceView
import android.os.* import android.os.*
import android.util.DisplayMetrics
import android.util.Log import android.util.Log
import android.view.* import android.view.*
import android.widget.* import android.widget.*
@ -21,15 +20,15 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.GestureDetectorCompat import androidx.core.view.GestureDetectorCompat
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel import com.hmg.hmgDr.model.ChangeCallStatusRequestModel
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.R import com.hmg.hmgDr.R
import com.hmg.hmgDr.ui.VideoCallContract.VideoCallPresenter import com.hmg.hmgDr.ui.VideoCallContract.VideoCallPresenter
import com.hmg.hmgDr.ui.VideoCallContract.VideoCallView import com.hmg.hmgDr.ui.VideoCallContract.VideoCallView
import com.hmg.hmgDr.ui.VideoCallPresenterImpl import com.hmg.hmgDr.ui.VideoCallPresenterImpl
import com.hmg.hmgDr.ui.VideoCallResponseListener import com.hmg.hmgDr.ui.VideoCallResponseListener
import com.hmg.hmgDr.util.DynamicVideoRenderer import com.hmg.hmgDr.util.opentok.DynamicVideoRenderer
import com.hmg.hmgDr.util.ViewsUtil import com.hmg.hmgDr.util.ViewsUtil
import com.opentok.android.* import com.opentok.android.*
import com.opentok.android.PublisherKit.PublisherListener import com.opentok.android.PublisherKit.PublisherListener
@ -98,16 +97,17 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
private lateinit var mSwitchCameraBtn: ImageView private lateinit var mSwitchCameraBtn: ImageView
private lateinit var mspeckerBtn: ImageView private lateinit var mspeckerBtn: ImageView
private lateinit var mMicBtn: ImageView private lateinit var mMicBtn: ImageView
private lateinit var patientName: TextView private lateinit var patientName: TextView
private lateinit var cmTimer: Chronometer private lateinit var cmTimer: Chronometer
private var elapsedTime: Long = 0 private var elapsedTime: Long = 0
private var resume = false private var resume = false
private val progressBar: ProgressBar? = null private val progressBar: ProgressBar? = null
private val countDownTimer: CountDownTimer? = null private val countDownTimer: CountDownTimer? = null
private val progressBarTextView: TextView? = null private val progressBarTextView: TextView? = null
private val progressBarLayout: RelativeLayout? = null private val
progressBarLayout: RelativeLayout? = null
private var isConnected = false private var isConnected = false
@ -199,6 +199,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
} }
} }
fun setCallListener(videoCallResponseListener: VideoCallResponseListener) { fun setCallListener(videoCallResponseListener: VideoCallResponseListener) {
this.videoCallResponseListener = videoCallResponseListener this.videoCallResponseListener = videoCallResponseListener
} }
@ -293,7 +294,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
recordContainer.visibility = View.GONE recordContainer.visibility = View.GONE
} }
cmTimer = view.findViewById(R.id.cmTimer) // cmTimer = view.findViewById(R.id.cmTimer)
cmTimer.format = "mm:ss" cmTimer.format = "mm:ss"
cmTimer.onChronometerTickListener = cmTimer.onChronometerTickListener =
Chronometer.OnChronometerTickListener { arg0: Chronometer? -> Chronometer.OnChronometerTickListener { arg0: Chronometer? ->
@ -354,6 +355,8 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
checkClientConnected() checkClientConnected()
handleVideoViewHeight(true) handleVideoViewHeight(true)
if (appLang == "ar") { if (appLang == "ar") {
progressBarLayout!!.layoutDirection = View.LAYOUT_DIRECTION_RTL progressBarLayout!!.layoutDirection = View.LAYOUT_DIRECTION_RTL
} }
@ -481,10 +484,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session
} }
override fun onStreamReceived(session: Session, stream: Stream) { override fun onStreamReceived(session: Session, stream: Stream) {
Log.d( Log.d(TAG, "onStreamReceived: New stream " + stream.streamId + " in session " + session.sessionId)
TAG,
"onStreamReceived: New stream " + stream.streamId + " in session " + session.sessionId
)
if (mSubscriber != null) { if (mSubscriber != null) {
isConnected = true isConnected = true
return return

@ -0,0 +1,38 @@
package com.hmg.hmgDr.util
import java.text.SimpleDateFormat
import java.util.*
object DateUtils {
var simpleDateFormat: SimpleDateFormat = SimpleDateFormat("hh:mm:ss", Locale.ENGLISH)
fun differentDateTimeBetweenDateAndNow(firstDate: Date): String {
val now: Date = Calendar.getInstance().time
//1 minute = 60 seconds
//1 hour = 60 x 60 = 3600
//1 day = 3600 x 24 = 86400
var different: Long = now.time - firstDate.time
val secondsInMilli: Long = 1000
val minutesInMilli = secondsInMilli * 60
val hoursInMilli = minutesInMilli * 60
val daysInMilli = hoursInMilli * 24
val elapsedDays = different / daysInMilli
different %= daysInMilli
val elapsedHours = different / hoursInMilli
different %= hoursInMilli
val elapsedMinutes = different / minutesInMilli
different %= minutesInMilli
val elapsedSeconds = different / secondsInMilli
val format = "%1$02d:%2$02d" // two digits
return String.format(format, elapsedMinutes, elapsedSeconds)
}
}

@ -0,0 +1,77 @@
package com.hmg.hmgDr.util
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Build
import androidx.core.app.NotificationCompat
import com.hmg.hmgDr.model.NotificationDataModel
import com.hmg.hmgDr.model.NotificationVideoModel
object NotificationUtil {
fun createNotificationChannel(
context: Context,
notificationDataModel: NotificationDataModel
): String {
// The id of the channel.
val channelId: String = notificationDataModel.mChannelId
// NotificationChannels are required for Notifications on O (API 26) and above.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// The user-visible name of the channel.
val channelName: CharSequence = notificationDataModel.mChannelName
// The user-visible description of the channel.
val channelDescription: String = notificationDataModel.mChannelDescription
val channelImportance: Int = notificationDataModel.mChannelImportance
val channelEnableVibrate: Boolean = notificationDataModel.mChannelEnableVibrate
val channelLockscreenVisibility: Int =
notificationDataModel.mChannelLockscreenVisibility
// Initializes NotificationChannel.
val notificationChannel = NotificationChannel(channelId, channelName, channelImportance)
notificationChannel.description = channelDescription
notificationChannel.lightColor = Color.BLUE
notificationChannel.lockscreenVisibility = channelLockscreenVisibility
// no vibration
notificationChannel.vibrationPattern = longArrayOf(0)
notificationChannel.enableVibration(channelEnableVibrate)
// Adds NotificationChannel to system. Attempting to create an existing notification
// channel with its original values performs no operation, so it's safe to perform the
// below sequence.
val notificationManager =
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.createNotificationChannel(notificationChannel)
}
return channelId
}
fun setNotificationBigStyle(notificationData : NotificationVideoModel): NotificationCompat.BigTextStyle {
return NotificationCompat.BigTextStyle() // Overrides ContentText in the big form of the template.
.bigText(notificationData.mBigText) // Overrides ContentTitle in the big form of the template.
.setBigContentTitle(notificationData.mBigContentTitle) // Summary line after the detail section in the big form of the template.
// Note: To improve readability, don't overload the user with info. If Summary Text
// doesn't add critical information, you should skip it.
.setSummaryText(notificationData.mSummaryText)
}
/**
* IMPORTANT NOTE: You should not do this action unless the user takes an action to see your
* Notifications like this sample demonstrates. Spamming users to re-enable your notifications
* is a bad idea.
*/
fun openNotificationSettingsForApp(context: Context) {
// Links to this app's notification settings.
val intent = Intent()
intent.action = "android.settings.APP_NOTIFICATION_SETTINGS"
intent.putExtra("app_package", context.packageName)
intent.putExtra("app_uid", context.applicationInfo.uid)
// for Android 8 and above
intent.putExtra("android.provider.extra.APP_PACKAGE", context.packageName)
context.startActivity(intent)
}
}

@ -0,0 +1,467 @@
package com.hmg.hmgDr.util.audio
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.media.AudioFormat
import android.media.AudioManager
import android.media.AudioRecord
import android.media.AudioTrack
import android.media.MediaRecorder.AudioSource
import android.os.Process
import android.util.Log
import com.opentok.android.BaseAudioDevice
import java.nio.ByteBuffer
import java.util.concurrent.locks.Condition
import java.util.concurrent.locks.ReentrantLock
class CustomAudioDevice(context: Context) : BaseAudioDevice() {
private val m_context: Context = context
private var m_audioTrack: AudioTrack? = null
private var m_audioRecord: AudioRecord? = null
// Capture & render buffers
private var m_playBuffer: ByteBuffer? = null
private var m_recBuffer: ByteBuffer? = null
private val m_tempBufPlay: ByteArray
private val m_tempBufRec: ByteArray
private val m_rendererLock: ReentrantLock = ReentrantLock(true)
private val m_renderEvent: Condition = m_rendererLock.newCondition()
@Volatile
private var m_isRendering = false
@Volatile
private var m_shutdownRenderThread = false
private val m_captureLock: ReentrantLock = ReentrantLock(true)
private val m_captureEvent: Condition = m_captureLock.newCondition()
@Volatile
private var m_isCapturing = false
@Volatile
private var m_shutdownCaptureThread = false
private val m_captureSettings: AudioSettings
private val m_rendererSettings: AudioSettings
// Capturing delay estimation
private var m_estimatedCaptureDelay = 0
// Rendering delay estimation
private var m_bufferedPlaySamples = 0
private var m_playPosition = 0
private var m_estimatedRenderDelay = 0
private val m_audioManager: AudioManager
private var isRendererMuted = false
companion object {
private const val LOG_TAG = "opentok-defaultaudio"
private const val SAMPLING_RATE = 44100
private const val NUM_CHANNELS_CAPTURING = 1
private const val NUM_CHANNELS_RENDERING = 1
private const val MAX_SAMPLES = 2 * 480 * 2 // Max 10 ms @ 48 kHz
}
init {
try {
m_playBuffer = ByteBuffer.allocateDirect(MAX_SAMPLES)
m_recBuffer = ByteBuffer.allocateDirect(MAX_SAMPLES)
} catch (e: Exception) {
Log.e(LOG_TAG, "${e.message}.")
}
m_tempBufPlay = ByteArray(MAX_SAMPLES)
m_tempBufRec = ByteArray(MAX_SAMPLES)
m_captureSettings = AudioSettings(
SAMPLING_RATE,
NUM_CHANNELS_CAPTURING
)
m_rendererSettings = AudioSettings(
SAMPLING_RATE,
NUM_CHANNELS_RENDERING
)
m_audioManager = m_context
.getSystemService(Context.AUDIO_SERVICE) as AudioManager
m_audioManager.mode = AudioManager.MODE_IN_COMMUNICATION
}
override fun initCapturer(): Boolean {
// get the minimum buffer size that can be used
val minRecBufSize: Int = AudioRecord.getMinBufferSize(
m_captureSettings
.sampleRate,
if (NUM_CHANNELS_CAPTURING == 1) AudioFormat.CHANNEL_IN_MONO else AudioFormat.CHANNEL_IN_STEREO,
AudioFormat.ENCODING_PCM_16BIT
)
// double size to be more safe
val recBufSize = minRecBufSize * 2
// release the object
if (m_audioRecord != null) {
m_audioRecord!!.release()
m_audioRecord = null
}
try {
m_audioRecord = AudioRecord(
AudioSource.VOICE_COMMUNICATION,
m_captureSettings.sampleRate,
if (NUM_CHANNELS_CAPTURING == 1) AudioFormat.CHANNEL_IN_MONO else AudioFormat.CHANNEL_IN_STEREO,
AudioFormat.ENCODING_PCM_16BIT, recBufSize
)
} catch (e: Exception) {
Log.e(LOG_TAG, "${e.message}.")
return false
}
// check that the audioRecord is ready to be used
if (m_audioRecord!!.state != AudioRecord.STATE_INITIALIZED) {
Log.i(
LOG_TAG, "Audio capture is not initialized "
+ m_captureSettings.sampleRate
)
return false
}
m_shutdownCaptureThread = false
Thread(m_captureThread).start()
return true
}
override fun destroyCapturer(): Boolean {
m_captureLock.lock()
// release the object
m_audioRecord?.release()
m_audioRecord = null
m_shutdownCaptureThread = true
m_captureEvent.signal()
m_captureLock.unlock()
return true
}
override fun getEstimatedCaptureDelay(): Int {
return m_estimatedCaptureDelay
}
override fun startCapturer(): Boolean {
// start recording
try {
m_audioRecord!!.startRecording()
} catch (e: IllegalStateException) {
e.printStackTrace()
return false
}
m_captureLock.lock()
m_isCapturing = true
m_captureEvent.signal()
m_captureLock.unlock()
return true
}
override fun stopCapturer(): Boolean {
m_captureLock.lock()
try {
// only stop if we are recording
if (m_audioRecord!!.recordingState == AudioRecord.RECORDSTATE_RECORDING) {
// stop recording
try {
m_audioRecord!!.stop()
} catch (e: IllegalStateException) {
e.printStackTrace()
return false
}
}
} finally {
// Ensure we always unlock
m_isCapturing = false
m_captureLock.unlock()
}
return true
}
private val m_captureThread = Runnable {
val samplesToRec = SAMPLING_RATE / 100
var samplesRead = 0
try {
Process.setThreadPriority(Process.THREAD_PRIORITY_URGENT_AUDIO)
} catch (e: Exception) {
e.printStackTrace()
}
while (!m_shutdownCaptureThread) {
m_captureLock.lock()
samplesRead = try {
if (!m_isCapturing) {
m_captureEvent.await()
continue
} else {
if (m_audioRecord == null) {
continue
}
val lengthInBytes = ((samplesToRec shl 1)
* NUM_CHANNELS_CAPTURING)
val readBytes: Int = m_audioRecord!!.read(
m_tempBufRec, 0,
lengthInBytes
)
m_recBuffer!!.rewind()
m_recBuffer!!.put(m_tempBufRec)
(readBytes shr 1) / NUM_CHANNELS_CAPTURING
}
} catch (e: Exception) {
Log.e(LOG_TAG, "RecordAudio try failed: " + e.message)
continue
} finally {
// Ensure we always unlock
m_captureLock.unlock()
}
audioBus.writeCaptureData(m_recBuffer, samplesRead)
m_estimatedCaptureDelay = samplesRead * 1000 / SAMPLING_RATE
}
}
override fun initRenderer(): Boolean {
// get the minimum buffer size that can be used
val minPlayBufSize: Int = AudioTrack.getMinBufferSize(
m_rendererSettings
.sampleRate,
if (NUM_CHANNELS_RENDERING == 1) AudioFormat.CHANNEL_OUT_MONO else AudioFormat.CHANNEL_OUT_STEREO,
AudioFormat.ENCODING_PCM_16BIT
)
var playBufSize = minPlayBufSize
if (playBufSize < 6000) {
playBufSize *= 2
}
// release the object
if (m_audioTrack != null) {
m_audioTrack!!.release()
m_audioTrack = null
}
try {
m_audioTrack = AudioTrack(
AudioManager.STREAM_VOICE_CALL,
m_rendererSettings.sampleRate,
if (NUM_CHANNELS_RENDERING == 1) AudioFormat.CHANNEL_OUT_MONO else AudioFormat.CHANNEL_OUT_STEREO,
AudioFormat.ENCODING_PCM_16BIT, playBufSize,
AudioTrack.MODE_STREAM
)
} catch (e: Exception) {
Log.e(LOG_TAG, "${e.message}.")
return false
}
// check that the audioRecord is ready to be used
if (m_audioTrack!!.state != AudioTrack.STATE_INITIALIZED) {
Log.i(
LOG_TAG, "Audio renderer not initialized "
+ m_rendererSettings.sampleRate
)
return false
}
m_bufferedPlaySamples = 0
outputMode = OutputMode.SpeakerPhone
m_shutdownRenderThread = false
Thread(m_renderThread).start()
return true
}
override fun destroyRenderer(): Boolean {
m_rendererLock.lock()
// release the object
m_audioTrack!!.release()
m_audioTrack = null
m_shutdownRenderThread = true
m_renderEvent.signal()
m_rendererLock.unlock()
unregisterHeadsetReceiver()
m_audioManager.isSpeakerphoneOn = false
m_audioManager.mode = AudioManager.MODE_NORMAL
return true
}
override fun getEstimatedRenderDelay(): Int {
return m_estimatedRenderDelay
}
override fun startRenderer(): Boolean {
// start playout
try {
m_audioTrack!!.play()
} catch (e: IllegalStateException) {
e.printStackTrace()
return false
}
m_rendererLock.lock()
m_isRendering = true
m_renderEvent.signal()
m_rendererLock.unlock()
return true
}
override fun stopRenderer(): Boolean {
m_rendererLock.lock()
try {
// only stop if we are playing
if (m_audioTrack!!.getPlayState() == AudioTrack.PLAYSTATE_PLAYING) {
// stop playout
try {
m_audioTrack!!.stop()
} catch (e: IllegalStateException) {
e.printStackTrace()
return false
}
// flush the buffers
m_audioTrack!!.flush()
}
} finally {
// Ensure we always unlock, both for success, exception or error
// return.
m_isRendering = false
m_rendererLock.unlock()
}
return true
}
private val m_renderThread = Runnable {
val samplesToPlay = SAMPLING_RATE / 100
try {
Process
.setThreadPriority(Process.THREAD_PRIORITY_URGENT_AUDIO)
} catch (e: Exception) {
e.printStackTrace()
}
while (!m_shutdownRenderThread) {
m_rendererLock.lock()
try {
if (!m_isRendering) {
m_renderEvent.await()
continue
} else {
m_rendererLock.unlock()
// Don't lock on audioBus calls
m_playBuffer!!.clear()
val samplesRead: Int = audioBus.readRenderData(
m_playBuffer, samplesToPlay
)
// Log.d(LOG_TAG, "Samples read: " + samplesRead);
m_rendererLock.lock()
if (!isRendererMuted) {
// After acquiring the lock again
// we must check if we are still playing
if (m_audioTrack == null
|| !m_isRendering
) {
continue
}
val bytesRead = ((samplesRead shl 1)
* NUM_CHANNELS_RENDERING)
m_playBuffer!!.get(m_tempBufPlay, 0, bytesRead)
val bytesWritten: Int = m_audioTrack!!.write(
m_tempBufPlay, 0,
bytesRead
)
// increase by number of written samples
m_bufferedPlaySamples += ((bytesWritten shr 1)
/ NUM_CHANNELS_RENDERING)
// decrease by number of played samples
val pos: Int = m_audioTrack!!.getPlaybackHeadPosition()
if (pos < m_playPosition) {
// wrap or reset by driver
m_playPosition = 0
}
m_bufferedPlaySamples -= pos - m_playPosition
m_playPosition = pos
// we calculate the estimated delay based on the
// buffered samples
m_estimatedRenderDelay = (m_bufferedPlaySamples * 1000
/ SAMPLING_RATE)
}
}
} catch (e: Exception) {
Log.e(LOG_TAG, "Exception: " + e.message)
e.printStackTrace()
} finally {
m_rendererLock.unlock()
}
}
}
override fun getCaptureSettings(): AudioSettings {
return m_captureSettings
}
override fun getRenderSettings(): AudioSettings {
return m_rendererSettings
}
/**
* Communication modes handling
*/
override fun setOutputMode(mode: OutputMode): Boolean {
super.setOutputMode(mode)
if (mode == OutputMode.Handset) {
unregisterHeadsetReceiver()
m_audioManager.isSpeakerphoneOn = false
} else {
m_audioManager.isSpeakerphoneOn = true
registerHeadsetReceiver()
}
return true
}
private val m_headsetReceiver: BroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent) {
if (intent.action!!.compareTo(Intent.ACTION_HEADSET_PLUG) == 0) {
val state: Int = intent.getIntExtra("state", 0)
m_audioManager.isSpeakerphoneOn = state == 0
}
}
}
private var m_receiverRegistered = false
private fun registerHeadsetReceiver() {
if (!m_receiverRegistered) {
val receiverFilter = IntentFilter(
Intent.ACTION_HEADSET_PLUG
)
m_context.registerReceiver(m_headsetReceiver, receiverFilter)
m_receiverRegistered = true
}
}
private fun unregisterHeadsetReceiver() {
if (m_receiverRegistered) {
try {
m_context.unregisterReceiver(m_headsetReceiver)
} catch (e: IllegalArgumentException) {
e.printStackTrace()
}
m_receiverRegistered = false
}
}
override fun onPause() {
if (outputMode == OutputMode.SpeakerPhone) {
unregisterHeadsetReceiver()
}
}
override fun onResume() {
if (outputMode == OutputMode.SpeakerPhone) {
registerHeadsetReceiver()
}
}
fun setRendererMute(isRendererMuted: Boolean) {
this.isRendererMuted = isRendererMuted
}
}

@ -1,4 +1,4 @@
package com.hmg.hmgDr.util package com.hmg.hmgDr.util.opentok
import android.content.Context import android.content.Context
import android.content.res.Resources import android.content.res.Resources

@ -1,4 +1,4 @@
package com.hmg.hmgDr.util package com.hmg.hmgDr.util.opentok
import android.content.Context import android.content.Context
import android.content.res.Resources import android.content.res.Resources

@ -2,9 +2,20 @@ package com.hmg.hmgDr.util
import android.content.Context import android.content.Context
import android.util.DisplayMetrics import android.util.DisplayMetrics
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
import io.flutter.embedding.android.FlutterFragmentActivity
import kotlin.math.ceil
object ViewsUtil { object ViewsUtil {
/* return status bar height on basis of device display metrics */
fun getStatusBarHeight(context: Context): Int {
return ceil(
(25 * context.resources.displayMetrics.density).toDouble()
).toInt()
}
/** /**
* @param context * @param context
* @return the Screen height in DP * @return the Screen height in DP
@ -30,4 +41,18 @@ object ViewsUtil {
displayMetrics.widthPixels.toFloat() displayMetrics.widthPixels.toFloat()
} }
} }
// code to hide soft keyboard
fun hideSoftKeyBoard(context: Context, editBox: EditText?) {
val imm = context.getSystemService(FlutterFragmentActivity.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(editBox?.windowToken, 0)
}
// code to show soft keyboard
private fun showSoftKeyBoard(context: Context, editBox: EditText?) {
val inputMethodManager = context.getSystemService(FlutterFragmentActivity.INPUT_METHOD_SERVICE) as InputMethodManager
editBox?.requestFocus()
inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0)
}
} }

@ -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="M7.41,8.59L12,13.17l4.59,-4.58L18,10l-6,6 -6,-6 1.41,-1.41z"/>
</vector>

@ -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="M7.41,15.41L12,10.83l4.59,4.58L18,14l-6,-6 -6,6z"/>
</vector>

@ -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="M12,9c-1.6,0 -3.15,0.25 -4.6,0.72v3.1c0,0.39 -0.23,0.74 -0.56,0.9 -0.98,0.49 -1.87,1.12 -2.66,1.85 -0.18,0.18 -0.43,0.28 -0.7,0.28 -0.28,0 -0.53,-0.11 -0.71,-0.29L0.29,13.08c-0.18,-0.17 -0.29,-0.42 -0.29,-0.7 0,-0.28 0.11,-0.53 0.29,-0.71C3.34,8.78 7.46,7 12,7s8.66,1.78 11.71,4.67c0.18,0.18 0.29,0.43 0.29,0.71 0,0.28 -0.11,0.53 -0.29,0.71l-2.48,2.48c-0.18,0.18 -0.43,0.29 -0.71,0.29 -0.27,0 -0.52,-0.11 -0.7,-0.28 -0.79,-0.74 -1.69,-1.36 -2.67,-1.85 -0.33,-0.16 -0.56,-0.5 -0.56,-0.9v-3.1C15.15,9.25 13.6,9 12,9z"/>
</vector>

@ -33,15 +33,15 @@
android:background="@drawable/shape_capsule" android:background="@drawable/shape_capsule"
android:padding="@dimen/padding_space_small"> android:padding="@dimen/padding_space_small">
<Chronometer <TextView
android:id="@+id/cmTimer" android:id="@+id/tv_timer"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="4dp" android:padding="4dp"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="16sp" android:textSize="@dimen/text_size_medium"
android:textStyle="bold" android:textStyle="bold"
tools:text="25:45" /> android:text="00:00" />
</FrameLayout> </FrameLayout>

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:padding="16dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fadeScrollbars="false"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/ask_for_error_log"
android:textColor="#212121"
android:textSize="18sp"/>
<Button
android:id="@+id/button_view_error_log"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="View Error Log"
android:textColor="#212121"/>
<Button
android:id="@+id/button_copy_error_log"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="Copy Error Log"
android:textColor="#212121"/>
<Button
android:id="@+id/button_share_error_log"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="Share Error Log"
android:textColor="#212121"/>
<Button
android:id="@+id/button_email_error_log"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="Email Error Log"
android:textColor="#212121"/>
<Button
android:id="@+id/button_save_error_log"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="Save Error Log"
android:textColor="#212121"/>
<Button
android:id="@+id/button_close_app"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Close App"
android:textColor="#212121"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:layout_width="match_parent"
android:layout_height="88dp"
android:background="@android:color/holo_blue_dark"
android:orientation="vertical"
android:padding="@dimen/padding_space_medium">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_icon"
android:layout_width="22dp"
android:layout_height="22dp"
android:src="@mipmap/ic_launcher" />
<TextView
style="@style/TextAppearance.Compat.Notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="@dimen/padding_space_small"
android:paddingEnd="@dimen/padding_space_small"
android:text="HMG Doctor"
android:textColor="@color/white"
android:textSize="@dimen/text_size_small" />
<Chronometer
android:id="@+id/notify_timer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/TextAppearance.Compat.Notification"
android:paddingStart="@dimen/padding_space_small"
android:paddingEnd="@dimen/padding_space_small"
android:textColor="@color/white"
android:textSize="@dimen/text_size_small"
android:format="MM:SS"
tools:text="25:45" />
<ImageView
android:id="@+id/iv_Arrow"
android:layout_width="22dp"
android:layout_height="22dp"
android:src="@drawable/ic_arrow_bottom" />
</LinearLayout>
<TextView
android:id="@+id/notify_title"
style="@style/TextAppearance.Compat.Notification.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/padding_space_medium"
android:paddingStart="@dimen/padding_space_small"
android:paddingEnd="@dimen/padding_space_small"
android:textColor="@color/white"
android:textSize="@dimen/text_size_small"
android:textStyle="bold"
tools:text="Mosa zaid mosa abuzaid" />
<TextView
android:id="@+id/notify_content"
style="@style/TextAppearance.Compat.Notification.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/padding_space_small"
android:paddingEnd="@dimen/padding_space_small"
android:textColor="@color/white"
android:textSize="@dimen/text_size_small"
android:text="Tap to return to call" />
</LinearLayout>

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/holo_blue_dark"
android:orientation="vertical"
android:padding="@dimen/padding_space_medium">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_icon"
android:layout_width="22dp"
android:layout_height="22dp"
android:src="@mipmap/ic_launcher" />
<TextView
style="@style/TextAppearance.Compat.Notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="@dimen/padding_space_small"
android:paddingEnd="@dimen/padding_space_small"
android:text="HMG Doctor"
android:textColor="@color/white"
android:textSize="@dimen/text_size_small" />
<Chronometer
android:id="@+id/notify_timer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/TextAppearance.Compat.Notification"
android:paddingStart="@dimen/padding_space_small"
android:paddingEnd="@dimen/padding_space_small"
android:textColor="@color/white"
android:textSize="@dimen/text_size_small"
android:format="MM:SS"
tools:text="25:45" />
<ImageView
android:id="@+id/iv_Arrow"
android:layout_width="22dp"
android:layout_height="22dp"
android:src="@drawable/ic_arrow_top" />
</LinearLayout>
<TextView
android:id="@+id/notify_title"
style="@style/TextAppearance.Compat.Notification.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/padding_space_big"
android:paddingStart="@dimen/padding_space_small"
android:paddingEnd="@dimen/padding_space_small"
android:textColor="@color/white"
android:textSize="@dimen/text_size_medium"
android:textStyle="bold"
tools:text="Mosa zaid mosa abuzaid" />
<TextView
android:id="@+id/notify_content"
style="@style/TextAppearance.Compat.Notification.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/padding_space_small"
android:paddingEnd="@dimen/padding_space_small"
android:textColor="@color/white"
android:textSize="@dimen/text_size_medium"
android:text="Tap to return to call" />
<TextView
android:id="@+id/btn_end"
style="@style/TextAppearance.Compat.Notification.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/padding_space_medium"
android:layout_marginBottom="@dimen/padding_space_medium"
android:paddingStart="@dimen/padding_space_small"
android:paddingEnd="@dimen/padding_space_small"
android:textColor="@color/white"
android:textSize="@dimen/text_size_medium"
android:textStyle="bold"
android:text="End call" />
</LinearLayout>

@ -4,7 +4,6 @@
<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="ask_for_error_log">An unexpected error has occurred.\nHelp developers by providing error details.\nThank you for your support.</string>
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources> </resources>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> <style name="LaunchTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Show a splash screen on the activity. Automatically removed when <!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame --> Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item> <item name="android:windowBackground">@drawable/launch_background</item>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path name="external_files" path="."/>
</paths>

@ -0,0 +1 @@
include ':app'

@ -26,7 +26,8 @@ class BaseAppClient {
Function(dynamic response, int statusCode) onSuccess, Function(dynamic response, int statusCode) onSuccess,
Function(String error, int statusCode) onFailure, Function(String error, int statusCode) onFailure,
bool isAllowAny = false, bool isAllowAny = false,
bool isLiveCare = false}) async { bool isLiveCare = false,
bool isFallLanguage=false}) async {
String url; String url;
if (isLiveCare) if (isLiveCare)
url = BASE_URL_LIVE_CARE + endPoint; url = BASE_URL_LIVE_CARE + endPoint;
@ -58,13 +59,14 @@ class BaseAppClient {
body['TokenID'] = token ?? ''; body['TokenID'] = token ?? '';
} }
// body['TokenID'] = "@dm!n" ?? ''; // body['TokenID'] = "@dm!n" ?? '';
String lang = await sharedPref.getString(APP_Language); if(!isFallLanguage) {
if (lang != null && lang == 'ar') String lang = await sharedPref.getString(APP_Language);
body['LanguageID'] = 1; if (lang != null && lang == 'ar')
else body['LanguageID'] = 1;
body['LanguageID'] = 2; else
body['LanguageID'] = 2;
body['stamp'] = STAMP; }
body['stamp'] = DateTime.now().toIso8601String();
// if(!body.containsKey("IPAdress")) // if(!body.containsKey("IPAdress"))
body['IPAdress'] = IP_ADDRESS; body['IPAdress'] = IP_ADDRESS;
body['VersionID'] = VERSION_ID; body['VersionID'] = VERSION_ID;

@ -125,6 +125,8 @@ const GET_Patient_LAB_SPECIAL_RESULT = 'Services/Patients.svc/REST/GetPatientLab
const SEND_LAB_RESULT_EMAIL = 'Services/Notifications.svc/REST/SendLabReportEmail'; const SEND_LAB_RESULT_EMAIL = 'Services/Notifications.svc/REST/SendLabReportEmail';
const GET_Patient_LAB_RESULT = 'Services/Patients.svc/REST/GetPatientLabResults'; const GET_Patient_LAB_RESULT = 'Services/Patients.svc/REST/GetPatientLabResults';
const GET_Patient_LAB_ORDERS_RESULT = 'Services/Patients.svc/REST/GetPatientLabOrdersResults'; const GET_Patient_LAB_ORDERS_RESULT = 'Services/Patients.svc/REST/GetPatientLabOrdersResults';
const GET_PATIENT_LAB_ORDERS_RESULT_HISTORY_BY_DESCRIPTION =
'Services/Patients.svc/REST/GetPatientLabOrdersResultsHistoryByDescription';
// SOAP // SOAP
@ -132,6 +134,7 @@ const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies';
const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList';
const POST_EPISODE = 'Services/DoctorApplication.svc/REST/PostEpisode'; const POST_EPISODE = 'Services/DoctorApplication.svc/REST/PostEpisode';
const POST_EPISODE_FOR_IN_PATIENT = 'Services/DoctorApplication.svc/REST/PostEpisodeForInpatient';
const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies';
const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory';
@ -234,6 +237,11 @@ const UPDATE_MEDICAL_REPORT = "Services/Patients.svc/REST/DAPP_UpdateMedicalRepo
const GET_SICK_LEAVE_DOCTOR_APP = "Services/DoctorApplication.svc/REST/GetAllSickLeaves"; const GET_SICK_LEAVE_DOCTOR_APP = "Services/DoctorApplication.svc/REST/GetAllSickLeaves";
const ADD_PATIENT_TO_DOCTOR = "LiveCareApi/DoctorApp/AssignPatientToDoctor"; const ADD_PATIENT_TO_DOCTOR = "LiveCareApi/DoctorApp/AssignPatientToDoctor";
const REMOVE_PATIENT_FROM_DOCTOR = "LiveCareApi/DoctorApp/BackPatientToQueue"; const REMOVE_PATIENT_FROM_DOCTOR = "LiveCareApi/DoctorApp/BackPatientToQueue";
const CREATE_DOCTOR_RESPONSE = "Services/DoctorApplication.svc/REST/CreateDoctorResponse";
const GET_DOCTOR_NOT_REPLIED_COUNTS = "Services/DoctorApplication.svc/REST/DoctorApp_GetDoctorNotRepliedCounts";
const ALL_SPECIAL_LAB_RESULT = "services/Patients.svc/REST/GetPatientLabSpecialResultsALL";
const GET_MEDICATION_FOR_IN_PATIENT = "Services/DoctorApplication.svc/REST/Doctor_GetMedicationForInpatient";
const GET_EPISODE_FOR_INPATIENT = "/Services/DoctorApplication.svc/REST/DoctorApp_GetEpisodeForInpatient";
var selectedPatientType = 1; var selectedPatientType = 1;
@ -279,14 +287,13 @@ var SERVICES_PATIANT_HEADER_AR = [
"المريض الواصل" "المريض الواصل"
]; ];
var DEVICE_TOKEN = "";
const PRIMARY_COLOR = 0xff515B5D; const PRIMARY_COLOR = 0xff515B5D;
const TRANSACTION_NO = 0; const TRANSACTION_NO = 0;
const LANGUAGE_ID = 2; const LANGUAGE_ID = 2;
const STAMP = '2020-04-27T12:17:17.721Z'; const STAMP = '2020-04-27T12:17:17.721Z';
const IP_ADDRESS = '9.9.9.9'; const IP_ADDRESS = '9.9.9.9';
const VERSION_ID = 6.2; const VERSION_ID = 6.4;
const CHANNEL = 9; const CHANNEL = 9;
const SESSION_ID = 'BlUSkYymTt'; const SESSION_ID = 'BlUSkYymTt';
const IS_LOGIN_FOR_DOCTOR_APP = true; const IS_LOGIN_FOR_DOCTOR_APP = true;
@ -298,6 +305,8 @@ const GENERAL_ID = 'Cs2020@2016\$2958';
const PATIENT_TYPE = 1; const PATIENT_TYPE = 1;
const PATIENT_TYPE_ID = 1; const PATIENT_TYPE_ID = 1;
const Color IN_PROGRESS_COLOR = Color(0xFFCC9B14);
/// Timer Info /// Timer Info
const TIMER_MIN = 10; const TIMER_MIN = 10;

File diff suppressed because it is too large Load Diff

@ -1,16 +1,16 @@
final TOKEN = 'token'; const TOKEN = 'token';
final PROJECT_ID = 'projectID'; const PROJECT_ID = 'projectID';
final VIDA_AUTH_TOKEN_ID = 'VidaAuthTokenID'; const VIDA_AUTH_TOKEN_ID = 'VidaAuthTokenID';
final VIDA_REFRESH_TOKEN_ID = 'VidaRefreshTokenID'; const VIDA_REFRESH_TOKEN_ID = 'VidaRefreshTokenID';
final LOGIN_TOKEN_ID = 'LogInToken'; const LOGIN_TOKEN_ID = 'LogInToken';
final DOCTOR_ID = 'doctorID'; const DOCTOR_ID = 'doctorID';
final SLECTED_PATIENT_TYPE = 'slectedPatientType'; const SLECTED_PATIENT_TYPE = 'slectedPatientType';
final APP_Language = 'language'; const APP_Language = 'language';
final DOCTOR_PROFILE = 'doctorProfile'; const DOCTOR_PROFILE = 'doctorProfile';
final LIVE_CARE_PATIENT = 'livecare-patient-profile'; const LIVE_CARE_PATIENT = 'livecare-patient-profile';
final LOGGED_IN_USER = 'loggedUser'; const LOGGED_IN_USER = 'loggedUser';
final DASHBOARD_DATA = 'dashboard-data'; const EMPLOYEE_ID = 'EmployeeID';
final OTP_TYPE = 'otp-type'; const DASHBOARD_DATA = 'dashboard-data';
final LAST_LOGIN_USER = 'last-login-user'; const OTP_TYPE = 'otp-type';
final PASSWORD = 'password'; const LAST_LOGIN_USER = 'last-login-user';
final CLINIC_NAME = 'clinic-name'; const CLINIC_NAME = 'clinic-name';

@ -17,15 +17,31 @@ class SizeConfig {
static bool isPortrait = true; static bool isPortrait = true;
static bool isMobilePortrait = false; static bool isMobilePortrait = false;
static bool isMobile = false; static bool isMobile = false;
static bool isHeightShort = false;
static bool isHeightVeryShort = false;
static bool isHeightMiddle = false;
static bool isHeightLarge = false;
static bool isWidthLarge = false;
void init(BoxConstraints constraints, Orientation orientation) { void init(BoxConstraints constraints, Orientation orientation) {
realScreenHeight = constraints.maxHeight; realScreenHeight = constraints.maxHeight;
realScreenWidth = constraints.maxWidth; realScreenWidth = constraints.maxWidth;
if (constraints.maxWidth <= MAX_SMALL_SCREEN) { if (constraints.maxWidth <= MAX_SMALL_SCREEN) {
isMobile = true; isMobile = true;
} }
if (constraints.maxHeight < 600) {
isHeightVeryShort = true;
} else if (constraints.maxHeight < 800) {
isHeightShort = true;
} else if (constraints.maxHeight < 1000) {
isHeightMiddle = true;
} else {
isHeightLarge = true;
}
if (constraints.maxWidth > 600) {
isWidthLarge = true;
}
if (orientation == Orientation.portrait) { if (orientation == Orientation.portrait) {
isPortrait = true; isPortrait = true;
if (realScreenWidth < 450) { if (realScreenWidth < 450) {
@ -59,5 +75,32 @@ class SizeConfig {
print('widthMultiplier $widthMultiplier'); print('widthMultiplier $widthMultiplier');
print('isPortrait $isPortrait'); print('isPortrait $isPortrait');
print('isMobilePortrait $isMobilePortrait'); print('isMobilePortrait $isMobilePortrait');
} }
static getTextMultiplierBasedOnWidth({double width}) {
// TODO handel LandScape case
if (width != null) {
return width / 100;
}
return widthMultiplier;
}
static getWidthMultiplier({double width}) {
// TODO handel LandScape case
if (width != null) {
return width / 100;
}
return widthMultiplier;
}
static getHeightMultiplier({double height}) {
// TODO handel LandScape case
if (height != null) {
return height / 100;
}
return heightMultiplier;
}
} }

@ -0,0 +1,157 @@
class GetMedicationForInPatientModel {
String setupID;
int projectID;
int admissionNo;
int patientID;
int orderNo;
int prescriptionNo;
int lineItemNo;
String prescriptionDatetime;
int itemID;
int directionID;
int refillID;
String dose;
int unitofMeasurement;
String startDatetime;
String stopDatetime;
int noOfDoses;
int routeId;
String comments;
int reviewedPharmacist;
dynamic reviewedPharmacistDatetime;
dynamic discountinueDatetime;
dynamic rescheduleDatetime;
int status;
String statusDescription;
int createdBy;
String createdOn;
dynamic editedBy;
dynamic editedOn;
dynamic strength;
String pHRItemDescription;
String pHRItemDescriptionN;
String doctorName;
String uomDescription;
String routeDescription;
String directionDescription;
String refillDescription;
GetMedicationForInPatientModel(
{this.setupID,
this.projectID,
this.admissionNo,
this.patientID,
this.orderNo,
this.prescriptionNo,
this.lineItemNo,
this.prescriptionDatetime,
this.itemID,
this.directionID,
this.refillID,
this.dose,
this.unitofMeasurement,
this.startDatetime,
this.stopDatetime,
this.noOfDoses,
this.routeId,
this.comments,
this.reviewedPharmacist,
this.reviewedPharmacistDatetime,
this.discountinueDatetime,
this.rescheduleDatetime,
this.status,
this.statusDescription,
this.createdBy,
this.createdOn,
this.editedBy,
this.editedOn,
this.strength,
this.pHRItemDescription,
this.pHRItemDescriptionN,
this.doctorName,
this.uomDescription,
this.routeDescription,
this.directionDescription,
this.refillDescription});
GetMedicationForInPatientModel.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID'];
projectID = json['ProjectID'];
doctorName = json['DoctorName'];
refillDescription = json['RefillDescription'];
directionDescription = json['DirectionDescription'];
routeDescription = json['RouteDescription'];
uomDescription = json['UOMDescription'];
admissionNo = json['AdmissionNo'];
patientID = json['PatientID'];
orderNo = json['OrderNo'];
prescriptionNo = json['PrescriptionNo'];
lineItemNo = json['LineItemNo'];
prescriptionDatetime = json['PrescriptionDatetime'];
itemID = json['ItemID'];
directionID = json['DirectionID'];
refillID = json['RefillID'];
dose = json['Dose'];
unitofMeasurement = json['UnitofMeasurement'];
startDatetime = json['StartDatetime'];
stopDatetime = json['StopDatetime'];
noOfDoses = json['NoOfDoses'];
routeId = json['RouteId'];
comments = json['Comments'];
reviewedPharmacist = json['ReviewedPharmacist'];
reviewedPharmacistDatetime = json['ReviewedPharmacistDatetime'];
discountinueDatetime = json['DiscountinueDatetime'];
rescheduleDatetime = json['RescheduleDatetime'];
status = json['Status'];
statusDescription = json['StatusDescription'];
createdBy = json['CreatedBy'];
createdOn = json['CreatedOn'];
editedBy = json['EditedBy'];
editedOn = json['EditedOn'];
strength = json['Strength'];
pHRItemDescription = json['PHRItemDescription'];
pHRItemDescriptionN = json['PHRItemDescriptionN'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['SetupID'] = this.setupID;
data['DoctorName'] = this.doctorName;
data['RefillDescription'] = this.refillDescription;
data['RouteDescription'] = this.routeDescription;
data['DirectionDescription'] = this.directionDescription;
data['UOMDescription'] = this.uomDescription;
data['ProjectID'] = this.projectID;
data['AdmissionNo'] = this.admissionNo;
data['PatientID'] = this.patientID;
data['OrderNo'] = this.orderNo;
data['PrescriptionNo'] = this.prescriptionNo;
data['LineItemNo'] = this.lineItemNo;
data['PrescriptionDatetime'] = this.prescriptionDatetime;
data['ItemID'] = this.itemID;
data['DirectionID'] = this.directionID;
data['RefillID'] = this.refillID;
data['Dose'] = this.dose;
data['UnitofMeasurement'] = this.unitofMeasurement;
data['StartDatetime'] = this.startDatetime;
data['StopDatetime'] = this.stopDatetime;
data['NoOfDoses'] = this.noOfDoses;
data['RouteId'] = this.routeId;
data['Comments'] = this.comments;
data['ReviewedPharmacist'] = this.reviewedPharmacist;
data['ReviewedPharmacistDatetime'] = this.reviewedPharmacistDatetime;
data['DiscountinueDatetime'] = this.discountinueDatetime;
data['RescheduleDatetime'] = this.rescheduleDatetime;
data['Status'] = this.status;
data['StatusDescription'] = this.statusDescription;
data['CreatedBy'] = this.createdBy;
data['CreatedOn'] = this.createdOn;
data['EditedBy'] = this.editedBy;
data['EditedOn'] = this.editedOn;
data['Strength'] = this.strength;
data['PHRItemDescription'] = this.pHRItemDescription;
data['PHRItemDescriptionN'] = this.pHRItemDescriptionN;
return data;
}
}

@ -0,0 +1,60 @@
class GetMedicationForInPatientRequestModel {
bool isDentalAllowedBackend;
double versionID;
int channel;
int languageID;
String iPAdress;
String generalid;
int deviceTypeID;
String tokenID;
int patientID;
int admissionNo;
String sessionID;
int projectID;
GetMedicationForInPatientRequestModel(
{this.isDentalAllowedBackend,
this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.deviceTypeID,
this.tokenID,
this.patientID,
this.admissionNo,
this.sessionID,
this.projectID});
GetMedicationForInPatientRequestModel.fromJson(Map<String, dynamic> json) {
isDentalAllowedBackend = json['isDentalAllowedBackend'];
versionID = json['VersionID'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
deviceTypeID = json['DeviceTypeID'];
tokenID = json['TokenID'];
patientID = json['PatientID'];
admissionNo = json['AdmissionNo'];
sessionID = json['SessionID'];
projectID = json['ProjectID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['generalid'] = this.generalid;
data['DeviceTypeID'] = this.deviceTypeID;
data['TokenID'] = this.tokenID;
data['PatientID'] = this.patientID;
data['AdmissionNo'] = this.admissionNo;
data['SessionID'] = this.sessionID;
data['ProjectID'] = this.projectID;
return data;
}
}

@ -1,13 +1,13 @@
class PrescriptionReport { class PrescriptionReport {
String address; String address;
int appointmentNo; dynamic appodynamicmentNo;
String clinic; String clinic;
String companyName; String companyName;
int days; dynamic days;
String doctorName; String doctorName;
var doseDailyQuantity; var doseDailyQuantity;
String frequency; String frequency;
int frequencyNumber; dynamic frequencyNumber;
String image; String image;
String imageExtension; String imageExtension;
String imageSRCUrl; String imageSRCUrl;
@ -15,30 +15,30 @@ class PrescriptionReport {
String imageThumbUrl; String imageThumbUrl;
String isCovered; String isCovered;
String itemDescription; String itemDescription;
int itemID; dynamic itemID;
String orderDate; String orderDate;
int patientID; dynamic patientID;
String patientName; String patientName;
String phoneOffice1; String phoneOffice1;
String prescriptionQR; String prescriptionQR;
int prescriptionTimes; dynamic prescriptionTimes;
String productImage; String productImage;
String productImageBase64; String productImageBase64;
String productImageString; String productImageString;
int projectID; dynamic projectID;
String projectName; String projectName;
String remarks; String remarks;
String route; String route;
String sKU; String sKU;
int scaleOffset; dynamic scaleOffset;
String startDate; String startDate;
String patientAge; String patientAge;
String patientGender; String patientGender;
String phoneOffice; String phoneOffice;
int doseTimingID; dynamic doseTimingID;
int frequencyID; dynamic frequencyID;
int routeID; dynamic routeID;
String name; String name;
String itemDescriptionN; String itemDescriptionN;
String routeN; String routeN;
@ -46,7 +46,7 @@ class PrescriptionReport {
PrescriptionReport({ PrescriptionReport({
this.address, this.address,
this.appointmentNo, this.appodynamicmentNo,
this.clinic, this.clinic,
this.companyName, this.companyName,
this.days, this.days,
@ -92,7 +92,7 @@ class PrescriptionReport {
PrescriptionReport.fromJson(Map<String, dynamic> json) { PrescriptionReport.fromJson(Map<String, dynamic> json) {
address = json['Address']; address = json['Address'];
appointmentNo = json['AppointmentNo']; appodynamicmentNo = json['AppodynamicmentNo'];
clinic = json['Clinic']; clinic = json['Clinic'];
companyName = json['CompanyName']; companyName = json['CompanyName'];
days = json['Days']; days = json['Days'];
@ -141,7 +141,7 @@ class PrescriptionReport {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['Address'] = this.address; data['Address'] = this.address;
data['AppointmentNo'] = this.appointmentNo; data['AppodynamicmentNo'] = this.appodynamicmentNo;
data['Clinic'] = this.clinic; data['Clinic'] = this.clinic;
data['CompanyName'] = this.companyName; data['CompanyName'] = this.companyName;
data['Days'] = this.days; data['Days'] = this.days;

@ -1,41 +1,41 @@
class PrescriptionReportEnh { class PrescriptionReportEnh {
String address; String address;
int appointmentNo; dynamic appodynamicmentNo;
String clinic; String clinic;
Null companyName; dynamic companyName;
int days; dynamic days;
String doctorName; String doctorName;
int doseDailyQuantity; dynamic doseDailyQuantity;
String frequency; String frequency;
int frequencyNumber; dynamic frequencyNumber;
Null image; dynamic image;
Null imageExtension; dynamic imageExtension;
String imageSRCUrl; String imageSRCUrl;
Null imageString; dynamic imageString;
String imageThumbUrl; String imageThumbUrl;
String isCovered; String isCovered;
String itemDescription; String itemDescription;
int itemID; dynamic itemID;
String orderDate; String orderDate;
int patientID; dynamic patientID;
String patientName; String patientName;
String phoneOffice1; String phoneOffice1;
Null prescriptionQR; dynamic prescriptionQR;
int prescriptionTimes; dynamic prescriptionTimes;
Null productImage; dynamic productImage;
Null productImageBase64; dynamic productImageBase64;
String productImageString; String productImageString;
int projectID; dynamic projectID;
String projectName; String projectName;
String remarks; String remarks;
String route; String route;
String sKU; String sKU;
int scaleOffset; dynamic scaleOffset;
String startDate; String startDate;
PrescriptionReportEnh( PrescriptionReportEnh(
{this.address, {this.address,
this.appointmentNo, this.appodynamicmentNo,
this.clinic, this.clinic,
this.companyName, this.companyName,
this.days, this.days,
@ -70,7 +70,7 @@ class PrescriptionReportEnh {
PrescriptionReportEnh.fromJson(Map<String, dynamic> json) { PrescriptionReportEnh.fromJson(Map<String, dynamic> json) {
address = json['Address']; address = json['Address'];
appointmentNo = json['AppointmentNo']; appodynamicmentNo = json['AppodynamicmentNo'];
clinic = json['Clinic']; clinic = json['Clinic'];
companyName = json['CompanyName']; companyName = json['CompanyName'];
days = json['Days']; days = json['Days'];
@ -107,7 +107,7 @@ class PrescriptionReportEnh {
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['Address'] = this.address; data['Address'] = this.address;
data['AppointmentNo'] = this.appointmentNo; data['AppodynamicmentNo'] = this.appodynamicmentNo;
data['Clinic'] = this.clinic; data['Clinic'] = this.clinic;
data['CompanyName'] = this.companyName; data['CompanyName'] = this.companyName;
data['Days'] = this.days; data['Days'] = this.days;

@ -1,51 +1,43 @@
class ActivationCodeModel { class ActivationCodeModel {
String mobileNumber;
String zipCode;
int channel; int channel;
int languageID; int languageID;
int loginDoctorID;
double versionID; double versionID;
int memberID; int memberID;
String password;
int facilityId; int facilityId;
String generalid; String generalid;
String otpSendType; String otpSendType;
ActivationCodeModel( ActivationCodeModel(
{this.mobileNumber, {this.channel,
this.zipCode,
this.channel,
this.languageID, this.languageID,
this.versionID, this.versionID,
this.memberID, this.memberID,
this.password,
this.facilityId, this.facilityId,
this.otpSendType, this.otpSendType,
this.generalid}); this.generalid,this.loginDoctorID});
ActivationCodeModel.fromJson(Map<String, dynamic> json) { ActivationCodeModel.fromJson(Map<String, dynamic> json) {
mobileNumber = json['MobileNumber'];
zipCode = json['ZipCode'];
channel = json['Channel']; channel = json['Channel'];
languageID = json['LanguageID']; languageID = json['LanguageID'];
versionID = json['VersionID']; versionID = json['VersionID'];
memberID = json['MemberID']; memberID = json['MemberID'];
password = json['Password'];
facilityId = json['facilityId']; facilityId = json['facilityId'];
otpSendType = json['OTP_SendType']; otpSendType = json['OTP_SendType'];
generalid = json['generalid']; generalid = json['generalid'];
loginDoctorID = json['LoginDoctorID'];
} }
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['MobileNumber'] = this.mobileNumber;
data['ZipCode'] = this.zipCode;
data['Channel'] = this.channel; data['Channel'] = this.channel;
data['LanguageID'] = this.languageID; data['LanguageID'] = this.languageID;
data['VersionID'] = this.versionID; data['VersionID'] = this.versionID;
data['MemberID'] = this.memberID; data['MemberID'] = this.memberID;
data['Password'] = this.password;
data['facilityId'] = this.facilityId; data['facilityId'] = this.facilityId;
data['OTP_SendType'] = otpSendType; data['OTP_SendType'] = otpSendType;
data['generalid'] = this.generalid; data['generalid'] = this.generalid;
data['LoginDoctorID'] = this.loginDoctorID;
return data; return data;
} }
} }

@ -3,6 +3,7 @@ class ActivationCodeForVerificationScreenModel {
String mobileNumber; String mobileNumber;
String zipCode; String zipCode;
int channel; int channel;
int loginDoctorID;
int languageID; int languageID;
double versionID; double versionID;
int memberID; int memberID;
@ -25,7 +26,7 @@ class ActivationCodeForVerificationScreenModel {
this.isMobileFingerPrint, this.isMobileFingerPrint,
this.vidaAuthTokenID, this.vidaAuthTokenID,
this.vidaRefreshTokenID, this.vidaRefreshTokenID,
this.iMEI}); this.iMEI,this.loginDoctorID});
ActivationCodeForVerificationScreenModel.fromJson(Map<String, dynamic> json) { ActivationCodeForVerificationScreenModel.fromJson(Map<String, dynamic> json) {
oTPSendType = json['OTP_SendType']; oTPSendType = json['OTP_SendType'];
@ -41,6 +42,7 @@ class ActivationCodeForVerificationScreenModel {
vidaAuthTokenID = json['VidaAuthTokenID']; vidaAuthTokenID = json['VidaAuthTokenID'];
vidaRefreshTokenID = json['VidaRefreshTokenID']; vidaRefreshTokenID = json['VidaRefreshTokenID'];
iMEI = json['IMEI']; iMEI = json['IMEI'];
loginDoctorID = json['LoginDoctorID'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -55,9 +57,8 @@ class ActivationCodeForVerificationScreenModel {
data['facilityId'] = this.facilityId; data['facilityId'] = this.facilityId;
data['generalid'] = this.generalid; data['generalid'] = this.generalid;
data['IsMobileFingerPrint'] = this.isMobileFingerPrint; data['IsMobileFingerPrint'] = this.isMobileFingerPrint;
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['VidaRefreshTokenID'] = this.vidaRefreshTokenID;
data['IMEI'] = this.iMEI; data['IMEI'] = this.iMEI;
data['LoginDoctorID'] = this.loginDoctorID;
return data; return data;
} }
} }

@ -5,11 +5,16 @@ class CheckActivationCodeForDoctorAppResponseModel {
List<ListDoctorsClinic> listDoctorsClinic; List<ListDoctorsClinic> listDoctorsClinic;
List<DoctorProfileModel> listDoctorProfile; List<DoctorProfileModel> listDoctorProfile;
MemberInformation memberInformation; MemberInformation memberInformation;
String vidaAuthTokenID;
String vidaRefreshTokenID;
CheckActivationCodeForDoctorAppResponseModel( CheckActivationCodeForDoctorAppResponseModel(
{this.authenticationTokenID, {this.authenticationTokenID,
this.listDoctorsClinic, this.listDoctorsClinic,
this.memberInformation}); this.memberInformation,
this.listDoctorProfile,
this.vidaAuthTokenID,
this.vidaRefreshTokenID});
CheckActivationCodeForDoctorAppResponseModel.fromJson( CheckActivationCodeForDoctorAppResponseModel.fromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) {
@ -27,6 +32,8 @@ class CheckActivationCodeForDoctorAppResponseModel {
listDoctorProfile.add(new DoctorProfileModel.fromJson(v)); listDoctorProfile.add(new DoctorProfileModel.fromJson(v));
}); });
} }
vidaAuthTokenID = json['VidaAuthTokenID'];
vidaRefreshTokenID = json['VidaRefreshTokenID'];
memberInformation = json['memberInformation'] != null memberInformation = json['memberInformation'] != null
? new MemberInformation.fromJson(json['memberInformation']) ? new MemberInformation.fromJson(json['memberInformation'])
@ -60,12 +67,13 @@ class ListDoctorsClinic {
bool isActive; bool isActive;
String clinicName; String clinicName;
ListDoctorsClinic({this.setupID, ListDoctorsClinic(
this.projectID, {this.setupID,
this.doctorID, this.projectID,
this.clinicID, this.doctorID,
this.isActive, this.clinicID,
this.clinicName}); this.isActive,
this.clinicName});
ListDoctorsClinic.fromJson(Map<String, dynamic> json) { ListDoctorsClinic.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID']; setupID = json['SetupID'];
@ -99,15 +107,16 @@ class MemberInformation {
String preferredLanguage; String preferredLanguage;
List<Roles> roles; List<Roles> roles;
MemberInformation({this.clinics, MemberInformation(
this.doctorId, {this.clinics,
this.email, this.doctorId,
this.employeeId, this.email,
this.memberId, this.employeeId,
this.memberName, this.memberId,
this.memberNameArabic, this.memberName,
this.preferredLanguage, this.memberNameArabic,
this.roles}); this.preferredLanguage,
this.roles});
MemberInformation.fromJson(Map<String, dynamic> json) { MemberInformation.fromJson(Map<String, dynamic> json) {
if (json['clinics'] != null) { if (json['clinics'] != null) {

@ -2,6 +2,10 @@ class CheckActivationCodeRequestModel {
String mobileNumber; String mobileNumber;
String zipCode; String zipCode;
int doctorID; int doctorID;
int memberID;
int loginDoctorID;
String password;
String facilityId;
String iPAdress; String iPAdress;
int channel; int channel;
int languageID; int languageID;
@ -12,6 +16,8 @@ class CheckActivationCodeRequestModel {
String activationCode; String activationCode;
String vidaAuthTokenID; String vidaAuthTokenID;
String vidaRefreshTokenID; String vidaRefreshTokenID;
String iMEI;
bool isForSilentLogin;
int oTPSendType; int oTPSendType;
CheckActivationCodeRequestModel( CheckActivationCodeRequestModel(
{this.mobileNumber, {this.mobileNumber,
@ -27,7 +33,7 @@ class CheckActivationCodeRequestModel {
this.activationCode, this.activationCode,
this.vidaAuthTokenID, this.vidaAuthTokenID,
this.vidaRefreshTokenID, this.vidaRefreshTokenID,
this.oTPSendType}); this.oTPSendType,this.password,this.facilityId,this.memberID,this.isForSilentLogin=false,this.iMEI,this.loginDoctorID});
CheckActivationCodeRequestModel.fromJson(Map<String, dynamic> json) { CheckActivationCodeRequestModel.fromJson(Map<String, dynamic> json) {
mobileNumber = json['MobileNumber']; mobileNumber = json['MobileNumber'];
@ -44,6 +50,7 @@ class CheckActivationCodeRequestModel {
vidaAuthTokenID = json['VidaAuthTokenID']; vidaAuthTokenID = json['VidaAuthTokenID'];
vidaRefreshTokenID = json['VidaRefreshTokenID']; vidaRefreshTokenID = json['VidaRefreshTokenID'];
oTPSendType = json['OTP_SendType']; oTPSendType = json['OTP_SendType'];
loginDoctorID = json['LoginDoctorID'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -62,6 +69,12 @@ class CheckActivationCodeRequestModel {
data['VidaAuthTokenID'] = this.vidaAuthTokenID; data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; data['VidaRefreshTokenID'] = this.vidaRefreshTokenID;
data['OTP_SendType'] = this.oTPSendType; data['OTP_SendType'] = this.oTPSendType;
data['facilityId'] = this.facilityId;
data['MemberID'] = this.memberID;
data['Password'] = this.password;
data['IMEI'] = this.iMEI;
data['IsForSilentLogin'] = this.isForSilentLogin;
data['LoginDoctorID'] = this.loginDoctorID;
return data; return data;
} }
} }

@ -0,0 +1,108 @@
class LabResultHistory {
String description;
String femaleInterpretativeData;
int gender;
bool isCertificateAllowed;
int lineItemNo;
String maleInterpretativeData;
String notes;
int orderLineItemNo;
int orderNo;
String packageID;
int patientID;
String projectID;
String referanceRange;
String resultValue;
int resultValueBasedLineItemNo;
String resultValueFlag;
String sampleCollectedOn;
String sampleReceivedOn;
String setupID;
String superVerifiedOn;
String testCode;
String uOM;
String verifiedOn;
String verifiedOnDateTime;
LabResultHistory(
{this.description,
this.femaleInterpretativeData,
this.gender,
this.isCertificateAllowed,
this.lineItemNo,
this.maleInterpretativeData,
this.notes,
this.orderLineItemNo,
this.orderNo,
this.packageID,
this.patientID,
this.projectID,
this.referanceRange,
this.resultValue,
this.resultValueBasedLineItemNo,
this.resultValueFlag,
this.sampleCollectedOn,
this.sampleReceivedOn,
this.setupID,
this.superVerifiedOn,
this.testCode,
this.uOM,
this.verifiedOn,
this.verifiedOnDateTime});
LabResultHistory.fromJson(Map<String, dynamic> json) {
description = json['Description'];
femaleInterpretativeData = json['FemaleInterpretativeData'];
gender = json['Gender'];
isCertificateAllowed = json['IsCertificateAllowed'];
lineItemNo = json['LineItemNo'];
maleInterpretativeData = json['MaleInterpretativeData'];
notes = json['Notes'];
orderLineItemNo = json['OrderLineItemNo'];
orderNo = json['OrderNo'];
packageID = json['PackageID'];
patientID = json['PatientID'];
projectID = json['ProjectID'];
referanceRange = json['ReferanceRange'];
resultValue = json['ResultValue'];
resultValueBasedLineItemNo = json['ResultValueBasedLineItemNo'];
resultValueFlag = json['ResultValueFlag'];
sampleCollectedOn = json['SampleCollectedOn'];
sampleReceivedOn = json['SampleReceivedOn'];
setupID = json['SetupID'];
superVerifiedOn = json['SuperVerifiedOn'];
testCode = json['TestCode'];
uOM = json['UOM'];
verifiedOn = json['VerifiedOn'];
verifiedOnDateTime = json['VerifiedOnDateTime'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Description'] = this.description;
data['FemaleInterpretativeData'] = this.femaleInterpretativeData;
data['Gender'] = this.gender;
data['IsCertificateAllowed'] = this.isCertificateAllowed;
data['LineItemNo'] = this.lineItemNo;
data['MaleInterpretativeData'] = this.maleInterpretativeData;
data['Notes'] = this.notes;
data['OrderLineItemNo'] = this.orderLineItemNo;
data['OrderNo'] = this.orderNo;
data['PackageID'] = this.packageID;
data['PatientID'] = this.patientID;
data['ProjectID'] = this.projectID;
data['ReferanceRange'] = this.referanceRange;
data['ResultValue'] = this.resultValue;
data['ResultValueBasedLineItemNo'] = this.resultValueBasedLineItemNo;
data['ResultValueFlag'] = this.resultValueFlag;
data['SampleCollectedOn'] = this.sampleCollectedOn;
data['SampleReceivedOn'] = this.sampleReceivedOn;
data['SetupID'] = this.setupID;
data['SuperVerifiedOn'] = this.superVerifiedOn;
data['TestCode'] = this.testCode;
data['UOM'] = this.uOM;
data['VerifiedOn'] = this.verifiedOn;
data['VerifiedOnDateTime'] = this.verifiedOnDateTime;
return data;
}
}

@ -0,0 +1,216 @@
class AllSpecialLabResultModel {
int actualDoctorRate;
dynamic admissionDate;
dynamic admissionNumber;
dynamic appointmentDate;
dynamic appointmentNo;
dynamic appointmentTime;
String clinicDescription;
String clinicDescriptionEnglish;
dynamic clinicDescriptionN;
dynamic clinicID;
dynamic createdOn;
double decimalDoctorRate;
dynamic doctorID;
String doctorImageURL;
String doctorName;
String doctorNameEnglish;
dynamic doctorNameN;
dynamic doctorRate;
dynamic doctorStarsRate;
String doctorTitle;
dynamic gender;
String genderDescription;
bool inOutPatient;
String invoiceNo;
bool isActiveDoctorProfile;
bool isDoctorAllowVedioCall;
bool isExecludeDoctor;
bool isInOutPatient;
dynamic isInOutPatientDescription;
dynamic isInOutPatientDescriptionN;
bool isLiveCareAppointment;
bool isRead;
bool isSendEmail;
String moduleID;
String nationalityFlagURL;
dynamic noOfPatientsRate;
dynamic orderDate;
String orderNo;
dynamic patientID;
String projectID;
String projectName;
dynamic projectNameN;
String qR;
String resultData;
String resultDataHTML;
dynamic resultDataTxt;
String setupID;
//List<String> speciality;
dynamic status;
dynamic statusDesc;
String strOrderDate;
AllSpecialLabResultModel(
{this.actualDoctorRate,
this.admissionDate,
this.admissionNumber,
this.appointmentDate,
this.appointmentNo,
this.appointmentTime,
this.clinicDescription,
this.clinicDescriptionEnglish,
this.clinicDescriptionN,
this.clinicID,
this.createdOn,
this.decimalDoctorRate,
this.doctorID,
this.doctorImageURL,
this.doctorName,
this.doctorNameEnglish,
this.doctorNameN,
this.doctorRate,
this.doctorStarsRate,
this.doctorTitle,
this.gender,
this.genderDescription,
this.inOutPatient,
this.invoiceNo,
this.isActiveDoctorProfile,
this.isDoctorAllowVedioCall,
this.isExecludeDoctor,
this.isInOutPatient,
this.isInOutPatientDescription,
this.isInOutPatientDescriptionN,
this.isLiveCareAppointment,
this.isRead,
this.isSendEmail,
this.moduleID,
this.nationalityFlagURL,
this.noOfPatientsRate,
this.orderDate,
this.orderNo,
this.patientID,
this.projectID,
this.projectName,
this.projectNameN,
this.qR,
this.resultData,
this.resultDataHTML,
this.resultDataTxt,
this.setupID,
//this.speciality,
this.status,
this.statusDesc,
this.strOrderDate});
AllSpecialLabResultModel.fromJson(Map<String, dynamic> json) {
actualDoctorRate = json['ActualDoctorRate'];
admissionDate = json['AdmissionDate'];
admissionNumber = json['AdmissionNumber'];
appointmentDate = json['AppointmentDate'];
appointmentNo = json['AppointmentNo'];
appointmentTime = json['AppointmentTime'];
clinicDescription = json['ClinicDescription'];
clinicDescriptionEnglish = json['ClinicDescriptionEnglish'];
clinicDescriptionN = json['ClinicDescriptionN'];
clinicID = json['ClinicID'];
createdOn = json['CreatedOn'];
decimalDoctorRate = json['DecimalDoctorRate'];
doctorID = json['DoctorID'];
doctorImageURL = json['DoctorImageURL'];
doctorName = json['DoctorName'];
doctorNameEnglish = json['DoctorNameEnglish'];
doctorNameN = json['DoctorNameN'];
doctorRate = json['DoctorRate'];
doctorStarsRate = json['DoctorStarsRate'];
doctorTitle = json['DoctorTitle'];
gender = json['Gender'];
genderDescription = json['GenderDescription'];
inOutPatient = json['InOutPatient'];
invoiceNo = json['InvoiceNo'];
isActiveDoctorProfile = json['IsActiveDoctorProfile'];
isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall'];
isExecludeDoctor = json['IsExecludeDoctor'];
isInOutPatient = json['IsInOutPatient'];
isInOutPatientDescription = json['IsInOutPatientDescription'];
isInOutPatientDescriptionN = json['IsInOutPatientDescriptionN'];
isLiveCareAppointment = json['IsLiveCareAppointment'];
isRead = json['IsRead'];
isSendEmail = json['IsSendEmail'];
moduleID = json['ModuleID'];
nationalityFlagURL = json['NationalityFlagURL'];
noOfPatientsRate = json['NoOfPatientsRate'];
orderDate = json['OrderDate'];
orderNo = json['OrderNo'];
patientID = json['PatientID'];
projectID = json['ProjectID'];
projectName = json['ProjectName'];
projectNameN = json['ProjectNameN'];
qR = json['QR'];
resultData = json['ResultData'];
resultDataHTML = json['ResultDataHTML'];
resultDataTxt = json['ResultDataTxt'];
setupID = json['SetupID'];
//speciality = json['Speciality'].cast<String>();
status = json['Status'];
statusDesc = json['StatusDesc'];
strOrderDate = json['StrOrderDate'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ActualDoctorRate'] = this.actualDoctorRate;
data['AdmissionDate'] = this.admissionDate;
data['AdmissionNumber'] = this.admissionNumber;
data['AppointmentDate'] = this.appointmentDate;
data['AppointmentNo'] = this.appointmentNo;
data['AppointmentTime'] = this.appointmentTime;
data['ClinicDescription'] = this.clinicDescription;
data['ClinicDescriptionEnglish'] = this.clinicDescriptionEnglish;
data['ClinicDescriptionN'] = this.clinicDescriptionN;
data['ClinicID'] = this.clinicID;
data['CreatedOn'] = this.createdOn;
data['DecimalDoctorRate'] = this.decimalDoctorRate;
data['DoctorID'] = this.doctorID;
data['DoctorImageURL'] = this.doctorImageURL;
data['DoctorName'] = this.doctorName;
data['DoctorNameEnglish'] = this.doctorNameEnglish;
data['DoctorNameN'] = this.doctorNameN;
data['DoctorRate'] = this.doctorRate;
data['DoctorStarsRate'] = this.doctorStarsRate;
data['DoctorTitle'] = this.doctorTitle;
data['Gender'] = this.gender;
data['GenderDescription'] = this.genderDescription;
data['InOutPatient'] = this.inOutPatient;
data['InvoiceNo'] = this.invoiceNo;
data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile;
data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall;
data['IsExecludeDoctor'] = this.isExecludeDoctor;
data['IsInOutPatient'] = this.isInOutPatient;
data['IsInOutPatientDescription'] = this.isInOutPatientDescription;
data['IsInOutPatientDescriptionN'] = this.isInOutPatientDescriptionN;
data['IsLiveCareAppointment'] = this.isLiveCareAppointment;
data['IsRead'] = this.isRead;
data['IsSendEmail'] = this.isSendEmail;
data['ModuleID'] = this.moduleID;
data['NationalityFlagURL'] = this.nationalityFlagURL;
data['NoOfPatientsRate'] = this.noOfPatientsRate;
data['OrderDate'] = this.orderDate;
data['OrderNo'] = this.orderNo;
data['PatientID'] = this.patientID;
data['ProjectID'] = this.projectID;
data['ProjectName'] = this.projectName;
data['ProjectNameN'] = this.projectNameN;
data['QR'] = this.qR;
data['ResultData'] = this.resultData;
data['ResultDataHTML'] = this.resultDataHTML;
data['ResultDataTxt'] = this.resultDataTxt;
data['SetupID'] = this.setupID;
//data['Speciality'] = this.speciality;
data['Status'] = this.status;
data['StatusDesc'] = this.statusDesc;
data['StrOrderDate'] = this.strOrderDate;
return data;
}
}

@ -0,0 +1,68 @@
class AllSpecialLabResultRequestModel {
double versionID;
int channel;
int languageID;
String iPAdress;
String generalid;
int patientOutSA;
String sessionID;
bool isDentalAllowedBackend;
int deviceTypeID;
String tokenID;
int patientTypeID;
int patientType;
int patientID;
int projectID;
AllSpecialLabResultRequestModel(
{this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.patientOutSA,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID,
this.tokenID,
this.patientTypeID,
this.patientType,
this.patientID,
this.projectID});
AllSpecialLabResultRequestModel.fromJson(Map<String, dynamic> json) {
versionID = json['VersionID'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
patientOutSA = json['PatientOutSA'];
sessionID = json['SessionID'];
isDentalAllowedBackend = json['isDentalAllowedBackend'];
deviceTypeID = json['DeviceTypeID'];
tokenID = json['TokenID'];
patientTypeID = json['PatientTypeID'];
patientType = json['PatientType'];
patientID = json['PatientID'];
projectID = json['ProjectID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['generalid'] = this.generalid;
data['PatientOutSA'] = this.patientOutSA;
data['SessionID'] = this.sessionID;
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['DeviceTypeID'] = this.deviceTypeID;
data['TokenID'] = this.tokenID;
data['PatientTypeID'] = this.patientTypeID;
data['PatientType'] = this.patientType;
data['PatientID'] = this.patientID;
data['ProjectID'] = this.projectID;
return data;
}
}

@ -10,6 +10,8 @@ class LabResult {
String projectID; String projectID;
String referanceRange; String referanceRange;
String resultValue; String resultValue;
String maxValue;
String minValue;
String sampleCollectedOn; String sampleCollectedOn;
String sampleReceivedOn; String sampleReceivedOn;
String setupID; String setupID;
@ -21,24 +23,26 @@ class LabResult {
LabResult( LabResult(
{this.description, {this.description,
this.femaleInterpretativeData, this.femaleInterpretativeData,
this.gender, this.gender,
this.lineItemNo, this.lineItemNo,
this.maleInterpretativeData, this.maleInterpretativeData,
this.notes, this.notes,
this.packageID, this.packageID,
this.patientID, this.patientID,
this.projectID, this.projectID,
this.referanceRange, this.referanceRange,
this.resultValue, this.resultValue,
this.sampleCollectedOn, this.maxValue,
this.sampleReceivedOn, this.minValue,
this.setupID, this.sampleCollectedOn,
this.superVerifiedOn, this.sampleReceivedOn,
this.testCode, this.setupID,
this.uOM, this.superVerifiedOn,
this.verifiedOn, this.testCode,
this.verifiedOnDateTime}); this.uOM,
this.verifiedOn,
this.verifiedOnDateTime});
LabResult.fromJson(Map<String, dynamic> json) { LabResult.fromJson(Map<String, dynamic> json) {
description = json['Description']; description = json['Description'];
@ -52,6 +56,8 @@ class LabResult {
projectID = json['ProjectID'].toString(); projectID = json['ProjectID'].toString();
referanceRange = json['ReferenceRange'] ?? json['ReferanceRange']; referanceRange = json['ReferenceRange'] ?? json['ReferanceRange'];
resultValue = json['ResultValue']; resultValue = json['ResultValue'];
maxValue = json['MaxValue'];
minValue = json['MinValue'];
sampleCollectedOn = json['SampleCollectedOn']; sampleCollectedOn = json['SampleCollectedOn'];
sampleReceivedOn = json['SampleReceivedOn']; sampleReceivedOn = json['SampleReceivedOn'];
setupID = json['SetupID']; setupID = json['SetupID'];
@ -75,6 +81,8 @@ class LabResult {
data['ProjectID'] = this.projectID; data['ProjectID'] = this.projectID;
data['ReferanceRange'] = this.referanceRange; data['ReferanceRange'] = this.referanceRange;
data['ResultValue'] = this.resultValue; data['ResultValue'] = this.resultValue;
data['MaxValue'] = this.maxValue;
data['MinValue'] = this.minValue;
data['SampleCollectedOn'] = this.sampleCollectedOn; data['SampleCollectedOn'] = this.sampleCollectedOn;
data['SampleReceivedOn'] = this.sampleReceivedOn; data['SampleReceivedOn'] = this.sampleReceivedOn;
data['SetupID'] = this.setupID; data['SetupID'] = this.setupID;
@ -85,8 +93,29 @@ class LabResult {
data['VerifiedOnDateTime'] = this.verifiedOnDateTime; data['VerifiedOnDateTime'] = this.verifiedOnDateTime;
return data; return data;
} }
}
int checkResultStatus() {
try {
var max = double.tryParse(maxValue) ?? null;
var min = double.tryParse(minValue) ?? null;
var result = double.tryParse(resultValue) ?? null;
if (max != null && min != null && result != null) {
if (result > max) {
return 1;
} else if (result < min) {
return -1;
} else {
return 0;
}
} else {
return 0;
}
}catch (e){
return 0;
}
}
}
class LabResultList { class LabResultList {
String filterName = ""; String filterName = "";

@ -64,7 +64,7 @@ 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['NursingStationID'] = this.nursingStationID;
data['ClinicID'] = this.clinicID; data['ClinicID'] = this.clinicID;
data['ProjectID'] = this.projectID; data['ProjectID'] = this.projectID;
return data; return data;

@ -1,18 +1,22 @@
class GetOrderedProcedureRequestModel { class GetOrderedProcedureRequestModel {
String vidaAuthTokenID; String vidaAuthTokenID;
int patientMRN; int patientMRN;
int appointmentNo;
GetOrderedProcedureRequestModel({this.vidaAuthTokenID, this.patientMRN}); GetOrderedProcedureRequestModel({this.vidaAuthTokenID, this.patientMRN, this.appointmentNo});
GetOrderedProcedureRequestModel.fromJson(Map<String, dynamic> json) { GetOrderedProcedureRequestModel.fromJson(Map<String, dynamic> json) {
vidaAuthTokenID = json['VidaAuthTokenID']; vidaAuthTokenID = json['VidaAuthTokenID'];
patientMRN = json['PatientMRN']; patientMRN = json['PatientMRN'];
appointmentNo = json['AppointmentNo'];
} }
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['VidaAuthTokenID'] = this.vidaAuthTokenID; data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['PatientMRN'] = this.patientMRN; data['PatientMRN'] = this.patientMRN;
data['AppointmentNo'] = this.appointmentNo;
return data; return data;
} }
} }

@ -1,41 +1,41 @@
import 'package:doctor_app_flutter/widgets/shared/StarRating.dart'; import 'package:doctor_app_flutter/widgets/shared/StarRating.dart';
class SickLeavePatientModel { class SickLeavePatientModel {
String setupID; dynamic setupID;
int projectID; dynamic projectID;
int patientID; dynamic patientID;
int patientType; dynamic patientType;
int clinicID; dynamic clinicID;
int doctorID; dynamic doctorID;
int requestNo; dynamic requestNo;
String requestDate; dynamic requestDate;
int sickLeaveDays; dynamic sickLeaveDays;
int appointmentNo; dynamic appointmentNo;
int admissionNo; dynamic admissionNo;
int actualDoctorRate; dynamic actualDoctorRate;
String appointmentDate; dynamic appointmentDate;
String clinicName; dynamic clinicName;
String doctorImageURL; dynamic doctorImageURL;
String doctorName; dynamic doctorName;
int doctorRate; dynamic doctorRate;
String doctorTitle; dynamic doctorTitle;
int gender; dynamic gender;
String genderDescription; dynamic genderDescription;
bool isActiveDoctorProfile; bool isActiveDoctorProfile;
bool isDoctorAllowVedioCall; bool isDoctorAllowVedioCall;
bool isExecludeDoctor; bool isExecludeDoctor;
bool isInOutPatient; bool isInOutPatient;
String isInOutPatientDescription; dynamic isInOutPatientDescription;
String isInOutPatientDescriptionN; dynamic isInOutPatientDescriptionN;
bool isLiveCareAppointment; bool isLiveCareAppointment;
int noOfPatientsRate; dynamic noOfPatientsRate;
dynamic patientName; dynamic patientName;
String projectName; dynamic projectName;
String qR; dynamic qR;
// List<String> speciality; // List<String> speciality;
String strRequestDate; dynamic strRequestDate;
String startDate; dynamic startDate;
String endDate; dynamic endDate;
dynamic isExtendedLeave; dynamic isExtendedLeave;
dynamic noOfDays; dynamic noOfDays;
dynamic patientMRN; dynamic patientMRN;

@ -1,22 +1,16 @@
import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_analytics/observer.dart'; import 'package:firebase_analytics/observer.dart';
import 'package:flutter/cupertino.dart';
class AnalyticsService { class AnalyticsService {
final FirebaseAnalytics _analytics = FirebaseAnalytics(); final FirebaseAnalytics _analytics = FirebaseAnalytics();
FirebaseAnalyticsObserver getAnalyticsObserver() => FirebaseAnalyticsObserver getAnalyticsObserver() => FirebaseAnalyticsObserver(analytics: _analytics);
FirebaseAnalyticsObserver(analytics: _analytics);
Future logEvent( Future logEvent({@required String eventCategory, @required String eventAction}) async {
{String eventCategory,
String eventLabel,
String eventAction,
String eventValue}) async {
await _analytics.logEvent(name: 'event', parameters: { await _analytics.logEvent(name: 'event', parameters: {
"eventCategory": eventCategory, "eventCategory": eventCategory,
"eventLabel": eventLabel,
"eventAction": eventAction, "eventAction": eventAction,
"eventValue": eventValue
}); });
} }
} }

@ -29,6 +29,7 @@ class VideoCallService extends BaseService {
DoctorProfileModel doctorProfile = DoctorProfileModel doctorProfile =
await getDoctorProfile(isGetProfile: true); await getDoctorProfile(isGetProfile: true);
await VideoChannel.openVideoCallScreen( await VideoChannel.openVideoCallScreen(
// TODO MOSA TEST
kToken: startCallRes.openTokenID, kToken: startCallRes.openTokenID,
kSessionId: startCallRes.openSessionID, kSessionId: startCallRes.openSessionID,
kApiKey:'46209962', kApiKey:'46209962',
@ -56,6 +57,7 @@ class VideoCallService extends BaseService {
endCall( endCall(
patient.vcId, patient.vcId,
false, false,
).then((value) { ).then((value) {
GifLoaderDialogUtils.hideDialog( GifLoaderDialogUtils.hideDialog(
locator<NavigationService>().navigatorKey.currentContext); locator<NavigationService>().navigatorKey.currentContext);

@ -14,7 +14,11 @@ class BaseService {
List<PatiantInformtion> patientArrivalList = []; List<PatiantInformtion> patientArrivalList = [];
//TODO add the user login model when we need it BaseService(){
doctorProfile = null;
}
//TODO add the user login model when we need it
Future<DoctorProfileModel> getDoctorProfile({bool isGetProfile = false}) async { Future<DoctorProfileModel> getDoctorProfile({bool isGetProfile = false}) async {
if(isGetProfile) if(isGetProfile)
{ {

@ -1,57 +1,77 @@
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/doctor/list_gt_my_patients_question_model.dart'; import 'package:doctor_app_flutter/models/doctor/list_gt_my_patients_question_model.dart';
import 'package:doctor_app_flutter/models/doctor/replay/request_create_doctor_response.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';
import 'package:doctor_app_flutter/models/doctor/request_doctor_reply.dart'; import 'package:doctor_app_flutter/models/doctor/replay/request_doctor_reply.dart';
import 'package:doctor_app_flutter/models/patient/my_referral/my_referral_patient_model.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/my_referral_patient_model.dart';
import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart'; import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart';
class DoctorReplyService extends BaseService { class DoctorReplyService extends BaseService {
List<ListGtMyPatientsQuestions> get listDoctorWorkingHoursTable =>
List<ListGtMyPatientsQuestions> get listDoctorWorkingHoursTable => _listDoctorWorkingHoursTable; _listDoctorWorkingHoursTable;
List<ListGtMyPatientsQuestions> get listDoctorNotRepliedQuestions =>
_listDoctorNotRepliedQuestions;
List<ListGtMyPatientsQuestions> _listDoctorWorkingHoursTable = []; List<ListGtMyPatientsQuestions> _listDoctorWorkingHoursTable = [];
List<ListGtMyPatientsQuestions> _listDoctorNotRepliedQuestions = [];
RequestDoctorReply _requestDoctorReply = RequestDoctorReply();
List<MyReferralPatientModel> _listMyReferralPatientModel = []; List<MyReferralPatientModel> _listMyReferralPatientModel = [];
List<MyReferralPatientModel> get listMyReferralPatientModel => _listMyReferralPatientModel;
Future getDoctorReply() async { List<MyReferralPatientModel> get listMyReferralPatientModel =>
_listMyReferralPatientModel;
int notRepliedCount = 0;
Future getDoctorReply(RequestDoctorReply _requestDoctorReply,
{bool clearData = false, bool isGettingNotReply = false}) async {
hasError = false; hasError = false;
await baseAppClient.post(GT_MY_PATIENT_QUESTION, await baseAppClient.post(
onSuccess: (dynamic response, int statusCode) { GT_MY_PATIENT_QUESTION,
onSuccess: (dynamic response, int statusCode) {
if (clearData) {
if(isGettingNotReply)
_listDoctorNotRepliedQuestions.clear();
else
_listDoctorWorkingHoursTable.clear(); _listDoctorWorkingHoursTable.clear();
response['List_GtMyPatientsQuestions'].forEach((v) { }
_listDoctorWorkingHoursTable
.add(ListGtMyPatientsQuestions.fromJson(v));
}); response['List_GtMyPatientsQuestions'].forEach((v) {
}, onFailure: (String error, int statusCode) {
hasError = true; if(isGettingNotReply)
super.error = error; _listDoctorNotRepliedQuestions.add(ListGtMyPatientsQuestions.fromJson(v));
}, body: _requestDoctorReply.toJson(),); else
_listDoctorWorkingHoursTable
.add(ListGtMyPatientsQuestions.fromJson(v));
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: _requestDoctorReply.toJson(),
);
}
Future createDoctorResponse(
CreateDoctorResponseModel createDoctorResponseModel) async {
hasError = false;
await baseAppClient.post(
CREATE_DOCTOR_RESPONSE,
body: createDoctorResponseModel.toJson(),
onSuccess: (dynamic body, int statusCode) {},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
);
} }
Future replay( Future getNotRepliedCount() async {
String referredDoctorRemarks, ListGtMyPatientsQuestions model) async { hasError = false;
RequestMyReferralPatientModel _requestMyReferralPatient =
RequestMyReferralPatientModel();
RequestAddReferredDoctorRemarks _requestAddReferredDoctorRemarks =
RequestAddReferredDoctorRemarks();
_requestAddReferredDoctorRemarks.admissionNo = model.admissionNo.toString();
_requestAddReferredDoctorRemarks.patientID = model.patientID;
_requestAddReferredDoctorRemarks.referredDoctorRemarks =
referredDoctorRemarks;
_requestAddReferredDoctorRemarks.lineItemNo = model.lineItemNo;
_requestAddReferredDoctorRemarks.referringDoctor = model.referringDoctor;
await baseAppClient.post( await baseAppClient.post(
ADD_REFERRED_DOCTOR_REMARKS, GET_DOCTOR_NOT_REPLIED_COUNTS,
body: _requestAddReferredDoctorRemarks.toJson(), body: {},
onSuccess: (dynamic body, int statusCode) { onSuccess: (dynamic body, int statusCode) {
print("succsss"); notRepliedCount = body["DoctorNotRepliedCounts"];
// model.referredDoctorRemarks = referredDoctorRemarks;
// listMyReferralPatientModel[listMyReferralPatientModel.indexOf(model)] =
// model;
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
hasError = true; hasError = true;

@ -21,6 +21,6 @@ class ScheduleService extends BaseService {
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: _requestSchedule.toJson(),); }, body: _requestSchedule.toJson(),isFallLanguage: true);
} }
} }

@ -10,7 +10,7 @@ class PatientInPatientService extends BaseService {
Future getInPatientList( Future getInPatientList(
PatientSearchRequestModel requestModel, bool isMyInpatient) async { PatientSearchRequestModel requestModel, bool isMyInpatient) async {
hasError = false; hasError = false;
await getDoctorProfile(); await getDoctorProfile(isGetProfile: true);
if (isMyInpatient) { if (isMyInpatient) {
requestModel.doctorID = doctorProfile.doctorID; requestModel.doctorID = doctorProfile.doctorID;

@ -1,5 +1,8 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/labs/LabOrderResult.dart'; import 'package:doctor_app_flutter/core/model/labs/LabOrderResult.dart';
import 'package:doctor_app_flutter/core/model/labs/LabResultHistory.dart';
import 'package:doctor_app_flutter/core/model/labs/all_special_lab_result_model.dart';
import 'package:doctor_app_flutter/core/model/labs/all_special_lab_result_request.dart';
import 'package:doctor_app_flutter/core/model/labs/lab_result.dart'; import 'package:doctor_app_flutter/core/model/labs/lab_result.dart';
import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart'; import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart';
import 'package:doctor_app_flutter/core/model/labs/patient_lab_special_result.dart'; import 'package:doctor_app_flutter/core/model/labs/patient_lab_special_result.dart';
@ -11,9 +14,12 @@ import '../../base/base_service.dart';
class LabsService extends BaseService { class LabsService extends BaseService {
List<PatientLabOrders> patientLabOrdersList = List(); List<PatientLabOrders> patientLabOrdersList = List();
List<AllSpecialLabResultModel> _allSpecialLab = List();
List<AllSpecialLabResultModel> get allSpecialLab => _allSpecialLab;
Future getPatientLabOrdersList( AllSpecialLabResultRequestModel _allSpecialLabResultRequestModel = AllSpecialLabResultRequestModel();
PatiantInformtion patient, bool isInpatient) async {
Future getPatientLabOrdersList(PatiantInformtion patient, bool isInpatient) async {
hasError = false; hasError = false;
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
String url = ""; String url = "";
@ -27,8 +33,7 @@ class LabsService extends BaseService {
} }
patientLabOrdersList = []; patientLabOrdersList = [];
patientLabOrdersList.clear(); patientLabOrdersList.clear();
await baseAppClient.postPatient(url, patient: patient, await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
patientLabOrdersList = []; patientLabOrdersList = [];
if (!isInpatient) { if (!isInpatient) {
response['ListPLO'].forEach((hospital) { response['ListPLO'].forEach((hospital) {
@ -46,12 +51,12 @@ class LabsService extends BaseService {
}, body: body); }, body: body);
} }
RequestPatientLabSpecialResult _requestPatientLabSpecialResult = RequestPatientLabSpecialResult _requestPatientLabSpecialResult = RequestPatientLabSpecialResult();
RequestPatientLabSpecialResult();
List<PatientLabSpecialResult> patientLabSpecialResult = List(); List<PatientLabSpecialResult> patientLabSpecialResult = List();
List<LabResult> labResultList = List(); List<LabResult> labResultList = List();
List<LabOrderResult> labOrdersResultsList = List(); List<LabOrderResult> labOrdersResultsList = List();
List<LabResultHistory> labOrdersResultHistoryList = List();
Future getLaboratoryResult( Future getLaboratoryResult(
{String projectID, {String projectID,
@ -69,8 +74,8 @@ class LabsService extends BaseService {
_requestPatientLabSpecialResult.orderNo = orderNo; _requestPatientLabSpecialResult.orderNo = orderNo;
body = _requestPatientLabSpecialResult.toJson(); body = _requestPatientLabSpecialResult.toJson();
await baseAppClient.postPatient(GET_Patient_LAB_SPECIAL_RESULT, await baseAppClient.postPatient(GET_Patient_LAB_SPECIAL_RESULT, patient: patient,
patient: patient, onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
patientLabSpecialResult.clear(); patientLabSpecialResult.clear();
response['ListPLSR'].forEach((hospital) { response['ListPLSR'].forEach((hospital) {
@ -82,10 +87,7 @@ class LabsService extends BaseService {
}, body: body); }, body: body);
} }
Future getPatientLabResult( Future getPatientLabResult({PatientLabOrders patientLabOrder, PatiantInformtion patient, bool isInpatient}) async {
{PatientLabOrders patientLabOrder,
PatiantInformtion patient,
bool isInpatient}) async {
hasError = false; hasError = false;
String url = ""; String url = "";
@ -103,8 +105,7 @@ class LabsService extends BaseService {
body['ProjectID'] = patientLabOrder.projectID; body['ProjectID'] = patientLabOrder.projectID;
body['ClinicID'] = patientLabOrder.clinicID ?? 0; body['ClinicID'] = patientLabOrder.clinicID ?? 0;
await baseAppClient.postPatient(url, patient: patient, await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
patientLabSpecialResult = []; patientLabSpecialResult = [];
labResultList = []; labResultList = [];
@ -127,9 +128,7 @@ class LabsService extends BaseService {
} }
Future getPatientLabOrdersResults( Future getPatientLabOrdersResults(
{PatientLabOrders patientLabOrder, {PatientLabOrders patientLabOrder, String procedure, PatiantInformtion patient}) async {
String procedure,
PatiantInformtion patient}) async {
hasError = false; hasError = false;
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
if (patientLabOrder != null) { if (patientLabOrder != null) {
@ -141,8 +140,8 @@ class LabsService extends BaseService {
} }
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
body['Procedure'] = procedure; body['Procedure'] = procedure;
await baseAppClient.postPatient(GET_Patient_LAB_ORDERS_RESULT, await baseAppClient.postPatient(GET_Patient_LAB_ORDERS_RESULT, patient: patient,
patient: patient, onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
labOrdersResultsList.clear(); labOrdersResultsList.clear();
response['ListPLR'].forEach((lab) { response['ListPLR'].forEach((lab) {
labOrdersResultsList.add(LabOrderResult.fromJson(lab)); labOrdersResultsList.add(LabOrderResult.fromJson(lab));
@ -153,8 +152,7 @@ class LabsService extends BaseService {
}, body: body); }, body: body);
} }
RequestSendLabReportEmail _requestSendLabReportEmail = RequestSendLabReportEmail _requestSendLabReportEmail = RequestSendLabReportEmail();
RequestSendLabReportEmail();
Future sendLabReportEmail({PatientLabOrders patientLabOrder}) async { Future sendLabReportEmail({PatientLabOrders patientLabOrder}) async {
// _requestSendLabReportEmail.projectID = patientLabOrder.projectID; // _requestSendLabReportEmail.projectID = patientLabOrder.projectID;
@ -179,4 +177,46 @@ class LabsService extends BaseService {
// super.error = error; // super.error = error;
// }, body: _requestSendLabReportEmail.toJson()); // }, body: _requestSendLabReportEmail.toJson());
} }
Future getPatientLabOrdersResultHistoryByDescription(
{PatientLabOrders patientLabOrder, String procedureDescription, PatiantInformtion patient}) async {
hasError = false;
Map<String, dynamic> body = Map();
if (patientLabOrder != null) {
body['SetupID'] = patientLabOrder.setupID;
body['ProjectID'] = 0;
body['ClinicID'] = 0;
}
body['isDentalAllowedBackend'] = false;
body['ProcedureDescription'] = procedureDescription;
await baseAppClient.postPatient(GET_PATIENT_LAB_ORDERS_RESULT_HISTORY_BY_DESCRIPTION, patient: patient,
onSuccess: (dynamic response, int statusCode) {
labOrdersResultHistoryList.clear();
response['ListGeneralResultHistory'].forEach((lab) {
labOrdersResultHistoryList.add(LabResultHistory.fromJson(lab));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
Future getAllSpecialLabResult({int mrn}) async {
_allSpecialLabResultRequestModel = AllSpecialLabResultRequestModel(
patientID: mrn,
patientType: 1,
patientTypeID: 1,
);
hasError = false;
_allSpecialLab.clear();
await baseAppClient.post(ALL_SPECIAL_LAB_RESULT, onSuccess: (dynamic response, int statusCode) {
response['ListPLSRALL'].forEach((lab) {
var labs = AllSpecialLabResultModel.fromJson(lab);
if (labs.invoiceNo != "0") _allSpecialLab.add(AllSpecialLabResultModel.fromJson(lab));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _allSpecialLabResultRequestModel.toJson());
}
} }

@ -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/Prescriptions/Prescriptions.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_request_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/in_patient_prescription_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/in_patient_prescription_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart';
@ -16,11 +18,13 @@ import '../../base/base_service.dart';
class PrescriptionsService extends BaseService { class PrescriptionsService extends BaseService {
List<Prescriptions> prescriptionsList = List(); List<Prescriptions> prescriptionsList = List();
List<GetMedicationForInPatientModel> medicationForInPatient = List();
List<PrescriptionsOrder> prescriptionsOrderList = List(); List<PrescriptionsOrder> prescriptionsOrderList = List();
List<PrescriotionInPatient> prescriptionInPatientList = List(); List<PrescriotionInPatient> prescriptionInPatientList = List();
InPatientPrescriptionRequestModel _inPatientPrescriptionRequestModel = InPatientPrescriptionRequestModel _inPatientPrescriptionRequestModel = InPatientPrescriptionRequestModel();
InPatientPrescriptionRequestModel(); GetMedicationForInPatientRequestModel _getMedicationForInPatientRequestModel =
GetMedicationForInPatientRequestModel();
Future getPrescriptionInPatient({int mrn, String adn}) async { Future getPrescriptionInPatient({int mrn, String adn}) async {
_inPatientPrescriptionRequestModel = InPatientPrescriptionRequestModel( _inPatientPrescriptionRequestModel = InPatientPrescriptionRequestModel(
@ -30,12 +34,10 @@ class PrescriptionsService extends BaseService {
hasError = false; hasError = false;
prescriptionInPatientList.clear(); prescriptionInPatientList.clear();
await baseAppClient.post(GET_PRESCRIPTION_IN_PATIENT, await baseAppClient.post(GET_PRESCRIPTION_IN_PATIENT, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
prescriptionsList.clear(); prescriptionsList.clear();
response['List_PrescriptionReportForInPatient'].forEach((prescriptions) { response['List_PrescriptionReportForInPatient'].forEach((prescriptions) {
prescriptionInPatientList prescriptionInPatientList.add(PrescriotionInPatient.fromJson(prescriptions));
.add(PrescriotionInPatient.fromJson(prescriptions));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -47,8 +49,7 @@ class PrescriptionsService extends BaseService {
hasError = false; hasError = false;
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
await baseAppClient.postPatient(PRESCRIPTIONS, patient: patient, await baseAppClient.postPatient(PRESCRIPTIONS, patient: patient, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
prescriptionsList.clear(); prescriptionsList.clear();
response['PatientPrescriptionList'].forEach((prescriptions) { response['PatientPrescriptionList'].forEach((prescriptions) {
prescriptionsList.add(Prescriptions.fromJson(prescriptions)); prescriptionsList.add(Prescriptions.fromJson(prescriptions));
@ -60,13 +61,10 @@ class PrescriptionsService extends BaseService {
} }
RequestPrescriptionReport _requestPrescriptionReport = RequestPrescriptionReport _requestPrescriptionReport =
RequestPrescriptionReport( RequestPrescriptionReport(appointmentNo: 0, isDentalAllowedBackend: false);
appointmentNo: 0, isDentalAllowedBackend: false);
List<PrescriptionReport> prescriptionReportList = List(); List<PrescriptionReport> prescriptionReportList = List();
Future getPrescriptionReport( Future getPrescriptionReport({Prescriptions prescriptions, @required PatiantInformtion patient}) async {
{Prescriptions prescriptions,
@required PatiantInformtion patient}) async {
hasError = false; hasError = false;
_requestPrescriptionReport.dischargeNo = prescriptions.dischargeNo; _requestPrescriptionReport.dischargeNo = prescriptions.dischargeNo;
_requestPrescriptionReport.projectID = prescriptions.projectID; _requestPrescriptionReport.projectID = prescriptions.projectID;
@ -76,23 +74,18 @@ class PrescriptionsService extends BaseService {
_requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo; _requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo;
await baseAppClient.postPatient( await baseAppClient.postPatient(
prescriptions.isInOutPatient prescriptions.isInOutPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT_NEW,
? GET_PRESCRIPTION_REPORT_ENH
: GET_PRESCRIPTION_REPORT_NEW,
patient: patient, onSuccess: (dynamic response, int statusCode) { patient: patient, onSuccess: (dynamic response, int statusCode) {
prescriptionReportList.clear(); prescriptionReportList.clear();
prescriptionReportEnhList.clear(); prescriptionReportEnhList.clear();
if (prescriptions.isInOutPatient) { if (prescriptions.isInOutPatient) {
response['ListPRM'].forEach((prescriptions) { response['ListPRM'].forEach((prescriptions) {
prescriptionReportList prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions));
.add(PrescriptionReport.fromJson(prescriptions)); prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions));
prescriptionReportEnhList
.add(PrescriptionReportEnh.fromJson(prescriptions));
}); });
} else { } else {
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) { response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
prescriptionReportList prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions));
.add(PrescriptionReport.fromJson(prescriptions));
}); });
} }
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
@ -101,8 +94,7 @@ class PrescriptionsService extends BaseService {
}, body: _requestPrescriptionReport.toJson()); }, body: _requestPrescriptionReport.toJson());
} }
RequestGetListPharmacyForPrescriptions RequestGetListPharmacyForPrescriptions requestGetListPharmacyForPrescriptions =
requestGetListPharmacyForPrescriptions =
RequestGetListPharmacyForPrescriptions( RequestGetListPharmacyForPrescriptions(
latitude: 0, latitude: 0,
longitude: 0, longitude: 0,
@ -110,16 +102,13 @@ class PrescriptionsService extends BaseService {
); );
List<PharmacyPrescriptions> pharmacyPrescriptionsList = List(); List<PharmacyPrescriptions> pharmacyPrescriptionsList = List();
Future getListPharmacyForPrescriptions( Future getListPharmacyForPrescriptions({int itemId, @required PatiantInformtion patient}) async {
{int itemId, @required PatiantInformtion patient}) async {
hasError = false; hasError = false;
requestGetListPharmacyForPrescriptions.itemID = itemId; requestGetListPharmacyForPrescriptions.itemID = itemId;
await baseAppClient.postPatient(GET_PHARMACY_LIST, patient: patient, await baseAppClient.postPatient(GET_PHARMACY_LIST, patient: patient, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
pharmacyPrescriptionsList.clear(); pharmacyPrescriptionsList.clear();
response['PharmList'].forEach((prescriptions) { response['PharmList'].forEach((prescriptions) {
pharmacyPrescriptionsList pharmacyPrescriptionsList.add(PharmacyPrescriptions.fromJson(prescriptions));
.add(PharmacyPrescriptions.fromJson(prescriptions));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -127,16 +116,13 @@ class PrescriptionsService extends BaseService {
}, body: requestGetListPharmacyForPrescriptions.toJson()); }, body: requestGetListPharmacyForPrescriptions.toJson());
} }
RequestPrescriptionReportEnh _requestPrescriptionReportEnh = RequestPrescriptionReportEnh _requestPrescriptionReportEnh = RequestPrescriptionReportEnh(
RequestPrescriptionReportEnh(
isDentalAllowedBackend: false, isDentalAllowedBackend: false,
); );
List<PrescriptionReportEnh> prescriptionReportEnhList = List(); List<PrescriptionReportEnh> prescriptionReportEnhList = List();
Future getPrescriptionReportEnh( Future getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder, @required PatiantInformtion patient}) async {
{PrescriptionsOrder prescriptionsOrder,
@required PatiantInformtion patient}) async {
///This logic copy from the old app from class [order-history.component.ts] in line 45 ///This logic copy from the old app from class [order-history.component.ts] in line 45
bool isInPatient = false; bool isInPatient = false;
prescriptionsList.forEach((element) { prescriptionsList.forEach((element) {
@ -151,8 +137,7 @@ class PrescriptionsService extends BaseService {
isInPatient = element.isInOutPatient; isInPatient = element.isInOutPatient;
} }
} else { } else {
if (int.parse(prescriptionsOrder.appointmentNo) == if (int.parse(prescriptionsOrder.appointmentNo) == element.appointmentNo) {
element.appointmentNo) {
_requestPrescriptionReportEnh.appointmentNo = element.appointmentNo; _requestPrescriptionReportEnh.appointmentNo = element.appointmentNo;
_requestPrescriptionReportEnh.clinicID = element.clinicID; _requestPrescriptionReportEnh.clinicID = element.clinicID;
_requestPrescriptionReportEnh.projectID = element.projectID; _requestPrescriptionReportEnh.projectID = element.projectID;
@ -168,20 +153,17 @@ class PrescriptionsService extends BaseService {
hasError = false; hasError = false;
await baseAppClient.postPatient( await baseAppClient.postPatient(isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT_NEW,
isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT_NEW,
patient: patient, onSuccess: (dynamic response, int statusCode) { patient: patient, onSuccess: (dynamic response, int statusCode) {
prescriptionReportEnhList.clear(); prescriptionReportEnhList.clear();
if (isInPatient) { if (isInPatient) {
response['ListPRM'].forEach((prescriptions) { response['ListPRM'].forEach((prescriptions) {
prescriptionReportEnhList prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions));
.add(PrescriptionReportEnh.fromJson(prescriptions));
}); });
} else { } else {
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) { response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
PrescriptionReportEnh reportEnh = PrescriptionReportEnh reportEnh = PrescriptionReportEnh.fromJson(prescriptions);
PrescriptionReportEnh.fromJson(prescriptions);
reportEnh.itemDescription = prescriptions['ItemDescriptionN']; reportEnh.itemDescription = prescriptions['ItemDescriptionN'];
prescriptionReportEnhList.add(reportEnh); prescriptionReportEnhList.add(reportEnh);
}); });
@ -195,17 +177,34 @@ class PrescriptionsService extends BaseService {
Future getPrescriptionsOrders() async { Future getPrescriptionsOrders() async {
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
prescriptionsOrderList.clear(); prescriptionsOrderList.clear();
response['PatientER_GetPatientAllPresOrdersList'] response['PatientER_GetPatientAllPresOrdersList'].forEach((prescriptionsOrder) {
.forEach((prescriptionsOrder) { prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder));
prescriptionsOrderList
.add(PrescriptionsOrder.fromJson(prescriptionsOrder));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: body); }, body: body);
} }
Future getMedicationForInPatient(PatiantInformtion patient) async {
hasError = false;
_getMedicationForInPatientRequestModel = GetMedicationForInPatientRequestModel(
isDentalAllowedBackend: false,
admissionNo: int.parse(patient.admissionNo),
tokenID: "@dm!n",
projectID: patient.projectId,
);
await baseAppClient.postPatient(GET_MEDICATION_FOR_IN_PATIENT, patient: patient,
onSuccess: (dynamic response, int statusCode) {
medicationForInPatient.clear();
response['List_GetMedicationForInpatient'].forEach((prescriptions) {
medicationForInPatient.add(GetMedicationForInPatientModel.fromJson(prescriptions));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _getMedicationForInPatientRequestModel.toJson());
}
} }

@ -28,16 +28,12 @@ class ProcedureService extends BaseService {
List<ProcedureTempleteDetailsModel> templateList = List(); List<ProcedureTempleteDetailsModel> templateList = List();
List<ProcedureTempleteDetailsModel> _templateDetailsList = List(); List<ProcedureTempleteDetailsModel> _templateDetailsList = List();
List<ProcedureTempleteDetailsModel> get templateDetailsList => List<ProcedureTempleteDetailsModel> get templateDetailsList => _templateDetailsList;
_templateDetailsList;
GetOrderedProcedureRequestModel _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel();
GetOrderedProcedureRequestModel();
ProcedureTempleteRequestModel _procedureTempleteRequestModel = ProcedureTempleteRequestModel _procedureTempleteRequestModel = ProcedureTempleteRequestModel();
ProcedureTempleteRequestModel(); ProcedureTempleteDetailsRequestModel _procedureTempleteDetailsRequestModel = ProcedureTempleteDetailsRequestModel();
ProcedureTempleteDetailsRequestModel _procedureTempleteDetailsRequestModel =
ProcedureTempleteDetailsRequestModel();
GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel(
// clinicId: 17, // clinicId: 17,
@ -63,8 +59,7 @@ class ProcedureService extends BaseService {
//search: ["DENTAL"], //search: ["DENTAL"],
); );
Future getProcedureTemplate( Future getProcedureTemplate({int doctorId, int projectId, int clinicId, String categoryID}) async {
{int doctorId, int projectId, int clinicId, String categoryID}) async {
_procedureTempleteRequestModel = ProcedureTempleteRequestModel( _procedureTempleteRequestModel = ProcedureTempleteRequestModel(
// tokenID: "@dm!n", // tokenID: "@dm!n",
patientID: 0, patientID: 0,
@ -72,19 +67,18 @@ class ProcedureService extends BaseService {
); );
hasError = false; hasError = false;
await baseAppClient.post(GET_TEMPLETE_LIST/*GET_PROCEDURE_TEMPLETE*/, await baseAppClient.post(GET_TEMPLETE_LIST /*GET_PROCEDURE_TEMPLETE*/,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
templateList.clear(); templateList.clear();
response['DAPP_TemplateGetList'].forEach((template) { response['DAPP_TemplateGetList'].forEach((template) {
ProcedureTempleteDetailsModel templateElement = ProcedureTempleteDetailsModel.fromJson(template); ProcedureTempleteDetailsModel templateElement = ProcedureTempleteDetailsModel.fromJson(template);
if(categoryID != null){ if (categoryID != null) {
if(categoryID == templateElement.categoryID){ if (categoryID == templateElement.categoryID) {
templateList.add(templateElement); templateList.add(templateElement);
} }
} else { } else {
templateList.add(templateElement); templateList.add(templateElement);
} }
}); });
// response['HIS_ProcedureTemplateList'].forEach((template) { // response['HIS_ProcedureTemplateList'].forEach((template) {
// _templateList.add(ProcedureTempleteModel.fromJson(template)); // _templateList.add(ProcedureTempleteModel.fromJson(template));
@ -95,21 +89,17 @@ class ProcedureService extends BaseService {
}, body: _procedureTempleteRequestModel.toJson()); }, body: _procedureTempleteRequestModel.toJson());
} }
Future getProcedureTemplateDetails( Future getProcedureTemplateDetails({int doctorId, int projectId, int clinicId, int templateId}) async {
{int doctorId, int projectId, int clinicId, int templateId}) async {
_procedureTempleteDetailsRequestModel = _procedureTempleteDetailsRequestModel =
ProcedureTempleteDetailsRequestModel( ProcedureTempleteDetailsRequestModel(templateID: templateId, searchType: 1, patientID: 0);
templateID: templateId, searchType: 1, patientID: 0);
hasError = false; hasError = false;
//insuranceApprovalInPatient.clear(); //insuranceApprovalInPatient.clear();
_templateDetailsList.clear(); _templateDetailsList.clear();
await baseAppClient.post(GET_PROCEDURE_TEMPLETE_DETAILS, await baseAppClient.post(GET_PROCEDURE_TEMPLETE_DETAILS, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
//prescriptionsList.clear(); //prescriptionsList.clear();
response['HIS_ProcedureTemplateDetailsList'].forEach((template) { response['HIS_ProcedureTemplateDetailsList'].forEach((template) {
_templateDetailsList _templateDetailsList.add(ProcedureTempleteDetailsModel.fromJson(template));
.add(ProcedureTempleteDetailsModel.fromJson(template));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -117,15 +107,14 @@ class ProcedureService extends BaseService {
}, body: _procedureTempleteDetailsRequestModel.toJson()); }, body: _procedureTempleteDetailsRequestModel.toJson());
} }
Future getProcedure({int mrn}) async { Future getProcedure({int mrn, int appointmentNo}) async {
_getOrderedProcedureRequestModel = _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel(
GetOrderedProcedureRequestModel(patientMRN: mrn); patientMRN: mrn,
);
hasError = false; hasError = false;
_procedureList.clear(); _procedureList.clear();
await baseAppClient.post(GET_PROCEDURE_LIST, await baseAppClient.post(GET_PROCEDURE_LIST, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) { _procedureList.add(GetOrderedProcedureModel.fromJson(response['OrderedProcedureList']));
_procedureList.add(
GetOrderedProcedureModel.fromJson(response['OrderedProcedureList']));
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
@ -135,8 +124,7 @@ class ProcedureService extends BaseService {
Future getCategory() async { Future getCategory() async {
hasError = false; hasError = false;
await baseAppClient.post(GET_LIST_CATEGORISE, await baseAppClient.post(GET_LIST_CATEGORISE, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
categoryList = []; categoryList = [];
categoryList = response['listProcedureCategories']['entityList']; categoryList = response['listProcedureCategories']['entityList'];
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
@ -145,7 +133,7 @@ class ProcedureService extends BaseService {
}, body: Map()); }, body: Map());
} }
Future getProcedureCategory({String categoryName, String categoryID,patientId}) async { Future getProcedureCategory({String categoryName, String categoryID, patientId}) async {
_getProcedureCategoriseReqModel = GetProcedureReqModel( _getProcedureCategoriseReqModel = GetProcedureReqModel(
search: ["$categoryName"], search: ["$categoryName"],
patientMRN: patientId, patientMRN: patientId,
@ -156,10 +144,8 @@ class ProcedureService extends BaseService {
); );
hasError = false; hasError = false;
_categoriesList.clear(); _categoriesList.clear();
await baseAppClient.post(GET_CATEGORISE_PROCEDURE, await baseAppClient.post(GET_CATEGORISE_PROCEDURE, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) { _categoriesList.add(CategoriseProcedureModel.fromJson(response['ProcedureList']));
_categoriesList
.add(CategoriseProcedureModel.fromJson(response['ProcedureList']));
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
@ -169,8 +155,7 @@ class ProcedureService extends BaseService {
Future postProcedure(PostProcedureReqModel postProcedureReqModel) async { Future postProcedure(PostProcedureReqModel postProcedureReqModel) async {
hasError = false; hasError = false;
_procedureList.clear(); _procedureList.clear();
await baseAppClient.post(POST_PROCEDURE_LIST, await baseAppClient.post(POST_PROCEDURE_LIST, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
print("Success"); print("Success");
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -178,12 +163,10 @@ class ProcedureService extends BaseService {
}, body: postProcedureReqModel.toJson()); }, body: postProcedureReqModel.toJson());
} }
Future updateProcedure( Future updateProcedure(UpdateProcedureRequestModel updateProcedureRequestModel) async {
UpdateProcedureRequestModel updateProcedureRequestModel) async {
hasError = false; hasError = false;
_procedureList.clear(); _procedureList.clear();
await baseAppClient.post(UPDATE_PROCEDURE, await baseAppClient.post(UPDATE_PROCEDURE, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
print("ACCEPTED"); print("ACCEPTED");
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -191,14 +174,11 @@ class ProcedureService extends BaseService {
}, body: updateProcedureRequestModel.toJson()); }, body: updateProcedureRequestModel.toJson());
} }
Future valadteProcedure( Future valadteProcedure(ProcedureValadteRequestModel procedureValadteRequestModel) async {
ProcedureValadteRequestModel procedureValadteRequestModel) async {
hasError = false; hasError = false;
_valadteProcedureList.clear(); _valadteProcedureList.clear();
await baseAppClient.post(GET_PROCEDURE_VALIDATION, await baseAppClient.post(GET_PROCEDURE_VALIDATION, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) { _valadteProcedureList.add(ProcedureValadteModel.fromJson(response['ValidateProcedureList']));
_valadteProcedureList.add(
ProcedureValadteModel.fromJson(response['ValidateProcedureList']));
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;

@ -9,19 +9,14 @@ class RadiologyService extends BaseService {
List<FinalRadiology> finalRadiologyList = List(); List<FinalRadiology> finalRadiologyList = List();
String url = ''; String url = '';
Future getRadImageURL( Future getRadImageURL({int invoiceNo, int lineItem, int projectId, @required PatiantInformtion patient}) async {
{int invoiceNo,
int lineItem,
int projectId,
@required PatiantInformtion patient}) async {
hasError = false; hasError = false;
final Map<String, dynamic> body = new Map<String, dynamic>(); final Map<String, dynamic> body = new Map<String, dynamic>();
body['InvoiceNo'] = invoiceNo; body['InvoiceNo'] = invoiceNo;
body['LineItemNo'] = lineItem; body['LineItemNo'] = lineItem;
body['ProjectID'] = projectId; body['ProjectID'] = projectId;
await baseAppClient.postPatient(GET_RAD_IMAGE_URL, patient: patient, await baseAppClient.postPatient(GET_RAD_IMAGE_URL, patient: patient, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
url = response['Data']; url = response['Data'];
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -29,24 +24,22 @@ class RadiologyService extends BaseService {
}, body: body); }, body: body);
} }
Future getPatientRadOrders(PatiantInformtion patient, Future getPatientRadOrders(PatiantInformtion patient, {isInPatient = false}) async {
{isInPatient = false}) async {
String url = GET_PATIENT_ORDERS; String url = GET_PATIENT_ORDERS;
final Map<String, dynamic> body = new Map<String, dynamic>(); final Map<String, dynamic> body = new Map<String, dynamic>();
if (isInPatient) { if (isInPatient) {
url = GET_IN_PATIENT_ORDERS; url = GET_IN_PATIENT_ORDERS;
body['ProjectID'] = patient.projectId; body['ProjectID'] = patient.projectId;
} }
finalRadiologyList.clear();
hasError = false; hasError = false;
await baseAppClient.postPatient(url, patient: patient, await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
finalRadiologyList = []; finalRadiologyList = [];
String label = "ListRAD"; String label = "ListRAD";
if (isInPatient) { if (isInPatient) {
label = "List_GetRadOreders"; label = "List_GetRadOreders";
} }
if(response[label] == null || response[label].length == 0){ if (response[label] == null || response[label].length == 0) {
label = "FinalRadiologyList"; label = "FinalRadiologyList";
} }
response[label].forEach((radiology) { response[label].forEach((radiology) {

@ -7,11 +7,12 @@ import 'package:doctor_app_flutter/core/viewModel/leave_rechdule_response.dart';
import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart';
import 'package:doctor_app_flutter/models/sickleave/extend_sick_leave_request.dart'; import 'package:doctor_app_flutter/models/sickleave/extend_sick_leave_request.dart';
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart';
import 'package:doctor_app_flutter/models/sickleave/sick_leave_statisitics_model.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
class SickLeaveService extends BaseService { class SickLeaveService extends BaseService {
Map get sickLeavestatisitics => _statistics; SickLeaveStatisticsModel get sickLeavestatisitics => _statistics;
Map _statistics = {}; SickLeaveStatisticsModel _statistics = SickLeaveStatisticsModel();
List get getOffTimeList => offTime; List get getOffTimeList => offTime;
List offTime = []; List offTime = [];
List get getReasons => reasonse; List get getReasons => reasonse;
@ -27,12 +28,9 @@ class SickLeaveService extends BaseService {
dynamic get postReschedule => _postReschedule; dynamic get postReschedule => _postReschedule;
dynamic _postReschedule; dynamic _postReschedule;
dynamic get sickLeaveResponse => _sickLeaveResponse;
dynamic _sickLeaveResponse;
List<SickLeavePatientModel> getAllSickLeavePatient = List(); List<SickLeavePatientModel> getAllSickLeavePatient = List();
List<SickLeavePatientModel> getAllSickLeaveDoctor = List(); List<SickLeavePatientModel> getAllSickLeaveDoctor = List();
//getAllSickLeavePatient.addAll(getAllSickLeaveDoctor);
SickLeavePatientRequestModel _sickLeavePatientRequestModel = SickLeavePatientRequestModel(); SickLeavePatientRequestModel _sickLeavePatientRequestModel = SickLeavePatientRequestModel();
GetSickLeaveDoctorRequestModel _sickLeaveDoctorRequestModel = GetSickLeaveDoctorRequestModel(); GetSickLeaveDoctorRequestModel _sickLeaveDoctorRequestModel = GetSickLeaveDoctorRequestModel();
@ -43,8 +41,8 @@ class SickLeaveService extends BaseService {
GET_SICKLEAVE_STATISTIC, GET_SICKLEAVE_STATISTIC,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
print(response); print(response);
_statistics = {};
_statistics = response['SickLeaveStatistics']; _statistics = SickLeaveStatisticsModel.fromJson(response['SickLeaveStatistics']);
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -55,20 +53,14 @@ class SickLeaveService extends BaseService {
} }
Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async {
// addSickLeaveRequest.appointmentNo = '2016054661';
// addSickLeaveRequest.patientMRN = '3120746';
hasError = false; hasError = false;
_sickLeaveResponse.clear();
await baseAppClient.post( await baseAppClient.post(
ADD_SICK_LEAVE, ADD_SICK_LEAVE,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_sickLeaveResponse = response;
return Future.value(response);
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
DrAppToastMsg.showErrorToast(error); hasError = true;
// hasError = true; super.error = error;
// super.error = error;
}, },
body: addSickLeaveRequest.toJson(), body: addSickLeaveRequest.toJson(),
); );
@ -84,7 +76,6 @@ class SickLeaveService extends BaseService {
await baseAppClient.post( await baseAppClient.post(
EXTEND_SICK_LEAVE, EXTEND_SICK_LEAVE,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_sickLeaveResponse = response;
return Future.value(response); return Future.value(response);
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {

@ -14,6 +14,8 @@ import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/in_patient/GetEpisodeForInpatientReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart';
@ -63,6 +65,18 @@ class SOAPService extends LookupService {
}, body: postEpisodeReqModel.toJson()); }, body: postEpisodeReqModel.toJson());
} }
Future postEpisodeForInPatient(PostEpisodeForInpatientRequestModel postEpisodeForInpatientRequestModel) async {
hasError = false;
await baseAppClient.post(POST_EPISODE_FOR_IN_PATIENT,
onSuccess: (dynamic response, int statusCode) {
episodeID = response['EpisodeID'];
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: postEpisodeForInpatientRequestModel.toJson());
}
Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async {
hasError = false; hasError = false;
@ -71,7 +85,7 @@ class SOAPService extends LookupService {
print("Success"); print("Success");
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = super.error+ "\n"+error;
}, body: postAllergyRequestModel.toJson()); }, body: postAllergyRequestModel.toJson());
} }
@ -83,13 +97,14 @@ class SOAPService extends LookupService {
print("Success"); print("Success");
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error =super.error + "\n"+error;
}, body: postHistoriesRequestModel.toJson()); }, body: postHistoriesRequestModel.toJson());
} }
Future postChiefComplaint( Future postChiefComplaint(
PostChiefComplaintRequestModel postChiefComplaintRequestModel) async { PostChiefComplaintRequestModel postChiefComplaintRequestModel) async {
hasError = false; hasError = false;
super.error ="";
await baseAppClient.post(POST_CHIEF_COMPLAINT, await baseAppClient.post(POST_CHIEF_COMPLAINT,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
print("Success"); print("Success");
@ -143,7 +158,7 @@ class SOAPService extends LookupService {
print("Success"); print("Success");
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = "\n"+error;
}, body: patchAllergyRequestModel.toJson()); }, body: patchAllergyRequestModel.toJson());
} }
@ -155,13 +170,14 @@ class SOAPService extends LookupService {
print("Success"); print("Success");
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = super.error +"\n"+error;
}, body: patchHistoriesRequestModel.toJson()); }, body: patchHistoriesRequestModel.toJson());
} }
Future patchChiefComplaint( Future patchChiefComplaint(
PostChiefComplaintRequestModel patchChiefComplaintRequestModel) async { PostChiefComplaintRequestModel patchChiefComplaintRequestModel) async {
hasError = false; hasError = false;
super.error ="";
await baseAppClient.post(PATCH_CHIEF_COMPLAINT, await baseAppClient.post(PATCH_CHIEF_COMPLAINT,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
print("Success"); print("Success");
@ -302,4 +318,19 @@ class SOAPService extends LookupService {
super.error = error; super.error = error;
}, body: getAssessmentReqModel.toJson()); }, body: getAssessmentReqModel.toJson());
} }
Future getEpisodeForInpatient(
GetEpisodeForInpatientReqModel getEpisodeForInpatientReqModel) async {
hasError = false;
await baseAppClient.post(GET_EPISODE_FOR_INPATIENT,
onSuccess: (dynamic response, int statusCode) {
print("Success");
episodeID = response["GetEpisodeNo"];
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: getEpisodeForInpatientReqModel.toJson());
}
} }

@ -8,8 +8,8 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart';
class UcafService extends LookupService { class UcafService extends LookupService {
List<GetChiefComplaintResModel> patientChiefComplaintList = []; List<GetChiefComplaintResModel> patientChiefComplaintList;
List<VitalSignHistory> patientVitalSignsHistory = []; List<VitalSignHistory> patientVitalSignsHistory;
List<GetAssessmentResModel> patientAssessmentList = []; List<GetAssessmentResModel> patientAssessmentList = [];
List<OrderProcedure> orderProcedureList = []; List<OrderProcedure> orderProcedureList = [];
PrescriptionModel prescriptionList; PrescriptionModel prescriptionList;
@ -17,15 +17,20 @@ class UcafService extends LookupService {
Future getPatientChiefComplaint(PatiantInformtion patient) async { Future getPatientChiefComplaint(PatiantInformtion patient) async {
hasError = false; hasError = false;
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['PatientMRN'] = patient.patientMRN ; body['PatientMRN'] = patient.patientMRN;
body['AppointmentNo'] = patient.appointmentNo; body['AppointmentNo'] = patient.appointmentNo;
body['EpisodeID'] = patient.episodeNo ; body['EpisodeID'] = patient.episodeNo;
body['DoctorID'] = ""; body['DoctorID'] = "";
patientChiefComplaintList = null;
await baseAppClient.post(GET_CHIEF_COMPLAINT, await baseAppClient.post(GET_CHIEF_COMPLAINT,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
print("Success"); print("Success");
patientChiefComplaintList.clear(); if (patientChiefComplaintList != null) {
patientChiefComplaintList.clear();
} else {
patientChiefComplaintList = new List();
}
response['List_ChiefComplaint']['entityList'].forEach((v) { response['List_ChiefComplaint']['entityList'].forEach((v) {
patientChiefComplaintList.add(GetChiefComplaintResModel.fromJson(v)); patientChiefComplaintList.add(GetChiefComplaintResModel.fromJson(v));
}); });
@ -47,10 +52,15 @@ class UcafService extends LookupService {
body['InOutPatientType'] = 2; body['InOutPatientType'] = 2;
} }
patientVitalSignsHistory = null;
await baseAppClient.post( await baseAppClient.post(
GET_PATIENT_VITAL_SIGN, GET_PATIENT_VITAL_SIGN,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
patientVitalSignsHistory.clear(); if (patientVitalSignsHistory != null) {
patientVitalSignsHistory.clear();
} else {
patientVitalSignsHistory = new List();
}
if (response['List_DoctorPatientVitalSign'] != null) { if (response['List_DoctorPatientVitalSign'] != null) {
response['List_DoctorPatientVitalSign'].forEach((v) { response['List_DoctorPatientVitalSign'].forEach((v) {
patientVitalSignsHistory.add(new VitalSignHistory.fromJson(v)); patientVitalSignsHistory.add(new VitalSignHistory.fromJson(v));
@ -79,10 +89,15 @@ class UcafService extends LookupService {
body['From'] = fromDate; body['From'] = fromDate;
body['To'] = toDate; body['To'] = toDate;
patientVitalSignsHistory = null;
await baseAppClient.post( await baseAppClient.post(
GET_PATIENT_VITAL_SIGN_DATA, GET_PATIENT_VITAL_SIGN_DATA,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
patientVitalSignsHistory.clear(); if (patientVitalSignsHistory != null) {
patientVitalSignsHistory.clear();
} else {
patientVitalSignsHistory = new List();
}
if (response['VitalSignsHistory'] != null) { if (response['VitalSignsHistory'] != null) {
response['VitalSignsHistory'].forEach((v) { response['VitalSignsHistory'].forEach((v) {
patientVitalSignsHistory.add(new VitalSignHistory.fromJson(v)); patientVitalSignsHistory.add(new VitalSignHistory.fromJson(v));

@ -14,26 +14,39 @@ 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>(); SpecialClinicsService _specialClinicsService =
locator<SpecialClinicsService>();
List<PatiantInformtion> get patientList => _outPatientService.patientList; List<PatiantInformtion> get patientList => _outPatientService.patientList;
List<GetSpecialClinicalCareMappingListResponseModel> get specialClinicalCareMappingList =>
_specialClinicsService.specialClinicalCareMappingList; List<GetSpecialClinicalCareMappingListResponseModel>
get specialClinicalCareMappingList =>
_specialClinicsService.specialClinicalCareMappingList;
List<PatiantInformtion> filterData = []; List<PatiantInformtion> filterData = [];
DateTime selectedFromDate; DateTime selectedFromDate;
DateTime selectedToDate; DateTime selectedToDate;
int firstSubsetIndex = 0;
int inPatientPageSize = 20;
int lastSubsetIndex = 20;
List<String> InpatientClinicList = [];
searchData(String str) { searchData(String str) {
var strExist = str.length > 0 ? true : false; var strExist = str.length > 0 ? true : false;
if (strExist) { if (strExist) {
filterData = []; filterData = [];
for (var i = 0; i < _outPatientService.patientList.length; i++) { for (var i = 0; i < _outPatientService.patientList.length; i++) {
String firstName = _outPatientService.patientList[i].firstName.toUpperCase(); String firstName =
String lastName = _outPatientService.patientList[i].lastName.toUpperCase(); _outPatientService.patientList[i].firstName.toUpperCase();
String mobile = _outPatientService.patientList[i].mobileNumber.toUpperCase(); String lastName =
String patientID = _outPatientService.patientList[i].patientId.toString(); _outPatientService.patientList[i].lastName.toUpperCase();
String mobile =
_outPatientService.patientList[i].mobileNumber.toUpperCase();
String patientID =
_outPatientService.patientList[i].patientId.toString();
if (firstName.contains(str.toUpperCase()) || if (firstName.contains(str.toUpperCase()) ||
lastName.contains(str.toUpperCase()) || lastName.contains(str.toUpperCase()) ||
@ -49,7 +62,8 @@ class PatientSearchViewModel extends BaseViewModel {
} }
} }
getOutPatient(PatientSearchRequestModel patientSearchRequestModel, {bool isLocalBusy = false}) async { getOutPatient(PatientSearchRequestModel patientSearchRequestModel,
{bool isLocalBusy = false}) async {
if (isLocalBusy) { if (isLocalBusy) {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
} else { } else {
@ -74,16 +88,16 @@ class PatientSearchViewModel extends BaseViewModel {
sortOutPatient({bool isDes = false}) { sortOutPatient({bool isDes = false}) {
if (isDes) if (isDes)
filterData = filterData.reversed.toList(); filterData = filterData.reversed.toList();
// filterData.sort((PatiantInformtion a, PatiantInformtion b)=>b.appointmentDateWithDateTimeForm.compareTo(a.appointmentDateWithDateTimeForm));
else else
filterData = filterData.reversed.toList(); filterData = filterData.reversed.toList();
// filterData.sort((PatiantInformtion a, PatiantInformtion b)=>a.appointmentDateWithDateTimeForm.compareTo(b.appointmentDateWithDateTimeForm));
setState(ViewState.Idle); setState(ViewState.Idle);
} }
getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel, {bool isLocalBusy = false}) async { getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel,
{bool isLocalBusy = false}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _outPatientService.getPatientFileInformation(patientSearchRequestModel); await _outPatientService
.getPatientFileInformation(patientSearchRequestModel);
if (_outPatientService.hasError) { if (_outPatientService.hasError) {
error = _outPatientService.error; error = _outPatientService.error;
setState(ViewState.Error); setState(ViewState.Error);
@ -102,21 +116,32 @@ class PatientSearchViewModel extends BaseViewModel {
String dateTo; String dateTo;
String dateFrom; String dateFrom;
if (OutPatientFilterType.Previous == outPatientFilterType) { if (OutPatientFilterType.Previous == outPatientFilterType) {
selectedFromDate = DateTime(DateTime.now().year, DateTime.now().month - 1, DateTime.now().day); selectedFromDate = DateTime(
selectedToDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day - 1); DateTime.now().year, DateTime.now().month - 1, DateTime.now().day);
selectedToDate = DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day - 1);
dateTo = AppDateUtils.convertDateToFormat(selectedToDate, 'yyyy-MM-dd'); dateTo = AppDateUtils.convertDateToFormat(selectedToDate, 'yyyy-MM-dd');
dateFrom = AppDateUtils.convertDateToFormat(selectedFromDate, 'yyyy-MM-dd'); dateFrom =
AppDateUtils.convertDateToFormat(selectedFromDate, 'yyyy-MM-dd');
} else if (OutPatientFilterType.NextWeek == outPatientFilterType) { } else if (OutPatientFilterType.NextWeek == outPatientFilterType) {
dateTo = AppDateUtils.convertDateToFormat( dateTo = AppDateUtils.convertDateToFormat(
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 6), 'yyyy-MM-dd'); DateTime(DateTime.now().year, DateTime.now().month,
DateTime.now().day + 6),
'yyyy-MM-dd');
dateFrom = AppDateUtils.convertDateToFormat( dateFrom = AppDateUtils.convertDateToFormat(
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 1), 'yyyy-MM-dd'); DateTime(DateTime.now().year, DateTime.now().month,
DateTime.now().day + 1),
'yyyy-MM-dd');
} else { } else {
dateFrom = AppDateUtils.convertDateToFormat( dateFrom = AppDateUtils.convertDateToFormat(
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd'); DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day),
'yyyy-MM-dd');
dateTo = AppDateUtils.convertDateToFormat( dateTo = AppDateUtils.convertDateToFormat(
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd'); DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day),
'yyyy-MM-dd');
} }
PatientSearchRequestModel currentModel = PatientSearchRequestModel(); PatientSearchRequestModel currentModel = PatientSearchRequestModel();
currentModel.patientID = patientSearchRequestModel.patientID; currentModel.patientID = patientSearchRequestModel.patientID;
@ -130,13 +155,16 @@ class PatientSearchViewModel extends BaseViewModel {
filterData = _outPatientService.patientList; filterData = _outPatientService.patientList;
} }
PatientInPatientService _inPatientService = locator<PatientInPatientService>(); PatientInPatientService _inPatientService =
locator<PatientInPatientService>();
List<PatiantInformtion> get inPatientList => _inPatientService.inPatientList; List<PatiantInformtion> get inPatientList => _inPatientService.inPatientList;
List<PatiantInformtion> get myIinPatientList => _inPatientService.myInPatientList; List<PatiantInformtion> get myIinPatientList =>
_inPatientService.myInPatientList;
List<PatiantInformtion> filteredInPatientItems = List(); List<PatiantInformtion> filteredInPatientItems = List();
List<PatiantInformtion> filteredMyInPatientItems = List();
Future getInPatientList(PatientSearchRequestModel requestModel, Future getInPatientList(PatientSearchRequestModel requestModel,
{bool isMyInpatient = false, bool isLocalBusy = false}) async { {bool isMyInpatient = false, bool isLocalBusy = false}) async {
@ -146,7 +174,8 @@ class PatientSearchViewModel extends BaseViewModel {
} else { } else {
setState(ViewState.Busy); setState(ViewState.Busy);
} }
if (inPatientList.length == 0) await _inPatientService.getInPatientList(requestModel, false); if (inPatientList.length == 0)
await _inPatientService.getInPatientList(requestModel, false);
if (_inPatientService.hasError) { if (_inPatientService.hasError) {
error = _inPatientService.error; error = _inPatientService.error;
if (isLocalBusy) { if (isLocalBusy) {
@ -155,60 +184,222 @@ class PatientSearchViewModel extends BaseViewModel {
setState(ViewState.Error); setState(ViewState.Error);
} }
} else { } else {
// setDefaultInPatientList(); setDefaultInPatientList();
generateInpatientClinicList();
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
sortInPatient({bool isDes = false}) { sortInPatient({bool isDes = false, bool isAllClinic, bool isMyInPatient}) {
if (isDes) if (isMyInPatient
filteredInPatientItems.sort((PatiantInformtion a, PatiantInformtion b) => ? myIinPatientList.length > 0
b.admissionDateWithDateTimeForm.compareTo(a.admissionDateWithDateTimeForm)); : isAllClinic
else ? inPatientList.length > 0
filteredInPatientItems.sort((PatiantInformtion a, PatiantInformtion b) => : filteredInPatientItems.length > 0) {
a.admissionDateWithDateTimeForm.compareTo(b.admissionDateWithDateTimeForm)); List<PatiantInformtion> localInPatient = isMyInPatient
? [...filteredMyInPatientItems]
: isAllClinic
? [...inPatientList]
: [...filteredInPatientItems];
if (isDes)
localInPatient.sort((PatiantInformtion a, PatiantInformtion b) => b
.admissionDateWithDateTimeForm
.compareTo(a.admissionDateWithDateTimeForm));
else
localInPatient.sort((PatiantInformtion a, PatiantInformtion b) => a
.admissionDateWithDateTimeForm
.compareTo(b.admissionDateWithDateTimeForm));
if (isMyInPatient) {
filteredMyInPatientItems.clear();
filteredMyInPatientItems.addAll(localInPatient);
} else if (isAllClinic) {
resetInPatientPagination();
filteredInPatientItems
.addAll(localInPatient.sublist(firstSubsetIndex, lastSubsetIndex));
} else {
filteredInPatientItems.clear();
filteredInPatientItems.addAll(localInPatient);
}
}
setState(ViewState.Idle); setState(ViewState.Idle);
} }
resetInPatientPagination() {
filteredInPatientItems.clear();
firstSubsetIndex = 0;
lastSubsetIndex = inPatientPageSize - 1;
}
Future setDefaultInPatientList() async { Future setDefaultInPatientList() async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await getDoctorProfile(); await getDoctorProfile();
filteredInPatientItems.clear(); resetInPatientPagination();
if (inPatientList.length > 0) filteredInPatientItems.addAll(inPatientList); if (inPatientList.length > 0) {
lastSubsetIndex = (inPatientList.length < inPatientPageSize - 1
? inPatientList.length
: inPatientPageSize - 1);
filteredInPatientItems
.addAll(inPatientList.sublist(firstSubsetIndex, lastSubsetIndex));
}
if (myIinPatientList.length > 0) {
filteredMyInPatientItems.addAll(myIinPatientList);
}
setState(ViewState.Idle); setState(ViewState.Idle);
} }
generateInpatientClinicList() {
InpatientClinicList.clear();
inPatientList.forEach((element) {
if (!InpatientClinicList.contains(element.clinicDescription)) {
InpatientClinicList.add(element.clinicDescription);
}
});
}
addOnFilteredList() {
if (lastSubsetIndex < inPatientList.length) {
firstSubsetIndex = firstSubsetIndex +
(inPatientList.length - lastSubsetIndex < inPatientPageSize - 1
? inPatientList.length - lastSubsetIndex
: inPatientPageSize - 1);
lastSubsetIndex = lastSubsetIndex +
(inPatientList.length - lastSubsetIndex < inPatientPageSize - 1
? inPatientList.length - lastSubsetIndex
: inPatientPageSize - 1);
filteredInPatientItems
.addAll(inPatientList.sublist(firstSubsetIndex, lastSubsetIndex));
setState(ViewState.Idle);
}
}
removeOnFilteredList() {
if (lastSubsetIndex - inPatientPageSize - 1 > 0) {
filteredInPatientItems.removeAt(lastSubsetIndex - inPatientPageSize - 1);
setState(ViewState.Idle);
}
}
filterByHospital({int hospitalId}) {
filteredInPatientItems = [];
for (var i = 0; i < inPatientList.length; i++) {
if (inPatientList[i].projectId == hospitalId) {
filteredInPatientItems.add(inPatientList[i]);
}
}
notifyListeners();
}
filterByClinic({String clinicName}) {
filteredInPatientItems = [];
for (var i = 0; i < inPatientList.length; i++) {
if (inPatientList[i].clinicDescription == clinicName) {
filteredInPatientItems.add(inPatientList[i]);
}
}
notifyListeners();
}
void clearPatientList() { void clearPatientList() {
_inPatientService.inPatientList = []; _inPatientService.inPatientList = [];
_inPatientService.myInPatientList = []; _inPatientService.myInPatientList = [];
} }
void filterSearchResults(String query) { void filterSearchResults(String query,
{bool isAllClinic, bool isMyInPatient}) {
var strExist = query.length > 0 ? true : false; var strExist = query.length > 0 ? true : false;
if (strExist) {
filteredInPatientItems = []; if (isMyInPatient) {
for (var i = 0; i < inPatientList.length; i++) { List<PatiantInformtion> localFilteredMyInPatientItems = [
String firstName = inPatientList[i].firstName.toUpperCase(); ...myIinPatientList
String lastName = inPatientList[i].lastName.toUpperCase(); ];
String mobile = inPatientList[i].mobileNumber.toUpperCase();
String patientID = inPatientList[i].patientId.toString(); if (strExist) {
filteredMyInPatientItems.clear();
if (firstName.contains(query.toUpperCase()) || for (var i = 0; i < localFilteredMyInPatientItems.length; i++) {
lastName.contains(query.toUpperCase()) || String firstName =
mobile.contains(query) || localFilteredMyInPatientItems[i].firstName.toUpperCase();
patientID.contains(query)) { String lastName =
filteredInPatientItems.add(inPatientList[i]); localFilteredMyInPatientItems[i].lastName.toUpperCase();
String mobile =
localFilteredMyInPatientItems[i].mobileNumber.toUpperCase();
String patientID =
localFilteredMyInPatientItems[i].patientId.toString();
if (firstName.contains(query.toUpperCase()) ||
lastName.contains(query.toUpperCase()) ||
mobile.contains(query) ||
patientID.contains(query)) {
filteredMyInPatientItems.add(localFilteredMyInPatientItems[i]);
}
} }
notifyListeners();
} else {
if (myIinPatientList.length > 0) filteredMyInPatientItems.clear();
filteredMyInPatientItems.addAll(myIinPatientList);
notifyListeners();
} }
notifyListeners();
} else { } else {
if (inPatientList.length > 0) filteredInPatientItems.clear(); if (isAllClinic) {
filteredInPatientItems.addAll(inPatientList); if (strExist) {
notifyListeners(); filteredInPatientItems = [];
for (var i = 0; i < inPatientList.length; i++) {
String firstName = inPatientList[i].firstName.toUpperCase();
String lastName = inPatientList[i].lastName.toUpperCase();
String mobile = inPatientList[i].mobileNumber.toUpperCase();
String patientID = inPatientList[i].patientId.toString();
if (firstName.contains(query.toUpperCase()) ||
lastName.contains(query.toUpperCase()) ||
mobile.contains(query) ||
patientID.contains(query)) {
filteredInPatientItems.add(inPatientList[i]);
}
}
notifyListeners();
} else {
if (inPatientList.length > 0) filteredInPatientItems.clear();
filteredInPatientItems.addAll(inPatientList);
notifyListeners();
}
} else {
List<PatiantInformtion> localFilteredInPatientItems = [
...filteredInPatientItems
];
if (strExist) {
filteredInPatientItems.clear();
for (var i = 0; i < localFilteredInPatientItems.length; i++) {
String firstName =
localFilteredInPatientItems[i].firstName.toUpperCase();
String lastName =
localFilteredInPatientItems[i].lastName.toUpperCase();
String mobile =
localFilteredInPatientItems[i].mobileNumber.toUpperCase();
String patientID =
localFilteredInPatientItems[i].patientId.toString();
if (firstName.contains(query.toUpperCase()) ||
lastName.contains(query.toUpperCase()) ||
mobile.contains(query) ||
patientID.contains(query)) {
filteredInPatientItems.add(localFilteredInPatientItems[i]);
}
}
notifyListeners();
} else {
if (localFilteredInPatientItems.length > 0)
filteredInPatientItems.clear();
filteredInPatientItems.addAll(localFilteredInPatientItems);
notifyListeners();
}
}
} }
} }
getSpecialClinicalCareMappingList(clinicId, {bool isLocalBusy = false}) async { getSpecialClinicalCareMappingList(clinicId,
{bool isLocalBusy = false}) async {
if (isLocalBusy) { if (isLocalBusy) {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
} else { } else {

@ -19,6 +19,8 @@ import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/in_patient/GetEpisodeForInpatientReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/in_patient/PostEpisodeForInpatientRequestModel.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart';
@ -26,6 +28,14 @@ import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_mode
import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart';
import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart';
import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/assessment/assessment_call_back.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/objective/objective_call_back.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/plan_call_back.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjective_call_back.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../locator.dart'; import '../../locator.dart';
@ -83,15 +93,67 @@ class SOAPViewModel extends BaseViewModel {
List<GetAssessmentResModel> get patientAssessmentList => List<GetAssessmentResModel> get patientAssessmentList =>
_SOAPService.patientAssessmentList; _SOAPService.patientAssessmentList;
int get episodeID => _SOAPService.episodeID; int get episodeID => _SOAPService.episodeID;
bool isAddProgress = true;
bool isAddExamInProgress = true;
String progressNoteText = "";
String complaintsControllerError = '';
String medicationControllerError = '';
String illnessControllerError = '';
get medicationStrengthList => _SOAPService.medicationStrengthListWithModel; get medicationStrengthList => _SOAPService.medicationStrengthListWithModel;
get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel; get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel;
get medicationRouteList => _SOAPService.medicationRouteListWithModel; get medicationRouteList => _SOAPService.medicationRouteListWithModel;
get medicationFrequencyList => _SOAPService.medicationFrequencyListWithModel; get medicationFrequencyList => _SOAPService.medicationFrequencyListWithModel;
List<GetMedicationResponseModel> get allMedicationList => List<GetMedicationResponseModel> get allMedicationList =>
_prescriptionService.allMedicationList; _prescriptionService.allMedicationList;
SubjectiveCallBack subjectiveCallBack;
setSubjectiveCallBack(SubjectiveCallBack callBack) {
this.subjectiveCallBack = callBack;
}
nextOnSubjectPage(model) {
subjectiveCallBack.nextFunction(model);
}
ObjectiveCallBack objectiveCallBack;
setObjectiveCallBack(ObjectiveCallBack callBack) {
this.objectiveCallBack = callBack;
}
nextOnObjectivePage(model) {
objectiveCallBack.nextFunction(model);
}
AssessmentCallBack assessmentCallBack;
setAssessmentCallBack(AssessmentCallBack callBack) {
this.assessmentCallBack = callBack;
}
nextOnAssessmentPage(model) {
assessmentCallBack.nextFunction(model);
}
PlanCallBack planCallBack;
setPlanCallBack(PlanCallBack callBack) {
this.planCallBack = callBack;
}
nextOnPlanPage(model) {
planCallBack.nextFunction(model);
}
Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _SOAPService.getAllergies(getAllergiesRequestModel); await _SOAPService.getAllergies(getAllergiesRequestModel);
@ -126,31 +188,12 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { Future postEpisodeForInPatient(
setState(ViewState.BusyLocal); PostEpisodeForInpatientRequestModel
await _SOAPService.postAllergy(postAllergyRequestModel); postEpisodeForInpatientRequestModel) async {
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future postHistories(
PostHistoriesRequestModel postHistoriesRequestModel) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _SOAPService.postHistories(postHistoriesRequestModel); await _SOAPService.postEpisodeForInPatient(
if (_SOAPService.hasError) { postEpisodeForInpatientRequestModel);
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future postChiefComplaint(
PostChiefComplaintRequestModel postChiefComplaintRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.postChiefComplaint(postChiefComplaintRequestModel);
if (_SOAPService.hasError) { if (_SOAPService.hasError) {
error = _SOAPService.error; error = _SOAPService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -191,38 +234,6 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future patchAllergy(PostAllergyRequestModel patchAllergyRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.patchAllergy(patchAllergyRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future patchHistories(
PostHistoriesRequestModel patchHistoriesRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.patchHistories(patchHistoriesRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future patchChiefComplaint(
PostChiefComplaintRequestModel patchChiefComplaintRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.patchChiefComplaint(patchChiefComplaintRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future patchPhysicalExam( Future patchPhysicalExam(
PostPhysicalExamRequestModel patchPhysicalExamRequestModel) async { PostPhysicalExamRequestModel patchPhysicalExamRequestModel) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
@ -288,31 +299,25 @@ class SOAPViewModel extends BaseViewModel {
return allergiesString; return allergiesString;
} }
Future getPatientHistories(GetHistoryReqModel getHistoryReqModel,
{bool isFirst = false}) async {
setState(ViewState.Busy);
await _SOAPService.getPatientHistories(getHistoryReqModel,
isFirst: isFirst);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future getPatientChiefComplaint(
GetChiefComplaintReqModel getChiefComplaintReqModel) async {
setState(ViewState.Busy);
await _SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future getPatientPhysicalExam( Future getPatientPhysicalExam(
GetPhysicalExamReqModel getPhysicalExamReqModel) async { PatiantInformtion patientInfo,
) async {
GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel(
patientMRN: patientInfo.patientMRN,
episodeID: patientInfo.episodeNo == null
? "0"
: patientInfo.episodeNo.toString(),
appointmentNo: patientInfo.appointmentNo == null
? 0
: int.parse(
patientInfo.appointmentNo.toString(),
),
);
if (patientInfo.admissionNo != null && patientInfo.admissionNo.isNotEmpty)
getPhysicalExamReqModel.admissionNo = int.parse(patientInfo.admissionNo);
else
getPhysicalExamReqModel.admissionNo = 0;
setState(ViewState.Busy); setState(ViewState.Busy);
await _SOAPService.getPatientPhysicalExam(getPhysicalExamReqModel); await _SOAPService.getPatientPhysicalExam(getPhysicalExamReqModel);
if (_SOAPService.hasError) { if (_SOAPService.hasError) {
@ -354,6 +359,23 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getEpisodeForInpatient(PatiantInformtion patient) async {
setState(ViewState.BusyLocal);
GetEpisodeForInpatientReqModel getEpisodeForInpatientReqModel =
GetEpisodeForInpatientReqModel(
patientID: patient.patientId,
admissionNo: int.parse(patient.admissionNo),
patientTypeID: 1);
await _SOAPService.getEpisodeForInpatient(getEpisodeForInpatientReqModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else {
patient.episodeNo = _SOAPService.episodeID;
setState(ViewState.Idle);
}
}
// ignore: missing_return // ignore: missing_return
MasterKeyModel getOneMasterKey( MasterKeyModel getOneMasterKey(
{@required MasterKeysService masterKeys, dynamic id, int typeId}) { {@required MasterKeysService masterKeys, dynamic id, int typeId}) {
@ -466,4 +488,382 @@ class SOAPViewModel extends BaseViewModel {
break; break;
} }
} }
int getFirstIndexForOldExamination(
List<MySelectedExamination> mySelectedExamination) {
Iterable<MySelectedExamination> examList =
mySelectedExamination.where((element) => !element.isLocal);
if (examList.length > 0) {
return mySelectedExamination.indexOf(examList.first);
} else
return -1;
}
onUpdateSubjectStepStart(PatiantInformtion patientInfo) async {
GetChiefComplaintReqModel getChiefComplaintReqModel =
GetChiefComplaintReqModel(
admissionNo:
patientInfo
.admissionNo !=
null
? int.parse(patientInfo.admissionNo)
: null,
patientMRN: patientInfo.patientMRN,
appointmentNo: patientInfo.appointmentNo != null
? int.parse(patientInfo.appointmentNo.toString())
: null,
episodeId: patientInfo.episodeNo,
episodeID: patientInfo.episodeNo,
doctorID: '');
var services = [
_SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel)
];
if (patientInfo.admissionNo == null) {
complaintsControllerError = '';
medicationControllerError = '';
illnessControllerError = '';
GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel(
patientMRN: patientInfo.patientMRN,
episodeID: patientInfo.episodeNo.toString(),
appointmentNo: int.parse(patientInfo.appointmentNo.toString()),
doctorID: '',
editedBy: '');
services.add(
_SOAPService.getPatientHistories(getHistoryReqModel, isFirst: true));
GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP(
patientMRN: patientInfo.patientMRN,
episodeId: patientInfo.episodeNo,
appointmentNo: int.parse(patientInfo.appointmentNo.toString()),
doctorID: '',
editedBy: '');
services.add(_SOAPService.getPatientAllergy(generalGetReqForSOAP));
}
final results = await Future.wait(services);
await callServicesAfterGetPatientInfoForUpdateSubject();
}
callServicesAfterGetPatientInfoForUpdateSubject() async {
var services;
if (patientHistoryList.isNotEmpty) {
if (historyFamilyList.isEmpty) {
if (services == null) {
services = [
_SOAPService.getMasterLookup(MasterKeysService.HistoryFamily)
];
} else {
services.add(
_SOAPService.getMasterLookup(MasterKeysService.HistoryFamily));
}
}
if (historyMedicalList.isEmpty) {
if (services == null) {
services = [
_SOAPService.getMasterLookup(MasterKeysService.HistoryMedical)
];
} else
services.add(
_SOAPService.getMasterLookup(MasterKeysService.HistoryMedical));
}
if (historySurgicalList.length == 0) {
if (services == null) {
services = [
_SOAPService.getMasterLookup(MasterKeysService.HistorySurgical)
];
} else
services.add(
_SOAPService.getMasterLookup(MasterKeysService.HistorySurgical));
}
if (historySportList.length == 0) {
if (services == null) {
services = [
_SOAPService.getMasterLookup(MasterKeysService.HistorySports)
];
} else
services.add(
_SOAPService.getMasterLookup(MasterKeysService.HistorySports));
}
}
if (patientAllergiesList.isNotEmpty) {
if (allergiesList.isEmpty) if (services == null) {
services = [_SOAPService.getMasterLookup(MasterKeysService.Allergies)];
} else
services.add(_SOAPService.getMasterLookup(MasterKeysService.Allergies));
if (allergySeverityList.isEmpty) {
if (services == null) {
services = [
_SOAPService.getMasterLookup(MasterKeysService.AllergySeverity)
];
} else
services.add(
_SOAPService.getMasterLookup(MasterKeysService.AllergySeverity));
}
}
final results = await Future.wait(services ?? []);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
onAddMedicationStart() async {
setState(ViewState.Busy);
var services;
if (medicationStrengthList.length == 0) {
if (services == null) {
services = [
_SOAPService.getMasterLookup(MasterKeysService.MedicationStrength)
];
} else {
services.add(
_SOAPService.getMasterLookup(MasterKeysService.MedicationStrength));
}
}
if (medicationFrequencyList.length == 0) {
if (services == null) {
services = [
_SOAPService.getMasterLookup(MasterKeysService.MedicationFrequency)
];
} else {
services.add(_SOAPService.getMasterLookup(
MasterKeysService.MedicationFrequency));
}
}
if (medicationDoseTimeList.length == 0) {
if (services == null) {
services = [
_SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime)
];
} else {
services.add(
_SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime));
}
}
if (medicationRouteList.length == 0) {
if (services == null) {
services = [
_SOAPService.getMasterLookup(MasterKeysService.MedicationRoute)
];
} else {
services.add(
_SOAPService.getMasterLookup(MasterKeysService.MedicationRoute));
}
}
if (allMedicationList.length == 0) {
if (services == null) {
services = [_prescriptionService.getMedicationList()];
} else {
services.add(_prescriptionService.getMedicationList());
}
}
final results = await Future.wait(services ?? []);
if (_SOAPService.hasError || _prescriptionService.hasError) {
error = _SOAPService.error + _prescriptionService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
callAddAssessmentLookupsServices({bool allowSetState = true}) async {
if (allowSetState) setState(ViewState.Busy);
var services;
if (listOfDiagnosisCondition.length == 0) {
if (services == null) {
services = [
_SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition)
];
} else {
services.add(
_SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition));
}
}
if (listOfDiagnosisType.length == 0) {
if (services == null) {
services = [
_SOAPService.getMasterLookup(MasterKeysService.DiagnosisType)
];
} else {
services
.add(_SOAPService.getMasterLookup(MasterKeysService.DiagnosisType));
}
}
if (listOfICD10.length == 0) {
if (services == null) {
services = [_SOAPService.getMasterLookup(MasterKeysService.ICD10)];
} else {
services.add(_SOAPService.getMasterLookup(MasterKeysService.ICD10));
}
}
final results = await Future.wait(services ?? []);
if (allowSetState) {
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
}
onUpdateAssessmentStepStart(PatiantInformtion patientInfo) async {
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel(
patientMRN: patientInfo.patientMRN,
episodeID: patientInfo.episodeNo.toString(),
editedBy: '',
doctorID: '',
appointmentNo: int.parse(patientInfo.appointmentNo.toString()));
var services = [_SOAPService.getPatientAssessment(getAssessmentReqModel)];
final results = await Future.wait(services);
if (patientAssessmentList.isNotEmpty) {
await callAddAssessmentLookupsServices(allowSetState: false);
}
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
postSubjectServices(
{patientInfo,
String complaintsText,
String medicationText,
String illnessText,
List<MySelectedHistory> myHistoryList,
List<MySelectedAllergy> myAllergiesList}) async {
var services;
PostChiefComplaintRequestModel postChiefComplaintRequestModel =
createPostChiefComplaintRequestModel(
patientInfo: patientInfo,
illnessText: illnessText,
medicationText: medicationText,
complaintsText: complaintsText);
if (patientChiefComplaintList.isEmpty) {
postChiefComplaintRequestModel.editedBy = '';
services = [
_SOAPService.postChiefComplaint(postChiefComplaintRequestModel)
];
} else {
postChiefComplaintRequestModel.editedBy = '';
services = [
_SOAPService.patchChiefComplaint(postChiefComplaintRequestModel)
];
}
if (myHistoryList.length != 0) {
PostHistoriesRequestModel postHistoriesRequestModel =
createPostHistoriesRequestModel(
patientInfo: patientInfo, myHistoryList: myHistoryList);
if (patientHistoryList.isEmpty) {
services.add(_SOAPService.postHistories(postHistoriesRequestModel));
} else {
services.add(_SOAPService.patchHistories(postHistoriesRequestModel));
}
}
if (myAllergiesList.length != 0) {
PostAllergyRequestModel postAllergyRequestModel =createPostAllergyRequestModel (myAllergiesList:myAllergiesList, patientInfo: patientInfo);
if (patientAllergiesList.isEmpty) {
services.add(_SOAPService.postAllergy(postAllergyRequestModel));
} else {
services.add(_SOAPService.patchAllergy(postAllergyRequestModel));
}
}
final results = await Future.wait(services);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
PostChiefComplaintRequestModel createPostChiefComplaintRequestModel(
{patientInfo,
String complaintsText,
String medicationText,
String illnessText}) {
return new PostChiefComplaintRequestModel(
admissionNo: patientInfo.admissionNo != null
? int.parse(patientInfo.admissionNo)
: null,
patientMRN: patientInfo.patientMRN,
episodeID: patientInfo.episodeNo ?? 0,
appointmentNo: patientInfo.appointmentNo ?? 0,
chiefComplaint: complaintsText,
currentMedication: medicationText,
hopi: illnessText,
isLactation: false,
ispregnant: false,
doctorID: '',
numberOfWeeks: 0);
}
PostHistoriesRequestModel createPostHistoriesRequestModel(
{patientInfo, List<MySelectedHistory> myHistoryList}) {
PostHistoriesRequestModel postHistoriesRequestModel =
new PostHistoriesRequestModel(doctorID: '');
myHistoryList.forEach((history) {
if (postHistoriesRequestModel.listMedicalHistoryVM == null)
postHistoriesRequestModel.listMedicalHistoryVM = [];
postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM(
patientMRN: patientInfo.patientMRN,
episodeId: patientInfo.episodeNo,
appointmentNo: patientInfo.appointmentNo,
remarks: "",
historyId: history.selectedHistory.id,
historyType: history.selectedHistory.typeId,
isChecked: history.isChecked,
));
});
return postHistoriesRequestModel;
}
PostAllergyRequestModel createPostAllergyRequestModel({myAllergiesList, patientInfo}){
PostAllergyRequestModel postAllergyRequestModel =
new PostAllergyRequestModel();
myAllergiesList.forEach((allergy) {
if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM ==
null)
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = [];
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add(
ListHisProgNotePatientAllergyDiseaseVM(
allergyDiseaseId: allergy.selectedAllergy.id,
allergyDiseaseType: allergy.selectedAllergy.typeId,
patientMRN: patientInfo.patientMRN,
episodeId: patientInfo.episodeNo,
appointmentNo: patientInfo.appointmentNo,
severity: allergy.selectedAllergySeverity.id,
remarks: allergy.remark,
createdBy: allergy.createdBy ?? doctorProfile.doctorID,
createdOn: DateTime.now().toIso8601String(),
editedBy: doctorProfile.doctorID,
editedOn: DateTime.now().toIso8601String(),
isChecked: allergy.isChecked,
isUpdatedByNurse: false));
});
return postAllergyRequestModel;
}
} }

@ -70,35 +70,25 @@ class AuthenticationViewModel extends BaseViewModel {
bool isLogin = false; bool isLogin = false;
bool unverified = false; bool unverified = false;
bool isFromLogin = false; bool isFromLogin = false;
APP_STATUS app_status = APP_STATUS.LOADING; APP_STATUS appStatus = APP_STATUS.LOADING;
String localToken ="";
AuthenticationViewModel({bool checkDeviceInfo = false}) { AuthenticationViewModel({bool checkDeviceInfo = false}) {
getDeviceInfoFromFirebase(); getDeviceInfoFromFirebase();
getDoctorProfile(); getDoctorProfile();
} }
/// select Device IMEI
Future selectDeviceImei(imei) async {
setState(ViewState.Busy);
await _authService.selectDeviceImei(imei);
if (_authService.hasError) {
error = _authService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
/// Insert Device IMEI /// Insert Device IMEI
Future insertDeviceImei() async { Future insertDeviceImei(token) async {
var loggedIn = await sharedPref.getObj(LOGGED_IN_USER); var loggedIn = await sharedPref.getObj(LOGGED_IN_USER);
var user = await sharedPref.getObj(LAST_LOGIN_USER); var data = await sharedPref.getObj(LAST_LOGIN_USER);
if (user != null) { if (data != null) {
user = GetIMEIDetailsModel.fromJson(user); user = GetIMEIDetailsModel.fromJson(data);
} }
var profileInfo = await sharedPref.getObj(DOCTOR_PROFILE); var profileInfo = await sharedPref.getObj(DOCTOR_PROFILE);
profileInfo['IMEI'] = DEVICE_TOKEN; profileInfo['IMEI'] = token;
profileInfo['LogInTypeID'] = await sharedPref.getInt(OTP_TYPE); profileInfo['LogInTypeID'] = await sharedPref.getInt(OTP_TYPE);
profileInfo['BioMetricEnabled'] = true; profileInfo['BioMetricEnabled'] = true;
profileInfo['MobileNo'] = profileInfo['MobileNo'] =
@ -115,9 +105,8 @@ class AuthenticationViewModel extends BaseViewModel {
: user.doctorID; : user.doctorID;
insertIMEIDetailsModel.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA; insertIMEIDetailsModel.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA;
insertIMEIDetailsModel.vidaAuthTokenID = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); insertIMEIDetailsModel.vidaAuthTokenID = await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
insertIMEIDetailsModel.vidaRefreshTokenID = insertIMEIDetailsModel.vidaRefreshTokenID =await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); insertIMEIDetailsModel.password = userInfo.password;
insertIMEIDetailsModel.password = await sharedPref.getString(PASSWORD);
await _authService.insertDeviceImei(insertIMEIDetailsModel); await _authService.insertDeviceImei(insertIMEIDetailsModel);
if (_authService.hasError) { if (_authService.hasError) {
@ -153,6 +142,7 @@ class AuthenticationViewModel extends BaseViewModel {
iMEI: user.iMEI, iMEI: user.iMEI,
facilityId: user.projectID, facilityId: user.projectID,
memberID: user.doctorID, memberID: user.doctorID,
loginDoctorID: int.parse(user.editedBy.toString()),
zipCode: user.outSA == true ? '971' : '966', zipCode: user.outSA == true ? '971' : '966',
mobileNumber: user.mobile, mobileNumber: user.mobile,
oTPSendType: authMethodType.getTypeIdService(), oTPSendType: authMethodType.getTypeIdService(),
@ -174,21 +164,23 @@ class AuthenticationViewModel extends BaseViewModel {
ActivationCodeModel activationCodeModel = ActivationCodeModel( ActivationCodeModel activationCodeModel = ActivationCodeModel(
facilityId: projectID, facilityId: projectID,
memberID: loggedUser.listMemberInformation[0].memberID, memberID: loggedUser.listMemberInformation[0].memberID,
zipCode: loggedUser.zipCode, loginDoctorID: loggedUser.listMemberInformation[0].employeeID,
mobileNumber: loggedUser.mobileNumber,
otpSendType: authMethodType.getTypeIdService().toString(), otpSendType: authMethodType.getTypeIdService().toString(),
password: password); );
await _authService.sendActivationCodeForDoctorApp(activationCodeModel); await _authService.sendActivationCodeForDoctorApp(activationCodeModel);
if (_authService.hasError) { if (_authService.hasError) {
error = _authService.error; error = _authService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else } else {
await sharedPref.setString(TOKEN,
_authService.activationCodeForDoctorAppRes.logInTokenID);
setState(ViewState.Idle); setState(ViewState.Idle);
}
} }
/// check activation code for sms and whats app /// check activation code for sms and whats app
Future checkActivationCodeForDoctorApp({String activationCode}) async { Future checkActivationCodeForDoctorApp({String activationCode,bool isSilentLogin = false}) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = CheckActivationCodeRequestModel checkActivationCodeForDoctorApp =
new CheckActivationCodeRequestModel( new CheckActivationCodeRequestModel(
@ -199,15 +191,22 @@ class AuthenticationViewModel extends BaseViewModel {
projectID: await sharedPref.getInt(PROJECT_ID) != null projectID: await sharedPref.getInt(PROJECT_ID) != null
? await sharedPref.getInt(PROJECT_ID) ? await sharedPref.getInt(PROJECT_ID)
: user.projectID, : user.projectID,
logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID), logInTokenID: await sharedPref.getString(TOKEN),
activationCode: activationCode ?? '0000', activationCode: activationCode ?? '0000',
memberID:userInfo.userID!=null? int.parse(userInfo.userID):user.doctorID ,
password: userInfo.password,
facilityId:userInfo.projectID!=null? userInfo.projectID.toString():user.projectID.toString(),
oTPSendType: await sharedPref.getInt(OTP_TYPE), oTPSendType: await sharedPref.getInt(OTP_TYPE),
iMEI: localToken,
loginDoctorID:userInfo.userID!=null? int.parse(userInfo.userID):user.editedBy,// loggedUser.listMemberInformation[0].employeeID,
isForSilentLogin:isSilentLogin,
generalid: "Cs2020@2016\$2958"); generalid: "Cs2020@2016\$2958");
await _authService.checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp); await _authService.checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp);
if (_authService.hasError) { if (_authService.hasError) {
error = _authService.error; error = _authService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else { } else {
await setDataAfterSendActivationSuccess(checkActivationCodeForDoctorAppRes);
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
@ -253,15 +252,14 @@ 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(CheckActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel)async {
print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); // print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode);
// DrAppToastMsg.showSuccesToast("_VerificationCode_ : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); await sharedPref.setString(VIDA_AUTH_TOKEN_ID,
sharedPref.setString(VIDA_AUTH_TOKEN_ID,
sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID); sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID);
sharedPref.setString(VIDA_REFRESH_TOKEN_ID, await sharedPref.setString(VIDA_REFRESH_TOKEN_ID,
sendActivationCodeForDoctorAppResponseModel.vidaRefreshTokenID); sendActivationCodeForDoctorAppResponseModel.vidaRefreshTokenID);
sharedPref.setString(LOGIN_TOKEN_ID, await sharedPref.setString(TOKEN,
sendActivationCodeForDoctorAppResponseModel.logInTokenID); sendActivationCodeForDoctorAppResponseModel.authenticationTokenID);
} }
saveObjToString(String key, value) async { saveObjToString(String key, value) async {
@ -299,8 +297,7 @@ class AuthenticationViewModel extends BaseViewModel {
clinicID: clinicInfo.clinicID, clinicID: clinicInfo.clinicID,
license: true, license: true,
projectID: clinicInfo.projectID, projectID: clinicInfo.projectID,
tokenID: '', languageID: 2);///TODO change the lan
languageID: 2);//TODO change the lan
await _authService.getDoctorProfileBasedOnClinic(docInfo); await _authService.getDoctorProfileBasedOnClinic(docInfo);
if (_authService.hasError) { if (_authService.hasError) {
error = _authService.error; error = _authService.error;
@ -312,7 +309,7 @@ class AuthenticationViewModel extends BaseViewModel {
} }
/// add some logic in case of check activation code is success /// add some logic in case of check activation code is success
onCheckActivationCodeSuccess() async { onCheckActivationCodeSuccess({bool isSilentLogin = false}) async {
sharedPref.setString( sharedPref.setString(
TOKEN, TOKEN,
checkActivationCodeForDoctorAppRes.authenticationTokenID); checkActivationCodeForDoctorAppRes.authenticationTokenID);
@ -359,17 +356,12 @@ class AuthenticationViewModel extends BaseViewModel {
if (Platform.isIOS) { if (Platform.isIOS) {
_firebaseMessaging.requestNotificationPermissions(); _firebaseMessaging.requestNotificationPermissions();
} }
try {
setState(ViewState.Busy); setState(ViewState.Busy);
} catch (e) {
Helpers.showErrorToast("fdfdfdfdf"+e.toString());
}
var token = await _firebaseMessaging.getToken(); var token = await _firebaseMessaging.getToken();
if (DEVICE_TOKEN == "") { if (localToken == "") {
DEVICE_TOKEN = token; localToken = token;
await _authService.selectDeviceImei(DEVICE_TOKEN); await _authService.selectDeviceImei(localToken);
if (_authService.hasError) { if (_authService.hasError) {
error = _authService.error; error = _authService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -378,6 +370,10 @@ class AuthenticationViewModel extends BaseViewModel {
user =_authService.dashboardItemsList[0]; user =_authService.dashboardItemsList[0];
sharedPref.setObj( sharedPref.setObj(
LAST_LOGIN_USER, _authService.dashboardItemsList[0]); LAST_LOGIN_USER, _authService.dashboardItemsList[0]);
await sharedPref.setString(VIDA_REFRESH_TOKEN_ID,
user.vidaRefreshTokenID);
await sharedPref.setString(VIDA_AUTH_TOKEN_ID,
user.vidaAuthTokenID);
this.unverified = true; this.unverified = true;
} }
setState(ViewState.Idle); setState(ViewState.Idle);
@ -390,22 +386,22 @@ class AuthenticationViewModel extends BaseViewModel {
/// determine the status of the app /// determine the status of the app
APP_STATUS get status { APP_STATUS get status {
if (state == ViewState.Busy) { if (state == ViewState.Busy) {
app_status = APP_STATUS.LOADING; appStatus = APP_STATUS.LOADING;
} else { } else {
if(this.doctorProfile !=null) if(this.doctorProfile !=null)
app_status = APP_STATUS.AUTHENTICATED; appStatus = APP_STATUS.AUTHENTICATED;
else if (this.unverified) { else if (this.unverified) {
app_status = APP_STATUS.UNVERIFIED; appStatus = APP_STATUS.UNVERIFIED;
} else if (this.isLogin) { } else if (this.isLogin) {
app_status = APP_STATUS.AUTHENTICATED; appStatus = APP_STATUS.AUTHENTICATED;
} else { } else {
app_status = APP_STATUS.UNAUTHENTICATED; appStatus = APP_STATUS.UNAUTHENTICATED;
} }
} }
return app_status; return appStatus;
} }
setAppStatus(APP_STATUS status){ setAppStatus(APP_STATUS status){
this.app_status = status; this.appStatus = status;
notifyListeners(); notifyListeners();
} }
@ -419,7 +415,7 @@ class AuthenticationViewModel extends BaseViewModel {
logout({bool isFromLogin = false}) async { logout({bool isFromLogin = false}) async {
DEVICE_TOKEN = ""; localToken = "";
String lang = await sharedPref.getString(APP_Language); String lang = await sharedPref.getString(APP_Language);
await Helpers.clearSharedPref(); await Helpers.clearSharedPref();
doctorProfile = null; doctorProfile = null;
@ -427,7 +423,7 @@ class AuthenticationViewModel extends BaseViewModel {
deleteUser(); deleteUser();
await getDeviceInfoFromFirebase(); await getDeviceInfoFromFirebase();
this.isFromLogin = isFromLogin; this.isFromLogin = isFromLogin;
app_status = APP_STATUS.UNAUTHENTICATED; appStatus = APP_STATUS.UNAUTHENTICATED;
setState(ViewState.Idle); setState(ViewState.Idle);
} }

@ -1,3 +1,5 @@
import 'dart:isolate';
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/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
@ -47,6 +49,21 @@ class BaseViewModel extends ChangeNotifier {
} }
} }
void getIsolateDoctorProfile(bool isGetProfile) async {
if (isGetProfile) {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
if (profile != null) {
doctorProfile = DoctorProfileModel.fromJson(profile);
}
}
if (doctorProfile == null) {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
if (profile != null) {
doctorProfile = DoctorProfileModel.fromJson(profile);
}
}
}
setDoctorProfile(DoctorProfileModel doctorProfile) async { setDoctorProfile(DoctorProfileModel doctorProfile) async {
await sharedPref.setObj(DOCTOR_PROFILE, doctorProfile); await sharedPref.setObj(DOCTOR_PROFILE, doctorProfile);
this.doctorProfile = doctorProfile; this.doctorProfile = doctorProfile;

@ -1,22 +1,23 @@
import 'package:doctor_app_flutter/config/config.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/home/doctor_reply_service.dart';
import 'package:doctor_app_flutter/core/service/special_clinics/special_clinic_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/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:firebase_messaging/firebase_messaging.dart'; import 'package:firebase_messaging/firebase_messaging.dart';
import '../../locator.dart'; import '../../locator.dart';
import 'authentication_view_model.dart'; import 'authentication_view_model.dart';
import 'base_view_model.dart'; 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>(); SpecialClinicsService _specialClinicsService =
locator<SpecialClinicsService>();
DoctorReplyService _doctorReplyService = locator<DoctorReplyService>();
List<DashboardModel> get dashboardItemsList => List<DashboardModel> get dashboardItemsList =>
_dashboardService.dashboardItemsList; _dashboardService.dashboardItemsList;
@ -25,15 +26,33 @@ class DashboardViewModel extends BaseViewModel {
String get sServiceID => _dashboardService.sServiceID; String get sServiceID => _dashboardService.sServiceID;
List<GetSpecialClinicalCareListResponseModel> get specialClinicalCareList => _specialClinicsService.specialClinicalCareList; int get notRepliedCount => _doctorReplyService.notRepliedCount;
List<GetSpecialClinicalCareListResponseModel> get specialClinicalCareList =>
_specialClinicsService.specialClinicalCareList;
Future setFirebaseNotification(ProjectViewModel projectsProvider, Future startHomeScreenServices(ProjectViewModel projectsProvider,
AuthenticationViewModel authProvider) async { AuthenticationViewModel authProvider) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await projectsProvider.getDoctorClinicsList(); await getDoctorProfile(isGetProfile: true);
final results = await Future.wait([
projectsProvider.getDoctorClinicsList(),
_dashboardService.getDashboard(),
_dashboardService.checkDoctorHasLiveCare(),
_specialClinicsService.getSpecialClinicalCareList(),
]);
if (_dashboardService.hasError) {
error = _dashboardService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
// _firebaseMessaging.setAutoInitEnabled(true); setFirebaseNotification(authProvider);
}
Future setFirebaseNotification(AuthenticationViewModel authProvider) async {
_firebaseMessaging.requestNotificationPermissions( _firebaseMessaging.requestNotificationPermissions(
const IosNotificationSettings( const IosNotificationSettings(
sound: true, badge: true, alert: true, provisional: true)); sound: true, badge: true, alert: true, provisional: true));
@ -44,8 +63,8 @@ class DashboardViewModel extends BaseViewModel {
_firebaseMessaging.getToken().then((String token) async { _firebaseMessaging.getToken().then((String token) async {
if (token != '') { if (token != '') {
DEVICE_TOKEN = token; // DEVICE_TOKEN = token;
authProvider.insertDeviceImei(); authProvider.insertDeviceImei(token);
} }
}); });
} }
@ -102,16 +121,27 @@ class DashboardViewModel extends BaseViewModel {
return value.toString(); return value.toString();
} }
GetSpecialClinicalCareListResponseModel getSpecialClinic(clinicId) {
GetSpecialClinicalCareListResponseModel getSpecialClinic(clinicId){ GetSpecialClinicalCareListResponseModel special;
GetSpecialClinicalCareListResponseModel special ;
specialClinicalCareList.forEach((element) { specialClinicalCareList.forEach((element) {
if(element.clinicID == 1){ if (element.clinicID == clinicId) {
special = element; special = element;
} }
}); });
return special; return special;
}
Future getNotRepliedCount() async {
setState(ViewState.BusyLocal);
await getDoctorProfile();
await _doctorReplyService.getNotRepliedCount();
if (_doctorReplyService.hasError) {
error = _doctorReplyService.error;
setState(ViewState.ErrorLocal);
} else {
notifyListeners();
setState(ViewState.Idle);
}
} }
} }

@ -1,6 +1,8 @@
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/doctor_reply_service.dart'; import 'package:doctor_app_flutter/core/service/home/doctor_reply_service.dart';
import 'package:doctor_app_flutter/models/doctor/list_gt_my_patients_question_model.dart'; import 'package:doctor_app_flutter/models/doctor/list_gt_my_patients_question_model.dart';
import 'package:doctor_app_flutter/models/doctor/replay/request_create_doctor_response.dart';
import 'package:doctor_app_flutter/models/doctor/replay/request_doctor_reply.dart';
import '../../locator.dart'; import '../../locator.dart';
import 'base_view_model.dart'; import 'base_view_model.dart';
@ -10,25 +12,57 @@ class DoctorReplayViewModel extends BaseViewModel {
List<ListGtMyPatientsQuestions> get listDoctorWorkingHoursTable => List<ListGtMyPatientsQuestions> get listDoctorWorkingHoursTable =>
_doctorReplyService.listDoctorWorkingHoursTable; _doctorReplyService.listDoctorWorkingHoursTable;
List<ListGtMyPatientsQuestions> get listDoctorNotRepliedQuestions =>
_doctorReplyService.listDoctorNotRepliedQuestions;
Future getDoctorReply() async { Future getDoctorReply(
setState(ViewState.Busy); {int pageSize = 10,
await _doctorReplyService.getDoctorReply(); int pageIndex = 1,
bool isLocalBusy = true,
bool isGettingNotReply = false}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
}
await getDoctorProfile();
RequestDoctorReply _requestDoctorReply =
RequestDoctorReply(pageIndex: pageIndex, pageSize: pageSize);
if (isGettingNotReply)
_requestDoctorReply.infoStatus = 99; //to get the not replied only
await _doctorReplyService.getDoctorReply(_requestDoctorReply,
clearData: !isLocalBusy, isGettingNotReply: isGettingNotReply);
if (_doctorReplyService.hasError) { if (_doctorReplyService.hasError) {
error = _doctorReplyService.error; error = _doctorReplyService.error;
setState(ViewState.Error); if (isLocalBusy) {
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Error);
}
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future replay( Future createDoctorResponse(
String referredDoctorRemarks, ListGtMyPatientsQuestions model) async { String response, ListGtMyPatientsQuestions model) async {
await getDoctorProfile();
CreateDoctorResponseModel createDoctorResponseModel =
CreateDoctorResponseModel(
transactionNo: model.transactionNo.toString(),
doctorResponse: response,
infoStatus: 6,
createdBy: this.doctorProfile.doctorID,
infoEnteredBy: this.doctorProfile.doctorID,
setupID: "010266");
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _doctorReplyService.replay(referredDoctorRemarks, model); await _doctorReplyService.createDoctorResponse(createDoctorResponseModel);
if (_doctorReplyService.hasError) { if (_doctorReplyService.hasError) {
error = _doctorReplyService.error; error = _doctorReplyService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else } else {
setState(ViewState.Idle); setState(ViewState.Idle);
_doctorReplyService.getNotRepliedCount();
}
} }
} }

@ -1,6 +1,8 @@
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/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/labs/LabOrderResult.dart'; import 'package:doctor_app_flutter/core/model/labs/LabOrderResult.dart';
import 'package:doctor_app_flutter/core/model/labs/LabResultHistory.dart';
import 'package:doctor_app_flutter/core/model/labs/all_special_lab_result_model.dart';
import 'package:doctor_app_flutter/core/model/labs/lab_result.dart'; import 'package:doctor_app_flutter/core/model/labs/lab_result.dart';
import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart'; import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart';
import 'package:doctor_app_flutter/core/model/labs/patient_lab_special_result.dart'; import 'package:doctor_app_flutter/core/model/labs/patient_lab_special_result.dart';
@ -15,16 +17,16 @@ class LabsViewModel extends BaseViewModel {
FilterType filterType = FilterType.Clinic; FilterType filterType = FilterType.Clinic;
LabsService _labsService = locator<LabsService>(); LabsService _labsService = locator<LabsService>();
List<LabOrderResult> get labOrdersResultsList => List<LabOrderResult> get labOrdersResultsList => _labsService.labOrdersResultsList;
_labsService.labOrdersResultsList; List<AllSpecialLabResultModel> get allSpecialLabList => _labsService.allSpecialLab;
List<PatientLabOrdersList> _patientLabOrdersListClinic = List(); List<PatientLabOrdersList> _patientLabOrdersListClinic = List();
List<PatientLabOrdersList> _patientLabOrdersListHospital = List(); List<PatientLabOrdersList> _patientLabOrdersListHospital = List();
List<PatientLabOrdersList> get patientLabOrdersList => List<PatientLabOrdersList> get patientLabOrdersList =>
filterType == FilterType.Clinic filterType == FilterType.Clinic ? _patientLabOrdersListClinic : _patientLabOrdersListHospital;
? _patientLabOrdersListClinic
: _patientLabOrdersListHospital; List<LabResultHistory> get labOrdersResultHistoryList => _labsService.labOrdersResultHistoryList;
void getLabs(PatiantInformtion patient) async { void getLabs(PatiantInformtion patient) async {
setState(ViewState.Busy); setState(ViewState.Busy);
@ -34,41 +36,33 @@ class LabsViewModel extends BaseViewModel {
setState(ViewState.Error); setState(ViewState.Error);
} else { } else {
_labsService.patientLabOrdersList.forEach((element) { _labsService.patientLabOrdersList.forEach((element) {
List<PatientLabOrdersList> patientLabOrdersClinic = List<PatientLabOrdersList> patientLabOrdersClinic = _patientLabOrdersListClinic
_patientLabOrdersListClinic .where((elementClinic) => elementClinic.filterName == element.clinicDescription)
.where((elementClinic) => .toList();
elementClinic.filterName == element.clinicDescription)
.toList();
if (patientLabOrdersClinic.length != 0) { if (patientLabOrdersClinic.length != 0) {
_patientLabOrdersListClinic[_patientLabOrdersListClinic _patientLabOrdersListClinic[_patientLabOrdersListClinic.indexOf(patientLabOrdersClinic[0])]
.indexOf(patientLabOrdersClinic[0])]
.patientLabOrdersList .patientLabOrdersList
.add(element); .add(element);
} else { } else {
_patientLabOrdersListClinic.add(PatientLabOrdersList( _patientLabOrdersListClinic
filterName: element.clinicDescription, .add(PatientLabOrdersList(filterName: element.clinicDescription, patientDoctorAppointment: element));
patientDoctorAppointment: element));
} }
// doctor list sort via project // doctor list sort via project
List<PatientLabOrdersList> patientLabOrdersHospital = List<PatientLabOrdersList> patientLabOrdersHospital = _patientLabOrdersListHospital
_patientLabOrdersListHospital .where(
.where( (elementClinic) => elementClinic.filterName == element.projectName,
(elementClinic) => )
elementClinic.filterName == element.projectName, .toList();
)
.toList();
if (patientLabOrdersHospital.length != 0) { if (patientLabOrdersHospital.length != 0) {
_patientLabOrdersListHospital[_patientLabOrdersListHospital _patientLabOrdersListHospital[_patientLabOrdersListHospital.indexOf(patientLabOrdersHospital[0])]
.indexOf(patientLabOrdersHospital[0])]
.patientLabOrdersList .patientLabOrdersList
.add(element); .add(element);
} else { } else {
_patientLabOrdersListHospital.add(PatientLabOrdersList( _patientLabOrdersListHospital
filterName: element.projectName, .add(PatientLabOrdersList(filterName: element.projectName, patientDoctorAppointment: element));
patientDoctorAppointment: element));
} }
}); });
@ -81,8 +75,7 @@ class LabsViewModel extends BaseViewModel {
notifyListeners(); notifyListeners();
} }
List<PatientLabSpecialResult> get patientLabSpecialResult => List<PatientLabSpecialResult> get patientLabSpecialResult => _labsService.patientLabSpecialResult;
_labsService.patientLabSpecialResult;
List<LabResult> get labResultList => _labsService.labResultList; List<LabResult> get labResultList => _labsService.labResultList;
@ -115,15 +108,10 @@ class LabsViewModel extends BaseViewModel {
} }
} }
getPatientLabResult( getPatientLabResult({PatientLabOrders patientLabOrder, PatiantInformtion patient, bool isInpatient}) async {
{PatientLabOrders patientLabOrder,
PatiantInformtion patient,
bool isInpatient}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _labsService.getPatientLabResult( await _labsService.getPatientLabResult(
patientLabOrder: patientLabOrder, patientLabOrder: patientLabOrder, patient: patient, isInpatient: isInpatient);
patient: patient,
isInpatient: isInpatient);
if (_labsService.hasError) { if (_labsService.hasError) {
error = _labsService.error; error = _labsService.error;
setState(ViewState.Error); setState(ViewState.Error);
@ -132,33 +120,23 @@ class LabsViewModel extends BaseViewModel {
} }
} }
void setLabResultDependOnFilterName(){ void setLabResultDependOnFilterName() {
_labsService.labResultList.forEach((element) { _labsService.labResultList.forEach((element) {
List<LabResultList> patientLabOrdersClinic = labResultLists List<LabResultList> patientLabOrdersClinic =
.where( labResultLists.where((elementClinic) => elementClinic.filterName == element.testCode).toList();
(elementClinic) => elementClinic.filterName == element.testCode)
.toList();
if (patientLabOrdersClinic.length != 0) { if (patientLabOrdersClinic.length != 0) {
labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])] labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])].patientLabResultList.add(element);
.patientLabResultList
.add(element);
} else { } else {
labResultLists labResultLists.add(LabResultList(filterName: element.testCode, lab: element));
.add(LabResultList(filterName: element.testCode, lab: element));
} }
}); });
} }
getPatientLabOrdersResults( getPatientLabOrdersResults({PatientLabOrders patientLabOrder, String procedure, PatiantInformtion patient}) async {
{PatientLabOrders patientLabOrder,
String procedure,
PatiantInformtion patient}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _labsService.getPatientLabOrdersResults( await _labsService.getPatientLabOrdersResults(
patientLabOrder: patientLabOrder, patientLabOrder: patientLabOrder, procedure: procedure, patient: patient);
procedure: procedure,
patient: patient);
if (_labsService.hasError) { if (_labsService.hasError) {
error = _labsService.error; error = _labsService.error;
setState(ViewState.Error); setState(ViewState.Error);
@ -166,9 +144,8 @@ class LabsViewModel extends BaseViewModel {
bool isShouldClear = false; bool isShouldClear = false;
if (_labsService.labOrdersResultsList.length == 1) { if (_labsService.labOrdersResultsList.length == 1) {
labOrdersResultsList.forEach((element) { labOrdersResultsList.forEach((element) {
if (element.resultValue.contains('/') || if (element.resultValue.contains('/') || element.resultValue.contains('*') || element.resultValue.isEmpty)
element.resultValue.contains('*') || isShouldClear = true;
element.resultValue.isEmpty) isShouldClear = true;
}); });
} }
if (isShouldClear) _labsService.labOrdersResultsList.clear(); if (isShouldClear) _labsService.labOrdersResultsList.clear();
@ -176,6 +153,19 @@ class LabsViewModel extends BaseViewModel {
} }
} }
getPatientLabResultHistoryByDescription(
{PatientLabOrders patientLabOrder, String procedureDescription, PatiantInformtion patient}) async {
setState(ViewState.Busy);
await _labsService.getPatientLabOrdersResultHistoryByDescription(
patientLabOrder: patientLabOrder, procedureDescription: procedureDescription, patient: patient);
if (_labsService.hasError) {
error = _labsService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
sendLabReportEmail({PatientLabOrders patientLabOrder, String mes}) async { sendLabReportEmail({PatientLabOrders patientLabOrder, String mes}) async {
await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder); await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder);
if (_labsService.hasError) { if (_labsService.hasError) {
@ -183,4 +173,14 @@ class LabsViewModel extends BaseViewModel {
} else } else
DrAppToastMsg.showSuccesToast(mes); DrAppToastMsg.showSuccesToast(mes);
} }
Future getAllSpecialLabResult({int patientId}) async {
setState(ViewState.Busy);
await _labsService.getAllSpecialLabResult(mrn: patientId);
if (_labsService.hasError) {
error = _labsService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
} }

@ -36,6 +36,8 @@ class UcafViewModel extends BaseViewModel {
List<OrderProcedure> get orderProcedures => _ucafService.orderProcedureList; List<OrderProcedure> get orderProcedures => _ucafService.orderProcedureList;
Function saveUCAFOnTap;
String selectedLanguage; String selectedLanguage;
String heightCm = "0"; String heightCm = "0";
String weightKg = "0"; String weightKg = "0";
@ -43,9 +45,13 @@ class UcafViewModel extends BaseViewModel {
String temperatureCelcius = "0"; String temperatureCelcius = "0";
String hartRat = "0"; String hartRat = "0";
String respirationBeatPerMinute = "0"; String respirationBeatPerMinute = "0";
String bloodPressure = "0 / 0"; String bloodPressure = "0/0";
resetDataInFirst() { resetDataInFirst({bool firstPage = true}) {
if(firstPage){
_ucafService.patientVitalSignsHistory = null;
_ucafService.patientChiefComplaintList = null;
}
_ucafService.patientAssessmentList = []; _ucafService.patientAssessmentList = [];
_ucafService.orderProcedureList = []; _ucafService.orderProcedureList = [];
_ucafService.prescriptionList = null; _ucafService.prescriptionList = null;
@ -56,7 +62,7 @@ class UcafViewModel extends BaseViewModel {
} }
Future getUCAFData(PatiantInformtion patient) async { Future getUCAFData(PatiantInformtion patient) async {
setState(ViewState.Busy); // setState(ViewState.Busy);
String from; String from;
String to; String to;
@ -112,7 +118,7 @@ class UcafViewModel extends BaseViewModel {
Future getPatientAssessment(PatiantInformtion patient) async { Future getPatientAssessment(PatiantInformtion patient) async {
if (patientAssessmentList.isEmpty) { if (patientAssessmentList.isEmpty) {
setState(ViewState.Busy); // setState(ViewState.Busy);
await _ucafService.getPatientAssessment(patient); await _ucafService.getPatientAssessment(patient);
if (_ucafService.hasError) { if (_ucafService.hasError) {
error = _ucafService.error; error = _ucafService.error;
@ -139,7 +145,7 @@ class UcafViewModel extends BaseViewModel {
Future getOrderProcedures(PatiantInformtion patient) async { Future getOrderProcedures(PatiantInformtion patient) async {
if (orderProcedures.isEmpty) { if (orderProcedures.isEmpty) {
setState(ViewState.Busy); // setState(ViewState.Busy);
await _ucafService.getOrderProcedures(patient); await _ucafService.getOrderProcedures(patient);
if (_ucafService.hasError) { if (_ucafService.hasError) {
error = _ucafService.error; error = _ucafService.error;
@ -152,7 +158,7 @@ class UcafViewModel extends BaseViewModel {
Future getPrescription(PatiantInformtion patient) async { Future getPrescription(PatiantInformtion patient) async {
if (prescriptionList == null) { if (prescriptionList == null) {
setState(ViewState.Busy); // setState(ViewState.Busy);
await _ucafService.getPrescription(patient); await _ucafService.getPrescription(patient);
if (_ucafService.hasError) { if (_ucafService.hasError) {
error = _ucafService.error; error = _ucafService.error;
@ -190,7 +196,7 @@ class UcafViewModel extends BaseViewModel {
} }
Future postUCAF(PatiantInformtion patient) async { Future postUCAF(PatiantInformtion patient) async {
setState(ViewState.Busy); // setState(ViewState.Busy);
await _ucafService.postUCAF(patient); await _ucafService.postUCAF(patient);
if (_ucafService.hasError) { if (_ucafService.hasError) {
error = _ucafService.error; error = _ucafService.error;

@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/enum/filter_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/Prescriptions/Prescriptions.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart';
@ -26,11 +27,10 @@ class PrescriptionViewModel extends BaseViewModel {
FilterType filterType = FilterType.Clinic; FilterType filterType = FilterType.Clinic;
bool hasError = false; bool hasError = false;
PrescriptionService _prescriptionService = locator<PrescriptionService>(); PrescriptionService _prescriptionService = locator<PrescriptionService>();
List<GetMedicationResponseModel> get allMedicationList => List<GetMedicationResponseModel> get allMedicationList => _prescriptionService.allMedicationList;
_prescriptionService.allMedicationList; List<GetMedicationForInPatientModel> get medicationForInPatient => _prescriptionsService.medicationForInPatient;
List<PrescriptionModel> get prescriptionList => List<PrescriptionModel> get prescriptionList => _prescriptionService.prescriptionList;
_prescriptionService.prescriptionList;
List<dynamic> get drugsList => _prescriptionService.doctorsList; List<dynamic> get drugsList => _prescriptionService.doctorsList;
//List<dynamic> get allMedicationList => _prescriptionService.allMedicationList; //List<dynamic> get allMedicationList => _prescriptionService.allMedicationList;
List<dynamic> get drugToDrug => _prescriptionService.drugToDrugList; List<dynamic> get drugToDrug => _prescriptionService.drugToDrugList;
@ -41,30 +41,22 @@ class PrescriptionViewModel extends BaseViewModel {
List<PrescriptionsList> _prescriptionsOrderListClinic = List(); List<PrescriptionsList> _prescriptionsOrderListClinic = List();
List<PrescriptionsList> _prescriptionsOrderListHospital = List(); List<PrescriptionsList> _prescriptionsOrderListHospital = List();
List<PrescriptionReport> get prescriptionReportList => List<PrescriptionReport> get prescriptionReportList => _prescriptionsService.prescriptionReportList;
_prescriptionsService.prescriptionReportList;
List<Prescriptions> get prescriptionsList => List<Prescriptions> get prescriptionsList => _prescriptionsService.prescriptionsList;
_prescriptionsService.prescriptionsList;
List<PharmacyPrescriptions> get pharmacyPrescriptionsList => List<PharmacyPrescriptions> get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList;
_prescriptionsService.pharmacyPrescriptionsList; List<PrescriptionReportEnh> get prescriptionReportEnhList => _prescriptionsService.prescriptionReportEnhList;
List<PrescriptionReportEnh> get prescriptionReportEnhList =>
_prescriptionsService.prescriptionReportEnhList;
List<PrescriptionsList> get prescriptionsOrderList => List<PrescriptionsList> get prescriptionsOrderList =>
filterType == FilterType.Clinic filterType == FilterType.Clinic ? _prescriptionsOrderListClinic : _prescriptionsOrderListHospital;
? _prescriptionsOrderListClinic
: _prescriptionsOrderListHospital;
List<PrescriotionInPatient> get inPatientPrescription => List<PrescriotionInPatient> get inPatientPrescription => _prescriptionsService.prescriptionInPatientList;
_prescriptionsService.prescriptionInPatientList;
getPrescriptionsInPatient(PatiantInformtion patient) async { getPrescriptionsInPatient(PatiantInformtion patient) async {
setState(ViewState.Busy); setState(ViewState.Busy);
error = ""; error = "";
await _prescriptionsService.getPrescriptionInPatient( await _prescriptionsService.getPrescriptionInPatient(mrn: patient.patientId, adn: patient.admissionNo);
mrn: patient.patientId, adn: patient.admissionNo);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = "No Prescription Found"; error = "No Prescription Found";
setState(ViewState.Error); setState(ViewState.Error);
@ -100,8 +92,7 @@ class PrescriptionViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future postPrescription( Future postPrescription(PostPrescriptionReqModel postProcedureReqModel, int mrn) async {
PostPrescriptionReqModel postProcedureReqModel, int mrn) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard(); //_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy); setState(ViewState.Busy);
@ -125,8 +116,7 @@ class PrescriptionViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future updatePrescription( Future updatePrescription(PostPrescriptionReqModel updatePrescriptionReqModel, int mrn) async {
PostPrescriptionReqModel updatePrescriptionReqModel, int mrn) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard(); //_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy); setState(ViewState.Busy);
@ -152,16 +142,11 @@ class PrescriptionViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getDrugToDrug( Future getDrugToDrug(VitalSignData vital, List<GetAssessmentResModel> lstAssessments,
VitalSignData vital, List<GetAllergiesResModel> allergy, PatiantInformtion patient, List<dynamic> prescription) async {
List<GetAssessmentResModel> lstAssessments,
List<GetAllergiesResModel> allergy,
PatiantInformtion patient,
List<dynamic> prescription) async {
hasError = false; hasError = false;
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionService.getDrugToDrug( await _prescriptionService.getDrugToDrug(vital, lstAssessments, allergy, patient, prescription);
vital, lstAssessments, allergy, patient, prescription);
if (_prescriptionService.hasError) { if (_prescriptionService.hasError) {
error = _prescriptionService.error; error = _prescriptionService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -174,12 +159,9 @@ class PrescriptionViewModel extends BaseViewModel {
notifyListeners(); notifyListeners();
} }
getPrescriptionReport( getPrescriptionReport({Prescriptions prescriptions, @required PatiantInformtion patient}) async {
{Prescriptions prescriptions,
@required PatiantInformtion patient}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReport( await _prescriptionsService.getPrescriptionReport(prescriptions: prescriptions, patient: patient);
prescriptions: prescriptions, patient: patient);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -188,11 +170,9 @@ class PrescriptionViewModel extends BaseViewModel {
} }
} }
getListPharmacyForPrescriptions( getListPharmacyForPrescriptions({int itemId, @required PatiantInformtion patient}) async {
{int itemId, @required PatiantInformtion patient}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionsService.getListPharmacyForPrescriptions( await _prescriptionsService.getListPharmacyForPrescriptions(itemId: itemId, patient: patient);
itemId: itemId, patient: patient);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.Error); setState(ViewState.Error);
@ -204,48 +184,39 @@ class PrescriptionViewModel extends BaseViewModel {
void _filterList() { void _filterList() {
_prescriptionsService.prescriptionsList.forEach((element) { _prescriptionsService.prescriptionsList.forEach((element) {
/// PrescriptionsList list sort clinic /// PrescriptionsList list sort clinic
List<PrescriptionsList> prescriptionsByClinic = List<PrescriptionsList> prescriptionsByClinic = _prescriptionsOrderListClinic
_prescriptionsOrderListClinic .where((elementClinic) => elementClinic.filterName == element.clinicDescription)
.where((elementClinic) => .toList();
elementClinic.filterName == element.clinicDescription)
.toList();
if (prescriptionsByClinic.length != 0) { if (prescriptionsByClinic.length != 0) {
_prescriptionsOrderListClinic[ _prescriptionsOrderListClinic[_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])]
_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])]
.prescriptionsList .prescriptionsList
.add(element); .add(element);
} else { } else {
_prescriptionsOrderListClinic.add(PrescriptionsList( _prescriptionsOrderListClinic
filterName: element.clinicDescription, prescriptions: element)); .add(PrescriptionsList(filterName: element.clinicDescription, prescriptions: element));
} }
/// PrescriptionsList list sort via hospital /// PrescriptionsList list sort via hospital
List<PrescriptionsList> prescriptionsByHospital = List<PrescriptionsList> prescriptionsByHospital = _prescriptionsOrderListHospital
_prescriptionsOrderListHospital .where(
.where( (elementClinic) => elementClinic.filterName == element.name,
(elementClinic) => elementClinic.filterName == element.name, )
) .toList();
.toList();
if (prescriptionsByHospital.length != 0) { if (prescriptionsByHospital.length != 0) {
_prescriptionsOrderListHospital[_prescriptionsOrderListHospital _prescriptionsOrderListHospital[_prescriptionsOrderListHospital.indexOf(prescriptionsByHospital[0])]
.indexOf(prescriptionsByHospital[0])]
.prescriptionsList .prescriptionsList
.add(element); .add(element);
} else { } else {
_prescriptionsOrderListHospital.add(PrescriptionsList( _prescriptionsOrderListHospital.add(PrescriptionsList(filterName: element.name, prescriptions: element));
filterName: element.name, prescriptions: element));
} }
}); });
} }
getPrescriptionReportEnh( getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder, @required PatiantInformtion patient}) async {
{PrescriptionsOrder prescriptionsOrder,
@required PatiantInformtion patient}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReportEnh( await _prescriptionsService.getPrescriptionReportEnh(prescriptionsOrder: prescriptionsOrder, patient: patient);
prescriptionsOrder: prescriptionsOrder, patient: patient);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.Error); setState(ViewState.Error);
@ -280,4 +251,15 @@ class PrescriptionViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
getMedicationForInPatient(PatiantInformtion patient) async {
setState(ViewState.Busy);
await _prescriptionsService.getMedicationForInPatient(patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
} }

@ -1,6 +1,7 @@
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/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report_enh.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report_enh.dart';
@ -19,21 +20,19 @@ class PrescriptionsViewModel extends BaseViewModel {
List<PrescriptionsList> _prescriptionsOrderListClinic = List(); List<PrescriptionsList> _prescriptionsOrderListClinic = List();
List<PrescriptionsList> _prescriptionsOrderListHospital = List(); List<PrescriptionsList> _prescriptionsOrderListHospital = List();
List<PrescriptionReport> get prescriptionReportList => List<PrescriptionReport> get prescriptionReportList => _prescriptionsService.prescriptionReportList;
_prescriptionsService.prescriptionReportList;
List<Prescriptions> get prescriptionsList => List<Prescriptions> get prescriptionsList => _prescriptionsService.prescriptionsList;
_prescriptionsService.prescriptionsList;
List<PharmacyPrescriptions> get pharmacyPrescriptionsList => List<PharmacyPrescriptions> get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList;
_prescriptionsService.pharmacyPrescriptionsList; List<PrescriptionReportEnh> get prescriptionReportEnhList => _prescriptionsService.prescriptionReportEnhList;
List<PrescriptionReportEnh> get prescriptionReportEnhList =>
_prescriptionsService.prescriptionReportEnhList;
List<PrescriptionsList> get prescriptionsOrderList => List<PrescriptionsList> get prescriptionsOrderList =>
filterType == FilterType.Clinic filterType == FilterType.Clinic ? _prescriptionsOrderListClinic : _prescriptionsOrderListHospital;
? _prescriptionsOrderListClinic
: _prescriptionsOrderListHospital; List<GetMedicationForInPatientModel> get medicationForInPatient => _prescriptionsService.medicationForInPatient;
List<PrescriptionsList> _medicationForInPatient = List();
getPrescriptions(PatiantInformtion patient) async { getPrescriptions(PatiantInformtion patient) async {
setState(ViewState.Busy); setState(ViewState.Busy);
@ -62,38 +61,32 @@ class PrescriptionsViewModel extends BaseViewModel {
void _filterList() { void _filterList() {
_prescriptionsService.prescriptionsList.forEach((element) { _prescriptionsService.prescriptionsList.forEach((element) {
/// PrescriptionsList list sort clinic /// PrescriptionsList list sort clinic
List<PrescriptionsList> prescriptionsByClinic = List<PrescriptionsList> prescriptionsByClinic = _prescriptionsOrderListClinic
_prescriptionsOrderListClinic .where((elementClinic) => elementClinic.filterName == element.clinicDescription)
.where((elementClinic) => .toList();
elementClinic.filterName == element.clinicDescription)
.toList();
if (prescriptionsByClinic.length != 0) { if (prescriptionsByClinic.length != 0) {
_prescriptionsOrderListClinic[ _prescriptionsOrderListClinic[_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])]
_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])]
.prescriptionsList .prescriptionsList
.add(element); .add(element);
} else { } else {
_prescriptionsOrderListClinic.add(PrescriptionsList( _prescriptionsOrderListClinic
filterName: element.clinicDescription, prescriptions: element)); .add(PrescriptionsList(filterName: element.clinicDescription, prescriptions: element));
} }
/// PrescriptionsList list sort via hospital /// PrescriptionsList list sort via hospital
List<PrescriptionsList> prescriptionsByHospital = List<PrescriptionsList> prescriptionsByHospital = _prescriptionsOrderListHospital
_prescriptionsOrderListHospital .where(
.where( (elementClinic) => elementClinic.filterName == element.name,
(elementClinic) => elementClinic.filterName == element.name, )
) .toList();
.toList();
if (prescriptionsByHospital.length != 0) { if (prescriptionsByHospital.length != 0) {
_prescriptionsOrderListHospital[_prescriptionsOrderListHospital _prescriptionsOrderListHospital[_prescriptionsOrderListHospital.indexOf(prescriptionsByHospital[0])]
.indexOf(prescriptionsByHospital[0])]
.prescriptionsList .prescriptionsList
.add(element); .add(element);
} else { } else {
_prescriptionsOrderListHospital.add(PrescriptionsList( _prescriptionsOrderListHospital.add(PrescriptionsList(filterName: element.name, prescriptions: element));
filterName: element.name, prescriptions: element));
} }
}); });
} }
@ -103,12 +96,9 @@ class PrescriptionsViewModel extends BaseViewModel {
notifyListeners(); notifyListeners();
} }
getPrescriptionReport( getPrescriptionReport({Prescriptions prescriptions, @required PatiantInformtion patient}) async {
{Prescriptions prescriptions,
@required PatiantInformtion patient}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReport( await _prescriptionsService.getPrescriptionReport(prescriptions: prescriptions, patient: patient);
prescriptions: prescriptions, patient: patient);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -117,11 +107,9 @@ class PrescriptionsViewModel extends BaseViewModel {
} }
} }
getListPharmacyForPrescriptions( getListPharmacyForPrescriptions({int itemId, @required PatiantInformtion patient}) async {
{int itemId, @required PatiantInformtion patient}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionsService.getListPharmacyForPrescriptions( await _prescriptionsService.getListPharmacyForPrescriptions(itemId: itemId, patient: patient);
itemId: itemId, patient: patient);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.Error); setState(ViewState.Error);
@ -130,12 +118,9 @@ class PrescriptionsViewModel extends BaseViewModel {
} }
} }
getPrescriptionReportEnh( getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder, @required PatiantInformtion patient}) async {
{PrescriptionsOrder prescriptionsOrder,
@required PatiantInformtion patient}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReportEnh( await _prescriptionsService.getPrescriptionReportEnh(prescriptionsOrder: prescriptionsOrder, patient: patient);
prescriptionsOrder: prescriptionsOrder, patient: patient);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.Error); setState(ViewState.Error);
@ -143,4 +128,14 @@ class PrescriptionsViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
getMedicationForInPatient(PatiantInformtion patient) async {
await _prescriptionsService.getMedicationForInPatient(patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
} }

@ -23,8 +23,7 @@ import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' as cpe;
as cpe;
class ProcedureViewModel extends BaseViewModel { class ProcedureViewModel extends BaseViewModel {
//TODO Hussam clean it //TODO Hussam clean it
@ -61,13 +60,13 @@ class ProcedureViewModel extends BaseViewModel {
List<PatientLabOrdersList> _patientLabOrdersListClinic = List(); List<PatientLabOrdersList> _patientLabOrdersListClinic = List();
List<PatientLabOrdersList> _patientLabOrdersListHospital = List(); List<PatientLabOrdersList> _patientLabOrdersListHospital = List();
Future getProcedure({int mrn, String patientType}) async { Future getProcedure({int mrn, String patientType, int appointmentNo}) async {
hasError = false; hasError = false;
await getDoctorProfile(); await getDoctorProfile();
//_insuranceCardService.clearInsuranceCard(); //_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy); setState(ViewState.Busy);
await _procedureService.getProcedure(mrn: mrn); await _procedureService.getProcedure(mrn: mrn, appointmentNo: appointmentNo);
if (_procedureService.hasError) { if (_procedureService.hasError) {
error = _procedureService.error; error = _procedureService.error;
if (patientType == "7") if (patientType == "7")
@ -78,15 +77,12 @@ class ProcedureViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getProcedureCategory( Future getProcedureCategory({String categoryName, String categoryID, patientId}) async {
{String categoryName, String categoryID, patientId}) async {
if (categoryName == null) return; if (categoryName == null) return;
hasError = false; hasError = false;
setState(ViewState.Busy); setState(ViewState.Busy);
await _procedureService.getProcedureCategory( await _procedureService.getProcedureCategory(
categoryName: categoryName, categoryName: categoryName, categoryID: categoryID, patientId: patientId);
categoryID: categoryID,
patientId: patientId);
if (_procedureService.hasError) { if (_procedureService.hasError) {
error = _procedureService.error; error = _procedureService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -321,8 +317,7 @@ class ProcedureViewModel extends BaseViewModel {
List<cpe.EntityList> entityList, List<cpe.EntityList> entityList,
ProcedureType procedureType}) async { ProcedureType procedureType}) async {
PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel();
ProcedureValadteRequestModel procedureValadteRequestModel = ProcedureValadteRequestModel procedureValadteRequestModel = new ProcedureValadteRequestModel();
new ProcedureValadteRequestModel();
procedureValadteRequestModel.patientMRN = patient.patientMRN; procedureValadteRequestModel.patientMRN = patient.patientMRN;
procedureValadteRequestModel.episodeID = patient.episodeNo; procedureValadteRequestModel.episodeID = patient.episodeNo;
procedureValadteRequestModel.appointmentNo = patient.appointmentNo; procedureValadteRequestModel.appointmentNo = patient.appointmentNo;
@ -337,21 +332,13 @@ class ProcedureViewModel extends BaseViewModel {
procedureValadteRequestModel.procedure = [element.procedureId]; procedureValadteRequestModel.procedure = [element.procedureId];
List<Controls> controls = List(); List<Controls> controls = List();
controls.add( controls.add(
Controls( Controls(code: "remarks", controlValue: element.remarks != null ? element.remarks : ""),
code: "remarks",
controlValue: element.remarks != null ? element.remarks : ""),
); );
controls.add( controls.add(
Controls( Controls(code: "ordertype", controlValue: procedureType == ProcedureType.PROCEDURE ? element.type ?? "1" : "0"),
code: "ordertype",
controlValue: procedureType == ProcedureType.PROCEDURE
? element.type ?? "1"
: "0"),
); );
controlsProcedure.add(Procedures( controlsProcedure
category: element.categoryID, .add(Procedures(category: element.categoryID, procedure: element.procedureId, controls: controls));
procedure: element.procedureId,
controls: controls));
}); });
postProcedureReqModel.procedures = controlsProcedure; postProcedureReqModel.procedures = controlsProcedure;
@ -371,8 +358,7 @@ class ProcedureViewModel extends BaseViewModel {
Helpers.showErrorToast(error); Helpers.showErrorToast(error);
getProcedure(mrn: patient.patientMRN); getProcedure(mrn: patient.patientMRN);
} else if (state == ViewState.Idle) { } else if (state == ViewState.Idle) {
Helpers.showErrorToast( Helpers.showErrorToast(valadteProcedureList[0].entityList[0].warringMessages);
valadteProcedureList[0].entityList[0].warringMessages);
} }
} }
} else { } else {

@ -1,42 +1,56 @@
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/patient/patient_service.dart';
import 'package:doctor_app_flutter/core/service/patient_medical_file/sick_leave/sickleave_service.dart'; import 'package:doctor_app_flutter/core/service/patient_medical_file/sick_leave/sickleave_service.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart';
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart';
import 'package:doctor_app_flutter/models/sickleave/sick_leave_statisitics_model.dart';
import '../../locator.dart'; import '../../locator.dart';
import 'base_view_model.dart'; import 'base_view_model.dart';
class SickLeaveViewModel extends BaseViewModel { class SickLeaveViewModel extends BaseViewModel {
SickLeaveService _sickLeaveService = locator<SickLeaveService>(); SickLeaveService _sickLeaveService = locator<SickLeaveService>();
get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics; PatientService _patientService = locator<PatientService>();
SickLeaveStatisticsModel get sickLeaveStatistics =>
_sickLeaveService.sickLeavestatisitics;
get getAllSIckLeave => _sickLeaveService.getAllSickLeave; get getAllSIckLeave => _sickLeaveService.getAllSickLeave;
//get getAllSIckLeavePatient => _sickLeaveService.getAllSickLeavePatient;
get sickleaveResponse => _sickLeaveService.sickLeaveResponse;
List get allOffTime => _sickLeaveService.getOffTimeList; List get allOffTime => _sickLeaveService.getOffTimeList;
List get allReasons => _sickLeaveService.getReasons; List get allReasons => _sickLeaveService.getReasons;
List get coveringDoctors => _sickLeaveService.coveringDoctorsList; List get coveringDoctors => _sickLeaveService.coveringDoctorsList;
List get sickLeaveDoctor => _sickLeaveService.getAllSickLeaveDoctor; List get sickLeaveDoctor => _sickLeaveService.getAllSickLeaveDoctor;
get getReschduleLeave => _sickLeaveService.getAllRescheduleLeave; get getReschduleLeave => _sickLeaveService.getAllRescheduleLeave;
get postSechedule => _sickLeaveService.postReschedule; get postSechedule => _sickLeaveService.postReschedule;
get getAllSIckLeavePatient =>
[..._sickLeaveService.getAllSickLeavePatient, ..._sickLeaveService.getAllSickLeaveDoctor]; get getAllSIckLeavePatient => [
..._sickLeaveService.getAllSickLeavePatient,
..._sickLeaveService.getAllSickLeaveDoctor
];
Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async {
setState(ViewState.Busy); setState(ViewState.BusyLocal);
await _sickLeaveService.addSickLeave(addSickLeaveRequest); await _sickLeaveService.addSickLeave(addSickLeaveRequest);
if (_sickLeaveService.hasError) { if (_sickLeaveService.hasError) {
error = _sickLeaveService.error; error = _sickLeaveService.error;
setState(ViewState.Error); setState(ViewState.ErrorLocal);
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future extendSickLeave(GetAllSickLeaveResponse extendSickLeaveRequest) async { Future extendSickLeave(GetAllSickLeaveResponse extendSickLeaveRequest) async {
setState(ViewState.Busy); setState(ViewState.BusyLocal);
await _sickLeaveService.extendSickLeave(extendSickLeaveRequest); await _sickLeaveService.extendSickLeave(extendSickLeaveRequest);
if (_sickLeaveService.hasError) { if (_sickLeaveService.hasError) {
error = _sickLeaveService.error; error = _sickLeaveService.error;
setState(ViewState.Error); setState(ViewState.ErrorLocal);
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }
@ -61,12 +75,36 @@ class SickLeaveViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getSickLeavePatient(patientMRN) async { Future getSickLeavePatient(patientMRN, {bool isLocalBusy = false}) async {
setState(ViewState.Busy); if (isLocalBusy)
setState(ViewState.BusyLocal);
else
setState(ViewState.Busy);
await _sickLeaveService.getSickLeavePatient(patientMRN); await _sickLeaveService.getSickLeavePatient(patientMRN);
if (_sickLeaveService.hasError) { if (_sickLeaveService.hasError) {
error = _sickLeaveService.error; error = _sickLeaveService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future getSickLeaveForPatient(PatiantInformtion patient, {bool isLocalBusy = false}) async {
if (isLocalBusy)
setState(ViewState.BusyLocal);
else
setState(ViewState.Busy);
var patientMRN = patient.patientMRN ?? patient.patientId;
var services = [_sickLeaveService.getSickLeavePatient(patientMRN),_sickLeaveService.getSickLeaveDoctor(patientMRN) ];
final results = await Future.wait(services);
if (_sickLeaveService.hasError) {
error = _sickLeaveService.error;
// if (isLocalBusy)
setState(ViewState.ErrorLocal);
// else
// setState(ViewState.Error);
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }

@ -1,4 +1,4 @@
import 'package:doctor_app_flutter/screens/doctor/doctor_reply_screen.dart'; import 'package:doctor_app_flutter/screens/doctor/doctor_replay/doctor_reply_screen.dart';
import 'package:doctor_app_flutter/screens/doctor/my_schedule_screen.dart'; import 'package:doctor_app_flutter/screens/doctor/my_schedule_screen.dart';
import 'package:doctor_app_flutter/screens/home/home_screen.dart'; 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';

@ -109,7 +109,7 @@ void setupLocator() {
locator.registerFactory(() => PatientViewModel()); locator.registerFactory(() => PatientViewModel());
locator.registerFactory(() => DashboardViewModel()); locator.registerFactory(() => DashboardViewModel());
locator.registerFactory(() => SickLeaveViewModel()); locator.registerFactory(() => SickLeaveViewModel());
locator.registerFactory(() => SOAPViewModel()); locator.registerLazySingleton(() => SOAPViewModel());
locator.registerFactory(() => PatientReferralViewModel()); locator.registerFactory(() => PatientReferralViewModel());
locator.registerFactory(() => PrescriptionViewModel()); locator.registerFactory(() => PrescriptionViewModel());
locator.registerFactory(() => ProcedureViewModel()); locator.registerFactory(() => ProcedureViewModel());

@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_analytics/observer.dart'; import 'package:firebase_analytics/observer.dart';
import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
@ -35,8 +36,7 @@ class MyApp extends StatelessWidget {
SizeConfig().init(constraints, orientation); SizeConfig().init(constraints, orientation);
return MultiProvider( return MultiProvider(
providers: [ providers: [
ChangeNotifierProvider<AuthenticationViewModel>( ChangeNotifierProvider<AuthenticationViewModel>(create: (context) => AuthenticationViewModel()),
create: (context) => AuthenticationViewModel()),
ChangeNotifierProvider<ProjectViewModel>( ChangeNotifierProvider<ProjectViewModel>(
create: (context) => ProjectViewModel(), create: (context) => ProjectViewModel(),
), ),
@ -57,6 +57,8 @@ class MyApp extends StatelessWidget {
TranslationBaseDelegate(), TranslationBaseDelegate(),
GlobalMaterialLocalizations.delegate, GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate, GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
DefaultCupertinoLocalizations.delegate
], ],
supportedLocales: [ supportedLocales: [
const Locale('ar', ''), // Arabic const Locale('ar', ''), // Arabic
@ -71,7 +73,7 @@ class MyApp extends StatelessWidget {
backgroundColor: Color.fromRGBO(255, 255, 255, 1), backgroundColor: Color.fromRGBO(255, 255, 255, 1),
), ),
navigatorKey: locator<NavigationService>().navigatorKey, navigatorKey: locator<NavigationService>().navigatorKey,
navigatorObservers:[ navigatorObservers: [
locator<AnalyticsService>().getAnalyticsObserver(), locator<AnalyticsService>().getAnalyticsObserver(),
], ],
initialRoute: INIT_ROUTE, initialRoute: INIT_ROUTE,

@ -4,9 +4,10 @@ class GetChiefComplaintReqModel {
int episodeId; int episodeId;
int episodeID; int episodeID;
dynamic doctorID; dynamic doctorID;
int admissionNo;
GetChiefComplaintReqModel( GetChiefComplaintReqModel(
{this.patientMRN, this.appointmentNo, this.episodeId, this.episodeID, this.doctorID}); {this.patientMRN, this.appointmentNo, this.episodeId, this.episodeID, this.doctorID, this.admissionNo});
GetChiefComplaintReqModel.fromJson(Map<String, dynamic> json) { GetChiefComplaintReqModel.fromJson(Map<String, dynamic> json) {
patientMRN = json['PatientMRN']; patientMRN = json['PatientMRN'];
@ -14,16 +15,27 @@ class GetChiefComplaintReqModel {
episodeId = json['EpisodeId']; episodeId = json['EpisodeId'];
episodeID = json['EpisodeID']; episodeID = json['EpisodeID'];
doctorID = json['DoctorID']; doctorID = json['DoctorID'];
admissionNo = json['admissionNo'];
} }
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['PatientMRN'] = this.patientMRN; data['PatientMRN'] = this.patientMRN;
data['AppointmentNo'] = this.appointmentNo; if (this.appointmentNo != null) {
data['EpisodeId'] = this.episodeId; data['AppointmentNo'] = this.appointmentNo;
data['EpisodeID'] = this.episodeID; }
data['DoctorID'] = this.doctorID; if (this.episodeId != null) {
data['EpisodeId'] = this.episodeId;
}
if (episodeID != null) {
data['EpisodeID'] = this.episodeID;
}
if (doctorID != null) {
data['DoctorID'] = this.doctorID;
}
if (this.admissionNo != null) {
data['AdmissionNo'] = this.admissionNo;
}
return data; return data;
} }

@ -1,6 +1,7 @@
class GetPhysicalExamReqModel { class GetPhysicalExamReqModel {
int patientMRN; int patientMRN;
int appointmentNo; int appointmentNo;
int admissionNo;
String episodeID; String episodeID;
String from; String from;
String to; String to;
@ -10,6 +11,7 @@ class GetPhysicalExamReqModel {
GetPhysicalExamReqModel({ GetPhysicalExamReqModel({
this.patientMRN, this.patientMRN,
this.appointmentNo, this.appointmentNo,
this.admissionNo,
this.episodeID, this.episodeID,
this.from, this.from,
this.to, this.to,
@ -31,11 +33,13 @@ class GetPhysicalExamReqModel {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['PatientMRN'] = this.patientMRN; data['PatientMRN'] = this.patientMRN;
data['AppointmentNo'] = this.appointmentNo; data['AppointmentNo'] = this.appointmentNo;
data['AdmissionNo'] = this.admissionNo;
data['EpisodeID'] = this.episodeID; data['EpisodeID'] = this.episodeID;
data['From'] = this.from; data['From'] = this.from;
data['To'] = this.to; data['To'] = this.to;
data['DoctorID'] = this.doctorID; data['DoctorID'] = this.doctorID;
data['EditedBy'] = this.editedBy; data['EditedBy'] = this.editedBy;
return data; return data;
} }
} }

@ -0,0 +1,22 @@
class GetEpisodeForInpatientReqModel {
int patientID;
int patientTypeID;
int admissionNo;
GetEpisodeForInpatientReqModel(
{this.patientID, this.patientTypeID, this.admissionNo});
GetEpisodeForInpatientReqModel.fromJson(Map<String, dynamic> json) {
patientID = json['PatientID'];
patientTypeID = json['PatientTypeID'];
admissionNo = json['AdmissionNo'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['PatientID'] = this.patientID;
data['PatientTypeID'] = this.patientTypeID;
data['AdmissionNo'] = this.admissionNo;
return data;
}
}

@ -0,0 +1,22 @@
class PostEpisodeForInpatientRequestModel {
int admissionNo;
int patientID;
int patientTypeID;
PostEpisodeForInpatientRequestModel(
{this.admissionNo, this.patientID, this.patientTypeID = 1});
PostEpisodeForInpatientRequestModel.fromJson(Map<String, dynamic> json) {
admissionNo = json['AdmissionNo'];
patientID = json['PatientID'];
patientTypeID = json['PatientTypeID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['AdmissionNo'] = this.admissionNo;
data['PatientID'] = this.patientID;
data['PatientTypeID'] = this.patientTypeID;
return data;
}
}

@ -1,54 +0,0 @@
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
class MySelectedAllergy {
MasterKeyModel selectedAllergySeverity;
MasterKeyModel selectedAllergy;
String remark;
bool isChecked;
bool isExpanded;
bool isLocal;
int createdBy;
bool hasValidationError;
MySelectedAllergy(
{this.selectedAllergySeverity,
this.selectedAllergy,
this.remark,
this.isChecked,
this.isExpanded = true,
this.isLocal = true,
this.createdBy,
this.hasValidationError = false});
MySelectedAllergy.fromJson(Map<String, dynamic> json) {
selectedAllergySeverity = json['selectedAllergySeverity'] != null
? new MasterKeyModel.fromJson(json['selectedAllergySeverity'])
: null;
selectedAllergy = json['selectedAllergy'] != null
? new MasterKeyModel.fromJson(json['selectedAllergy'])
: null;
remark = json['remark'];
isChecked = json['isChecked'];
isExpanded = json['isExpanded'];
isLocal = json['isLocal'];
createdBy = json['createdBy'];
hasValidationError = json['hasValidationError'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.selectedAllergySeverity != null) {
data['selectedAllergySeverity'] = this.selectedAllergySeverity.toJson();
}
if (this.selectedAllergy != null) {
data['selectedAllergy'] = this.selectedAllergy.toJson();
}
data['remark'] = this.remark;
data['isChecked'] = this.isChecked;
data['isExpanded'] = this.isExpanded;
data['createdBy'] = this.createdBy;
data['isLocal'] = this.isLocal;
data['hasValidationError'] = this.hasValidationError;
return data;
}
}

@ -1,65 +0,0 @@
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
class MySelectedAssessment {
MasterKeyModel selectedICD;
MasterKeyModel selectedDiagnosisCondition;
MasterKeyModel selectedDiagnosisType;
String remark;
int appointmentId;
int createdBy;
String createdOn;
int doctorID;
String doctorName;
String icdCode10ID;
MySelectedAssessment(
{this.selectedICD,
this.selectedDiagnosisCondition,
this.selectedDiagnosisType,
this.remark, this.appointmentId, this.createdBy,
this.createdOn,
this.doctorID,
this.doctorName,
this.icdCode10ID});
MySelectedAssessment.fromJson(Map<String, dynamic> json) {
selectedICD = json['selectedICD'] != null
? new MasterKeyModel.fromJson(json['selectedICD'])
: null;
selectedDiagnosisCondition = json['selectedDiagnosisCondition'] != null
? new MasterKeyModel.fromJson(json['selectedDiagnosisCondition'])
: null;
selectedDiagnosisType = json['selectedDiagnosisType'] != null
? new MasterKeyModel.fromJson(json['selectedDiagnosisType'])
: null;
remark = json['remark'];
appointmentId = json['appointmentId'];
createdBy = json['createdBy'];
createdOn = json['createdOn'];
doctorID = json['doctorID'];
doctorName = json['doctorName'];
icdCode10ID = json['icdCode10ID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.selectedICD != null) {
data['selectedICD'] = this.selectedICD.toJson();
}
if (this.selectedDiagnosisCondition != null) {
data['selectedICD'] = this.selectedDiagnosisCondition.toJson();
}
if (this.selectedDiagnosisType != null) {
data['selectedICD'] = this.selectedDiagnosisType.toJson();
}
data['remark'] = this.remark;
data['appointmentId'] = this.appointmentId;
data['createdBy'] = this.createdBy;
data['createdOn'] = this.createdOn;
data['doctorID'] = this.doctorID;
data['doctorName'] = this.doctorName;
data['icdCode10ID'] = this.icdCode10ID;
return data;
}
}

@ -1,61 +0,0 @@
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
class MySelectedExamination {
MasterKeyModel selectedExamination;
String remark;
bool isNormal;
bool isAbnormal;
bool notExamined;
bool isNew;
bool isLocal;
int createdBy;
String createdOn;
String editedOn;
MySelectedExamination({
this.selectedExamination,
this.remark,
this.isNormal = false,
this.isAbnormal = false,
this.notExamined = true,
this.isNew = true,
this.isLocal = true,
this.createdBy,
this.createdOn,
this.editedOn,
});
MySelectedExamination.fromJson(Map<String, dynamic> json) {
selectedExamination = json['selectedExamination'] != null
? new MasterKeyModel.fromJson(json['selectedExamination'])
: null;
remark = json['remark'];
isNormal = json['isNormal'];
isAbnormal = json['isAbnormal'];
notExamined = json['notExamined'];
isNew = json['isNew'];
createdBy = json['createdBy'];
createdOn = json['createdOn'];
editedOn = json['editedOn'];
isLocal = json['isLocal'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.selectedExamination != null) {
data['selectedExamination'] = this.selectedExamination.toJson();
}
data['remark'] = this.remark;
data['isNormal'] = this.isNormal;
data['isAbnormal'] = this.isAbnormal;
data['notExamined'] = this.notExamined;
data['isNew'] = this.isNew;
data['createdBy'] = this.createdBy;
data['createdOn'] = this.createdOn;
data['editedOn'] = this.editedOn;
data['isLocal'] = this.isLocal;
return data;
}
}

@ -1,33 +0,0 @@
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
class MySelectedHistory {
MasterKeyModel selectedHistory;
String remark;
bool isChecked;
bool isLocal;
MySelectedHistory(
{ this.selectedHistory, this.remark, this.isChecked, this.isLocal = true});
MySelectedHistory.fromJson(Map<String, dynamic> json) {
selectedHistory = json['selectedHistory'] != null
? new MasterKeyModel.fromJson(json['selectedHistory'])
: null;
remark = json['remark'];
remark = json['isChecked'];
isLocal = json['isLocal'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.selectedHistory != null) {
data['selectedHistory'] = this.selectedHistory.toJson();
}
data['remark'] = this.remark;
data['isChecked'] = this.remark;
data['isLocal'] = this.isLocal;
return data;
}
}

@ -2,6 +2,7 @@ class PostChiefComplaintRequestModel {
int appointmentNo; int appointmentNo;
int episodeID; int episodeID;
int patientMRN; int patientMRN;
int admissionNo;
String chiefComplaint; String chiefComplaint;
String hopi; String hopi;
String currentMedication; String currentMedication;
@ -11,7 +12,6 @@ class PostChiefComplaintRequestModel {
dynamic doctorID; dynamic doctorID;
dynamic editedBy; dynamic editedBy;
PostChiefComplaintRequestModel( PostChiefComplaintRequestModel(
{this.appointmentNo, {this.appointmentNo,
this.episodeID, this.episodeID,
@ -23,7 +23,8 @@ class PostChiefComplaintRequestModel {
this.isLactation, this.isLactation,
this.doctorID, this.doctorID,
this.editedBy, this.editedBy,
this.numberOfWeeks}); this.numberOfWeeks,
this.admissionNo});
PostChiefComplaintRequestModel.fromJson(Map<String, dynamic> json) { PostChiefComplaintRequestModel.fromJson(Map<String, dynamic> json) {
appointmentNo = json['AppointmentNo']; appointmentNo = json['AppointmentNo'];
@ -37,12 +38,18 @@ class PostChiefComplaintRequestModel {
numberOfWeeks = json['numberOfWeeks']; numberOfWeeks = json['numberOfWeeks'];
doctorID = json['DoctorID']; doctorID = json['DoctorID'];
editedBy = json['EditedBy']; editedBy = json['EditedBy'];
admissionNo = json['AdmissionNo'];
} }
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['AppointmentNo'] = this.appointmentNo; if (appointmentNo != null) {
data['EpisodeID'] = this.episodeID; data['AppointmentNo'] = this.appointmentNo;
}
if (episodeID != null) {
data['EpisodeID'] = this.episodeID;
}
data['PatientMRN'] = this.patientMRN; data['PatientMRN'] = this.patientMRN;
data['chiefComplaint'] = this.chiefComplaint; data['chiefComplaint'] = this.chiefComplaint;
data['Hopi'] = this.hopi; data['Hopi'] = this.hopi;
@ -51,7 +58,12 @@ class PostChiefComplaintRequestModel {
data['isLactation'] = this.isLactation; data['isLactation'] = this.isLactation;
data['numberOfWeeks'] = this.numberOfWeeks; data['numberOfWeeks'] = this.numberOfWeeks;
data['DoctorID'] = this.doctorID; data['DoctorID'] = this.doctorID;
data['EditedBy'] = this.editedBy; if (editedBy != null) {
data['EditedBy'] = this.editedBy;
}
if (admissionNo != null) {
data['AdmissionNo'] = this.admissionNo;
}
return data; return data;
} }

@ -1,12 +1,13 @@
class PostPhysicalExamRequestModel { class PostPhysicalExamRequestModel {
List<ListHisProgNotePhysicalExaminationVM> listHisProgNotePhysicalExaminationVM; List<ListHisProgNotePhysicalExaminationVM>
listHisProgNotePhysicalExaminationVM;
PostPhysicalExamRequestModel({this.listHisProgNotePhysicalExaminationVM}); PostPhysicalExamRequestModel({this.listHisProgNotePhysicalExaminationVM});
PostPhysicalExamRequestModel.fromJson(Map<String, dynamic> json) { PostPhysicalExamRequestModel.fromJson(Map<String, dynamic> json) {
if (json['listHisProgNotePhysicalExaminationVM'] != null) { if (json['listHisProgNotePhysicalExaminationVM'] != null) {
listHisProgNotePhysicalExaminationVM = new List<ListHisProgNotePhysicalExaminationVM>(); listHisProgNotePhysicalExaminationVM =
new List<ListHisProgNotePhysicalExaminationVM>();
json['listHisProgNotePhysicalExaminationVM'].forEach((v) { json['listHisProgNotePhysicalExaminationVM'].forEach((v) {
listHisProgNotePhysicalExaminationVM listHisProgNotePhysicalExaminationVM
.add(new ListHisProgNotePhysicalExaminationVM.fromJson(v)); .add(new ListHisProgNotePhysicalExaminationVM.fromJson(v));
@ -17,98 +18,105 @@ class PostPhysicalExamRequestModel {
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>();
if (this.listHisProgNotePhysicalExaminationVM != null) { if (this.listHisProgNotePhysicalExaminationVM != null) {
data['listHisProgNotePhysicalExaminationVM'] = data['listHisProgNotePhysicalExaminationVM'] = this
this.listHisProgNotePhysicalExaminationVM.map((v) => v.toJson()).toList(); .listHisProgNotePhysicalExaminationVM
.map((v) => v.toJson())
.toList();
} }
return data; return data;
} }
} }
class ListHisProgNotePhysicalExaminationVM { class ListHisProgNotePhysicalExaminationVM {
int episodeId; int episodeId;
int appointmentNo; int appointmentNo;
int examType; int admissionNo;
int examId; int examType;
int patientMRN; int examId;
bool isNormal; int patientMRN;
bool isAbnormal; bool isNormal;
bool notExamined; bool isAbnormal;
String examName; bool notExamined;
String examinationTypeName; String examName;
int examinationType; String examinationTypeName;
String remarks; int examinationType;
bool isNew; String remarks;
int createdBy; bool isNew;
String createdOn; int createdBy;
String createdByName; String createdOn;
int editedBy; String createdByName;
String editedOn; int editedBy;
String editedByName; String editedOn;
String editedByName;
ListHisProgNotePhysicalExaminationVM( ListHisProgNotePhysicalExaminationVM(
{this.episodeId, {this.episodeId,
this.appointmentNo, this.appointmentNo,
this.examType, this.admissionNo,
this.examId, this.examType,
this.patientMRN, this.examId,
this.isNormal, this.patientMRN,
this.isAbnormal, this.isNormal,
this.notExamined, this.isAbnormal,
this.examName, this.notExamined,
this.examinationTypeName, this.examName,
this.examinationType, this.examinationTypeName,
this.remarks, this.examinationType,
this.isNew, this.remarks,
this.createdBy, this.isNew,
this.createdOn, this.createdBy,
this.createdByName, this.createdOn,
this.editedBy, this.createdByName,
this.editedOn, this.editedBy,
this.editedByName}); this.editedOn,
this.editedByName});
ListHisProgNotePhysicalExaminationVM.fromJson(Map<String, dynamic> json) { ListHisProgNotePhysicalExaminationVM.fromJson(Map<String, dynamic> json) {
episodeId = json['episodeId']; episodeId = json['episodeId'];
appointmentNo = json['appointmentNo']; appointmentNo = json['appointmentNo'];
examType = json['examType']; admissionNo = json['AdmissionNo'];
examId = json['examId'];
patientMRN = json['patientMRN'];
isNormal = json['isNormal'];
isAbnormal = json['isAbnormal'];
notExamined = json['notExamined'];
examName = json['examName'];
examinationTypeName = json['examinationTypeName'];
examinationType = json['examinationType'];
remarks = json['remarks'];
isNew = json['isNew'];
createdBy = json['createdBy'];
createdOn = json['createdOn'];
createdByName = json['createdByName'];
editedBy = json['editedBy'];
editedOn = json['editedOn'];
editedByName = json['editedByName'];
}
Map<String, dynamic> toJson() { examType = json['examType'];
final Map<String, dynamic> data = new Map<String, dynamic>(); examId = json['examId'];
data['episodeId'] = this.episodeId; patientMRN = json['patientMRN'];
data['appointmentNo'] = this.appointmentNo; isNormal = json['isNormal'];
data['examType'] = this.examType; isAbnormal = json['isAbnormal'];
data['examId'] = this.examId; notExamined = json['notExamined'];
data['patientMRN'] = this.patientMRN; examName = json['examName'];
data['isNormal'] = this.isNormal; examinationTypeName = json['examinationTypeName'];
data['isAbnormal'] = this.isAbnormal; examinationType = json['examinationType'];
data['notExamined'] = this.notExamined; remarks = json['remarks'];
data['examName'] = this.examName; isNew = json['isNew'];
data['examinationTypeName'] = this.examinationTypeName; createdBy = json['createdBy'];
data['examinationType'] = this.examinationType; createdOn = json['createdOn'];
data['remarks'] = this.remarks; createdByName = json['createdByName'];
data['isNew'] = this.isNew; editedBy = json['editedBy'];
data['createdBy'] = this.createdBy; editedOn = json['editedOn'];
data['createdOn'] = this.createdOn; editedByName = json['editedByName'];
data['createdByName'] = this.createdByName;
data['editedBy'] = this.editedBy;
data['editedOn'] = this.editedOn;
data['editedByName'] = this.editedByName;
return data;
}
} }
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['episodeId'] = this.episodeId;
data['appointmentNo'] = this.appointmentNo;
data['admissionNo'] = this.admissionNo;
data['examType'] = this.examType;
data['examId'] = this.examId;
data['patientMRN'] = this.patientMRN;
data['isNormal'] = this.isNormal;
data['isAbnormal'] = this.isAbnormal;
data['notExamined'] = this.notExamined;
data['examName'] = this.examName;
data['examinationTypeName'] = this.examinationTypeName;
data['examinationType'] = this.examinationType;
data['remarks'] = this.remarks;
data['isNew'] = this.isNew;
data['createdBy'] = this.createdBy;
data['createdOn'] = this.createdOn;
data['createdByName'] = this.createdByName;
data['editedBy'] = this.editedBy;
data['editedOn'] = this.editedOn;
data['editedByName'] = this.editedByName;
return data;
}
}

@ -0,0 +1,23 @@
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
class MySelectedAllergy {
MasterKeyModel selectedAllergySeverity;
MasterKeyModel selectedAllergy;
String remark;
bool isChecked;
bool isExpanded;
bool isLocal;
int createdBy;
bool hasValidationError;
MySelectedAllergy(
{this.selectedAllergySeverity,
this.selectedAllergy,
this.remark,
this.isChecked,
this.isExpanded = true,
this.isLocal = true,
this.createdBy,
this.hasValidationError = false});
}

@ -0,0 +1,24 @@
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
class MySelectedAssessment {
MasterKeyModel selectedICD;
MasterKeyModel selectedDiagnosisCondition;
MasterKeyModel selectedDiagnosisType;
String remark;
int appointmentId;
int createdBy;
String createdOn;
int doctorID;
String doctorName;
String icdCode10ID;
MySelectedAssessment(
{this.selectedICD,
this.selectedDiagnosisCondition,
this.selectedDiagnosisType,
this.remark, this.appointmentId, this.createdBy,
this.createdOn,
this.doctorID,
this.doctorName,
this.icdCode10ID});
}

@ -0,0 +1,27 @@
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
class MySelectedExamination {
MasterKeyModel selectedExamination;
String remark;
bool isNormal;
bool isAbnormal;
bool notExamined;
bool isNew;
bool isLocal;
int createdBy;
String createdOn;
String editedOn;
MySelectedExamination({
this.selectedExamination,
this.remark,
this.isNormal = false,
this.isAbnormal = false,
this.notExamined = true,
this.isNew = true,
this.isLocal = true,
this.createdBy,
this.createdOn,
this.editedOn,
});
}

@ -0,0 +1,11 @@
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
class MySelectedHistory {
MasterKeyModel selectedHistory;
String remark;
bool isChecked;
bool isLocal;
MySelectedHistory(
{this.selectedHistory, this.remark, this.isChecked, this.isLocal = true});
}

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

Loading…
Cancel
Save