merge-requests/316/head
hussam al-habibeh 4 years ago
parent 2563b10216
commit d115564cc1

@ -27,7 +27,8 @@ const PATIENT_GET_CLINIC_BY_PROJECT_URL =
const PROJECT_GET_INFO = "Services/DoctorApplication.svc/REST/GetProjectInfo";
const GET_CLINICS = "Services/DoctorApplication.svc/REST/GetClinics";
const GET_REFERRAL_FACILITIES = 'Services/DoctorApplication.svc/REST/GetReferralFacilities';
const GET_REFERRAL_FACILITIES =
'Services/DoctorApplication.svc/REST/GetReferralFacilities';
const GET_PROJECTS = 'Services/DoctorApplication.svc/REST/GetProjectInfo';
@ -195,11 +196,16 @@ const DRUG_TO_DRUG =
const GET_MEDICAL_FILE = 'Services/DoctorApplication.svc/REST/GetMedicalFile';
const GET_FLOORS = 'Services/DoctorApplication.svc/REST/GetFloors';
const GET_WARDS = 'Services/DoctorApplication.svc/REST/GetWards';
const GET_ROOM_CATEGORIES = 'Services/DoctorApplication.svc/REST/GetRoomCategories';
const GET_DIAGNOSIS_TYPES = 'Services/DoctorApplication.svc/REST/DiagnosisTypes';
const GET_ROOM_CATEGORIES =
'Services/DoctorApplication.svc/REST/GetRoomCategories';
const GET_DIAGNOSIS_TYPES =
'Services/DoctorApplication.svc/REST/DiagnosisTypes';
const GET_DIET_TYPES = 'Services/DoctorApplication.svc/REST/DietTypes';
const GET_ICD_CODES = 'Services/DoctorApplication.svc/REST/GetICDCodes';
const POST_ADMISSION_REQUEST = 'Services/DoctorApplication.svc/REST/PostAdmissionRequest';
const POST_ADMISSION_REQUEST =
'Services/DoctorApplication.svc/REST/PostAdmissionRequest';
const GET_ITEM_BY_MEDICINE =
'Services/DoctorApplication.svc/REST/GetItemByMedicineCode';
var selectedPatientType = 1;

@ -0,0 +1,108 @@
class ItemByMedicineModel {
List<Frequencies> frequencies;
List<Routes> routes;
List<Strengths> strengths;
ItemByMedicineModel({this.frequencies, this.routes, this.strengths});
ItemByMedicineModel.fromJson(Map<String, dynamic> json) {
if (json['frequencies'] != null) {
frequencies = new List<Frequencies>();
json['frequencies'].forEach((v) {
frequencies.add(new Frequencies.fromJson(v));
});
}
if (json['routes'] != null) {
routes = new List<Routes>();
json['routes'].forEach((v) {
routes.add(new Routes.fromJson(v));
});
}
if (json['strengths'] != null) {
strengths = new List<Strengths>();
json['strengths'].forEach((v) {
strengths.add(new Strengths.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.frequencies != null) {
data['frequencies'] = this.frequencies.map((v) => v.toJson()).toList();
}
if (this.routes != null) {
data['routes'] = this.routes.map((v) => v.toJson()).toList();
}
if (this.strengths != null) {
data['strengths'] = this.strengths.map((v) => v.toJson()).toList();
}
return data;
}
}
class Frequencies {
String description;
bool isDefault;
int parameterCode;
Frequencies({this.description, this.isDefault, this.parameterCode});
Frequencies.fromJson(Map<String, dynamic> json) {
description = json['description'];
isDefault = json['isDefault'];
parameterCode = json['parameterCode'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['description'] = this.description;
data['isDefault'] = this.isDefault;
data['parameterCode'] = this.parameterCode;
return data;
}
}
class Strengths {
String description;
bool isDefault;
int parameterCode;
Strengths({this.description, this.isDefault, this.parameterCode});
Strengths.fromJson(Map<String, dynamic> json) {
description = json['description'];
isDefault = json['isDefault'];
parameterCode = json['parameterCode'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['description'] = this.description;
data['isDefault'] = this.isDefault;
data['parameterCode'] = this.parameterCode;
return data;
}
}
class Routes {
String description;
bool isDefault;
int parameterCode;
Routes({this.description, this.isDefault, this.parameterCode});
Routes.fromJson(Map<String, dynamic> json) {
description = json['description'];
isDefault = json['isDefault'];
parameterCode = json['parameterCode'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['description'] = this.description;
data['isDefault'] = this.isDefault;
data['parameterCode'] = this.parameterCode;
return data;
}
}

@ -0,0 +1,18 @@
class ItemByMedicineRequestModel {
String vidaAuthTokenID;
int medicineCode;
ItemByMedicineRequestModel({this.vidaAuthTokenID, this.medicineCode});
ItemByMedicineRequestModel.fromJson(Map<String, dynamic> json) {
vidaAuthTokenID = json['VidaAuthTokenID'];
medicineCode = json['MedicineCode'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['MedicineCode'] = this.medicineCode;
return data;
}
}

@ -1,6 +1,7 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/Prescription_model.dart';
import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/model/item_by_medicine_request_model.dart';
import 'package:doctor_app_flutter/core/model/prescription_req_model.dart';
import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug_model.dart';
@ -23,8 +24,13 @@ class PrescriptionService extends LookupService {
List<GetMedicationResponseModel> allMedicationList = [];
List<dynamic> specialityList = [];
List<dynamic> drugToDrug = [];
List<dynamic> itemMedicineList = [];
List<dynamic> itemMedicineListRoute = [];
List<dynamic> itemMedicineListUnit = [];
PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel();
ItemByMedicineRequestModel _itemByMedicineRequestModel =
ItemByMedicineRequestModel();
SearchDrugRequestModel _drugRequestModel = SearchDrugRequestModel(
//search: ["Acetaminophen"],
search: ["Amoxicillin"],
@ -32,6 +38,25 @@ class PrescriptionService extends LookupService {
PostPrescriptionReqModel _postPrescriptionReqModel =
PostPrescriptionReqModel();
Future getItem({int itemID}) async {
_itemByMedicineRequestModel =
ItemByMedicineRequestModel(medicineCode: itemID);
hasError = false;
await baseAppClient.post(GET_ITEM_BY_MEDICINE,
onSuccess: (dynamic response, int statusCode) {
itemMedicineList = [];
itemMedicineList = response['listItemByMedicineCode']['frequencies'];
itemMedicineListRoute = response['listItemByMedicineCode']['routes'];
itemMedicineListUnit = response['listItemByMedicineCode']['strengths'];
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _itemByMedicineRequestModel.toJson());
}
Future getPatientAssessment(
GetAssessmentReqModel getAssessmentReqModel) async {
hasError = false;

@ -35,6 +35,22 @@ class MedicineViewModel extends BaseViewModel {
List<GetMedicationResponseModel> get allMedicationList =>
_prescriptionService.allMedicationList;
List<dynamic> get itemMedicineList => _prescriptionService.itemMedicineList;
List<dynamic> get itemMedicineListRoute =>
_prescriptionService.itemMedicineListRoute;
List<dynamic> get itemMedicineListUnit =>
_prescriptionService.itemMedicineListUnit;
Future getItem({int itemID}) async {
//hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.BusyLocal);
await _prescriptionService.getItem(itemID: itemID);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future getMedicineItem(String itemName) async {
setState(ViewState.Busy);

@ -22,6 +22,20 @@ class PrescriptionViewModel extends BaseViewModel {
List<dynamic> get drugsList => _prescriptionService.doctorsList;
//List<dynamic> get allMedicationList => _prescriptionService.allMedicationList;
List<dynamic> get itemMedicineList => _prescriptionService.itemMedicineList;
Future getItem({int itemID}) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.BusyLocal);
await _prescriptionService.getItem(itemID: itemID);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future getPrescription({int mrn}) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();

@ -201,6 +201,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
await model.getMedicationDoseTime();
//await model.getMedicationIndications();
await model.getPatientAssessment(getAssessmentReqModel);
await model.getItem();
},
builder: (
BuildContext context,
@ -251,12 +252,23 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
Helpers.hideKeyboard(context);
setState(() {
_selectedMedication = null;
model.getItem(
itemID: _selectedMedication
.itemId);
});
}
: null,
child: _selectedMedication == null
? AutoCompleteTextField<
GetMedicationResponseModel>(
onFocusChanged: (__) {
_selectedMedication != null
? model.getItem(
itemID:
_selectedMedication
.itemId)
: null;
},
decoration:
textFieldSelectorDecoration(
TranslationBase.of(context)
@ -297,6 +309,11 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
input.toLowerCase()),
)
: TextField(
onEditingComplete: () {
model.getItem(
itemID: _selectedMedication
.itemId);
},
decoration:
textFieldSelectorDecoration(
TranslationBase.of(context)
@ -353,7 +370,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
TranslationBase.of(context)
.strength,
controller: strengthController,
keyboardType: TextInputType.numberWithOptions(decimal: true,),
keyboardType:
TextInputType.numberWithOptions(
decimal: true,
),
onChanged: (String value) {
setState(() {
strengthChar = value.length;
@ -383,50 +403,46 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
.width *
0.350,
child: InkWell(
onTap:
model.medicationStrengthList !=
null
? () {
Helpers.hideKeyboard(
context);
ListSelectDialog
dialog =
ListSelectDialog(
list: model
.medicationStrengthList,
attributeName:
'nameEn',
attributeValueId:
'id',
okText:
TranslationBase.of(
context)
.ok,
okFunction:
(selectedValue) {
setState(() {
units =
selectedValue;
});
},
);
showDialog(
barrierDismissible:
false,
context: context,
builder: (BuildContext
context) {
return dialog;
},
);
}
: null,
onTap: model.itemMedicineListUnit !=
null
? () {
Helpers.hideKeyboard(
context);
ListSelectDialog dialog =
ListSelectDialog(
list: model
.itemMedicineListUnit,
attributeName:
'description',
attributeValueId:
'parameterCode',
okText:
TranslationBase.of(
context)
.ok,
okFunction:
(selectedValue) {
setState(() {
units = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext
context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
'UNIT Type',
units != null
? units['nameEn']
? units['description']
: null,
true),
enabled: false,
@ -440,14 +456,16 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
Container(
height: screenSize.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,
@ -475,7 +493,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).route,
route != null
? route['nameEn']
? route['description']
: null,
true),
enabled: false,
@ -486,16 +504,15 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: model.medicationFrequencyList !=
null
onTap: model.itemMedicineList != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: model
.medicationFrequencyList,
attributeName: 'nameEn',
attributeValueId: 'id',
list: model.itemMedicineList,
attributeName: 'description',
attributeValueId:
'parameterCode',
okText:
TranslationBase.of(context)
.ok,
@ -520,7 +537,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
TranslationBase.of(context)
.frequency,
frequency != null
? frequency['nameEn']
? frequency['description']
: null,
true),
enabled: false,
@ -796,16 +813,19 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
// .join(' '),
dose: strengthController.text,
doseUnit:
units['id'].toString(),
units['parameterCode']
.toString(),
patient: widget.patient,
doseTimeIn:
doseTime['id'].toString(),
model: widget.model,
duration:
duration['id'].toString(),
frequency: frequency['id']
frequency:
frequency['parameterCode']
.toString(),
route: route['parameterCode']
.toString(),
route: route['id'].toString(),
drugId: _selectedMedication
.itemId
.toString(),

Loading…
Cancel
Save