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

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

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

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

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

@ -58,6 +58,7 @@ class EntityList {
dynamic stopDate;
dynamic uom;
dynamic pharmacistRemarks;
dynamic pharmacyInervention;
dynamic refill;
dynamic mediSpanGPICode;
EntityList(
@ -92,6 +93,7 @@ class EntityList {
this.uom,
this.pharmacistRemarks,
this.mediSpanGPICode,
this.pharmacyInervention,
this.refill});
EntityList.fromJson(Map<String, dynamic> json) {
@ -127,6 +129,7 @@ class EntityList {
pharmacistRemarks = json['pharmacistRemarks'];
mediSpanGPICode = json['mediSpanGPICode'];
refill = json['refill'];
pharmacyInervention = json['interventionID'];
}
Map<String, dynamic> toJson() {
@ -163,6 +166,8 @@ class EntityList {
data['pharmacistRemarks'] = this.pharmacistRemarks;
data['mediSpanGPICode'] = this.mediSpanGPICode;
data['refill'] = this.refill;
data['interventionID'] = this.pharmacyInervention;
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_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/service/base/base_service.dart';
@ -13,6 +15,8 @@ import 'package:flutter/foundation.dart';
class ProcedureService extends BaseService {
List<GetOrderedProcedureModel> _procedureList = List();
List<GetOrderedProcedureModel> get procedureList => _procedureList;
List<ProcedureValadteModel> _valadteProcedureList = List();
List<ProcedureValadteModel> get valadteProcedureList => _valadteProcedureList;
List<CategoriseProcedureModel> _categoriesList = List();
List<CategoriseProcedureModel> get categoriesList => _categoriesList;
List<Procedures> procedureslist = List();
@ -80,7 +84,7 @@ class ProcedureService extends BaseService {
pageIndex: 0,
clinicId: 0,
pageSize: 0,
category: categoryID,
category: categoryID ?? "01",
);
hasError = false;
_categoriesList.clear();
@ -118,4 +122,18 @@ class ProcedureService extends BaseService {
super.error = error;
}, 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;
}
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_procedure_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/service/procedure_service.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
@ -13,6 +15,8 @@ class ProcedureViewModel extends BaseViewModel {
ProcedureService _procedureService = locator<ProcedureService>();
List<GetOrderedProcedureModel> get procedureList =>
_procedureService.procedureList;
List<ProcedureValadteModel> get valadteProcedureList =>
_procedureService.valadteProcedureList;
List<CategoriseProcedureModel> get categoriesList =>
_procedureService.categoriesList;
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(
{UpdateProcedureRequestModel updateProcedureRequestModel,
int mrn}) async {
@ -81,6 +99,6 @@ class ProcedureViewModel extends BaseViewModel {
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
await getProcedure(mrn: mrn);
//await getProcedure(mrn: mrn);
}
}

@ -361,8 +361,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
0.550,
child: TextFields(
inputFormatters: [
// LengthLimitingTextInputFormatter(
// 4),
LengthLimitingTextInputFormatter(
5),
// WhitelistingTextInputFormatter
// .digitsOnly
],
@ -378,9 +378,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
setState(() {
strengthChar = value.length;
});
if (strengthChar >= 4) {
if (strengthChar >= 5) {
DrAppToastMsg.showErrorToast(
"Only 4 Digits allowed for strength");
"Only 5 Digits allowed for strength");
}
},
// validator: (value) {
@ -424,6 +424,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
(selectedValue) {
setState(() {
units = selectedValue;
units['isDefault'] =
true;
});
},
);
@ -472,6 +474,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
okFunction: (selectedValue) {
setState(() {
route = selectedValue;
route['isDefault'] = true;
});
if (route == null) {
helpers.showErrorToast(
@ -519,6 +522,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
okFunction: (selectedValue) {
setState(() {
frequency = selectedValue;
frequency['isDefault'] =
true;
});
},
);
@ -757,6 +762,14 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
// formKey.currentState.save();
// Navigator.pop(context);
// openDrugToDrug();
if (_selectedMedication
.isNarcotic ==
true) {
DrAppToastMsg.showErrorToast(
"Narcotic medicine can only be prescribed from VIDA");
Navigator.pop(context);
return;
}
if (route == null ||
frequency == null ||
doseTime == null ||
@ -775,10 +788,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
return;
}
if (double.parse(
strengthController.text) ==
strengthController.text) <
0.0) {
DrAppToastMsg.showErrorToast(
"Streangth can't be zero");
"strength can't be zero");
return;
}
@ -796,16 +809,20 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
postProcedure(
icdCode: model
.patientAssessmentList[
0]
.icdCode10ID
.isEmpty
? "test"
: model
.patientAssessmentList[
0]
.icdCode10ID
.toString(),
.patientAssessmentList
.isNotEmpty
? model
.patientAssessmentList[
0]
.icdCode10ID
.isEmpty
? "test"
: model
.patientAssessmentList[
0]
.icdCode10ID
.toString()
: "TEST",
// icdCode: model
// .patientAssessmentList
// .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/network_base_view.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class NewPrescriptionScreen extends StatefulWidget {
@override
@ -205,7 +206,7 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
context)
.size
.width *
0.09,
0.1,
child: Column(
children: [
AppText(
@ -244,6 +245,17 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
color: Colors
.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(
child:
AppText(
model
.prescriptionList[
0]
.entityList[
index]
.startDate
.replaceAll("-",
"/"),
Helpers.getDateFormatted(DateTime.parse(model
.prescriptionList[0]
.entityList[index]
.startDate)),
fontSize:
12.0,
13.5,
),
),
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(
height:
5.0),

@ -79,6 +79,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
@override
void initState() {
super.initState();
strengthController.text = widget.doseStreangth;
remarksController.text = widget.remarks;
indicationList = List();
@ -121,14 +122,16 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
await model.getMedicationRoute();
await model.getMedicationFrequency();
await model.getMedicationDoseTime();
await model.getItem(itemID: widget.drugId);
//await model.getMedicationIndications();
route = model.getLookupById(model.medicationRouteList, widget.route);
route = model.getLookupByIdFilter(
model.itemMedicineListRoute, widget.route);
doseTime =
model.getLookupById(model.medicationDoseTimeList, widget.dose);
updatedDuration = model.getLookupById(
model.medicationDurationList, widget.duration);
units = model.getLookupById(
model.medicationStrengthList, widget.doseUnit);
units = model.getLookupByIdFilter(
model.itemMedicineListUnit, widget.doseUnit);
frequencyUpdate = model.getLookupById(
model.medicationFrequencyList, widget.frequency);
},
@ -256,7 +259,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
child: TextFields(
inputFormatters: [
LengthLimitingTextInputFormatter(
4),
5),
// WhitelistingTextInputFormatter
// .digitsOnly
],
@ -272,9 +275,9 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
setState(() {
strengthChar = value.length;
});
if (strengthChar >= 4) {
if (strengthChar >= 5) {
DrAppToastMsg.showErrorToast(
"Only 4 Digits allowed for strength");
"Only 5 Digits allowed for strength");
}
},
// validator: (value) {
@ -298,7 +301,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
0.3700,
child: InkWell(
onTap:
model.medicationStrengthList !=
model.itemMedicineListUnit !=
null
? () {
Helpers.hideKeyboard(
@ -307,11 +310,11 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
dialog =
ListSelectDialog(
list: model
.medicationStrengthList,
.itemMedicineListUnit,
attributeName:
'nameEn',
'description',
attributeValueId:
'id',
'parameterCode',
okText:
TranslationBase.of(
context)
@ -341,7 +344,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
textFieldSelectorDecoration(
'UNIT Type',
units != null
? units['nameEn']
? units[
'description']
: null,
true),
enabled: false,
@ -359,15 +363,17 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
MediaQuery.of(context).size.height *
0.070,
child: InkWell(
onTap: model.medicationRouteList != null
onTap: model.itemMedicineListRoute !=
null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list:
model.medicationRouteList,
attributeName: 'nameEn',
attributeValueId: 'id',
list: model
.itemMedicineListRoute,
attributeName: 'description',
attributeValueId:
'parameterCode',
okText: TranslationBase.of(
context)
.ok,
@ -395,7 +401,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
textFieldSelectorDecoration(
'Route',
route != null
? route['nameEn']
? route['description']
: null,
true),
enabled: false,
@ -715,16 +721,17 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
.text) ==
0.0) {
DrAppToastMsg.showErrorToast(
"Streangth can't be zero");
"strength can't be zero");
return;
}
if (strengthController
.text.length >
4) {
DrAppToastMsg.showErrorToast(
"Streangth can't be zero");
"strength can't be more then 4 digits ");
return;
}
// if(units==null&& updatedDuration==null&&frequencyUpdate==null&&)
updatePrescription(
newStartDate: selectedDate,
newDoseStreangth:
@ -735,7 +742,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
: widget
.doseStreangth,
newUnit: units != null
? units['id'].toString()
? units['parameterCode']
.toString()
: widget.doseUnit,
doseUnit: widget.doseUnit,
doseStreangth:
@ -747,22 +755,24 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
routeId: widget.route,
patient: widget.patient,
model: widget.model,
newDuration: updatedDuration !=
null
? updatedDuration['id']
.toString()
: widget.duration,
newDuration:
updatedDuration != null
? updatedDuration['id']
.toString()
: widget.duration,
drugId: widget.drugId,
remarks:
remarksController.text,
remarks: remarksController
.text,
route: route != null
? route['id'].toString()
: widget.route,
frequency: frequencyUpdate !=
null
? frequencyUpdate['id']
? route['parameterCode']
.toString()
: widget.frequency,
: widget.route,
frequency:
frequencyUpdate != null
? frequencyUpdate[
'id']
.toString()
: widget.frequency,
dose: doseTime != null
? doseTime['id']
.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/categories_procedure.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/models/patient/patiant_info_model.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 '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(
{ProcedureViewModel model,
@ -25,6 +37,12 @@ postProcedure(
PatiantInformtion patient,
List<EntityList> entityList}) async {
PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel();
ProcedureValadteRequestModel procedureValadteRequestModel =
new ProcedureValadteRequestModel();
procedureValadteRequestModel.patientMRN = patient.patientMRN;
procedureValadteRequestModel.episodeID = patient.episodeNo;
procedureValadteRequestModel.appointmentNo = patient.appointmentNo;
List<Procedures> controlsProcedure = List();
postProcedureReqModel.appointmentNo = patient.appointmentNo;
@ -33,14 +51,15 @@ postProcedure(
postProcedureReqModel.patientMRN = patient.patientMRN;
entityList.forEach((element) {
procedureValadteRequestModel.procedure = [element.procedureId];
List<Controls> controls = List();
controls.add(
Controls(
code: "remarks",
controlValue: element.remarks.isNotEmpty ? element.remarks : ""),
controlValue: element.remarks != null ? element.remarks : ""),
);
controls.add(
Controls(code: "ordertype", controlValue: element.type),
Controls(code: "ordertype", controlValue: "0"),
);
controlsProcedure.add(Procedures(
category: element.categoryID,
@ -49,13 +68,28 @@ postProcedure(
});
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);
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 remarksController = TextEditingController();
List<EntityList> entityList = List();
List<EntityList> entityListProcedure = List();
dynamic selectedCategory;
setSelectedType(int val) {
setState(() {
selectedType = val;
@ -120,10 +157,9 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context)
.selectProcedures
.toUpperCase(),
'Please Select Category',
fontWeight: FontWeight.w900,
fontSize: 15.0,
),
SizedBox(
height: 10.0,
@ -186,29 +222,53 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
),
if (widget.model.categoriesList.length != 0)
NetworkBaseView(
baseViewModel: model,
child: EntityListCheckboxSearchWidget(
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),
),
),
baseViewModel: model,
child: selectedCategory != null
? selectedCategory['categoryId'] == 02 ||
selectedCategory['categoryId'] == 03
? EntityListCheckboxSearchWidget(
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),
)
: 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(
height: 15.0,
),
@ -264,6 +324,13 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
.addSelectedProcedures,
onPressed: () {
//print(entityList.toString());
onPressed:
if (entityList.isEmpty == true) {
DrAppToastMsg.showErrorToast(
"Fill the mandatory procedure details");
return;
}
Navigator.pop(context);
postProcedure(
orderType: selectedType.toString(),

@ -40,7 +40,10 @@ class EntityListCheckboxSearchWidget extends StatefulWidget {
class _EntityListCheckboxSearchWidgetState
extends State<EntityListCheckboxSearchWidget> {
int selectedType = 1;
int selectedType = 0;
int typeUrgent;
int typeRegular;
setSelectedType(int val) {
setState(() {
selectedType = val;
@ -130,12 +133,13 @@ class _EntityListCheckboxSearchWidgetState
.orderType),
Radio(
activeColor: Color(0xFFB9382C),
value: 1,
value: 0,
groupValue: selectedType,
onChanged: (value) {
historyInfo.type =
setSelectedType(value)
.toString();
historyInfo.type =
value.toString();
},
@ -144,11 +148,12 @@ class _EntityListCheckboxSearchWidgetState
Radio(
activeColor: Color(0xFFB9382C),
groupValue: selectedType,
value: 0,
value: 1,
onChanged: (value) {
historyInfo.type =
setSelectedType(value)
.toString();
historyInfo.type =
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/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
@ -235,7 +236,7 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
.entityList[
index]
.orderType ==
0
1
? Color(
0xFFB9382C)
: Colors
@ -254,7 +255,7 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
.entityList[
index]
.orderType ==
0
1
? Color(
0xFFB9382C)
: Colors
@ -274,7 +275,7 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
.entityList[
index]
.orderType ==
0
1
? Color(
0xFFB9382C)
: Colors
@ -330,13 +331,13 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
Expanded(
child: AppText(
model.procedureList[0].entityList[index].orderType ==
1
0
? 'Routine'
: 'Urgent',
fontSize:
13.5,
color: model.procedureList[0].entityList[index].orderType ==
0
1
? Color(0xFFB9382C)
: Colors.green),
),
@ -459,43 +460,66 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
onTap: () {
// model
// .updateProcedure();
updateProcedureForm(
context,
model:
model,
orderNo: model
.procedureList[
0]
.entityList[
index]
.orderNo,
remarks: model
.procedureList[
0]
.entityList[
index]
.remarks,
procedureName: model
.procedureList[
0]
.entityList[
index]
.procedureName,
patient:
patient,
procedureId: model
.procedureList[
0]
.entityList[
index]
.procedureId,
categoreId: model
.procedureList[
0]
.entityList[
index]
.categoryID
.toString());
if (model.procedureList[0].entityList[index].categoryID == 02 ||
model
.procedureList[
0]
.entityList[
index]
.categoryID ==
03 ||
model
.procedureList[0]
.entityList[index]
.categoryID ==
55) {
updateProcedureForm(
context,
limetNo: model
.procedureList[
0]
.entityList[
index]
.lineItemNo,
model:
model,
orderNo: model
.procedureList[
0]
.entityList[
index]
.orderNo,
remarks: model
.procedureList[
0]
.entityList[
index]
.remarks,
procedureName: model
.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/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_procedure_widget.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/TextFields.dart';
@ -22,6 +23,7 @@ import 'package:hexcolor/hexcolor.dart';
void updateProcedureForm(context,
{String procedureName,
int orderNo,
int limetNo,
PatiantInformtion patient,
String orderType,
String procedureId,
@ -44,6 +46,7 @@ void updateProcedureForm(context,
procedureId: procedureId,
categoryId: categoreId,
orderNo: orderNo,
limetNo: limetNo,
);
});
}
@ -57,6 +60,7 @@ class UpdateProcedureWidget extends StatefulWidget {
final String procedureId;
final String categoryId;
final int orderNo;
final int limetNo;
UpdateProcedureWidget(
{this.model,
@ -66,7 +70,8 @@ class UpdateProcedureWidget extends StatefulWidget {
this.patient,
this.procedureId,
this.categoryId,
this.orderNo});
this.orderNo,
this.limetNo});
@override
_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();
dynamic selectedCategory;
@override
@ -177,74 +187,111 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
),
if (widget.model.categoriesList.length != 0)
NetworkBaseView(
baseViewModel: model,
child: EntityListCheckboxSearchWidget(
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),
),
baseViewModel: model,
child: selectedCategory != null
? selectedCategory['categoryId'] ==
02 ||
selectedCategory[
'categoryId'] ==
03 ||
selectedCategory[
'categoryId'] ==
55
? EntityListCheckboxSearchWidget(
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),
)
: 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(
height: 50.0,
),
@ -259,8 +306,16 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
.updateProcedure
.toUpperCase(),
onPressed: () {
if (entityList.isEmpty == true &&
widget.remarksController.text ==
widget.remarks) {
DrAppToastMsg.showErrorToast(
"Fill the mandatory procedure details");
return;
}
Navigator.pop(context);
updateProcedure(
limetNO: widget.limetNo,
orderNo: widget.orderNo,
orderType: selectedType.toString(),
categorieId: widget.categoryId,
@ -290,6 +345,7 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
updateProcedure(
{ProcedureViewModel model,
String remarks,
int limetNO,
int orderNo,
String newProcedureId,
String newCategorieId,
@ -307,29 +363,38 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
updateProcedureReqModel.episodeID = patient.episodeNo;
updateProcedureReqModel.patientMRN = patient.patientMRN;
updateProcedureReqModel.lineItemNo = 1;
updateProcedureReqModel.lineItemNo = limetNO;
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(
code: "remarks",
controlValue: element.remarks.isNotEmpty ? element.remarks : ""),
code: "remarks", controlValue: remarks.isNotEmpty ? remarks : ""),
);
controls.add(
Controls(code: "ordertype", controlValue: '1'),
Controls(code: "ordertype", controlValue: orderType),
);
});
entityList.isNotEmpty
? entityList.forEach((element) {
controlsProcedure.procedure = element.procedureId;
controlsProcedure.category = element.categoryID;
controlsProcedure.controls = controls;
})
: controlsProcedure.procedure = procedureId;
controlsProcedure.category = categorieId;
controlsProcedure.controls = controls;
controlsProcedure.procedure = procedureId;
controlsProcedure.category = '0' + categorieId;
controlsProcedure.controls = controls;
}
// controlsProcedure.add(ProcedureDetail(
// category: categorieId, procedure: procedureId, controls: controls));
updateProcedureReqModel.procedureDetail = controlsProcedure;
@ -343,6 +408,7 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
model.getProcedure(mrn: patient.patientMRN);
} else if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast('procedure has been updated');
model.getProcedure(mrn: patient.patientMRN);
}
}

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

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

Loading…
Cancel
Save