merge-requests/336/head
Sultan Khan 5 years ago
commit 12f936d045

@ -83,8 +83,6 @@ class BaseAppClient {
print("URL : $url"); print("URL : $url");
print("Body : ${json.encode(body)}"); print("Body : ${json.encode(body)}");
var ee = {json.encode(body)};
if (await Helpers.checkConnection()) { if (await Helpers.checkConnection()) {
final response = await http.post(url, final response = await http.post(url,
body: json.encode(body), body: json.encode(body),

@ -207,6 +207,9 @@ const POST_ADMISSION_REQUEST =
const GET_ITEM_BY_MEDICINE = const GET_ITEM_BY_MEDICINE =
'Services/DoctorApplication.svc/REST/GetItemByMedicineCode'; 'Services/DoctorApplication.svc/REST/GetItemByMedicineCode';
const GET_PROCEDURE_VALIDATION =
'Services/DoctorApplication.svc/REST/ValidateProcedures';
var selectedPatientType = 1; var selectedPatientType = 1;
//*********change value to decode json from Dropdown ************ //*********change value to decode json from Dropdown ************

@ -174,8 +174,8 @@ const Map<String, Map<String, String>> localizedValues = {
'ar': 'الرجاء ادخال الرمز' 'ar': 'الرجاء ادخال الرمز'
}, },
'youDon\'tHaveAnyPatient': { 'youDon\'tHaveAnyPatient': {
'en': 'You don\'t have any patient', 'en': 'No data found for the selected search criteria',
'ar': 'ليس لديك اي مرضى' 'ar': 'لا توجد بيانات لمعايير البحث المختارة'
}, },
'age': {'en': 'Age', 'ar': 'العمر'}, 'age': {'en': 'Age', 'ar': 'العمر'},
'nationality': {'en': 'Nationality', 'ar': 'الجنسية'}, 'nationality': {'en': 'Nationality', 'ar': 'الجنسية'},

@ -6,6 +6,8 @@ class GetMedicationResponseModel {
dynamic price; dynamic price;
dynamic quantity; dynamic quantity;
dynamic mediSpanGPICode; dynamic mediSpanGPICode;
bool isNarcotic;
GetMedicationResponseModel( GetMedicationResponseModel(
{this.description, {this.description,
this.genericName, this.genericName,
@ -13,6 +15,7 @@ class GetMedicationResponseModel {
this.keywords, this.keywords,
this.price, this.price,
this.quantity, this.quantity,
this.isNarcotic,
this.mediSpanGPICode}); this.mediSpanGPICode});
GetMedicationResponseModel.fromJson(Map<String, dynamic> json) { GetMedicationResponseModel.fromJson(Map<String, dynamic> json) {
@ -23,6 +26,7 @@ class GetMedicationResponseModel {
price = json['Price']; price = json['Price'];
quantity = json['Quantity']; quantity = json['Quantity'];
mediSpanGPICode = json['mediSpanGPICode']; mediSpanGPICode = json['mediSpanGPICode'];
isNarcotic = json['isNarcotic'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -34,6 +38,7 @@ class GetMedicationResponseModel {
data['Price'] = this.price; data['Price'] = this.price;
data['Quantity'] = this.quantity; data['Quantity'] = this.quantity;
data['mediSpanGPICode'] = this.mediSpanGPICode; data['mediSpanGPICode'] = this.mediSpanGPICode;
data['isNarcotic'] = this.isNarcotic;
return data; return data;
} }
} }

@ -58,6 +58,7 @@ class EntityList {
dynamic stopDate; dynamic stopDate;
dynamic uom; dynamic uom;
dynamic pharmacistRemarks; dynamic pharmacistRemarks;
dynamic pharmacyInervention;
dynamic refill; dynamic refill;
dynamic mediSpanGPICode; dynamic mediSpanGPICode;
EntityList( EntityList(
@ -92,6 +93,7 @@ class EntityList {
this.uom, this.uom,
this.pharmacistRemarks, this.pharmacistRemarks,
this.mediSpanGPICode, this.mediSpanGPICode,
this.pharmacyInervention,
this.refill}); this.refill});
EntityList.fromJson(Map<String, dynamic> json) { EntityList.fromJson(Map<String, dynamic> json) {
@ -127,6 +129,7 @@ class EntityList {
pharmacistRemarks = json['pharmacistRemarks']; pharmacistRemarks = json['pharmacistRemarks'];
mediSpanGPICode = json['mediSpanGPICode']; mediSpanGPICode = json['mediSpanGPICode'];
refill = json['refill']; refill = json['refill'];
pharmacyInervention = json['interventionID'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -163,6 +166,8 @@ class EntityList {
data['pharmacistRemarks'] = this.pharmacistRemarks; data['pharmacistRemarks'] = this.pharmacistRemarks;
data['mediSpanGPICode'] = this.mediSpanGPICode; data['mediSpanGPICode'] = this.mediSpanGPICode;
data['refill'] = this.refill; data['refill'] = this.refill;
data['interventionID'] = this.pharmacyInervention;
return data; return data;
} }
} }

@ -0,0 +1,51 @@
class ProcedureValadteModel {
List<EntityList> entityList;
int rowcount;
dynamic statusMessage;
dynamic success;
ProcedureValadteModel(
{this.entityList, this.rowcount, this.statusMessage, this.success});
ProcedureValadteModel.fromJson(Map<String, dynamic> json) {
if (json['entityList'] != null) {
entityList = new List<EntityList>();
json['entityList'].forEach((v) {
entityList.add(new EntityList.fromJson(v));
});
}
rowcount = json['rowcount'];
statusMessage = json['statusMessage'];
success = json['success'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.entityList != null) {
data['entityList'] = this.entityList.map((v) => v.toJson()).toList();
}
data['rowcount'] = this.rowcount;
data['statusMessage'] = this.statusMessage;
data['success'] = this.success;
return data;
}
}
class EntityList {
String procedureId;
List<String> warringMessages;
EntityList({this.procedureId, this.warringMessages});
EntityList.fromJson(Map<String, dynamic> json) {
procedureId = json['procedureId'];
warringMessages = json['warringMessages'].cast<String>();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['procedureId'] = this.procedureId;
data['warringMessages'] = this.warringMessages;
return data;
}
}

@ -0,0 +1,32 @@
class ProcedureValadteRequestModel {
String vidaAuthTokenID;
int patientMRN;
int appointmentNo;
int episodeID;
List<String> procedure;
ProcedureValadteRequestModel(
{this.vidaAuthTokenID,
this.patientMRN,
this.appointmentNo,
this.episodeID,
this.procedure});
ProcedureValadteRequestModel.fromJson(Map<String, dynamic> json) {
vidaAuthTokenID = json['VidaAuthTokenID'];
patientMRN = json['PatientMRN'];
appointmentNo = json['AppointmentNo'];
episodeID = json['EpisodeID'];
procedure = json['Procedure'].cast<String>();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['PatientMRN'] = this.patientMRN;
data['AppointmentNo'] = this.appointmentNo;
data['EpisodeID'] = this.episodeID;
data['Procedure'] = this.procedure;
return data;
}
}

@ -5,6 +5,8 @@ import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_re
import 'package:doctor_app_flutter/core/model/procedure/get_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_procedure_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/get_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_procedure_req_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart';
@ -13,6 +15,8 @@ import 'package:flutter/foundation.dart';
class ProcedureService extends BaseService { class ProcedureService extends BaseService {
List<GetOrderedProcedureModel> _procedureList = List(); List<GetOrderedProcedureModel> _procedureList = List();
List<GetOrderedProcedureModel> get procedureList => _procedureList; List<GetOrderedProcedureModel> get procedureList => _procedureList;
List<ProcedureValadteModel> _valadteProcedureList = List();
List<ProcedureValadteModel> get valadteProcedureList => _valadteProcedureList;
List<CategoriseProcedureModel> _categoriesList = List(); List<CategoriseProcedureModel> _categoriesList = List();
List<CategoriseProcedureModel> get categoriesList => _categoriesList; List<CategoriseProcedureModel> get categoriesList => _categoriesList;
List<Procedures> procedureslist = List(); List<Procedures> procedureslist = List();
@ -80,7 +84,7 @@ class ProcedureService extends BaseService {
pageIndex: 0, pageIndex: 0,
clinicId: 0, clinicId: 0,
pageSize: 0, pageSize: 0,
category: categoryID, category: categoryID ?? "01",
); );
hasError = false; hasError = false;
_categoriesList.clear(); _categoriesList.clear();
@ -118,4 +122,18 @@ class ProcedureService extends BaseService {
super.error = error; super.error = error;
}, body: updateProcedureRequestModel.toJson()); }, body: updateProcedureRequestModel.toJson());
} }
Future valadteProcedure(
ProcedureValadteRequestModel procedureValadteRequestModel) async {
hasError = false;
_valadteProcedureList.clear();
await baseAppClient.post(GET_PROCEDURE_VALIDATION,
onSuccess: (dynamic response, int statusCode) {
_valadteProcedureList.add(
ProcedureValadteModel.fromJson(response['ValidateProcedureList']));
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: procedureValadteRequestModel.toJson());
}
} }

@ -167,4 +167,13 @@ class MedicineViewModel extends BaseViewModel {
} }
return null; return null;
} }
dynamic getLookupByIdFilter(List<dynamic> list, String id) {
for (int i = 0; i < list.length; i++) {
if (list[i]['parameterCode'].toString() == id) {
return list[i];
}
}
return null;
}
} }

@ -3,6 +3,8 @@ import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dar
import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/get_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_procedure_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart';
import 'package:doctor_app_flutter/core/service/procedure_service.dart'; import 'package:doctor_app_flutter/core/service/procedure_service.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
@ -13,6 +15,8 @@ class ProcedureViewModel extends BaseViewModel {
ProcedureService _procedureService = locator<ProcedureService>(); ProcedureService _procedureService = locator<ProcedureService>();
List<GetOrderedProcedureModel> get procedureList => List<GetOrderedProcedureModel> get procedureList =>
_procedureService.procedureList; _procedureService.procedureList;
List<ProcedureValadteModel> get valadteProcedureList =>
_procedureService.valadteProcedureList;
List<CategoriseProcedureModel> get categoriesList => List<CategoriseProcedureModel> get categoriesList =>
_procedureService.categoriesList; _procedureService.categoriesList;
List<dynamic> get categoryList => _procedureService.categoryList; List<dynamic> get categoryList => _procedureService.categoryList;
@ -69,6 +73,20 @@ class ProcedureViewModel extends BaseViewModel {
} }
} }
Future valadteProcedure(
ProcedureValadteRequestModel procedureValadteRequestModel) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _procedureService.valadteProcedure(procedureValadteRequestModel);
if (_procedureService.hasError) {
error = _procedureService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
Future updateProcedure( Future updateProcedure(
{UpdateProcedureRequestModel updateProcedureRequestModel, {UpdateProcedureRequestModel updateProcedureRequestModel,
int mrn}) async { int mrn}) async {
@ -81,6 +99,6 @@ class ProcedureViewModel extends BaseViewModel {
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
await getProcedure(mrn: mrn); //await getProcedure(mrn: mrn);
} }
} }

@ -361,8 +361,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
0.550, 0.550,
child: TextFields( child: TextFields(
inputFormatters: [ inputFormatters: [
// LengthLimitingTextInputFormatter( LengthLimitingTextInputFormatter(
// 4), 5),
// WhitelistingTextInputFormatter // WhitelistingTextInputFormatter
// .digitsOnly // .digitsOnly
], ],
@ -378,9 +378,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
setState(() { setState(() {
strengthChar = value.length; strengthChar = value.length;
}); });
if (strengthChar >= 4) { if (strengthChar >= 5) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
"Only 4 Digits allowed for strength"); "Only 5 Digits allowed for strength");
} }
}, },
// validator: (value) { // validator: (value) {
@ -424,6 +424,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
(selectedValue) { (selectedValue) {
setState(() { setState(() {
units = selectedValue; units = selectedValue;
units['isDefault'] =
true;
}); });
}, },
); );
@ -472,6 +474,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
route = selectedValue; route = selectedValue;
route['isDefault'] = true;
}); });
if (route == null) { if (route == null) {
helpers.showErrorToast( helpers.showErrorToast(
@ -519,6 +522,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
frequency = selectedValue; frequency = selectedValue;
frequency['isDefault'] =
true;
}); });
}, },
); );
@ -757,6 +762,14 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
// formKey.currentState.save(); // formKey.currentState.save();
// Navigator.pop(context); // Navigator.pop(context);
// openDrugToDrug(); // openDrugToDrug();
if (_selectedMedication
.isNarcotic ==
true) {
DrAppToastMsg.showErrorToast(
"Narcotic medicine can only be prescribed from VIDA");
Navigator.pop(context);
return;
}
if (route == null || if (route == null ||
frequency == null || frequency == null ||
doseTime == null || doseTime == null ||
@ -775,10 +788,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
return; return;
} }
if (double.parse( if (double.parse(
strengthController.text) == strengthController.text) <
0.0) { 0.0) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
"Streangth can't be zero"); "strength can't be zero");
return; return;
} }
@ -796,16 +809,20 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
postProcedure( postProcedure(
icdCode: model icdCode: model
.patientAssessmentList[ .patientAssessmentList
0] .isNotEmpty
.icdCode10ID ? model
.isEmpty .patientAssessmentList[
? "test" 0]
: model .icdCode10ID
.patientAssessmentList[ .isEmpty
0] ? "test"
.icdCode10ID : model
.toString(), .patientAssessmentList[
0]
.icdCode10ID
.toString()
: "TEST",
// icdCode: model // icdCode: model
// .patientAssessmentList // .patientAssessmentList
// .map((value) => value // .map((value) => value

@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class NewPrescriptionScreen extends StatefulWidget { class NewPrescriptionScreen extends StatefulWidget {
@override @override
@ -205,7 +206,7 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
context) context)
.size .size
.width * .width *
0.09, 0.1,
child: Column( child: Column(
children: [ children: [
AppText( AppText(
@ -244,6 +245,17 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
color: Colors color: Colors
.green, .green,
), ),
AppText(
Helpers.getTimeFormated(DateTime.parse(model
.prescriptionList[
0]
.entityList[
index]
.createdOn))
.toString(),
color: Colors
.green,
),
], ],
), ),
), ),
@ -273,16 +285,12 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
Expanded( Expanded(
child: child:
AppText( AppText(
model Helpers.getDateFormatted(DateTime.parse(model
.prescriptionList[ .prescriptionList[0]
0] .entityList[index]
.entityList[ .startDate)),
index]
.startDate
.replaceAll("-",
"/"),
fontSize: fontSize:
12.0, 13.5,
), ),
), ),
SizedBox( SizedBox(
@ -381,6 +389,87 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
), ),
], ],
), ),
Row(
children: [
AppText(
'UOM: ',
fontWeight:
FontWeight
.w700,
fontSize:
17.0,
),
Expanded(
child:
RichText(
maxLines:
3,
overflow:
TextOverflow.ellipsis,
strutStyle:
StrutStyle(fontSize: 12.0),
text: TextSpan(
style:
TextStyle(color: Colors.black),
text: model.prescriptionList[0].entityList[index].uom),
),
),
],
),
Row(
children: [
AppText(
'BOX Quantity: ',
fontWeight:
FontWeight
.w700,
fontSize:
17.0,
),
Expanded(
child:
RichText(
maxLines:
3,
overflow:
TextOverflow.ellipsis,
strutStyle:
StrutStyle(fontSize: 12.0),
text: TextSpan(
style:
TextStyle(color: Colors.black),
text: model.prescriptionList[0].entityList[index].quantity.toString() == null ? "" : model.prescriptionList[0].entityList[index].quantity.toString()),
),
),
],
),
Row(
children: [
AppText(
'pharmacy Intervention ',
fontWeight:
FontWeight
.w700,
fontSize:
17.0,
),
Expanded(
child:
RichText(
maxLines:
3,
overflow:
TextOverflow.ellipsis,
strutStyle:
StrutStyle(fontSize: 12.0),
text: TextSpan(
style:
TextStyle(color: Colors.black),
text: model.prescriptionList[0].entityList[index].pharmacyInervention == null ? "" : model.prescriptionList[0].entityList[index].pharmacyInervention.toString()),
),
),
],
),
SizedBox( SizedBox(
height: height:
5.0), 5.0),

@ -79,6 +79,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
strengthController.text = widget.doseStreangth;
remarksController.text = widget.remarks; remarksController.text = widget.remarks;
indicationList = List(); indicationList = List();
@ -121,14 +122,16 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
await model.getMedicationRoute(); await model.getMedicationRoute();
await model.getMedicationFrequency(); await model.getMedicationFrequency();
await model.getMedicationDoseTime(); await model.getMedicationDoseTime();
await model.getItem(itemID: widget.drugId);
//await model.getMedicationIndications(); //await model.getMedicationIndications();
route = model.getLookupById(model.medicationRouteList, widget.route); route = model.getLookupByIdFilter(
model.itemMedicineListRoute, widget.route);
doseTime = doseTime =
model.getLookupById(model.medicationDoseTimeList, widget.dose); model.getLookupById(model.medicationDoseTimeList, widget.dose);
updatedDuration = model.getLookupById( updatedDuration = model.getLookupById(
model.medicationDurationList, widget.duration); model.medicationDurationList, widget.duration);
units = model.getLookupById( units = model.getLookupByIdFilter(
model.medicationStrengthList, widget.doseUnit); model.itemMedicineListUnit, widget.doseUnit);
frequencyUpdate = model.getLookupById( frequencyUpdate = model.getLookupById(
model.medicationFrequencyList, widget.frequency); model.medicationFrequencyList, widget.frequency);
}, },
@ -256,7 +259,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
child: TextFields( child: TextFields(
inputFormatters: [ inputFormatters: [
LengthLimitingTextInputFormatter( LengthLimitingTextInputFormatter(
4), 5),
// WhitelistingTextInputFormatter // WhitelistingTextInputFormatter
// .digitsOnly // .digitsOnly
], ],
@ -272,9 +275,9 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
setState(() { setState(() {
strengthChar = value.length; strengthChar = value.length;
}); });
if (strengthChar >= 4) { if (strengthChar >= 5) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
"Only 4 Digits allowed for strength"); "Only 5 Digits allowed for strength");
} }
}, },
// validator: (value) { // validator: (value) {
@ -298,7 +301,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
0.3700, 0.3700,
child: InkWell( child: InkWell(
onTap: onTap:
model.medicationStrengthList != model.itemMedicineListUnit !=
null null
? () { ? () {
Helpers.hideKeyboard( Helpers.hideKeyboard(
@ -307,11 +310,11 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
dialog = dialog =
ListSelectDialog( ListSelectDialog(
list: model list: model
.medicationStrengthList, .itemMedicineListUnit,
attributeName: attributeName:
'nameEn', 'description',
attributeValueId: attributeValueId:
'id', 'parameterCode',
okText: okText:
TranslationBase.of( TranslationBase.of(
context) context)
@ -341,7 +344,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
textFieldSelectorDecoration( textFieldSelectorDecoration(
'UNIT Type', 'UNIT Type',
units != null units != null
? units['nameEn'] ? units[
'description']
: null, : null,
true), true),
enabled: false, enabled: false,
@ -359,15 +363,17 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
MediaQuery.of(context).size.height * MediaQuery.of(context).size.height *
0.070, 0.070,
child: InkWell( child: InkWell(
onTap: model.medicationRouteList != null onTap: model.itemMedicineListRoute !=
null
? () { ? () {
Helpers.hideKeyboard(context); Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog =
ListSelectDialog( ListSelectDialog(
list: list: model
model.medicationRouteList, .itemMedicineListRoute,
attributeName: 'nameEn', attributeName: 'description',
attributeValueId: 'id', attributeValueId:
'parameterCode',
okText: TranslationBase.of( okText: TranslationBase.of(
context) context)
.ok, .ok,
@ -395,7 +401,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
textFieldSelectorDecoration( textFieldSelectorDecoration(
'Route', 'Route',
route != null route != null
? route['nameEn'] ? route['description']
: null, : null,
true), true),
enabled: false, enabled: false,
@ -715,16 +721,17 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
.text) == .text) ==
0.0) { 0.0) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
"Streangth can't be zero"); "strength can't be zero");
return; return;
} }
if (strengthController if (strengthController
.text.length > .text.length >
4) { 4) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
"Streangth can't be zero"); "strength can't be more then 4 digits ");
return; return;
} }
// if(units==null&& updatedDuration==null&&frequencyUpdate==null&&)
updatePrescription( updatePrescription(
newStartDate: selectedDate, newStartDate: selectedDate,
newDoseStreangth: newDoseStreangth:
@ -735,7 +742,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
: widget : widget
.doseStreangth, .doseStreangth,
newUnit: units != null newUnit: units != null
? units['id'].toString() ? units['parameterCode']
.toString()
: widget.doseUnit, : widget.doseUnit,
doseUnit: widget.doseUnit, doseUnit: widget.doseUnit,
doseStreangth: doseStreangth:
@ -747,22 +755,24 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
routeId: widget.route, routeId: widget.route,
patient: widget.patient, patient: widget.patient,
model: widget.model, model: widget.model,
newDuration: updatedDuration != newDuration:
null updatedDuration != null
? updatedDuration['id'] ? updatedDuration['id']
.toString() .toString()
: widget.duration, : widget.duration,
drugId: widget.drugId, drugId: widget.drugId,
remarks: remarks: remarksController
remarksController.text, .text,
route: route != null route: route != null
? route['id'].toString() ? route['parameterCode']
: widget.route,
frequency: frequencyUpdate !=
null
? frequencyUpdate['id']
.toString() .toString()
: widget.frequency, : widget.route,
frequency:
frequencyUpdate != null
? frequencyUpdate[
'id']
.toString()
: widget.frequency,
dose: doseTime != null dose: doseTime != null
? doseTime['id'] ? doseTime['id']
.toString() .toString()

@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart';
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.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';
@ -17,6 +18,17 @@ import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'entity_list_checkbox_search_widget.dart'; import 'entity_list_checkbox_search_widget.dart';
import 'entity_list_procedure_widget.dart';
valdateProcedure(ProcedureViewModel model, PatiantInformtion patient,
List<EntityList> entityList) async {
ProcedureValadteRequestModel procedureValadteRequestModel =
new ProcedureValadteRequestModel();
procedureValadteRequestModel.patientMRN = patient.appointmentNo;
procedureValadteRequestModel.episodeID = patient.episodeNo;
procedureValadteRequestModel.appointmentNo = patient.appointmentNo;
}
postProcedure( postProcedure(
{ProcedureViewModel model, {ProcedureViewModel model,
@ -25,6 +37,12 @@ postProcedure(
PatiantInformtion patient, PatiantInformtion patient,
List<EntityList> entityList}) async { List<EntityList> entityList}) async {
PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel();
ProcedureValadteRequestModel procedureValadteRequestModel =
new ProcedureValadteRequestModel();
procedureValadteRequestModel.patientMRN = patient.patientMRN;
procedureValadteRequestModel.episodeID = patient.episodeNo;
procedureValadteRequestModel.appointmentNo = patient.appointmentNo;
List<Procedures> controlsProcedure = List(); List<Procedures> controlsProcedure = List();
postProcedureReqModel.appointmentNo = patient.appointmentNo; postProcedureReqModel.appointmentNo = patient.appointmentNo;
@ -33,14 +51,15 @@ postProcedure(
postProcedureReqModel.patientMRN = patient.patientMRN; postProcedureReqModel.patientMRN = patient.patientMRN;
entityList.forEach((element) { entityList.forEach((element) {
procedureValadteRequestModel.procedure = [element.procedureId];
List<Controls> controls = List(); List<Controls> controls = List();
controls.add( controls.add(
Controls( Controls(
code: "remarks", code: "remarks",
controlValue: element.remarks.isNotEmpty ? element.remarks : ""), controlValue: element.remarks != null ? element.remarks : ""),
); );
controls.add( controls.add(
Controls(code: "ordertype", controlValue: element.type), Controls(code: "ordertype", controlValue: "0"),
); );
controlsProcedure.add(Procedures( controlsProcedure.add(Procedures(
category: element.categoryID, category: element.categoryID,
@ -49,13 +68,28 @@ postProcedure(
}); });
postProcedureReqModel.procedures = controlsProcedure; postProcedureReqModel.procedures = controlsProcedure;
await model.postProcedure(postProcedureReqModel, patient.patientMRN); await model.valadteProcedure(procedureValadteRequestModel);
if (model.state == ViewState.Idle) {
if (model.valadteProcedureList[0].entityList.length == 0) {
await model.postProcedure(postProcedureReqModel, patient.patientMRN);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
model.getProcedure(mrn: patient.patientMRN);
} else if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast('procedure has been added');
}
} else {
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
model.getProcedure(mrn: patient.patientMRN);
} else if (model.state == ViewState.Idle) {
helpers.showErrorToast(
model.valadteProcedureList[0].entityList[0].warringMessages);
}
}
} else {
helpers.showErrorToast(model.error); helpers.showErrorToast(model.error);
model.getProcedure(mrn: patient.patientMRN);
} else if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast('procedure has been added');
} }
} }
@ -91,7 +125,10 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
TextEditingController procedureController = TextEditingController(); TextEditingController procedureController = TextEditingController();
TextEditingController remarksController = TextEditingController(); TextEditingController remarksController = TextEditingController();
List<EntityList> entityList = List(); List<EntityList> entityList = List();
List<EntityList> entityListProcedure = List();
dynamic selectedCategory; dynamic selectedCategory;
setSelectedType(int val) { setSelectedType(int val) {
setState(() { setState(() {
selectedType = val; selectedType = val;
@ -120,10 +157,9 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) 'Please Select Category',
.selectProcedures
.toUpperCase(),
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
fontSize: 15.0,
), ),
SizedBox( SizedBox(
height: 10.0, height: 10.0,
@ -186,29 +222,53 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
), ),
if (widget.model.categoriesList.length != 0) if (widget.model.categoriesList.length != 0)
NetworkBaseView( NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: EntityListCheckboxSearchWidget( child: selectedCategory != null
model: widget.model, ? selectedCategory['categoryId'] == 02 ||
masterList: selectedCategory['categoryId'] == 03
widget.model.categoriesList[0].entityList, ? EntityListCheckboxSearchWidget(
removeHistory: (item) { model: widget.model,
setState(() { masterList: widget.model
entityList.remove(item); .categoriesList[0].entityList,
}); removeHistory: (item) {
}, setState(() {
addHistory: (history) { entityList.remove(item);
setState(() { });
entityList.add(history); },
}); addHistory: (history) {
}, setState(() {
addSelectedHistories: () { entityList.add(history);
//TODO build your fun herr });
// widget.addSelectedHistories(); },
}, addSelectedHistories: () {
isEntityListSelected: (master) => //TODO build your fun herr
isEntityListSelected(master), // widget.addSelectedHistories();
), },
), isEntityListSelected: (master) =>
isEntityListSelected(master),
)
: ProcedureListWidget(
model: widget.model,
masterList: widget.model
.categoriesList[0].entityList,
removeHistory: (item) {
setState(() {
entityList.remove(item);
});
},
addHistory: (history) {
setState(() {
entityList.add(history);
});
},
addSelectedHistories: () {
//TODO build your fun herr
// widget.addSelectedHistories();
},
isEntityListSelected: (master) =>
isEntityListSelected(master),
)
: null),
SizedBox( SizedBox(
height: 15.0, height: 15.0,
), ),
@ -264,6 +324,13 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
.addSelectedProcedures, .addSelectedProcedures,
onPressed: () { onPressed: () {
//print(entityList.toString()); //print(entityList.toString());
onPressed:
if (entityList.isEmpty == true) {
DrAppToastMsg.showErrorToast(
"Fill the mandatory procedure details");
return;
}
Navigator.pop(context); Navigator.pop(context);
postProcedure( postProcedure(
orderType: selectedType.toString(), orderType: selectedType.toString(),

@ -40,7 +40,10 @@ class EntityListCheckboxSearchWidget extends StatefulWidget {
class _EntityListCheckboxSearchWidgetState class _EntityListCheckboxSearchWidgetState
extends State<EntityListCheckboxSearchWidget> { extends State<EntityListCheckboxSearchWidget> {
int selectedType = 1; int selectedType = 0;
int typeUrgent;
int typeRegular;
setSelectedType(int val) { setSelectedType(int val) {
setState(() { setState(() {
selectedType = val; selectedType = val;
@ -130,12 +133,13 @@ class _EntityListCheckboxSearchWidgetState
.orderType), .orderType),
Radio( Radio(
activeColor: Color(0xFFB9382C), activeColor: Color(0xFFB9382C),
value: 1, value: 0,
groupValue: selectedType, groupValue: selectedType,
onChanged: (value) { onChanged: (value) {
historyInfo.type = historyInfo.type =
setSelectedType(value) setSelectedType(value)
.toString(); .toString();
historyInfo.type = historyInfo.type =
value.toString(); value.toString();
}, },
@ -144,11 +148,12 @@ class _EntityListCheckboxSearchWidgetState
Radio( Radio(
activeColor: Color(0xFFB9382C), activeColor: Color(0xFFB9382C),
groupValue: selectedType, groupValue: selectedType,
value: 0, value: 1,
onChanged: (value) { onChanged: (value) {
historyInfo.type = historyInfo.type =
setSelectedType(value) setSelectedType(value)
.toString(); .toString();
historyInfo.type = historyInfo.type =
value.toString(); value.toString();
}, },

@ -0,0 +1,171 @@
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ProcedureListWidget extends StatefulWidget {
final ProcedureViewModel model;
final Function addSelectedHistories;
final Function(EntityList) removeHistory;
final Function(EntityList) addHistory;
final Function(EntityList) addRemarks;
final bool Function(EntityList) isEntityListSelected;
final List<EntityList> masterList;
ProcedureListWidget(
{Key key,
this.model,
this.addSelectedHistories,
this.removeHistory,
this.masterList,
this.addHistory,
this.isEntityListSelected,
this.addRemarks})
: super(key: key);
@override
_ProcedureListWidgetState createState() => _ProcedureListWidgetState();
}
class _ProcedureListWidgetState extends State<ProcedureListWidget> {
int selectedType = 0;
int typeUrgent;
int typeRegular;
setSelectedType(int val) {
setState(() {
selectedType = val;
});
}
List<EntityList> items = List();
List<String> remarksList = List();
List<int> typeList = List();
@override
void initState() {
items.addAll(widget.masterList);
super.initState();
}
TextEditingController remarksController = TextEditingController();
@override
Widget build(BuildContext context) {
return Container(
child: Column(
children: [
NetworkBaseView(
baseViewModel: widget.model,
child: Container(
height: MediaQuery.of(context).size.height * 0.55,
child: Center(
child: Container(
margin: EdgeInsets.only(top: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: ListView(
children: [
TextFields(
hintText: TranslationBase.of(context).searchProcedures,
suffixIcon: EvaIcons.search,
onChanged: (value) {
filterSearchResults(value);
},
),
SizedBox(
height: 15,
),
items.length != 0
? Column(
children: items.map((historyInfo) {
return Column(
children: [
Row(
children: [
Checkbox(
value: widget.isEntityListSelected(
historyInfo),
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {
if (widget.isEntityListSelected(
historyInfo)) {
widget
.removeHistory(historyInfo);
} else {
widget.addHistory(historyInfo);
}
});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts(
historyInfo.procedureName,
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
),
DividerWithSpacesAround(),
],
);
}).toList(),
)
: Center(
child: Container(
child: AppText(
"There's no procedures for this category",
color: Color(0xFFB9382C)),
),
)
],
),
)),
),
),
SizedBox(
height: 10,
),
],
),
);
}
void filterSearchResults(String query) {
List<EntityList> dummySearchList = List();
dummySearchList.addAll(widget.masterList);
if (query.isNotEmpty) {
List<EntityList> dummyListData = List();
dummySearchList.forEach((item) {
if (item.procedureName.toLowerCase().contains(query.toLowerCase())) {
dummyListData.add(item);
}
});
setState(() {
items.clear();
items.addAll(dummyListData);
});
return;
} else {
setState(() {
items.clear();
items.addAll(widget.masterList);
});
}
}
}

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.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';
@ -235,7 +236,7 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
.entityList[ .entityList[
index] index]
.orderType == .orderType ==
0 1
? Color( ? Color(
0xFFB9382C) 0xFFB9382C)
: Colors : Colors
@ -254,7 +255,7 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
.entityList[ .entityList[
index] index]
.orderType == .orderType ==
0 1
? Color( ? Color(
0xFFB9382C) 0xFFB9382C)
: Colors : Colors
@ -274,7 +275,7 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
.entityList[ .entityList[
index] index]
.orderType == .orderType ==
0 1
? Color( ? Color(
0xFFB9382C) 0xFFB9382C)
: Colors : Colors
@ -330,13 +331,13 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
Expanded( Expanded(
child: AppText( child: AppText(
model.procedureList[0].entityList[index].orderType == model.procedureList[0].entityList[index].orderType ==
1 0
? 'Routine' ? 'Routine'
: 'Urgent', : 'Urgent',
fontSize: fontSize:
13.5, 13.5,
color: model.procedureList[0].entityList[index].orderType == color: model.procedureList[0].entityList[index].orderType ==
0 1
? Color(0xFFB9382C) ? Color(0xFFB9382C)
: Colors.green), : Colors.green),
), ),
@ -459,43 +460,66 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
onTap: () { onTap: () {
// model // model
// .updateProcedure(); // .updateProcedure();
updateProcedureForm( if (model.procedureList[0].entityList[index].categoryID == 02 ||
context, model
model: .procedureList[
model, 0]
orderNo: model .entityList[
.procedureList[ index]
0] .categoryID ==
.entityList[ 03 ||
index] model
.orderNo, .procedureList[0]
remarks: model .entityList[index]
.procedureList[ .categoryID ==
0] 55) {
.entityList[ updateProcedureForm(
index] context,
.remarks, limetNo: model
procedureName: model .procedureList[
.procedureList[ 0]
0] .entityList[
.entityList[ index]
index] .lineItemNo,
.procedureName, model:
patient: model,
patient, orderNo: model
procedureId: model .procedureList[
.procedureList[ 0]
0] .entityList[
.entityList[ index]
index] .orderNo,
.procedureId, remarks: model
categoreId: model .procedureList[
.procedureList[ 0]
0] .entityList[
.entityList[ index]
index] .remarks,
.categoryID procedureName: model
.toString()); .procedureList[
0]
.entityList[
index]
.procedureName,
patient:
patient,
procedureId: model
.procedureList[
0]
.entityList[
index]
.procedureId,
categoreId: model
.procedureList[
0]
.entityList[
index]
.categoryID
.toString());
} else {
helpers.showErrorToast(
'You cant Update this Procedure');
}
}, },
) )
], ],

@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.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/procedures/entity_list_checkbox_search_widget.dart'; import 'package:doctor_app_flutter/screens/procedures/entity_list_checkbox_search_widget.dart';
import 'package:doctor_app_flutter/screens/procedures/entity_list_procedure_widget.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/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
@ -22,6 +23,7 @@ import 'package:hexcolor/hexcolor.dart';
void updateProcedureForm(context, void updateProcedureForm(context,
{String procedureName, {String procedureName,
int orderNo, int orderNo,
int limetNo,
PatiantInformtion patient, PatiantInformtion patient,
String orderType, String orderType,
String procedureId, String procedureId,
@ -44,6 +46,7 @@ void updateProcedureForm(context,
procedureId: procedureId, procedureId: procedureId,
categoryId: categoreId, categoryId: categoreId,
orderNo: orderNo, orderNo: orderNo,
limetNo: limetNo,
); );
}); });
} }
@ -57,6 +60,7 @@ class UpdateProcedureWidget extends StatefulWidget {
final String procedureId; final String procedureId;
final String categoryId; final String categoryId;
final int orderNo; final int orderNo;
final int limetNo;
UpdateProcedureWidget( UpdateProcedureWidget(
{this.model, {this.model,
@ -66,7 +70,8 @@ class UpdateProcedureWidget extends StatefulWidget {
this.patient, this.patient,
this.procedureId, this.procedureId,
this.categoryId, this.categoryId,
this.orderNo}); this.orderNo,
this.limetNo});
@override @override
_UpdateProcedureWidgetState createState() => _UpdateProcedureWidgetState(); _UpdateProcedureWidgetState createState() => _UpdateProcedureWidgetState();
} }
@ -79,6 +84,11 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
}); });
} }
void initState() {
super.initState();
widget.remarksController.text = widget.remarks;
}
List<EntityList> entityList = List(); List<EntityList> entityList = List();
dynamic selectedCategory; dynamic selectedCategory;
@override @override
@ -177,74 +187,111 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
), ),
if (widget.model.categoriesList.length != 0) if (widget.model.categoriesList.length != 0)
NetworkBaseView( NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: EntityListCheckboxSearchWidget( child: selectedCategory != null
model: widget.model, ? selectedCategory['categoryId'] ==
masterList: widget 02 ||
.model.categoriesList[0].entityList, selectedCategory[
removeHistory: (item) { 'categoryId'] ==
setState(() { 03 ||
entityList.remove(item); selectedCategory[
}); 'categoryId'] ==
}, 55
addHistory: (history) { ? EntityListCheckboxSearchWidget(
setState(() { model: widget.model,
entityList.add(history); masterList: widget
}); .model
}, .categoriesList[0]
addSelectedHistories: () { .entityList,
//TODO build your fun herr removeHistory: (item) {
// widget.addSelectedHistories(); setState(() {
}, entityList.remove(item);
isEntityListSelected: (master) => });
isEntityListSelected(master), },
), addHistory: (history) {
setState(() {
entityList.add(history);
});
},
addSelectedHistories: () {
//TODO build your fun herr
// widget.addSelectedHistories();
},
isEntityListSelected:
(master) =>
isEntityListSelected(
master),
)
: ProcedureListWidget(
model: widget.model,
masterList: widget
.model
.categoriesList[0]
.entityList,
removeHistory: (item) {
setState(() {
entityList.remove(item);
});
},
addHistory: (history) {
setState(() {
entityList.add(history);
});
},
addSelectedHistories: () {
//TODO build your fun herr
// widget.addSelectedHistories();
},
isEntityListSelected:
(master) =>
isEntityListSelected(
master),
)
: null),
Container(
child: Row(
children: [
AppText(
TranslationBase.of(context).orderType),
Radio(
activeColor: Color(0xFFB9382C),
value: 0,
groupValue: selectedType,
onChanged: (value) {
setSelectedType(value);
},
),
Text('routine'),
Radio(
activeColor: Color(0xFFB9382C),
groupValue: selectedType,
value: 1,
onChanged: (value) {
setSelectedType(value);
},
),
Text(TranslationBase.of(context).urgent),
],
),
),
SizedBox(
height: 12.0,
),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
fontSize: 15.0,
controller: widget.remarksController,
maxLines: 3,
minLines: 2,
onChanged: (value) {},
), ),
// Container( ),
// child: Row(
// children: [
// AppText(
// TranslationBase.of(context).orderType),
// Radio(
// activeColor: Color(0xFFB9382C),
// value: 0,
// groupValue: selectedType,
// onChanged: (value) {
// setSelectedType(value);
// },
// ),
// Text(TranslationBase.of(context).urgent),
// Radio(
// activeColor: Color(0xFFB9382C),
// groupValue: selectedType,
// value: 1,
// onChanged: (value) {
// setSelectedType(value);
// },
// ),
// Text('routine'),
// ],
// ),
// ),
// SizedBox(
// height: 12.0,
// ),
// Container(
// decoration: BoxDecoration(
// borderRadius:
// BorderRadius.all(Radius.circular(6.0)),
// border: Border.all(
// width: 1.0,
// color: HexColor("#CCCCCC"))),
// child: TextFields(
// hintText: widget.remarks,
// fontSize: 15.0,
// controller: widget.remarksController,
// maxLines: 3,
// minLines: 2,
// onChanged: (value) {},
// ),
// ),
SizedBox( SizedBox(
height: 50.0, height: 50.0,
), ),
@ -259,8 +306,16 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
.updateProcedure .updateProcedure
.toUpperCase(), .toUpperCase(),
onPressed: () { onPressed: () {
if (entityList.isEmpty == true &&
widget.remarksController.text ==
widget.remarks) {
DrAppToastMsg.showErrorToast(
"Fill the mandatory procedure details");
return;
}
Navigator.pop(context); Navigator.pop(context);
updateProcedure( updateProcedure(
limetNO: widget.limetNo,
orderNo: widget.orderNo, orderNo: widget.orderNo,
orderType: selectedType.toString(), orderType: selectedType.toString(),
categorieId: widget.categoryId, categorieId: widget.categoryId,
@ -290,6 +345,7 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
updateProcedure( updateProcedure(
{ProcedureViewModel model, {ProcedureViewModel model,
String remarks, String remarks,
int limetNO,
int orderNo, int orderNo,
String newProcedureId, String newProcedureId,
String newCategorieId, String newCategorieId,
@ -307,29 +363,38 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
updateProcedureReqModel.episodeID = patient.episodeNo; updateProcedureReqModel.episodeID = patient.episodeNo;
updateProcedureReqModel.patientMRN = patient.patientMRN; updateProcedureReqModel.patientMRN = patient.patientMRN;
updateProcedureReqModel.lineItemNo = 1; updateProcedureReqModel.lineItemNo = limetNO;
updateProcedureReqModel.orderNo = orderNo; updateProcedureReqModel.orderNo = orderNo;
entityList.forEach((element) { if (entityList.isNotEmpty) {
entityList.forEach((element) {
controls.add(
Controls(code: "remarks", controlValue: element.remarks ?? ''),
);
controls.add(
Controls(code: "ordertype", controlValue: '1'),
);
controlsProcedure.procedure = element.procedureId;
controlsProcedure.category = int.parse(element.categoryID) > 9
? element.categoryID
: "0" + element.categoryID;
controlsProcedure.controls = controls;
});
} else {
controls.add( controls.add(
Controls( Controls(
code: "remarks", code: "remarks", controlValue: remarks.isNotEmpty ? remarks : ""),
controlValue: element.remarks.isNotEmpty ? element.remarks : ""),
); );
controls.add( controls.add(
Controls(code: "ordertype", controlValue: '1'), Controls(code: "ordertype", controlValue: orderType),
); );
});
entityList.isNotEmpty controlsProcedure.procedure = procedureId;
? entityList.forEach((element) { controlsProcedure.category = '0' + categorieId;
controlsProcedure.procedure = element.procedureId;
controlsProcedure.category = element.categoryID; controlsProcedure.controls = controls;
controlsProcedure.controls = controls; }
})
: controlsProcedure.procedure = procedureId;
controlsProcedure.category = categorieId;
controlsProcedure.controls = controls;
// controlsProcedure.add(ProcedureDetail( // controlsProcedure.add(ProcedureDetail(
// category: categorieId, procedure: procedureId, controls: controls)); // category: categorieId, procedure: procedureId, controls: controls));
updateProcedureReqModel.procedureDetail = controlsProcedure; updateProcedureReqModel.procedureDetail = controlsProcedure;
@ -343,6 +408,7 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
model.getProcedure(mrn: patient.patientMRN); model.getProcedure(mrn: patient.patientMRN);
} else if (model.state == ViewState.Idle) { } else if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast('procedure has been updated'); DrAppToastMsg.showSuccesToast('procedure has been updated');
model.getProcedure(mrn: patient.patientMRN);
} }
} }

@ -29,7 +29,7 @@ class DrAppToastMsg {
icon: ICON.CLOSE, icon: ICON.CLOSE,
fontSize: 16, fontSize: 16,
imageSize: 35, imageSize: 35,
timeInSeconds: 9000, timeInSeconds: 912,
textColor: Colors.white); textColor: Colors.white);
} }

@ -303,6 +303,14 @@ class Helpers {
return ""; return "";
} }
static String getTimeFormated(DateTime dateTime) {
print(dateTime);
if (dateTime != null)
return dateTime.hour.toString() + ":" + dateTime.minute.toString();
else
return "";
}
/* /*
*@author: Mohammad Aljammal *@author: Mohammad Aljammal
*@Date:26/5/2020 *@Date:26/5/2020

Loading…
Cancel
Save