Merge branch 'development' into video-stream-background

merge-requests/760/head
mosazaid 5 years ago
commit 1bb40ddeb9

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]"; const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
const BASE_URL = 'https://hmgwebservices.com/'; // const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/'; const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient";
@ -228,6 +228,10 @@ const ADD_REFERRED_REMARKS_NEW = "Services/DoctorApplication.svc/REST/AddReferre
const GET_SPECIAL_CLINICAL_CARE_LIST = "Services/DoctorApplication.svc/REST/GetSpecialClinicalCareList"; const GET_SPECIAL_CLINICAL_CARE_LIST = "Services/DoctorApplication.svc/REST/GetSpecialClinicalCareList";
const GET_SPECIAL_CLINICAL_CARE_MAPPING_LIST = "Services/DoctorApplication.svc/REST/GetSpecialClinicalCareMappingList"; const GET_SPECIAL_CLINICAL_CARE_MAPPING_LIST = "Services/DoctorApplication.svc/REST/GetSpecialClinicalCareMappingList";
const INSERT_MEDICAL_REPORT = "Services/Patients.svc/REST/DAPP_InsertMedicalReport_New";
const UPDATE_MEDICAL_REPORT = "Services/Patients.svc/REST/DAPP_UpdateMedicalReport";
var selectedPatientType = 1; var selectedPatientType = 1;
//*********change value to decode json from Dropdown ************ //*********change value to decode json from Dropdown ************

@ -16,15 +16,14 @@ class PatientMedicalReportService extends BaseService {
body['SetupID'] = doctorProfile.setupID; body['SetupID'] = doctorProfile.setupID;
body['ProjectID'] = doctorProfile.projectID; body['ProjectID'] = doctorProfile.projectID;
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST, await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
medicalReportList.clear(); medicalReportList.clear();
if (response['DAPP_ListMedicalReportList'] != null) { if (response['DAPP_ListMedicalReportList'] != null) {
response['DAPP_ListMedicalReportList'].forEach((v) { response['DAPP_ListMedicalReportList'].forEach((v) {
medicalReportList.add(MedicalReportModel.fromJson(v)); medicalReportList.add(MedicalReportModel.fromJson(v));
}); });
} }
medicalReportList = medicalReportList.reversed.toList();
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error.toString(); super.error = error.toString();
@ -38,19 +37,17 @@ class PatientMedicalReportService extends BaseService {
body['SetupID'] = "91877"; body['SetupID'] = "91877";
body['TemplateID'] = 43; body['TemplateID'] = 43;
await baseAppClient.post(PATIENT_MEDICAL_REPORT_GET_TEMPLATE, await baseAppClient.post(PATIENT_MEDICAL_REPORT_GET_TEMPLATE, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) { medicalReportTemplate.clear();
if (response['DAPP_GetTemplateByIDList'] != null) {
medicalReportTemplate.clear(); response['DAPP_GetTemplateByIDList'].forEach((v) {
if (response['DAPP_GetTemplateByIDList'] != null) { medicalReportTemplate.add(MedicalReportTemplate.fromJson(v));
response['DAPP_GetTemplateByIDList'].forEach((v) { });
medicalReportTemplate.add(MedicalReportTemplate.fromJson(v)); }
}); }, onFailure: (String error, int statusCode) {
} hasError = true;
}, onFailure: (String error, int statusCode) { super.error = error.toString();
hasError = true; }, body: body);
super.error = error.toString();
}, body: body);
} }
Future insertMedicalReport(PatiantInformtion patient, String htmlText) async { Future insertMedicalReport(PatiantInformtion patient, String htmlText) async {
@ -61,13 +58,11 @@ class PatientMedicalReportService extends BaseService {
body['AdmissionNo'] = patient.admissionNo; body['AdmissionNo'] = patient.admissionNo;
body['MedicalReportHTML'] = htmlText; body['MedicalReportHTML'] = htmlText;
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_INSERT, await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_INSERT, onSuccess: (dynamic response, int statusCode) {},
onSuccess: (dynamic response, int statusCode) { onFailure: (String error, int statusCode) {
hasError = true;
}, onFailure: (String error, int statusCode) { super.error = error.toString();
hasError = true; }, body: body, patient: patient);
super.error = error.toString();
}, body: body, patient: patient);
} }
Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport) async { Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport) async {
@ -78,13 +73,65 @@ class PatientMedicalReportService extends BaseService {
body['AdmissionNo'] = patient.admissionNo; body['AdmissionNo'] = patient.admissionNo;
body['InvoiceNo'] = medicalReport.invoiceNo; body['InvoiceNo'] = medicalReport.invoiceNo;
body['LineItemNo'] = medicalReport.lineItemNo; body['LineItemNo'] = medicalReport.lineItemNo;
if (body['ProjectID'] == null) {
body['ProjectID'] = doctorProfile?.projectID;
}
if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID;
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_VERIFIED, await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_VERIFIED, onSuccess: (dynamic response, int statusCode) {},
onSuccess: (dynamic response, int statusCode) { onFailure: (String error, int statusCode) {
hasError = true;
super.error = error.toString();
}, body: body, patient: patient);
}
}, onFailure: (String error, int statusCode) { Future addMedicalReport(PatiantInformtion patient, String htmlText) async {
hasError = true; hasError = false;
super.error = error.toString(); Map<String, dynamic> body = Map();
}, body: body, patient: patient); // body['TokenID'] = "@dm!n";
body['SetupID'] = body.containsKey('SetupID')
? body['SetupID'] != null
? body['SetupID']
: SETUP_ID
: SETUP_ID;
body['AdmissionNo'] = int.parse(patient.admissionNo);
body['MedicalReportHTML'] = htmlText;
if (body['ProjectID'] == null) {
body['ProjectID'] = doctorProfile?.projectID;
}
if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID;
await baseAppClient.postPatient(INSERT_MEDICAL_REPORT, onSuccess: (dynamic response, int statusCode) {},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error.toString();
}, body: body, patient: patient);
}
Future updateMedicalReport(PatiantInformtion patient, String htmlText, int limitNumber, String invoiceNumber) async {
hasError = false;
Map<String, dynamic> body = Map();
// body['TokenID'] = "@dm!n";
body['LineItemNo'] = limitNumber;
body['InvoiceNo'] = invoiceNumber;
body['SetupID'] = body.containsKey('SetupID')
? body['SetupID'] != null
? body['SetupID']
: SETUP_ID
: SETUP_ID;
//body['AdmissionNo'] = int.parse(patient.admissionNo);
body['MedicalReportHTML'] = htmlText;
if (body['ProjectID'] == null) {
body['ProjectID'] = doctorProfile?.projectID;
}
if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID;
await baseAppClient.postPatient(UPDATE_MEDICAL_REPORT, onSuccess: (dynamic response, int statusCode) {},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error.toString();
}, body: body, patient: patient);
} }
} }

@ -12,8 +12,7 @@ class PatientMedicalReportViewModel extends BaseViewModel {
List<MedicalReportModel> get medicalReportList => _service.medicalReportList; List<MedicalReportModel> get medicalReportList => _service.medicalReportList;
List<MedicalReportTemplate> get medicalReportTemplate => List<MedicalReportTemplate> get medicalReportTemplate => _service.medicalReportTemplate;
_service.medicalReportTemplate;
Future getMedicalReportList(PatiantInformtion patient) async { Future getMedicalReportList(PatiantInformtion patient) async {
setState(ViewState.Busy); setState(ViewState.Busy);
@ -25,16 +24,15 @@ class PatientMedicalReportViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
bool hasOnHold(){ bool hasOnHold() {
bool hasHold = false; bool hasHold = false;
medicalReportList.forEach((element) { medicalReportList.forEach((element) {
if(element.status == 1){ if (element.status == 1) {
hasHold = true; hasHold = true;
} }
}); });
return hasHold; return hasHold;
} }
Future getMedicalReportTemplate() async { Future getMedicalReportTemplate() async {
@ -57,14 +55,36 @@ class PatientMedicalReportViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future verifyMedicalReport( Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport) async {
PatiantInformtion patient, MedicalReportModel medicalReport) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _service.verifyMedicalReport(patient, medicalReport); await _service.verifyMedicalReport(patient, medicalReport);
if (_service.hasError) { if (_service.hasError) {
error = _service.error; error = _service.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else } else
setState(ViewState.Idle); getMedicalReportList(patient);
setState(ViewState.Idle);
}
Future addMedicalReport(PatiantInformtion patient, String htmlText) async {
setState(ViewState.Busy);
await _service.addMedicalReport(patient, htmlText);
if (_service.hasError) {
error = _service.error;
setState(ViewState.ErrorLocal);
} else
getMedicalReportList(patient);
setState(ViewState.Idle);
}
Future updateMedicalReport(PatiantInformtion patient, String htmlText, int limitNumber, String invoiceNumber) async {
setState(ViewState.Busy);
await _service.updateMedicalReport(patient, htmlText, limitNumber, invoiceNumber);
if (_service.hasError) {
error = _service.error;
setState(ViewState.ErrorLocal);
} else
getMedicalReportList(patient);
setState(ViewState.Idle);
} }
} }

@ -124,6 +124,6 @@ void setupLocator() {
locator.registerFactory(() => PatientSearchViewModel()); locator.registerFactory(() => PatientSearchViewModel());
locator.registerFactory(() => HospitalViewModel()); locator.registerFactory(() => HospitalViewModel());
locator.registerFactory(() => LiveCarePatientViewModel()); locator.registerFactory(() => LiveCarePatientViewModel());
locator.registerFactory(() => PatientMedicalReportViewModel()); locator.registerLazySingleton(() => PatientMedicalReportViewModel());
locator.registerFactory(() => ScanQrViewModel()); locator.registerFactory(() => ScanQrViewModel());
} }

@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/medical_report/MedicalReportPage.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart';
@ -26,14 +27,13 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of<ProjectViewModel>(context); ProjectViewModel projectViewModel = Provider.of<ProjectViewModel>(context);
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatientMedicalReportViewModel patientMedicalReportViewModel = routeArgs['model'];
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
MedicalReportStatus status = routeArgs['status']; MedicalReportStatus status = routeArgs['status'] as MedicalReportStatus;
MedicalReportModel medicalReport = routeArgs.containsKey("medicalReport") MedicalReportModel medicalReport = routeArgs.containsKey("medicalReport") ? routeArgs['medicalReport'] : null;
? routeArgs['medicalReport']
: null;
return BaseView<PatientMedicalReportViewModel>( return BaseView<PatientMedicalReportViewModel>(
onModelReady: (model) => model.getMedicalReportTemplate(), onModelReady: (_) => patientMedicalReportViewModel.getMedicalReportTemplate(),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
@ -55,88 +55,91 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
child: Container( child: Container(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// if (model.medicalReportTemplate.length > 0) // if (model.medicalReportTemplate.length > 0)
HtmlRichEditor( HtmlRichEditor(
initialText: (medicalReport != null initialText: (medicalReport != null
? medicalReport.reportDataHtml ? medicalReport.reportDataHtml
: model.medicalReportTemplate : model.medicalReportTemplate[0].templateText.length > 0
.length > 0 ? model ? model.medicalReportTemplate[0].templateText
.medicalReportTemplate[0] : ""), : ""),
hint: "Write the medical report ", hint: "Write the medical report ",
height: height: MediaQuery.of(context).size.height * 0.75,
MediaQuery ),
.of(context) ],
.size
.height *
0.75,
), ),
], ),
),
), ),
), ],
), ),
), ),
], ),
), Container(
), padding: EdgeInsets.all(16.0),
), color: Colors.white,
Container( child: Row(
padding: EdgeInsets.all(16.0), children: [
color: Colors.white, Expanded(
child: Row( child: AppButton(
children: [ title: status == MedicalReportStatus.ADD
Expanded( ? TranslationBase.of(context).save
child: AppButton( : TranslationBase.of(context).save,
title: status == MedicalReportStatus.ADD color: Color(0xffEAEAEA),
? TranslationBase.of(context).save fontColor: Colors.black,
: TranslationBase.of(context).save, // disabled: progressNoteController.text.isEmpty,
color: Color(0xffEAEAEA), fontWeight: FontWeight.w700,
fontColor: Colors.black, onPressed: () async {
// disabled: progressNoteController.text.isEmpty, String txtOfMedicalReport = await HtmlEditor.getText();
fontWeight: FontWeight.w700,
onPressed: () async { if (txtOfMedicalReport.isNotEmpty) {
String txtOfMedicalReport = GifLoaderDialogUtils.showMyDialog(context);
await HtmlEditor.getText(); medicalReport != null
? model.updateMedicalReport(
patient,
txtOfMedicalReport,
medicalReport != null ? medicalReport.lineItemNo : null,
medicalReport != null ? medicalReport.invoiceNo : null)
: model.addMedicalReport(patient, txtOfMedicalReport);
//model.getMedicalReportList(patient);
if (txtOfMedicalReport.isNotEmpty) { Navigator.pop(context);
GifLoaderDialogUtils.showMyDialog(context);
model.insertMedicalReport( GifLoaderDialogUtils.hideDialog(context);
patient, txtOfMedicalReport); if (model.state == ViewState.ErrorLocal) {
GifLoaderDialogUtils.hideDialog(context); DrAppToastMsg.showErrorToast(model.error);
if (model.state == ViewState.ErrorLocal) { }
DrAppToastMsg.showErrorToast(model.error); }
} },
} ),
}, ),
SizedBox(
width: 8,
),
if (medicalReport != null)
Expanded(
child: AppButton(
title: status == MedicalReportStatus.ADD
? TranslationBase.of(context).add
: TranslationBase.of(context).verify,
color: Color(0xff359846),
fontWeight: FontWeight.w700,
onPressed: () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.verifyMedicalReport(patient, medicalReport);
GifLoaderDialogUtils.hideDialog(context);
Navigator.pop(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}
},
),
),
],
), ),
), ),
SizedBox(
width: 8,
),
if (medicalReport != null)
Expanded(
child: AppButton(
title: status == MedicalReportStatus.ADD
? TranslationBase.of(context).add
: TranslationBase.of(context).verify,
color: Color(0xff359846),
fontWeight: FontWeight.w700,
onPressed: () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.verifyMedicalReport(
patient, medicalReport);
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}
},
),
),
], ],
), ),
),
],
),
)); ));
} }

@ -23,7 +23,12 @@ import 'package:provider/provider.dart';
import '../../../../routes.dart'; import '../../../../routes.dart';
import 'AddVerifyMedicalReport.dart'; import 'AddVerifyMedicalReport.dart';
class MedicalReportPage extends StatelessWidget { class MedicalReportPage extends StatefulWidget {
@override
_MedicalReportPageState createState() => _MedicalReportPageState();
}
class _MedicalReportPageState extends State<MedicalReportPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
@ -35,9 +40,6 @@ class MedicalReportPage extends StatelessWidget {
return BaseView<PatientMedicalReportViewModel>( return BaseView<PatientMedicalReportViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
await model.getMedicalReportList(patient); await model.getMedicalReportList(patient);
// if (model.state == ViewState.ErrorLocal) {
// DrAppToastMsg.showErrorToast(model.error);
// }
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
@ -81,7 +83,8 @@ class MedicalReportPage extends StatelessWidget {
'patient': patient, 'patient': patient,
'patientType': patientType, 'patientType': patientType,
'arrivalType': arrivalType, 'arrivalType': arrivalType,
'type': MedicalReportStatus.ADD 'type': MedicalReportStatus.ADD,
'model': model,
}); });
}, },
label: TranslationBase.of(context).createNewMedicalReport, label: TranslationBase.of(context).createNewMedicalReport,
@ -96,7 +99,8 @@ class MedicalReportPage extends StatelessWidget {
'patient': patient, 'patient': patient,
'patientType': patientType, 'patientType': patientType,
'arrivalType': arrivalType, 'arrivalType': arrivalType,
'medicalReport': model.medicalReportList[index] 'medicalReport': model.medicalReportList[index],
'model': model,
}); });
} else { } else {
Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_DETAIL, arguments: { Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_DETAIL, arguments: {
@ -104,7 +108,8 @@ class MedicalReportPage extends StatelessWidget {
'patientType': patientType, 'patientType': patientType,
'arrivalType': arrivalType, 'arrivalType': arrivalType,
'type': MedicalReportStatus.ADD, 'type': MedicalReportStatus.ADD,
'medicalReport': model.medicalReportList[index] 'medicalReport': model.medicalReportList[index],
'model': model,
}); });
} }
}, },

Loading…
Cancel
Save