Covid Lab result generate certificate implemented

merge-requests/372/head
haroon amjad 4 years ago
parent 5f521556dc
commit 73097d15de

@ -1345,4 +1345,5 @@ const Map localizedValues = {
"book-video-livecare-2": {"en": "I don't need to visit the clinic", "ar": "اتصال فيديو لا احتاج الحضور الى العيادة"},
"no-thankyou": {"en": "No Thanks", "ar": "لا شكرا"},
"visit-clinic": {"en": "Schedule appointment with the doctor", "ar": "ارغب في حجز موعد مجدول مع الطبيب"},
"generate-covid-certificate": {"en": "Generate Covid-19 Certificate", "ar": "إنشاء شهادة كورونا"},
};

@ -1,57 +1,81 @@
class LabResultList {
String filterName = "";
List<LabResult> patientLabResultList = List();
LabResultList({this.filterName, LabResult lab}) {
patientLabResultList.add(lab);
}
}
class LabResult {
String description;
dynamic femaleInterpretativeData;
Null femaleInterpretativeData;
int gender;
bool isCertificateAllowed;
int lineItemNo;
dynamic maleInterpretativeData;
String notes;
Null maleInterpretativeData;
Null 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;
dynamic superVerifiedOn;
Null superVerifiedOn;
String testCode;
String uOM;
String verifiedOn;
dynamic verifiedOnDateTime;
Null verifiedOnDateTime;
LabResult(
{this.description,
this.femaleInterpretativeData,
this.gender,
this.lineItemNo,
this.maleInterpretativeData,
this.notes,
this.packageID,
this.patientID,
this.projectID,
this.referanceRange,
this.resultValue,
this.sampleCollectedOn,
this.sampleReceivedOn,
this.setupID,
this.superVerifiedOn,
this.testCode,
this.uOM,
this.verifiedOn,
this.verifiedOnDateTime});
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});
LabResult.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'];
@ -67,14 +91,19 @@ class LabResult {
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;
@ -86,13 +115,3 @@ class LabResult {
return data;
}
}
class LabResultList {
String filterName = "";
List<LabResult> patientLabResultList = List();
LabResultList({this.filterName, LabResult lab}) {
patientLabResultList.add(lab);
}
}

@ -3,21 +3,18 @@ import 'package:diplomaticquarterapp/core/model/labs/LabOrderResult.dart';
import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart';
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_special_result.dart';
import 'package:diplomaticquarterapp/core/model/labs/request_patient_lab_orders.dart';
import 'package:diplomaticquarterapp/core/model/labs/request_patient_lab_special_result.dart';
import 'package:diplomaticquarterapp/core/model/labs/request_send_lab_report_email.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
class LabsService extends BaseService {
List<PatientLabOrders> patientLabOrdersList = List();
Future getPatientLabOrdersList() async {
hasError = false;
Map<String,dynamic> body = Map();
Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false;
await baseAppClient.post(GET_Patient_LAB_ORDERS,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.post(GET_Patient_LAB_ORDERS, onSuccess: (dynamic response, int statusCode) {
patientLabOrdersList.clear();
response['ListPLO'].forEach((hospital) {
patientLabOrdersList.add(PatientLabOrders.fromJson(hospital));
@ -28,26 +25,20 @@ class LabsService extends BaseService {
}, body: body);
}
RequestPatientLabSpecialResult _requestPatientLabSpecialResult =
RequestPatientLabSpecialResult();
RequestPatientLabSpecialResult _requestPatientLabSpecialResult = RequestPatientLabSpecialResult();
List<PatientLabSpecialResult> patientLabSpecialResult = List();
List<LabResult> labResultList = List();
List<LabOrderResult> labOrdersResultsList = List();
Future getLaboratoryResult(
{String projectID,
int clinicID,
String invoiceNo,
String orderNo}) async {
Future getLaboratoryResult({String projectID, int clinicID, String invoiceNo, String orderNo}) async {
hasError = false;
_requestPatientLabSpecialResult.projectID = projectID;
_requestPatientLabSpecialResult.clinicID = clinicID;
_requestPatientLabSpecialResult.invoiceNo = invoiceNo;
_requestPatientLabSpecialResult.orderNo = orderNo;
await baseAppClient.post(GET_Patient_LAB_SPECIAL_RESULT,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.post(GET_Patient_LAB_SPECIAL_RESULT, onSuccess: (dynamic response, int statusCode) {
patientLabSpecialResult.clear();
response['ListPLSR'].forEach((hospital) {
patientLabSpecialResult.add(PatientLabSpecialResult.fromJson(hospital));
@ -67,8 +58,7 @@ class LabsService extends BaseService {
body['SetupID'] = patientLabOrder.setupID;
body['ProjectID'] = patientLabOrder.projectID;
body['ClinicID'] = patientLabOrder.clinicID;
await baseAppClient.post(GET_Patient_LAB_RESULT,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.post(GET_Patient_LAB_RESULT, onSuccess: (dynamic response, int statusCode) {
patientLabSpecialResult.clear();
labResultList.clear();
response['ListPLR'].forEach((lab) {
@ -80,7 +70,33 @@ class LabsService extends BaseService {
}, body: body);
}
Future getPatientLabOrdersResults({PatientLabOrders patientLabOrder,String procedure}) async {
Future generateCovidLabReport(LabResult covidLabResult) async {
hasError = false;
Map<String, dynamic> body = Map();
body['To'] = user.emailAddress;
body['OrderNo'] = covidLabResult.orderNo;
body['OrderLineItemNo'] = covidLabResult.orderLineItemNo;
body['LineItemNo'] = covidLabResult.resultValueBasedLineItemNo;
body['CertificateFormat'] = 5;
body['GeneratedBy'] = 102;
body['ShowPassportNumber'] = "no";
body['isDentalAllowedBackend'] = false;
body['SetupID'] = covidLabResult.setupID;
body['ProjectID'] = covidLabResult.projectID;
dynamic localRes;
await baseAppClient.post(SEND_COVID_LAB_RESULT_EMAIL, onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
return Future.value(localRes);
}
Future getPatientLabOrdersResults({PatientLabOrders patientLabOrder, String procedure}) async {
hasError = false;
Map<String, dynamic> body = Map();
body['InvoiceNo'] = patientLabOrder.invoiceNo;
@ -90,9 +106,8 @@ class LabsService extends BaseService {
body['ProjectID'] = patientLabOrder.projectID;
body['ClinicID'] = patientLabOrder.clinicID;
body['Procedure'] = procedure;
await baseAppClient.post(GET_Patient_LAB_ORDERS_RESULT,
onSuccess: (dynamic response, int statusCode) {
labOrdersResultsList.clear();
await baseAppClient.post(GET_Patient_LAB_ORDERS_RESULT, onSuccess: (dynamic response, int statusCode) {
labOrdersResultsList.clear();
response['ListPLR'].forEach((lab) {
labOrdersResultsList.add(LabOrderResult.fromJson(lab));
});
@ -102,28 +117,23 @@ class LabsService extends BaseService {
}, body: body);
}
RequestSendLabReportEmail _requestSendLabReportEmail =
RequestSendLabReportEmail();
RequestSendLabReportEmail _requestSendLabReportEmail = RequestSendLabReportEmail();
Future sendLabReportEmail({PatientLabOrders patientLabOrder}) async {
_requestSendLabReportEmail.projectID = patientLabOrder.projectID;
_requestSendLabReportEmail.invoiceNo = patientLabOrder.invoiceNo;
_requestSendLabReportEmail.doctorName = patientLabOrder.doctorName;
_requestSendLabReportEmail.clinicName = patientLabOrder.clinicDescription;
_requestSendLabReportEmail.patientName = user.firstName +" "+ user.lastName;
_requestSendLabReportEmail.patientIditificationNum =
user.patientIdentificationNo;
_requestSendLabReportEmail.patientName = user.firstName + " " + user.lastName;
_requestSendLabReportEmail.patientIditificationNum = user.patientIdentificationNo;
_requestSendLabReportEmail.dateofBirth = user.dateofBirth;
_requestSendLabReportEmail.to = user.emailAddress;
_requestSendLabReportEmail.orderDate = '${patientLabOrder.orderDate.year}-${patientLabOrder.orderDate.month}-${patientLabOrder.orderDate.day}';
_requestSendLabReportEmail.patientMobileNumber = user.mobileNumber;
_requestSendLabReportEmail.projectName = patientLabOrder.projectName;
_requestSendLabReportEmail.setupID = user.setupID;
await baseAppClient.post(SEND_LAB_RESULT_EMAIL,
onSuccess: (dynamic response, int statusCode) {
_requestSendLabReportEmail.setupID = user.setupID;
}, onFailure: (String error, int statusCode) {
await baseAppClient.post(SEND_LAB_RESULT_EMAIL, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _requestSendLabReportEmail.toJson());

@ -1217,6 +1217,8 @@ class TranslationBase {
String get bookVideoLivecare2 => localizedValues["book-video-livecare-2"][locale.languageCode];
String get noThankyou => localizedValues["no-thankyou"][locale.languageCode];
String get visitClinic => localizedValues["visit-clinic"][locale.languageCode];
String get generateCovidCertificate => localizedValues["generate-covid-certificate"][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -1,7 +1,11 @@
import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart';
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -10,15 +14,17 @@ import 'package:provider/provider.dart';
import '../../text.dart';
import 'FlowChartPage.dart';
class LabResultWidget extends StatelessWidget {
final String filterName;
final String filterName ;
final List<LabResult> patientLabResultList;
final PatientLabOrders patientLabOrder;
LabResultWidget({Key key, this.filterName, this.patientLabResultList, this.patientLabOrder}) : super(key: key);
LabResult covidLabResult;
LabResultWidget({Key key, this.filterName, this.patientLabResultList, this.patientLabOrder}) : super(key: key);
ProjectViewModel projectViewModel;
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
@ -29,8 +35,7 @@ class LabResultWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(filterName),
InkWell(
@ -40,7 +45,7 @@ class LabResultWidget extends StatelessWidget {
FadePage(
page: FlowChartPage(
filterName: filterName,
patientLabOrder: patientLabOrder,
patientLabOrder: patientLabOrder,
),
),
);
@ -55,16 +60,76 @@ class LabResultWidget extends StatelessWidget {
),
Table(
border: TableBorder.symmetric(
inside: BorderSide(
width: 2.0, color: Colors.grey[300]),
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
),
children: fullData(patientLabResultList,context),
children: fullData(patientLabResultList, context),
),
checkIfCovidLab(patientLabResultList)
? Container(
margin: EdgeInsets.only(top: 10.0),
child: ButtonTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
minWidth: MediaQuery.of(context).size.width * 0.91,
height: 45.0,
child: RaisedButton(
color: new Color(0xFFc5272d),
textColor: Colors.white,
disabledTextColor: Colors.white,
disabledColor: Colors.red[300],
onPressed: () {
showConfirmMessage(context, projectViewModel.user.emailAddress);
},
child: Text(TranslationBase.of(context).generateCovidCertificate, style: TextStyle(fontSize: 18.0)),
),
),
)
: Container(),
],
),
);
}
List<TableRow> fullData(List<LabResult> labResultList,context) {
generateCovidCertificate(BuildContext context) {
LabsService service = new LabsService();
GifLoaderDialogUtils.showMyDialog(context);
service.generateCovidLabReport(covidLabResult).then((res) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showSuccessToast(message: TranslationBase.of(context).emailSentSuccessfully);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
}
void showConfirmMessage(BuildContext context, String email) {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
email: email,
onTapSendEmail: () {
generateCovidCertificate(context);
},
),
);
}
bool checkIfCovidLab(List<LabResult> labResultList) {
bool isCovidResult = false;
labResultList.forEach((order) {
if (order.testCode.toUpperCase().contains("COVID") && order.isCertificateAllowed.toString() == "true") {
isCovidResult = true;
covidLabResult = order;
}
print(covidLabResult.testCode);
});
return isCovidResult;
}
List<TableRow> fullData(List<LabResult> labResultList, context) {
List<TableRow> tableRow = [];
tableRow.add(
TableRow(
@ -74,12 +139,8 @@ class LabResultWidget extends StatelessWidget {
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic
? Radius.circular(0.0)
: Radius.circular(10.0),
topRight: projectViewModel.isArabic
? Radius.circular(10.0)
: Radius.circular(0.0),
topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
),
),
child: Center(
@ -106,12 +167,8 @@ class LabResultWidget extends StatelessWidget {
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic
? Radius.circular(10.0)
: Radius.circular(0.0),
topRight: projectViewModel.isArabic
? Radius.circular(0.0)
: Radius.circular(10.0),
topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
topRight: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
),
),
child: Center(
@ -144,7 +201,7 @@ class LabResultWidget extends StatelessWidget {
color: Colors.white,
child: Center(
child: Texts(
lab.resultValue+" "+lab.uOM,
lab.resultValue + " " + lab.uOM,
textAlign: TextAlign.center,
),
),
@ -168,7 +225,4 @@ class LabResultWidget extends StatelessWidget {
});
return tableRow;
}
}

@ -188,7 +188,7 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
.labResultLists[index]
.patientLabResultList,
),
)
),
],
),
),
@ -252,7 +252,6 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
data: widget.details ?? TranslationBase.of(context).noDataAvailable,
)),
),
],
),
],

@ -23,23 +23,23 @@ var _InAppBrowserOptions = InAppBrowserClassOptions(
class MyInAppBrowser extends InAppBrowser {
_PAYMENT_TYPE paymentType;
// static String SERVICE_URL =
// 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT
static String SERVICE_URL =
'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE
'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT
// static String PREAUTH_SERVICE_URL =
// 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT
// static String SERVICE_URL =
// 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE
static String PREAUTH_SERVICE_URL =
'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store
'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT
// static String PRESCRIPTION_PAYMENT_WITH_ORDERID =
// 'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID=';
// static String PREAUTH_SERVICE_URL =
// 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store
static String PRESCRIPTION_PAYMENT_WITH_ORDERID =
'https://mdlaboratories.com/exacartapi/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID='; //Live
'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID=';
// static String PRESCRIPTION_PAYMENT_WITH_ORDERID =
// 'https://mdlaboratories.com/exacartapi/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID='; //Live
// Packages
static String PACKAGES_REQUEST_PAYMENT_URL =

Loading…
Cancel
Save