Merge branch 'development' into video-stream-background

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

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
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_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;
//*********change value to decode json from Dropdown ************

@ -16,15 +16,14 @@ class PatientMedicalReportService extends BaseService {
body['SetupID'] = doctorProfile.setupID;
body['ProjectID'] = doctorProfile.projectID;
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST, onSuccess: (dynamic response, int statusCode) {
medicalReportList.clear();
if (response['DAPP_ListMedicalReportList'] != null) {
response['DAPP_ListMedicalReportList'].forEach((v) {
medicalReportList.add(MedicalReportModel.fromJson(v));
});
}
medicalReportList = medicalReportList.reversed.toList();
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error.toString();
@ -38,19 +37,17 @@ class PatientMedicalReportService extends BaseService {
body['SetupID'] = "91877";
body['TemplateID'] = 43;
await baseAppClient.post(PATIENT_MEDICAL_REPORT_GET_TEMPLATE,
onSuccess: (dynamic response, int statusCode) {
medicalReportTemplate.clear();
if (response['DAPP_GetTemplateByIDList'] != null) {
response['DAPP_GetTemplateByIDList'].forEach((v) {
medicalReportTemplate.add(MedicalReportTemplate.fromJson(v));
});
}
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error.toString();
}, body: body);
await baseAppClient.post(PATIENT_MEDICAL_REPORT_GET_TEMPLATE, onSuccess: (dynamic response, int statusCode) {
medicalReportTemplate.clear();
if (response['DAPP_GetTemplateByIDList'] != null) {
response['DAPP_GetTemplateByIDList'].forEach((v) {
medicalReportTemplate.add(MedicalReportTemplate.fromJson(v));
});
}
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error.toString();
}, body: body);
}
Future insertMedicalReport(PatiantInformtion patient, String htmlText) async {
@ -61,13 +58,11 @@ class PatientMedicalReportService extends BaseService {
body['AdmissionNo'] = patient.admissionNo;
body['MedicalReportHTML'] = htmlText;
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_INSERT,
onSuccess: (dynamic response, int statusCode) {
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error.toString();
}, body: body, patient: patient);
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_INSERT, onSuccess: (dynamic response, int statusCode) {},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error.toString();
}, body: body, patient: patient);
}
Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport) async {
@ -78,13 +73,65 @@ class PatientMedicalReportService extends BaseService {
body['AdmissionNo'] = patient.admissionNo;
body['InvoiceNo'] = medicalReport.invoiceNo;
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,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_VERIFIED, 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) {
hasError = true;
super.error = error.toString();
}, body: body, patient: patient);
Future addMedicalReport(PatiantInformtion patient, String htmlText) async {
hasError = false;
Map<String, dynamic> body = Map();
// 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<MedicalReportTemplate> get medicalReportTemplate =>
_service.medicalReportTemplate;
List<MedicalReportTemplate> get medicalReportTemplate => _service.medicalReportTemplate;
Future getMedicalReportList(PatiantInformtion patient) async {
setState(ViewState.Busy);
@ -25,16 +24,15 @@ class PatientMedicalReportViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
bool hasOnHold(){
bool hasOnHold() {
bool hasHold = false;
medicalReportList.forEach((element) {
if(element.status == 1){
if (element.status == 1) {
hasHold = true;
}
});
return hasHold;
}
Future getMedicalReportTemplate() async {
@ -57,14 +55,36 @@ class PatientMedicalReportViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future verifyMedicalReport(
PatiantInformtion patient, MedicalReportModel medicalReport) async {
Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport) async {
setState(ViewState.Busy);
await _service.verifyMedicalReport(patient, medicalReport);
if (_service.hasError) {
error = _service.error;
setState(ViewState.ErrorLocal);
} 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(() => HospitalViewModel());
locator.registerFactory(() => LiveCarePatientViewModel());
locator.registerFactory(() => PatientMedicalReportViewModel());
locator.registerLazySingleton(() => PatientMedicalReportViewModel());
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/patiant_info_model.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/translations_delegate_base.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) {
ProjectViewModel projectViewModel = Provider.of<ProjectViewModel>(context);
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatientMedicalReportViewModel patientMedicalReportViewModel = routeArgs['model'];
PatiantInformtion patient = routeArgs['patient'];
MedicalReportStatus status = routeArgs['status'];
MedicalReportModel medicalReport = routeArgs.containsKey("medicalReport")
? routeArgs['medicalReport']
: null;
MedicalReportStatus status = routeArgs['status'] as MedicalReportStatus;
MedicalReportModel medicalReport = routeArgs.containsKey("medicalReport") ? routeArgs['medicalReport'] : null;
return BaseView<PatientMedicalReportViewModel>(
onModelReady: (model) => model.getMedicalReportTemplate(),
onModelReady: (_) => patientMedicalReportViewModel.getMedicalReportTemplate(),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
@ -55,88 +55,91 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// if (model.medicalReportTemplate.length > 0)
HtmlRichEditor(
initialText: (medicalReport != null
? medicalReport.reportDataHtml
: model.medicalReportTemplate
.length > 0 ? model
.medicalReportTemplate[0] : ""),
hint: "Write the medical report ",
height:
MediaQuery
.of(context)
.size
.height *
0.75,
children: [
// if (model.medicalReportTemplate.length > 0)
HtmlRichEditor(
initialText: (medicalReport != null
? medicalReport.reportDataHtml
: model.medicalReportTemplate[0].templateText.length > 0
? model.medicalReportTemplate[0].templateText
: ""),
hint: "Write the medical report ",
height: MediaQuery.of(context).size.height * 0.75,
),
],
),
],
),
),
),
),
],
),
),
],
),
),
),
Container(
padding: EdgeInsets.all(16.0),
color: Colors.white,
child: Row(
children: [
Expanded(
child: AppButton(
title: status == MedicalReportStatus.ADD
? TranslationBase.of(context).save
: TranslationBase.of(context).save,
color: Color(0xffEAEAEA),
fontColor: Colors.black,
// disabled: progressNoteController.text.isEmpty,
fontWeight: FontWeight.w700,
onPressed: () async {
String txtOfMedicalReport =
await HtmlEditor.getText();
),
Container(
padding: EdgeInsets.all(16.0),
color: Colors.white,
child: Row(
children: [
Expanded(
child: AppButton(
title: status == MedicalReportStatus.ADD
? TranslationBase.of(context).save
: TranslationBase.of(context).save,
color: Color(0xffEAEAEA),
fontColor: Colors.black,
// disabled: progressNoteController.text.isEmpty,
fontWeight: FontWeight.w700,
onPressed: () async {
String txtOfMedicalReport = await HtmlEditor.getText();
if (txtOfMedicalReport.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
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) {
GifLoaderDialogUtils.showMyDialog(context);
model.insertMedicalReport(
patient, txtOfMedicalReport);
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}
}
},
Navigator.pop(context);
GifLoaderDialogUtils.hideDialog(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);
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 'AddVerifyMedicalReport.dart';
class MedicalReportPage extends StatelessWidget {
class MedicalReportPage extends StatefulWidget {
@override
_MedicalReportPageState createState() => _MedicalReportPageState();
}
class _MedicalReportPageState extends State<MedicalReportPage> {
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
@ -35,9 +40,6 @@ class MedicalReportPage extends StatelessWidget {
return BaseView<PatientMedicalReportViewModel>(
onModelReady: (model) async {
await model.getMedicalReportList(patient);
// if (model.state == ViewState.ErrorLocal) {
// DrAppToastMsg.showErrorToast(model.error);
// }
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
@ -81,7 +83,8 @@ class MedicalReportPage extends StatelessWidget {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'type': MedicalReportStatus.ADD
'type': MedicalReportStatus.ADD,
'model': model,
});
},
label: TranslationBase.of(context).createNewMedicalReport,
@ -96,7 +99,8 @@ class MedicalReportPage extends StatelessWidget {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'medicalReport': model.medicalReportList[index]
'medicalReport': model.medicalReportList[index],
'model': model,
});
} else {
Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_DETAIL, arguments: {
@ -104,7 +108,8 @@ class MedicalReportPage extends StatelessWidget {
'patientType': patientType,
'arrivalType': arrivalType,
'type': MedicalReportStatus.ADD,
'medicalReport': model.medicalReportList[index]
'medicalReport': model.medicalReportList[index],
'model': model,
});
}
},

Loading…
Cancel
Save