current medication done.
parent
b727e66ac1
commit
7765e8ff35
@ -0,0 +1,40 @@
|
||||
class GetSearchCurrentMedication {
|
||||
String? formularyName;
|
||||
String? genericFormularyCode;
|
||||
String? genericFormularyId;
|
||||
int? hospitalGroupId;
|
||||
int? hospitalId;
|
||||
String? itemType;
|
||||
bool? outOfStock;
|
||||
|
||||
GetSearchCurrentMedication(
|
||||
{this.formularyName,
|
||||
this.genericFormularyCode,
|
||||
this.genericFormularyId,
|
||||
this.hospitalGroupId,
|
||||
this.hospitalId,
|
||||
this.itemType,
|
||||
this.outOfStock});
|
||||
|
||||
GetSearchCurrentMedication.fromJson(Map<String, dynamic> json) {
|
||||
formularyName = json['formularyName'];
|
||||
genericFormularyCode = json['genericFormularyCode'];
|
||||
genericFormularyId = json['genericFormularyId'];
|
||||
hospitalGroupId = json['hospitalGroupId'];
|
||||
hospitalId = json['hospitalId'];
|
||||
itemType = json['itemType'];
|
||||
outOfStock = json['outOfStock'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['formularyName'] = this.formularyName;
|
||||
data['genericFormularyCode'] = this.genericFormularyCode;
|
||||
data['genericFormularyId'] = this.genericFormularyId;
|
||||
data['hospitalGroupId'] = this.hospitalGroupId;
|
||||
data['hospitalId'] = this.hospitalId;
|
||||
data['itemType'] = this.itemType;
|
||||
data['outOfStock'] = this.outOfStock;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,108 @@
|
||||
class GetSearchCurrentMedicationDetails {
|
||||
List<GenericItemFrequencyDetailsEntity>? genericItemFrequencyDetailsEntity;
|
||||
List<GenericItemRouteDetailsEntity>? genericItemRouteDetailsEntity;
|
||||
List<ItemStrengthDetailsDto>? itemStrengthDetailsDto;
|
||||
int? patientTypeId;
|
||||
|
||||
GetSearchCurrentMedicationDetails({this.genericItemFrequencyDetailsEntity, this.genericItemRouteDetailsEntity, this.itemStrengthDetailsDto, this.patientTypeId});
|
||||
|
||||
GetSearchCurrentMedicationDetails.fromJson(Map<String, dynamic> json) {
|
||||
if (json['genericItemFrequencyDetailsEntity'] != null) {
|
||||
genericItemFrequencyDetailsEntity = <GenericItemFrequencyDetailsEntity>[];
|
||||
json['genericItemFrequencyDetailsEntity'].forEach((v) { genericItemFrequencyDetailsEntity!.add(new GenericItemFrequencyDetailsEntity.fromJson(v)); });
|
||||
}
|
||||
if (json['genericItemRouteDetailsEntity'] != null) {
|
||||
genericItemRouteDetailsEntity = <GenericItemRouteDetailsEntity>[];
|
||||
json['genericItemRouteDetailsEntity'].forEach((v) { genericItemRouteDetailsEntity!.add(new GenericItemRouteDetailsEntity.fromJson(v)); });
|
||||
}
|
||||
if (json['itemStrengthDetailsDto'] != null) {
|
||||
itemStrengthDetailsDto = <ItemStrengthDetailsDto>[];
|
||||
json['itemStrengthDetailsDto'].forEach((v) { itemStrengthDetailsDto!.add(new ItemStrengthDetailsDto.fromJson(v)); });
|
||||
}
|
||||
patientTypeId = json['patientTypeId'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.genericItemFrequencyDetailsEntity != null) {
|
||||
data['genericItemFrequencyDetailsEntity'] = this.genericItemFrequencyDetailsEntity!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.genericItemRouteDetailsEntity != null) {
|
||||
data['genericItemRouteDetailsEntity'] = this.genericItemRouteDetailsEntity!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.itemStrengthDetailsDto != null) {
|
||||
data['itemStrengthDetailsDto'] = this.itemStrengthDetailsDto!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['patientTypeId'] = this.patientTypeId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class GenericItemFrequencyDetailsEntity {
|
||||
bool? Default;
|
||||
String? frequency;
|
||||
int? frequencyId;
|
||||
int? interval;
|
||||
|
||||
GenericItemFrequencyDetailsEntity({this.Default, this.frequency, this.frequencyId, this.interval});
|
||||
|
||||
GenericItemFrequencyDetailsEntity.fromJson(Map<String, dynamic> json) {
|
||||
Default = json['Default'];
|
||||
frequency = json['Frequency'];
|
||||
frequencyId = json['FrequencyId'];
|
||||
interval = json['Interval'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['Default'] = this.Default;
|
||||
data['Frequency'] = this.frequency;
|
||||
data['FrequencyId'] = this.frequencyId;
|
||||
data['Interval'] = this.interval;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class GenericItemRouteDetailsEntity {
|
||||
bool? Default;
|
||||
String? route;
|
||||
int? routeId;
|
||||
|
||||
GenericItemRouteDetailsEntity({this.Default, this.route, this.routeId});
|
||||
|
||||
GenericItemRouteDetailsEntity.fromJson(Map<String, dynamic> json) {
|
||||
Default = json['default'];
|
||||
route = json['route'];
|
||||
routeId = json['routeId'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['default'] = this.Default;
|
||||
data['route'] = this.route;
|
||||
data['routeId'] = this.routeId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ItemStrengthDetailsDto {
|
||||
bool? Default;
|
||||
String? strength;
|
||||
int? strengthId;
|
||||
|
||||
ItemStrengthDetailsDto({this.Default, this.strength, this.strengthId});
|
||||
|
||||
ItemStrengthDetailsDto.fromJson(Map<String, dynamic> json) {
|
||||
Default = json['default'];
|
||||
strength = json['strength'];
|
||||
strengthId = json['strengthId'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['default'] = this.Default;
|
||||
data['strength'] = this.strength;
|
||||
data['strengthId'] = this.strengthId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,150 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/model/SOAP/home_medication_vp/GetSearchCurrentMedicationDetails.dart';
|
||||
import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
||||
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
|
||||
class DropdownPopup extends StatefulWidget {
|
||||
final GetSearchCurrentMedicationDetails? medicationDetails;
|
||||
bool isStrength;
|
||||
bool isRoute;
|
||||
bool isFrequency;
|
||||
int? selectedID;
|
||||
String? selectedText;
|
||||
final okText;
|
||||
final Function(int selectedID, String selectedText)? okFunction;
|
||||
DropdownPopup({this.medicationDetails, this.isStrength = false, this.okFunction, this.okText, this.selectedID, this.isRoute =false, this.isFrequency =false, this.selectedText });
|
||||
|
||||
@override
|
||||
_DropdownPopupState createState() => _DropdownPopupState();
|
||||
}
|
||||
|
||||
class _DropdownPopupState extends State<DropdownPopup> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProjectViewModel projectViewModel = Provider.of(context);
|
||||
return showAlertDialog(context, projectViewModel);
|
||||
}
|
||||
|
||||
showAlertDialog(BuildContext context, ProjectViewModel projectViewModel) {
|
||||
// set up the buttons
|
||||
Widget cancelButton = ElevatedButton(
|
||||
child: AppText(
|
||||
TranslationBase.of(context).cancel,
|
||||
color: Colors.white,
|
||||
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3.5 : 5),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
Widget continueButton = ElevatedButton(
|
||||
child: AppText(
|
||||
this.widget.okText,
|
||||
color: Colors.white,
|
||||
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3.5 : 5),
|
||||
),
|
||||
onPressed: () {
|
||||
|
||||
// this.widget.okFunction(selectedValue);
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
// set up the AlertDialog
|
||||
AlertDialog alert = AlertDialog(
|
||||
// title: Text(widget.title),
|
||||
content: createDialogList(projectViewModel),
|
||||
actions: [
|
||||
cancelButton,
|
||||
continueButton,
|
||||
],
|
||||
);
|
||||
return alert;
|
||||
}
|
||||
|
||||
Widget createDialogList(ProjectViewModel projectViewModel) {
|
||||
return Container(
|
||||
height: MediaQuery.of(context).size.height * 0.5,
|
||||
child: SingleChildScrollView(
|
||||
child: widget.isStrength ? Column(
|
||||
children: [
|
||||
|
||||
...widget.medicationDetails!.itemStrengthDetailsDto!
|
||||
.map((item) => RadioListTile(
|
||||
title: AppText(
|
||||
'${item.strength}',
|
||||
),
|
||||
groupValue: widget.selectedID!.toString(),
|
||||
value: item.strengthId.toString(),
|
||||
activeColor: Colors.blue.shade700,
|
||||
selected: item.strengthId.toString() == widget.selectedID!.toString(),
|
||||
onChanged: (val) {
|
||||
widget.selectedID = item.strengthId;
|
||||
widget.selectedText = item.strength;
|
||||
widget.okFunction!( item.strengthId!, item.strength!);
|
||||
|
||||
},
|
||||
))
|
||||
.toList()
|
||||
],
|
||||
) :
|
||||
|
||||
widget.isRoute ? Column( children: [
|
||||
|
||||
...widget.medicationDetails!.genericItemRouteDetailsEntity!
|
||||
.map((item) => RadioListTile(
|
||||
title: AppText(
|
||||
'${item.route}',
|
||||
),
|
||||
groupValue: widget.selectedID!.toString(),
|
||||
value: item.routeId.toString(),
|
||||
activeColor: Colors.blue.shade700,
|
||||
selected: item.routeId.toString() == widget.selectedID!.toString(),
|
||||
onChanged: (val) {
|
||||
widget.selectedID = item.routeId;
|
||||
widget.selectedText = item.route;
|
||||
widget.okFunction!( item.routeId!, item.route!);
|
||||
|
||||
},
|
||||
))
|
||||
.toList()
|
||||
],
|
||||
) : Column( children: [
|
||||
|
||||
...widget.medicationDetails!.genericItemFrequencyDetailsEntity!
|
||||
.map((item) => RadioListTile(
|
||||
title: AppText(
|
||||
'${item.frequency}',
|
||||
),
|
||||
groupValue: widget.selectedID!.toString(),
|
||||
value: item.frequencyId.toString(),
|
||||
activeColor: Colors.blue.shade700,
|
||||
selected: item.frequencyId.toString() == widget.selectedID!.toString() ,
|
||||
onChanged: (val) {
|
||||
widget.selectedID = item.frequencyId;
|
||||
widget.selectedText = item.frequency;
|
||||
widget.okFunction!( item.frequencyId!, item.frequency!);
|
||||
setState(() {
|
||||
|
||||
});
|
||||
},
|
||||
))
|
||||
.toList()
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static closeAlertDialog(BuildContext context) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue