Merge branch 'development_new_design_2.0' into haroon-new-design

merge-update-with-lab-changes
haroon amjad 5 years ago
commit af7b27258c

@ -19,8 +19,7 @@ class BloodSugarService 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_DIABETIC_RESULT_AVERAGE, await baseAppClient.post(GET_DIABETIC_RESULT_AVERAGE, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
monthDiabtectResultAverageList.clear(); monthDiabtectResultAverageList.clear();
weekDiabtectResultAverageList.clear(); weekDiabtectResultAverageList.clear();
yearDiabtecResultAverageList.clear(); yearDiabtecResultAverageList.clear();
@ -30,18 +29,15 @@ class BloodSugarService extends BaseService {
yearDiabtecPatientResult.clear(); yearDiabtecPatientResult.clear();
response['List_MonthDiabtectResultAverage'].forEach((item) { response['List_MonthDiabtectResultAverage'].forEach((item) {
monthDiabtectResultAverageList monthDiabtectResultAverageList.add(MonthDiabtectResultAverage.fromJson(item));
.add(MonthDiabtectResultAverage.fromJson(item));
}); });
response['List_WeekDiabtectResultAverage'].forEach((item) { response['List_WeekDiabtectResultAverage'].forEach((item) {
weekDiabtectResultAverageList weekDiabtectResultAverageList.add(WeekDiabtectResultAverage.fromJson(item));
.add(WeekDiabtectResultAverage.fromJson(item));
}); });
response['List_YearDiabtecResultAverage'].forEach((item) { response['List_YearDiabtecResultAverage'].forEach((item) {
yearDiabtecResultAverageList yearDiabtecResultAverageList.add(YearDiabtecResultAverage.fromJson(item));
.add(YearDiabtecResultAverage.fromJson(item));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -51,8 +47,7 @@ class BloodSugarService extends BaseService {
Future getDiabtecResults() async { Future getDiabtecResults() async {
hasError = false; hasError = false;
await baseAppClient.post(GET_DIABTEC_RESULT, await baseAppClient.post(GET_DIABTEC_RESULT, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
monthDiabtecPatientResult.clear(); monthDiabtecPatientResult.clear();
weekDiabtecPatientResult.clear(); weekDiabtecPatientResult.clear();
yearDiabtecPatientResult.clear(); yearDiabtecPatientResult.clear();
@ -69,7 +64,6 @@ class BloodSugarService extends BaseService {
yearDiabtecPatientResult.add(DiabtecPatientResult.fromJson(item)); yearDiabtecPatientResult.add(DiabtecPatientResult.fromJson(item));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error; super.error = error;
}, body: Map()); }, body: Map());
} }
@ -81,17 +75,15 @@ class BloodSugarService extends BaseService {
body['BloodSugerDateChart'] = bloodSugerDateChart; body['BloodSugerDateChart'] = bloodSugerDateChart;
body['BloodSugerResult'] = bloodSugerResult; body['BloodSugerResult'] = bloodSugerResult;
body['DiabtecUnit'] = diabtecUnit; body['DiabtecUnit'] = diabtecUnit;
body['MeasuredTime'] = measuredTime+1; body['MeasuredTime'] = measuredTime + 1;
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
await baseAppClient.post(ADD_DIABTEC_RESULT, await baseAppClient.post(ADD_DIABTEC_RESULT, onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) {
onSuccess: (response, statusCode) async {},
onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: body); }, body: body);
} }
updateDiabtecResult({DateTime month,DateTime hour,String bloodSugerResult,String diabtecUnit, int measuredTime,int lineItemNo}) async { updateDiabtecResult({DateTime month, DateTime hour, String bloodSugerResult, String diabtecUnit, int measuredTime, int lineItemNo}) async {
hasError = false; hasError = false;
super.error = ""; super.error = "";
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
@ -99,11 +91,9 @@ class BloodSugarService extends BaseService {
body['DiabtecUnit'] = diabtecUnit; body['DiabtecUnit'] = diabtecUnit;
body['BloodSugerDateChart'] = '${month.year}-${month.month}-${month.day} ${hour.hour}:${hour.minute}:00'; body['BloodSugerDateChart'] = '${month.year}-${month.month}-${month.day} ${hour.hour}:${hour.minute}:00';
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
body['MeasuredTime'] = measuredTime+1; body['MeasuredTime'] = measuredTime + 1;
body['LineItemNo'] = lineItemNo; body['LineItemNo'] = lineItemNo;
await baseAppClient.post(UPDATE_DIABETIC_RESULT, await baseAppClient.post(UPDATE_DIABETIC_RESULT, onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) {
onSuccess: (response, statusCode) async {},
onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: body); }, body: body);
@ -115,25 +105,21 @@ class BloodSugarService extends BaseService {
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
body['To'] = user.emailAddress; body['To'] = user.emailAddress;
await baseAppClient.post(SEND_AVERAGE_BLOOD_SUGAR_REPORT, await baseAppClient.post(SEND_AVERAGE_BLOOD_SUGAR_REPORT, onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) {
onSuccess: (response, statusCode) async {}, hasError = true;
onFailure: (String error, int statusCode) { super.error = error;
hasError = true; }, body: body);
super.error = error;
}, body: body);
} }
Future deactivateDiabeticStatus({int lineItemNo }) async { Future deactivateDiabeticStatus({int lineItemNo}) async {
hasError = false; hasError = false;
super.error = ""; super.error = "";
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
body['LineItemNo'] =lineItemNo; body['LineItemNo'] = lineItemNo;
await baseAppClient.post(DEACTIVATE_DIABETIC_STATUS, await baseAppClient.post(DEACTIVATE_DIABETIC_STATUS, onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) {
onSuccess: (response, statusCode) async {}, hasError = true;
onFailure: (String error, int statusCode) { super.error = error;
hasError = true; }, body: body);
super.error = error;
}, body: body);
} }
} }

@ -16,7 +16,7 @@ class PrescriptionsService extends BaseService {
List<Prescriptions> prescriptionsList = List(); List<Prescriptions> prescriptionsList = List();
List<PrescriptionReportINP> prescriptionReportListINP = List(); List<PrescriptionReportINP> prescriptionReportListINP = List();
List<PrescriptionsOrder> prescriptionsOrderList = List(); List<PrescriptionsOrder> prescriptionsOrderList = List();
var isMedDeliveryAllowed;
Future getPrescriptions() async { Future getPrescriptions() async {
hasError = false; hasError = false;
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
@ -46,8 +46,7 @@ class PrescriptionsService extends BaseService {
}, body: body); }, body: body);
} }
RequestPrescriptionReport _requestPrescriptionReport = RequestPrescriptionReport _requestPrescriptionReport = RequestPrescriptionReport(appointmentNo: 0, isDentalAllowedBackend: false);
RequestPrescriptionReport(appointmentNo: 0, isDentalAllowedBackend: false);
List<PrescriptionReport> prescriptionReportList = List(); List<PrescriptionReport> prescriptionReportList = List();
Future getPrescriptionReport({Prescriptions prescriptions}) async { Future getPrescriptionReport({Prescriptions prescriptions}) async {
@ -63,10 +62,10 @@ class PrescriptionsService extends BaseService {
_requestPrescriptionReport.episodeID = prescriptions.episodeID; _requestPrescriptionReport.episodeID = prescriptions.episodeID;
_requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo; _requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo;
await baseAppClient.post(prescriptions.isInOutPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT, await baseAppClient.post(prescriptions.isInOutPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
prescriptionReportList.clear(); prescriptionReportList.clear();
prescriptionReportEnhList.clear(); prescriptionReportEnhList.clear();
isMedDeliveryAllowed = response['IsHomeMedicineDeliverySupported'];
if (prescriptions.isInOutPatient) { if (prescriptions.isInOutPatient) {
response['ListPRM'].forEach((prescriptions) { response['ListPRM'].forEach((prescriptions) {
prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions)); prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions));
@ -88,8 +87,7 @@ class PrescriptionsService extends BaseService {
isDentalAllowedBackend: false, isDentalAllowedBackend: false,
); );
Future sendPrescriptionEmail( Future sendPrescriptionEmail(String appointmentDate, int patientID, String clinicName, String doctorName, int doctorID, int projectID) async {
String appointmentDate, int patientID, String clinicName, String doctorName, int doctorID, int projectID) async {
_requestSendPrescriptionEmail.listPrescriptions = prescriptionReportList; _requestSendPrescriptionEmail.listPrescriptions = prescriptionReportList;
_requestSendPrescriptionEmail.appointmentDate = appointmentDate; _requestSendPrescriptionEmail.appointmentDate = appointmentDate;
_requestSendPrescriptionEmail.patientID = patientID; _requestSendPrescriptionEmail.patientID = patientID;
@ -105,15 +103,13 @@ class PrescriptionsService extends BaseService {
_requestSendPrescriptionEmail.setupID = user.setupID; _requestSendPrescriptionEmail.setupID = user.setupID;
_requestSendPrescriptionEmail.to = user.emailAddress; _requestSendPrescriptionEmail.to = user.emailAddress;
hasError = false; hasError = false;
await baseAppClient.post(SEND_PRESCRIPTION_EMAIL, onSuccess: (response, statusCode) {}, await baseAppClient.post(SEND_PRESCRIPTION_EMAIL, onSuccess: (response, statusCode) {}, onFailure: (String error, int statusCode) {
onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: _requestSendPrescriptionEmail.toJson()); }, body: _requestSendPrescriptionEmail.toJson());
} }
RequestGetListPharmacyForPrescriptions requestGetListPharmacyForPrescriptions = RequestGetListPharmacyForPrescriptions requestGetListPharmacyForPrescriptions = RequestGetListPharmacyForPrescriptions(
RequestGetListPharmacyForPrescriptions(
latitude: 0, latitude: 0,
longitude: 0, longitude: 0,
isDentalAllowedBackend: false, isDentalAllowedBackend: false,
@ -172,8 +168,7 @@ class PrescriptionsService extends BaseService {
hasError = false; hasError = false;
await baseAppClient.post(isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT, await baseAppClient.post(isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
prescriptionReportEnhList.clear(); prescriptionReportEnhList.clear();
if (isInPatient) { if (isInPatient) {
@ -201,8 +196,7 @@ class PrescriptionsService extends BaseService {
body['RejectionReason'] = ''; body['RejectionReason'] = '';
body['PresOrderStatus'] = 4; body['PresOrderStatus'] = 4;
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
await baseAppClient.post(UPDATE_PRESS_ORDER, onSuccess: (dynamic response, int statusCode) {}, await baseAppClient.post(UPDATE_PRESS_ORDER, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) {
onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: body); }, body: body);

@ -30,9 +30,8 @@ class PrescriptionsViewModel extends BaseViewModel {
List<PharmacyPrescriptions> get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList; List<PharmacyPrescriptions> get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList;
List<PrescriptionsList> get prescriptionsOrderList => List<PrescriptionsList> get prescriptionsOrderList => filterType == FilterType.Clinic ? _prescriptionsOrderListClinic : _prescriptionsOrderListHospital;
filterType == FilterType.Clinic ? _prescriptionsOrderListClinic : _prescriptionsOrderListHospital; get isMedDeliveryAllowed => _prescriptionsService.isMedDeliveryAllowed;
getPrescriptions() async { getPrescriptions() async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionsService.getPrescriptions(); await _prescriptionsService.getPrescriptions();
@ -49,17 +48,12 @@ 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 = _prescriptionsOrderListClinic List<PrescriptionsList> prescriptionsByClinic = _prescriptionsOrderListClinic.where((elementClinic) => elementClinic.filterName == element.clinicDescription).toList();
.where((elementClinic) => elementClinic.filterName == element.clinicDescription)
.toList();
if (prescriptionsByClinic.length != 0) { if (prescriptionsByClinic.length != 0) {
_prescriptionsOrderListClinic[_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])] _prescriptionsOrderListClinic[_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])].prescriptionsList.add(element);
.prescriptionsList
.add(element);
} else { } else {
_prescriptionsOrderListClinic _prescriptionsOrderListClinic.add(PrescriptionsList(filterName: element.clinicDescription, prescriptions: element));
.add(PrescriptionsList(filterName: element.clinicDescription, prescriptions: element));
} }
/// PrescriptionsList list sort via hospital /// PrescriptionsList list sort via hospital
@ -70,9 +64,7 @@ class PrescriptionsViewModel extends BaseViewModel {
.toList(); .toList();
if (prescriptionsByHospital.length != 0) { if (prescriptionsByHospital.length != 0) {
_prescriptionsOrderListHospital[_prescriptionsOrderListHospital.indexOf(prescriptionsByHospital[0])] _prescriptionsOrderListHospital[_prescriptionsOrderListHospital.indexOf(prescriptionsByHospital[0])].prescriptionsList.add(element);
.prescriptionsList
.add(element);
} else { } else {
_prescriptionsOrderListHospital.add(PrescriptionsList(filterName: element.name, prescriptions: element)); _prescriptionsOrderListHospital.add(PrescriptionsList(filterName: element.name, prescriptions: element));
} }
@ -105,17 +97,9 @@ class PrescriptionsViewModel extends BaseViewModel {
} }
} }
sendPrescriptionEmail( sendPrescriptionEmail({String appointmentDate, int patientID, String clinicName, String doctorName, int doctorID, String mes, int projectID}) async {
{String appointmentDate,
int patientID,
String clinicName,
String doctorName,
int doctorID,
String mes,
int projectID}) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _prescriptionsService.sendPrescriptionEmail( await _prescriptionsService.sendPrescriptionEmail(appointmentDate, patientID, clinicName, doctorName, doctorID, projectID);
appointmentDate, patientID, clinicName, doctorName, doctorID, projectID);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);

@ -18,7 +18,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import '../../../widgets/dialogs/confirm_send_email_dialog.dart'; import '../../../widgets/dialogs/confirm_send_email_dialog.dart';
import 'PrescriptionIDeliveryAddressPage.dart'; import 'PrescriptionIDeliveryAddressPage.dart';
@ -303,25 +303,29 @@ class PrescriptionItemsPage extends StatelessWidget {
), ),
), ),
Container( Container(
color: Colors.white, width: double.infinity,
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), padding: EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 20),
child: DefaultButton( child: Container(
TranslationBase.of(context).resendOrder, width: MediaQuery.of(context).size.width * 0.8,
() { child: SecondaryButton(
Navigator.push( label: TranslationBase.of(context).resendOrder,
context, disabled: (!projectViewModel.havePrivilege(62)) || projectViewModel.user.outSA == 1 || model.isMedDeliveryAllowed == false,
FadePage( onTap: () {
page: PrescriptionDeliveryAddressPage( Navigator.push(
prescriptions: prescriptions, context,
prescriptionReportList: model.prescriptionReportList, FadePage(
prescriptionReportEnhList: model.prescriptionReportEnhList, page: PrescriptionDeliveryAddressPage(
prescriptions: prescriptions,
prescriptionReportList: model.prescriptionReportList,
prescriptionReportEnhList: model.prescriptionReportEnhList,
),
), ),
), );
); },
}, color: Color(0xff359846),
color: Color(0xff359846), ),
), ),
), )
], ],
), ),
), ),

@ -48,6 +48,7 @@ class _AppDrawerState extends State<AppDrawer> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
checkUserData(); checkUserData();
} }
@ -467,6 +468,7 @@ class _AppDrawerState extends State<AppDrawer> {
this.mainUser = data2; this.mainUser = data2;
}); });
} }
notificationCount = await sharedPref.getString(NOTIFICATION_COUNT);
} }
logout() async { logout() async {

Loading…
Cancel
Save