Merge branch 'development' into 'sultan'

# Conflicts:
#   lib/widgets/patients/profile/profile_medical_info_widget.dart
merge-requests/267/head
Mohammad Aljammal 5 years ago
commit 35a9f34b18

@ -48,7 +48,9 @@ class PrescriptionService extends BaseService {
}, body: _prescriptionReqModel.toJson());
}
Future getDrugs() async {
Future getDrugs({String drugName}) async {
_drugRequestModel = SearchDrugRequestModel(search: [drugName]);
hasError = false;
await baseAppClient.post(SEARCH_DRUG,

@ -61,11 +61,11 @@ class PrescriptionViewModel extends BaseViewModel {
}
}
Future getDrugs() async {
Future getDrugs({String drugName}) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _prescriptionService.getDrugs();
setState(ViewState.BusyLocal);
await _prescriptionService.getDrugs(drugName: drugName);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);

@ -68,7 +68,7 @@ class ProcedureViewModel extends BaseViewModel {
}
Future updateProcedure(
PostProcedureReqModel postProcedureReqModel, int mrn) async {
{PostProcedureReqModel postProcedureReqModel, int mrn}) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);

@ -42,6 +42,7 @@ class PatiantInformtion {
int patientMRN;
String admissionNo;
String admissionDate;
String createdOn;
String roomId;
String bedId;
String nursingStationId;
@ -77,6 +78,7 @@ class PatiantInformtion {
this.patientType,
this.admissionNo,
this.admissionDate,
this.createdOn,
this.roomId,
this.bedId,
this.nursingStationId,
@ -129,6 +131,7 @@ class PatiantInformtion {
patientType: json["PatientType"]?? json["patientType"],
admissionNo: json["AdmissionNo"]?? json["admissionNo"],
admissionDate: json["AdmissionDate"]?? json["admissionDate"],
createdOn: json["CreatedOn"]?? json["CreatedOn"],
roomId: json["RoomID"]?? json["roomID"],
bedId: json["BedID"]?? json["bedID"],
nursingStationId: json["NursingStationID"]?? json["nursingStationID"],
@ -158,10 +161,4 @@ class PatiantInformtion {
patientMRN :json['patientMRN'] ?? json['PatientMRN'],
);
}

@ -21,6 +21,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
@ -107,6 +108,12 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
TextEditingController drugIdController = TextEditingController();
TextEditingController doseController = TextEditingController();
final searchController = TextEditingController();
var notesList;
var filteredNotesList;
String textSeartch = "Amoxicillin";
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
final double spaceBetweenTextFileds = 12;
List<dynamic> referToList;
@ -165,6 +172,24 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
dynamic route7 = {"id": 27, "name": "In Both EYES"};
dynamic route8 = {"id": 28, "name": "In Both Ears"};
dynamic route9 = {"id": 32, "name": "Intramuscular"};
dynamic route10 = {"id": 60, "name": "TRANSDERMAL"};
dynamic route11 = {"id": 59, "name": "OROPHARYNGEAL"};
dynamic route12 = {"id": 15, "name": "for INJECTION"};
dynamic route13 = {"id": 58, "name": "SUBCUTANEOUS"};
dynamic route14 = {"id": 57, "name": "NASOGASTRIC"};
dynamic route15 = {"id": 56, "name": "IRRIGATION"};
dynamic route16 = {"id": 55, "name": "INTRAVITREAL"};
dynamic route17 = {"id": 54, "name": "INTRAVENOUS BOLUS"};
dynamic route18 = {"id": 51, "name": "EPIDURAL"};
dynamic route19 = {"id": 47, "name": "Parenteral"};
dynamic route20 = {"id": 43, "name": "IM"};
dynamic route21 = {"id": 42, "name": "IV"};
dynamic route22 = {"id": 41, "name": "Sublingual"};
dynamic route23 = {"id": 40, "name": "For Nebulization"};
dynamic route24 = {"id": 39, "name": "Nasal"};
dynamic route25 = {"id": 37, "name": "Inserted into Vagina"};
dynamic route26 = {"id": 36, "name": "Inserted into Rectum"};
dynamic route27 = {"id": 31, "name": "In Each Nostril"};
dynamic frequency1 = {"id": 1, "name": "2 Times a day"};
dynamic frequency2 = {"id": 2, "name": "3 Times a day"};
dynamic frequency3 = {"id": 3, "name": "4 Times a day"};
@ -258,6 +283,24 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
routeList.add(route7);
routeList.add(route8);
routeList.add(route9);
routeList.add(route10);
routeList.add(route11);
routeList.add(route12);
routeList.add(route13);
routeList.add(route14);
routeList.add(route15);
routeList.add(route16);
routeList.add(route17);
routeList.add(route18);
routeList.add(route19);
routeList.add(route20);
routeList.add(route21);
routeList.add(route22);
routeList.add(route23);
routeList.add(route24);
routeList.add(route25);
routeList.add(route26);
routeList.add(route27);
strengthList.add(strength1);
strengthList.add(strength2);
strengthList.add(strength3);
@ -295,12 +338,13 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
@override
Widget build(BuildContext context) {
ListSelectDialog drugDialog;
final screenSize = MediaQuery.of(context).size;
// final routeArgs = ModalRoute.of(context).settings.arguments as Map;
// patient = routeArgs['patient'];
return BaseView<PrescriptionViewModel>(
onModelReady: (model) => model.getDrugs(),
onModelReady: (model) => model.getDrugs(drugName: textSeartch),
builder:
(BuildContext context, PrescriptionViewModel model, Widget child) =>
NetworkBaseView(
@ -339,7 +383,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
onTap: model.drugsList != null &&
model.drugsList.length > 0
? () {
ListSelectDialog dialog =
return drugDialog =
ListSelectDialog(
list: model.drugsList,
attributeName: 'GenericName',
@ -352,17 +396,121 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
selectedDrug = selectedValue;
});
},
/* searchWidget: Row(
children: [
Expanded(
child: TextField(
decoration: Helpers
.textFieldSelectorDecoration(
TranslationBase.of(
context)
.search,
searchController.text !=
null &&
searchController
.text !=
""
? searchController
.text
: null,
false,
),
onChanged: (String str) {
textSeartch = str;
},
controller:
searchController,
enabled: true,
),
),
Container(
child: InkWell(
child: Icon(
Icons.search,
color: Colors.black,
),
onTap: () async {
Navigator.of(context)
.pop();
await searchMedicine(
context,
model,
textSeartch);
showDialog(
barrierDismissible:
false,
context: context,
builder: (BuildContext
context) {
return drugDialog;
},
);
},
),
margin:
EdgeInsets.symmetric(
horizontal: 8),
)
],
),*/
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
return drugDialog;
},
);
}
: null,
child: TextField(
child: Row(
children: [
Expanded(
child: TextField(
decoration: Helpers
.textFieldSelectorDecoration(
TranslationBase.of(context)
.search,
searchController.text != null &&
searchController.text !=
""
? searchController.text
: null,
false,
),
onChanged: (String str) {
textSeartch = str;
},
controller: searchController,
enabled: true,
),
),
Container(
child: InkWell(
child: Icon(
Icons.search,
color: Colors.black,
),
onTap: () async {
// Navigator.of(context)
// .pop();
await searchMedicine(
context, model, textSeartch);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return drugDialog;
},
);
},
),
margin: EdgeInsets.symmetric(
horizontal: 8),
)
],
), /*TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.searchMedicine,
@ -374,8 +522,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
Icons.search,
color: Colors.black,
)),
enabled: false,
),
enabled: true,
),*/
),
),
SizedBox(
@ -945,4 +1093,41 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
);
});
}
// searchData(String str, PrescriptionViewModel model) {
// var strExist = str.length > 0 ? true : false;
//
// if (strExist) {
// filteredNotesList = null;
// filteredNotesList = model.drugsList
// .where((note) =>
// note["GenericName"].toString().contains(str.toUpperCase()))
// .toList();
// setState(() {
// notesList = filteredNotesList;
// });
// } else {
// setState(() {
// notesList = model.drugsList;
// });
// }
// }
searchMedicine(context, PrescriptionViewModel model, String str) async {
FocusScope.of(context).unfocus();
// if (searchController.text.isEmpty()) {
// helpers.showErrorToast(TranslationBase.of(context).typeMedicineName);
// //"Type Medicine Name")
// return;
// }
if (searchController.text.length < 0) {
helpers.showErrorToast(TranslationBase.of(context).moreThan3Letter);
return;
}
GifLoaderDialogUtils.showMyDialog(context);
await model.getDrugs(drugName: searchController.text);
GifLoaderDialogUtils.hideDialog(context);
}
}

@ -9,6 +9,7 @@ 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/prescription/add_prescription_form.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_widget.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/profile_medical_info_widget.dart';
@ -337,7 +338,25 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
child: Column(
children: [
AppText(
'8\nDEC',
DateTime.parse(model
.prescriptionList[
0]
.entityList[
index]
.startDate)
.day
.toString(),
color: Colors
.green,
),
AppText(
Helpers.getMonth(model.prescriptionList[0].entityList[index].startDate !=
null
? (DateTime.parse(model.prescriptionList[0].entityList[index].startDate)
.month)
: DateTime.now()
.month)
.toUpperCase(),
color: Colors
.green,
)

@ -11,6 +11,7 @@ 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/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
@ -271,7 +272,36 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
child: Column(
children: [
AppText(
'8\nDEC',
DateTime.parse(model
.procedureList[
0]
.entityList[
index]
.orderDate)
.day
.toString(),
color:
Colors.green,
),
AppText(
Helpers.getMonth(model
.procedureList[
0]
.entityList[
index]
.orderDate !=
null
? (DateTime.parse(model
.procedureList[
0]
.entityList[
index]
.orderDate)
.month)
: DateTime
.now()
.month)
.toUpperCase(),
color:
Colors.green,
)
@ -421,6 +451,8 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
child: Icon(
Icons.edit),
onTap: () {
// model
// .updateProcedure();
updateProcedureForm(
context,
remarks: model
@ -691,7 +723,8 @@ updateProcedure(
category: categorieId, procedure: procedureId, controls: controls));
updateProcedureReqModel.procedures = controlsProcedure;
await model.updateProcedure(updateProcedureReqModel, patient.patientMRN);
await model.updateProcedure(
postProcedureReqModel: updateProcedureReqModel, mrn: patient.patientMRN);
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);

@ -254,8 +254,8 @@ class PatientProfileWidget extends StatelessWidget {
),
Expanded(
child: AppText(
patient.admissionDate != null
? "${DateUtils.convertDateFromServerFormat(patient.admissionDate, 'EEEE dd, MMMM yyyy hh:mm a')}"
patient.createdOn != null
? "${DateUtils.convertDateFromServerFormat(patient.createdOn, 'EEEE dd, MMMM yyyy hh:mm a')}"
: "",
color: Colors.black,
fontWeight: FontWeight.normal,
@ -310,10 +310,10 @@ class PatientProfileWidget extends StatelessWidget {
),
),
AppText(
patient.admissionDate != null
patient.createdOn != null
? DateUtils
.differenceBetweenServerDateAndCurrent(
patient.admissionDate)
patient.createdOn)
: "",
color: Colors.black,
fontWeight: FontWeight.normal,

@ -116,20 +116,22 @@ class ProfileMedicalInfoWidget extends StatelessWidget {
nameLine1: TranslationBase.of(context).admission,
nameLine2: TranslationBase.of(context).request,
icon: 'heartbeat.png'),
PatientProfileButton(
key: key,
patient: patient,
route: ORDER_PRESCRIPTION,
nameLine1: TranslationBase.of(context).orders,
nameLine2: TranslationBase.of(context).prescription,
icon: 'lab.png'),
PatientProfileButton(
key: key,
patient: patient,
route: ORDER_PROCEDURE,
nameLine1: TranslationBase.of(context).orders,
nameLine2: TranslationBase.of(context).procedures,
icon: 'lab.png'),
if (int.parse(patientType) == 7 || int.parse(patientType) == 6)
PatientProfileButton(
key: key,
patient: patient,
route: ORDER_PRESCRIPTION,
nameLine1: TranslationBase.of(context).orders,
nameLine2: TranslationBase.of(context).prescription,
icon: 'lab.png'),
if (int.parse(patientType) == 7 || int.parse(patientType) == 6)
PatientProfileButton(
key: key,
patient: patient,
route: ORDER_PROCEDURE,
nameLine1: TranslationBase.of(context).orders,
nameLine2: TranslationBase.of(context).procedures,
icon: 'lab.png'),
if (int.parse(patientType) == 7 || int.parse(patientType) == 6)
PatientProfileButton(
key: key,

@ -1,3 +1,6 @@
import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:flutter/material.dart';
@ -8,13 +11,15 @@ class ListSelectDialog extends StatefulWidget {
final okText;
final Function(dynamic) okFunction;
dynamic selectedValue;
final Widget searchWidget;
ListSelectDialog(
{@required this.list,
@required this.attributeName,
@required this.attributeValueId,
@required this.okText,
@required this.okFunction});
@required this.okFunction,
this.searchWidget});
@override
_ListSelectDialogState createState() => _ListSelectDialogState();
@ -63,6 +68,7 @@ class _ListSelectDialogState extends State<ListSelectDialog> {
child: SingleChildScrollView(
child: Column(
children: [
if (widget.searchWidget != null) widget.searchWidget,
...widget.list
.map((item) => RadioListTile(
title: Text("${item[widget.attributeName].toString()}"),

@ -0,0 +1,92 @@
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:flutter/material.dart';
class ListSelectDialog extends StatefulWidget {
final List<dynamic> list;
final String attributeName;
final String attributeValueId;
final okText;
final Function(dynamic) okFunction;
dynamic selectedValue;
ListSelectDialog(
{@required this.list,
@required this.attributeName,
@required this.attributeValueId,
@required this.okText,
@required this.okFunction});
@override
_ListSelectDialogState createState() => _ListSelectDialogState();
}
class _ListSelectDialogState extends State<ListSelectDialog> {
@override
void initState() {
super.initState();
widget.selectedValue = widget.selectedValue ?? widget.list[0];
}
@override
Widget build(BuildContext context) {
return showAlertDialog(context);
}
showAlertDialog(BuildContext context) {
// set up the buttons
Widget cancelButton = FlatButton(
child: Text(TranslationBase.of(context).cancel),
onPressed: () {
Navigator.of(context).pop();
});
Widget continueButton = FlatButton(
child: Text(this.widget.okText),
onPressed: () {
this.widget.okFunction(widget.selectedValue);
Navigator.of(context).pop();
});
// set up the AlertDialog
AlertDialog alert = AlertDialog(
// title: Text(widget.title),
content: createDialogList(),
actions: [
cancelButton,
continueButton,
],
);
return alert;
}
Widget createDialogList() {
return Container(
height: MediaQuery.of(context).size.height * 0.5,
child: SingleChildScrollView(
child: Column(
children: [
...widget.list
.map((item) => RadioListTile(
title: Text("${item[widget.attributeName].toString()}"),
groupValue: widget.selectedValue[widget.attributeValueId]
.toString(),
value: item[widget.attributeValueId].toString(),
activeColor: Colors.blue.shade700,
selected: item[widget.attributeValueId].toString() ==
widget.selectedValue[widget.attributeValueId]
.toString(),
onChanged: (val) {
setState(() {
widget.selectedValue = item;
});
},
))
.toList()
],
),
),
);
}
static closeAlertDialog(BuildContext context) {
Navigator.of(context).pop();
}
}
Loading…
Cancel
Save