add medical report new service

merge-requests/757/head
hussam al-habibeh 5 years ago
parent 07835aaa1b
commit c652f40a89

@ -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,9 +16,7 @@ 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) {
@ -38,19 +36,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 +57,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 {
@ -79,12 +73,48 @@ class PatientMedicalReportService extends BaseService {
body['InvoiceNo'] = medicalReport.invoiceNo; body['InvoiceNo'] = medicalReport.invoiceNo;
body['LineItemNo'] = medicalReport.lineItemNo; body['LineItemNo'] = medicalReport.lineItemNo;
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'] = "91877";
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) async {
hasError = false;
Map<String, dynamic> body = Map();
// body['TokenID'] = "@dm!n";
body['SetupID'] = "91877";
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);
} }
} }

@ -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,8 +55,7 @@ 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) {
@ -67,4 +64,14 @@ class PatientMedicalReportViewModel extends BaseViewModel {
} else } else
setState(ViewState.Idle); 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
setState(ViewState.Idle);
}
} }

@ -28,9 +28,7 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
MedicalReportStatus status = routeArgs['status']; MedicalReportStatus status = routeArgs['status'];
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: (model) => model.getMedicalReportTemplate(),
@ -55,88 +53,82 @@ 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 {
String txtOfMedicalReport =
await HtmlEditor.getText();
if (txtOfMedicalReport.isNotEmpty) { if (txtOfMedicalReport.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
model.insertMedicalReport( status == MedicalReportStatus.ADD
patient, txtOfMedicalReport); ? model.addMedicalReport(patient, txtOfMedicalReport)
GifLoaderDialogUtils.hideDialog(context); : model.addMedicalReport(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);
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);
}
},
),
),
], ],
), ),
),
],
),
)); ));
} }

Loading…
Cancel
Save