@ -1,16 +1,16 @@
import ' dart:ui ' ;
import ' dart:ui ' ;
import ' package: diplomaticquarter app/config/config.dart' ;
import ' package: hmg_patient_ app/config/config.dart' ;
import ' package: diplomaticquarter app/core/model/labs/LabOrderResult.dart' ;
import ' package: hmg_patient_ app/core/model/labs/LabOrderResult.dart' ;
import ' package: diplomaticquarter app/core/model/labs/lab_result.dart' ;
import ' package: hmg_patient_ app/core/model/labs/lab_result.dart' ;
import ' package: diplomaticquarter app/core/model/labs/patient_lab_orders.dart' ;
import ' package: hmg_patient_ app/core/model/labs/patient_lab_orders.dart' ;
import ' package: diplomaticquarter app/core/model/labs/patient_lab_special_result.dart' ;
import ' package: hmg_patient_ app/core/model/labs/patient_lab_special_result.dart' ;
import ' package: diplomaticquarter app/core/model/labs/request_patient_lab_special_result.dart' ;
import ' package: hmg_patient_ app/core/model/labs/request_patient_lab_special_result.dart' ;
import ' package: diplomaticquarter app/core/model/labs/request_send_lab_report_email.dart' ;
import ' package: hmg_patient_ app/core/model/labs/request_send_lab_report_email.dart' ;
import ' package: diplomaticquarter app/core/service/base_service.dart' ;
import ' package: hmg_patient_ app/core/service/base_service.dart' ;
import ' package: diplomaticquarter app/models/Authentication/authenticated_user.dart' ;
import ' package: hmg_patient_ app/models/Authentication/authenticated_user.dart' ;
import ' package: diplomaticquarter app/uitl/date_uitl.dart' ;
import ' package: hmg_patient_ app/uitl/date_uitl.dart' ;
import ' package: diplomaticquarter app/widgets/data_display/medical/LabResult/lab_result_graph.dart' ;
import ' package: hmg_patient_ app/widgets/data_display/medical/LabResult/lab_result_graph.dart' ;
class LabsService extends BaseService {
class LabsService extends BaseService {
List < PatientLabOrders > patientLabOrdersList = [ ] ;
List < PatientLabOrders > patientLabOrdersList = [ ] ;
@ -21,8 +21,7 @@ class LabsService extends BaseService {
hasError = false ;
hasError = false ;
Map < String , dynamic > body = Map ( ) ;
Map < String , dynamic > body = Map ( ) ;
body [ ' isDentalAllowedBackend ' ] = false ;
body [ ' isDentalAllowedBackend ' ] = false ;
await baseAppClient . post ( GET_Patient_LAB_ORDERS ,
await baseAppClient . post ( GET_Patient_LAB_ORDERS , onSuccess: ( dynamic response , int statusCode ) {
onSuccess: ( dynamic response , int statusCode ) {
patientLabOrdersList . clear ( ) ;
patientLabOrdersList . clear ( ) ;
response [ ' ListPLO ' ] . forEach ( ( hospital ) {
response [ ' ListPLO ' ] . forEach ( ( hospital ) {
patientLabOrdersList . add ( PatientLabOrders . fromJson ( hospital ) ) ;
patientLabOrdersList . add ( PatientLabOrders . fromJson ( hospital ) ) ;
@ -33,21 +32,13 @@ class LabsService extends BaseService {
} , body: body ) ;
} , body: body ) ;
}
}
RequestPatientLabSpecialResult _requestPatientLabSpecialResult =
RequestPatientLabSpecialResult _requestPatientLabSpecialResult = RequestPatientLabSpecialResult ( ) ;
RequestPatientLabSpecialResult ( ) ;
List < PatientLabSpecialResult > patientLabSpecialResult = [ ] ;
List < PatientLabSpecialResult > patientLabSpecialResult = [ ] ;
List < LabResult > labResultList = [ ] ;
List < LabResult > labResultList = [ ] ;
List < LabOrderResult > labOrdersResultsList = [ ] ;
List < LabOrderResult > labOrdersResultsList = [ ] ;
Future getLaboratoryResult (
Future getLaboratoryResult ( { String ? projectID , int ? clinicID , String ? invoiceNo , String ? invoiceType , String ? orderNo , String ? setupID , bool ? isVidaPlus } ) async {
{ String ? projectID ,
int ? clinicID ,
String ? invoiceNo ,
String ? invoiceType ,
String ? orderNo ,
String ? setupID ,
bool ? isVidaPlus } ) async {
hasError = false ;
hasError = false ;
_requestPatientLabSpecialResult . projectID = projectID ;
_requestPatientLabSpecialResult . projectID = projectID ;
_requestPatientLabSpecialResult . clinicID = clinicID ;
_requestPatientLabSpecialResult . clinicID = clinicID ;
@ -60,8 +51,7 @@ class LabsService extends BaseService {
_requestPatientLabSpecialResult . orderNo = orderNo ;
_requestPatientLabSpecialResult . orderNo = orderNo ;
_requestPatientLabSpecialResult . setupID = setupID ;
_requestPatientLabSpecialResult . setupID = setupID ;
await baseAppClient . post ( GET_Patient_LAB_SPECIAL_RESULT ,
await baseAppClient . post ( GET_Patient_LAB_SPECIAL_RESULT , onSuccess: ( dynamic response , int statusCode ) {
onSuccess: ( dynamic response , int statusCode ) {
patientLabSpecialResult . clear ( ) ;
patientLabSpecialResult . clear ( ) ;
response [ ' ListPLSR ' ] . forEach ( ( hospital ) {
response [ ' ListPLSR ' ] . forEach ( ( hospital ) {
patientLabSpecialResult . add ( PatientLabSpecialResult . fromJson ( hospital ) ) ;
patientLabSpecialResult . add ( PatientLabSpecialResult . fromJson ( hospital ) ) ;
@ -72,8 +62,7 @@ class LabsService extends BaseService {
} , body: _requestPatientLabSpecialResult . toJson ( ) ) ;
} , body: _requestPatientLabSpecialResult . toJson ( ) ) ;
}
}
Future getPatientLabResult (
Future getPatientLabResult ( { PatientLabOrders ? patientLabOrder , bool ? isVidaPlus } ) async {
{ PatientLabOrders ? patientLabOrder , bool ? isVidaPlus } ) async {
hasError = false ;
hasError = false ;
Map < String , dynamic > body = Map ( ) ;
Map < String , dynamic > body = Map ( ) ;
body [ ' InvoiceNo_VP ' ] = isVidaPlus ! ? patientLabOrder ! . invoiceNo : " 0 " ;
body [ ' InvoiceNo_VP ' ] = isVidaPlus ! ? patientLabOrder ! . invoiceNo : " 0 " ;
@ -84,14 +73,11 @@ class LabsService extends BaseService {
body [ ' SetupID ' ] = patientLabOrder . setupID ;
body [ ' SetupID ' ] = patientLabOrder . setupID ;
body [ ' ProjectID ' ] = patientLabOrder . projectID ;
body [ ' ProjectID ' ] = patientLabOrder . projectID ;
body [ ' ClinicID ' ] = patientLabOrder . clinicID ;
body [ ' ClinicID ' ] = patientLabOrder . clinicID ;
await baseAppClient . post ( GET_Patient_LAB_RESULT ,
await baseAppClient . post ( GET_Patient_LAB_RESULT , onSuccess: ( dynamic response , int statusCode ) {
onSuccess: ( dynamic response , int statusCode ) {
patientLabSpecialResult . clear ( ) ;
patientLabSpecialResult . clear ( ) ;
labResultList . clear ( ) ;
labResultList . clear ( ) ;
response [ ' ListPLR ' ] . forEach ( ( lab ) {
response [ ' ListPLR ' ] . forEach ( ( lab ) {
labResultList . add (
labResultList . add ( LabResult . fromJson ( lab ) ) ;
LabResult . fromJson ( lab ) ,
) ;
} ) ;
} ) ;
} , onFailure: ( String error , int statusCode ) {
} , onFailure: ( String error , int statusCode ) {
hasError = true ;
hasError = true ;
@ -99,8 +85,7 @@ class LabsService extends BaseService {
} , body: body ) ;
} , body: body ) ;
}
}
Future generateCovidLabReport (
Future generateCovidLabReport ( LabResult covidLabResult , String isOutsideKSA ) async {
LabResult covidLabResult , String isOutsideKSA ) async {
hasError = false ;
hasError = false ;
Map < String , dynamic > body = Map ( ) ;
Map < String , dynamic > body = Map ( ) ;
@ -117,8 +102,7 @@ class LabsService extends BaseService {
dynamic localRes ;
dynamic localRes ;
await baseAppClient . post ( SEND_COVID_LAB_RESULT_EMAIL ,
await baseAppClient . post ( SEND_COVID_LAB_RESULT_EMAIL , onSuccess: ( dynamic response , int statusCode ) {
onSuccess: ( dynamic response , int statusCode ) {
localRes = response ;
localRes = response ;
} , onFailure: ( String error , int statusCode ) {
} , onFailure: ( String error , int statusCode ) {
hasError = true ;
hasError = true ;
@ -135,8 +119,7 @@ class LabsService extends BaseService {
dynamic localRes ;
dynamic localRes ;
await baseAppClient . post ( COVID_PASSPORT_UPDATE ,
await baseAppClient . post ( COVID_PASSPORT_UPDATE , onSuccess: ( dynamic response , int statusCode ) {
onSuccess: ( dynamic response , int statusCode ) {
localRes = response ;
localRes = response ;
} , onFailure: ( String error , int statusCode ) {
} , onFailure: ( String error , int statusCode ) {
hasError = true ;
hasError = true ;
@ -145,14 +128,7 @@ class LabsService extends BaseService {
return Future . value ( localRes ) ;
return Future . value ( localRes ) ;
}
}
Future updateWorkplaceName (
Future updateWorkplaceName ( String workplaceName , String workplaceNameAR , String occupation , String occupationAR , int requestNumber , String setupID , int projectID ) async {
String workplaceName ,
String workplaceNameAR ,
String occupation ,
String occupationAR ,
int requestNumber ,
String setupID ,
int projectID ) async {
/ / Future updateWorkplaceName ( String workplaceName , String workplaceNameAR , int requestNumber , String setupID , int projectID ) async {
/ / Future updateWorkplaceName ( String workplaceName , String workplaceNameAR , int requestNumber , String setupID , int projectID ) async {
hasError = false ;
hasError = false ;
Map < String , dynamic > body = Map ( ) ;
Map < String , dynamic > body = Map ( ) ;
@ -169,8 +145,7 @@ class LabsService extends BaseService {
dynamic localRes ;
dynamic localRes ;
await baseAppClient . post ( UPDATE_WORKPLACE_NAME ,
await baseAppClient . post ( UPDATE_WORKPLACE_NAME , onSuccess: ( dynamic response , int statusCode ) {
onSuccess: ( dynamic response , int statusCode ) {
localRes = response ;
localRes = response ;
} , onFailure: ( String error , int statusCode ) {
} , onFailure: ( String error , int statusCode ) {
hasError = true ;
hasError = true ;
@ -185,8 +160,7 @@ class LabsService extends BaseService {
dynamic localRes ;
dynamic localRes ;
await baseAppClient . post ( GET_PATIENT_PASSPORT_NUMBER ,
await baseAppClient . post ( GET_PATIENT_PASSPORT_NUMBER , onSuccess: ( dynamic response , int statusCode ) {
onSuccess: ( dynamic response , int statusCode ) {
localRes = response ;
localRes = response ;
} , onFailure: ( String error , int statusCode ) {
} , onFailure: ( String error , int statusCode ) {
hasError = true ;
hasError = true ;
@ -204,8 +178,7 @@ class LabsService extends BaseService {
dynamic localRes ;
dynamic localRes ;
await baseAppClient . post ( GET_SICKLEAVE_STATUS_ADMISSION_NO ,
await baseAppClient . post ( GET_SICKLEAVE_STATUS_ADMISSION_NO , onSuccess: ( dynamic response , int statusCode ) {
onSuccess: ( dynamic response , int statusCode ) {
localRes = response ;
localRes = response ;
} , onFailure: ( String error , int statusCode ) {
} , onFailure: ( String error , int statusCode ) {
hasError = true ;
hasError = true ;
@ -214,10 +187,7 @@ class LabsService extends BaseService {
return Future . value ( localRes ) ;
return Future . value ( localRes ) ;
}
}
Future getPatientLabOrdersResults (
Future getPatientLabOrdersResults ( { PatientLabOrders ? patientLabOrder , String ? procedure , bool isVidaPlus = false } ) async {
{ PatientLabOrders ? patientLabOrder ,
String ? procedure ,
bool isVidaPlus = false } ) async {
hasError = false ;
hasError = false ;
Map < String , dynamic > body = Map ( ) ;
Map < String , dynamic > body = Map ( ) ;
body [ ' InvoiceNo_VP ' ] = isVidaPlus ? patientLabOrder ! . invoiceNo : " 0 " ;
body [ ' InvoiceNo_VP ' ] = isVidaPlus ? patientLabOrder ! . invoiceNo : " 0 " ;
@ -230,8 +200,7 @@ class LabsService extends BaseService {
body [ ' Procedure ' ] = procedure ;
body [ ' Procedure ' ] = procedure ;
body [ ' Procedure ' ] = procedure ;
body [ ' Procedure ' ] = procedure ;
body [ ' LanguageID ' ] = 1 ;
body [ ' LanguageID ' ] = 1 ;
await baseAppClient . post ( GET_Patient_LAB_ORDERS_RESULT ,
await baseAppClient . post ( GET_Patient_LAB_ORDERS_RESULT , 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 ) ) ;
@ -243,31 +212,20 @@ class LabsService extends BaseService {
} , body: body ) ;
} , body: body ) ;
}
}
RequestSendLabReportEmail _requestSendLabReportEmail =
RequestSendLabReportEmail _requestSendLabReportEmail = RequestSendLabReportEmail ( ) ;
RequestSendLabReportEmail ( ) ;
Future sendLabReportEmail (
Future sendLabReportEmail ( { PatientLabOrders ? patientLabOrder , AuthenticatedUser ? userObj , bool isVidaPlus = false , bool isDownload = false , int languageID = 1 } ) async {
{ PatientLabOrders ? patientLabOrder ,
AuthenticatedUser ? userObj ,
bool isVidaPlus = false ,
bool isDownload = false ,
int languageID = 1 } ) async {
_requestSendLabReportEmail . projectID = patientLabOrder ! . projectID ;
_requestSendLabReportEmail . projectID = patientLabOrder ! . projectID ;
_requestSendLabReportEmail . invoiceNo =
_requestSendLabReportEmail . invoiceNo = isVidaPlus ? " 0 " : patientLabOrder . invoiceNo ;
isVidaPlus ? " 0 " : patientLabOrder . invoiceNo ;
_requestSendLabReportEmail . invoiceNoVP = isVidaPlus ? patientLabOrder . invoiceNo : " 0 " ;
_requestSendLabReportEmail . invoiceNoVP =
isVidaPlus ? patientLabOrder . invoiceNo : " 0 " ;
_requestSendLabReportEmail . invoiceType = patientLabOrder . invoiceType ;
_requestSendLabReportEmail . invoiceType = patientLabOrder . invoiceType ;
_requestSendLabReportEmail . doctorName = patientLabOrder . doctorName ;
_requestSendLabReportEmail . doctorName = patientLabOrder . doctorName ;
_requestSendLabReportEmail . clinicName = patientLabOrder . clinicDescription ;
_requestSendLabReportEmail . clinicName = patientLabOrder . clinicDescription ;
_requestSendLabReportEmail . patientName =
_requestSendLabReportEmail . patientName = userObj ! . firstName ! + " " + userObj . lastName ! ;
userObj ! . firstName ! + " " + userObj . lastName ! ;
_requestSendLabReportEmail . patientIditificationNum = userObj . patientIdentificationNo ;
_requestSendLabReportEmail . patientIditificationNum =
userObj . patientIdentificationNo ;
_requestSendLabReportEmail . dateofBirth = userObj . dateofBirth ;
_requestSendLabReportEmail . dateofBirth = userObj . dateofBirth ;
_requestSendLabReportEmail . to = userObj . emailAddress ;
_requestSendLabReportEmail . to = userObj . emailAddress ;
_requestSendLabReportEmail . orderDate =
_requestSendLabReportEmail . orderDate = ' ${ patientLabOrder . orderDate ! . year } - ${ patientLabOrder . orderDate ! . month } - ${ patientLabOrder . orderDate ! . day } ' ;
' ${ patientLabOrder . orderDate ! . year } - ${ patientLabOrder . orderDate ! . month } - ${ patientLabOrder . orderDate ! . day } ' ;
_requestSendLabReportEmail . patientMobileNumber = userObj . mobileNumber ;
_requestSendLabReportEmail . patientMobileNumber = userObj . mobileNumber ;
_requestSendLabReportEmail . projectName = patientLabOrder . projectName ;
_requestSendLabReportEmail . projectName = patientLabOrder . projectName ;
_requestSendLabReportEmail . setupID = patientLabOrder . setupID ;
_requestSendLabReportEmail . setupID = patientLabOrder . setupID ;
@ -278,13 +236,9 @@ class LabsService extends BaseService {
_requestSendLabReportEmail . languageID = languageID ;
_requestSendLabReportEmail . languageID = languageID ;
/ / await baseAppClient . post ( SEND_LAB_RESULT_EMAIL , onSuccess: ( dynamic response , int statusCode ) {
/ / await baseAppClient . post ( SEND_LAB_RESULT_EMAIL , onSuccess: ( dynamic response , int statusCode ) {
await baseAppClient
await baseAppClient . post ( isVidaPlus ? SEND_LAB_RESULT_EMAIL : SEND_LAB_RESULT_EMAIL_NEW , onSuccess: ( dynamic response , int statusCode ) {
. post ( isVidaPlus ? SEND_LAB_RESULT_EMAIL : SEND_LAB_RESULT_EMAIL_NEW ,
onSuccess: ( dynamic response , int statusCode ) {
if ( isDownload ) {
if ( isDownload ) {
labReportPDF = isVidaPlus
labReportPDF = isVidaPlus ? response [ ' LabReportsPDFContent ' ] : response [ ' PdfContent ' ] ;
? response [ ' LabReportsPDFContent ' ]
: response [ ' PdfContent ' ] ;
}
}
} , onFailure: ( String error , int statusCode ) {
} , onFailure: ( String error , int statusCode ) {
hasError = true ;
hasError = true ;