pull/209/head
Elham Rababah 5 years ago
commit d8ac550357

@ -159,7 +159,7 @@ const GET_ASSESSMENT =
'Services/DoctorApplication.svc/REST/GetAssessment'; 'Services/DoctorApplication.svc/REST/GetAssessment';
const GET_CATEGORISE_PROCEDURE = const GET_CATEGORISE_PROCEDURE =
'Services/DoctorApplication.svc/REST/GetCategories'; 'Services/DoctorApplication.svc/REST/GetProcedure';
var selectedPatientType = 1; var selectedPatientType = 1;

@ -7,12 +7,11 @@ class PostPrescriptionReqModel {
List<PrescriptionRequestModel> prescriptionRequestModel; List<PrescriptionRequestModel> prescriptionRequestModel;
PostPrescriptionReqModel( PostPrescriptionReqModel(
{this.vidaAuthTokenID = {this.vidaAuthTokenID,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiYTYxZjAyZjItNzUwZS00MTZkLWEzOTQtZTRjZmViZGVjMDE5IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUzNTIiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODUzMDAyNywiZXhwIjoxNjA5Mzk0MDI3LCJpYXQiOjE2MDg1MzAwMjd9.M1NTREPgz5vQH_GTZ_KGb0xQW5HEDs47AtNR3jbqnms", this.clinicID,
this.clinicID = 1, this.episodeID,
this.episodeID = 200012117, this.appointmentNo,
this.appointmentNo = 2016054573, this.patientMRN,
this.patientMRN = 3120690,
this.prescriptionRequestModel}); this.prescriptionRequestModel});
PostPrescriptionReqModel.fromJson(Map<String, dynamic> json) { PostPrescriptionReqModel.fromJson(Map<String, dynamic> json) {
@ -58,19 +57,20 @@ class PrescriptionRequestModel {
String remarks; String remarks;
String icdcode10Id; String icdcode10Id;
PrescriptionRequestModel( PrescriptionRequestModel({
{this.itemId = 4, this.itemId,
this.doseStartDate = "2020-12-20T13:07:41.769Z", this.doseStartDate,
this.duration = 2, this.duration,
this.dose = 1, this.dose,
this.doseUnitId = 1, this.doseUnitId,
this.route = 1, this.route,
this.frequency = 1, this.frequency,
this.doseTime = 1, this.doseTime,
this.covered = true, this.covered,
this.approvalRequired = true, this.approvalRequired,
this.remarks = "test1", this.remarks,
this.icdcode10Id = "test3"}); this.icdcode10Id,
});
PrescriptionRequestModel.fromJson(Map<String, dynamic> json) { PrescriptionRequestModel.fromJson(Map<String, dynamic> json) {
itemId = json['itemId']; itemId = json['itemId'];

@ -1,18 +1,90 @@
class CategoriseProcedureModel { class CategoriseProcedureModel {
String categoryID; List<EntityList> entityList;
String categoryName; int rowcount;
dynamic statusMessage;
CategoriseProcedureModel({this.categoryID, this.categoryName}); CategoriseProcedureModel(
{this.entityList, this.rowcount, this.statusMessage});
CategoriseProcedureModel.fromJson(Map<String, dynamic> json) { CategoriseProcedureModel.fromJson(Map<String, dynamic> json) {
categoryID = json['CategoryID']; if (json['entityList'] != null) {
categoryName = json['CategoryName']; entityList = new List<EntityList>();
json['entityList'].forEach((v) {
entityList.add(new EntityList.fromJson(v));
});
}
rowcount = json['rowcount'];
statusMessage = json['statusMessage'];
}
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;
return data;
}
}
class EntityList {
bool allowedClinic;
String category;
String categoryID;
String genderValidation;
String group;
String orderedValidation;
dynamic price;
String procedureId;
String procedureName;
String specialPermission;
String subGroup;
String template;
EntityList(
{this.allowedClinic,
this.category,
this.categoryID,
this.genderValidation,
this.group,
this.orderedValidation,
this.price,
this.procedureId,
this.procedureName,
this.specialPermission,
this.subGroup,
this.template});
EntityList.fromJson(Map<String, dynamic> json) {
allowedClinic = json['allowedClinic'];
category = json['category'];
categoryID = json['categoryID'];
genderValidation = json['genderValidation'];
group = json['group'];
orderedValidation = json['orderedValidation'];
price = json['price'];
procedureId = json['procedureId'];
procedureName = json['procedureName'];
specialPermission = json['specialPermission'];
subGroup = json['subGroup'];
template = json['template'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['CategoryID'] = this.categoryID; data['allowedClinic'] = this.allowedClinic;
data['CategoryName'] = this.categoryName; data['category'] = this.category;
data['categoryID'] = this.categoryID;
data['genderValidation'] = this.genderValidation;
data['group'] = this.group;
data['orderedValidation'] = this.orderedValidation;
data['price'] = this.price;
data['procedureId'] = this.procedureId;
data['procedureName'] = this.procedureName;
data['specialPermission'] = this.specialPermission;
data['subGroup'] = this.subGroup;
data['template'] = this.template;
return data; return data;
} }
} }

@ -9,7 +9,7 @@ class PrescriptionService extends BaseService {
List<PrescriptionModel> get prescriptionList => _prescriptionList; List<PrescriptionModel> get prescriptionList => _prescriptionList;
PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel( PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel(
patientMRN: 1231755, patientMRN: 3120877,
vidaAuthTokenID: vidaAuthTokenID:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiNzNiNmUyZDctMjA0ZC00NzAyLTkxMDYtODE3MzI3OTZkYzI5IiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NjIwOSIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgyMzY2MjAsImV4cCI6MTYwOTEwMDYyMCwiaWF0IjoxNjA4MjM2NjIwfQ.z4Lh0dCRr9GWXvaTo7x5GPV7R5z8ONyh3-0uk3PXMu8", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiNzNiNmUyZDctMjA0ZC00NzAyLTkxMDYtODE3MzI3OTZkYzI5IiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NjIwOSIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgyMzY2MjAsImV4cCI6MTYwOTEwMDYyMCwiaWF0IjoxNjA4MjM2NjIwfQ.z4Lh0dCRr9GWXvaTo7x5GPV7R5z8ONyh3-0uk3PXMu8",
); );
@ -30,19 +30,20 @@ class PrescriptionService extends BaseService {
}, body: _prescriptionReqModel.toJson()); }, body: _prescriptionReqModel.toJson());
} }
Future postPrescription() async { Future postPrescription(
PostPrescriptionReqModel postProcedureReqModel) async {
hasError = false; hasError = false;
//_prescriptionList.clear(); //_prescriptionList.clear();
await baseAppClient.post( await baseAppClient.post(
GET_CATEGORISE_PROCEDURE, POST_PRESCRIPTION_LIST,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_prescriptionList print("Success");
.add(PrescriptionModel.fromJson(response['PrescriptionList']));
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, },
body: postProcedureReqModel.toJson(),
); );
} }
} }

@ -13,11 +13,6 @@ class ProcedureService extends BaseService {
List<CategoriseProcedureModel> get categoriesList => _categoriesList; List<CategoriseProcedureModel> get categoriesList => _categoriesList;
List<Procedures> procedureslist = List(); List<Procedures> procedureslist = List();
Procedures t1 = Procedures(
category: '02',
procedure: '02011002',
);
GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel(
clinicId: 0, clinicId: 0,
pageSize: 10, pageSize: 10,
@ -29,8 +24,17 @@ class ProcedureService extends BaseService {
search: ["lab"], search: ["lab"],
); );
GetProcedureReqModel _getProcedureCategoriseReqModel = GetProcedureReqModel(
clinicId: 0,
pageSize: 100,
pageIndex: 1,
patientMRN: 0,
//categoryId: null,
vidaAuthTokenID:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI",
PostProcedureReqModel _postProcedureReqModel = PostProcedureReqModel(); search: ["lab"],
);
Future getProcedure() async { Future getProcedure() async {
hasError = false; hasError = false;
@ -47,17 +51,14 @@ class ProcedureService extends BaseService {
Future getCategories() async { Future getCategories() async {
hasError = false; hasError = false;
_categoriesList.clear(); _categoriesList.clear();
await baseAppClient.post( await baseAppClient.post(GET_CATEGORISE_PROCEDURE,
GET_CATEGORISE_PROCEDURE, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) { _categoriesList
_categoriesList .add(CategoriseProcedureModel.fromJson(response['ProcedureList']));
.add(CategoriseProcedureModel.fromJson(response['listCategories'])); }, onFailure: (String error, int statusCode) {
}, hasError = true;
onFailure: (String error, int statusCode) { super.error = error;
hasError = true; }, body: _getProcedureCategoriseReqModel.toJson());
super.error = error;
},
);
} }
Future postProcedure(PostProcedureReqModel postProcedureReqModel) async { Future postProcedure(PostProcedureReqModel postProcedureReqModel) async {

@ -24,15 +24,18 @@ class PrescriptionViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future postPrescription() async { Future postPrescription(
PostPrescriptionReqModel postProcedureReqModel) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard(); //_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionService.postPrescription(); await _prescriptionService.postPrescription(postProcedureReqModel);
if (_prescriptionService.hasError) { if (_prescriptionService.hasError) {
error = _prescriptionService.error; error = _prescriptionService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else } else {
await getPrescription();
setState(ViewState.Idle); setState(ViewState.Idle);
}
} }
} }

@ -45,7 +45,9 @@ class ProcedureViewModel extends BaseViewModel {
if (_procedureService.hasError) { if (_procedureService.hasError) {
error = _procedureService.error; error = _procedureService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else } else {
await getProcedure();
setState(ViewState.Idle); setState(ViewState.Idle);
}
} }
} }

@ -69,19 +69,19 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
try { try {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); /* Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel doctorProfile =
new DoctorProfileModel.fromJson(profile); new DoctorProfileModel.fromJson(profile)*/;
if (_formKey.currentState.validate()) { if (_formKey.currentState.validate()) {
_formKey.currentState.save(); _formKey.currentState.save();
sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType); /* sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType);
String token = await sharedPref.getString(TOKEN); String token = await sharedPref.getString(TOKEN);
_patientSearchFormValues.TokenID = token; _patientSearchFormValues.TokenID = token;
_patientSearchFormValues.ProjectID = doctorProfile.projectID; //15 _patientSearchFormValues.ProjectID = doctorProfile.projectID; //15
_patientSearchFormValues.DoctorID = doctorProfile.doctorID; _patientSearchFormValues.DoctorID = doctorProfile.doctorID;
_patientSearchFormValues.ClinicID = doctorProfile.clinicID; _patientSearchFormValues.ClinicID = doctorProfile.clinicID;*/
if ((_patientSearchFormValues.From == "0" || if ((_patientSearchFormValues.From == "0" ||
_patientSearchFormValues.To == "0") && _patientSearchFormValues.To == "0") &&

@ -569,100 +569,102 @@ class _PatientsScreenState extends State<PatientsScreen> {
), ),
], ],
), ),
Column( Expanded(
crossAxisAlignment: child: Column(
CrossAxisAlignment.start, crossAxisAlignment:
// mainAxisAlignment: CrossAxisAlignment.start,
// MainAxisAlignment // mainAxisAlignment:
// .spaceBetween, // MainAxisAlignment
children: < // .spaceBetween,
Widget>[ children: <
SizedBox( Widget>[
height: SizedBox(
0.5, height:
), 0.5,
SizedBox( ),
height: SizedBox(
0, height:
), 0,
Wrap( ),
children: [ Wrap(
AppText( children: [
TranslationBase.of(context).age2, AppText(
fontSize: 1.8 * SizeConfig.textMultiplier, TranslationBase.of(context).age2,
fontWeight: FontWeight.bold, fontSize: 1.8 * SizeConfig.textMultiplier,
backGroundcolor: Colors.white, fontWeight: FontWeight.bold,
), backGroundcolor: Colors.white,
AppText( ),
item.age.toString(), AppText(
fontSize: 1.8 * SizeConfig.textMultiplier, item.age.toString(),
fontWeight: FontWeight.w300, fontSize: 1.8 * SizeConfig.textMultiplier,
backGroundcolor: Colors.white, fontWeight: FontWeight.w300,
), backGroundcolor: Colors.white,
], ),
), ],
SizedBox( ),
height: SizedBox(
2.5, height:
), 2.5,
Wrap( ),
children: [ Wrap(
AppText( children: [
TranslationBase.of(context).gender2, AppText(
fontSize: 1.8 * SizeConfig.textMultiplier, TranslationBase.of(context).gender2,
fontWeight: FontWeight.bold, fontSize: 1.8 * SizeConfig.textMultiplier,
backGroundcolor: Colors.white, fontWeight: FontWeight.bold,
), backGroundcolor: Colors.white,
AppText( ),
item.gender.toString() == '1' ? 'Male' : 'Female', AppText(
fontSize: 1.8 * SizeConfig.textMultiplier, item.gender.toString() == '1' ? 'Male' : 'Female',
fontWeight: FontWeight.w300, fontSize: 1.8 * SizeConfig.textMultiplier,
backGroundcolor: Colors.white, fontWeight: FontWeight.w300,
), backGroundcolor: Colors.white,
], ),
), ],
SizedBox( ),
height: SizedBox(
8, height:
), 8,
SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient" ),
? Row( SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient"
mainAxisAlignment: MainAxisAlignment.spaceBetween, ? Row(
children: <Widget>[ mainAxisAlignment: MainAxisAlignment.spaceBetween,
Container( children: <Widget>[
height: 15, Container(
width: 60, height: 15,
decoration: BoxDecoration( width: 60,
borderRadius: BorderRadius.circular(25), decoration: BoxDecoration(
color: HexColor("#20A169"), borderRadius: BorderRadius.circular(25),
color: HexColor("#20A169"),
),
child: AppText(
item.startTime,
color: Colors.white,
fontSize: 1.5 * SizeConfig.textMultiplier,
textAlign: TextAlign.center,
fontWeight: FontWeight.bold,
),
), ),
child: AppText( SizedBox(
item.startTime, width: 3.5,
color: Colors.white,
fontSize: 1.5 * SizeConfig.textMultiplier,
textAlign: TextAlign.center,
fontWeight: FontWeight.bold,
), ),
), Container(
SizedBox( child: AppText(
width: 3.5, convertDateFormat2(item.appointmentDate.toString()),
), fontSize: 1.5 * SizeConfig.textMultiplier,
Container( fontWeight: FontWeight.bold,
child: AppText( ),
convertDateFormat2(item.appointmentDate.toString()),
fontSize: 1.5 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
), ),
), SizedBox(
SizedBox( height: 25.5,
height: 25.5, ),
), ],
], )
) : SizedBox(
: SizedBox( height: 15,
height: 15, ),
), ],
], ),
), ),
], ],
), ),

@ -1,212 +1,372 @@
import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.dart'; import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_screen.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.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/app_buttons_widget.dart'; 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_text_form_field.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:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
void addPrescriptionForm(context) { void addPrescriptionForm(context, PrescriptionViewModel model) {
final GlobalKey<FormState> _formKey = GlobalKey<FormState>(); TextEditingController durationController = TextEditingController();
TextEditingController strengthController = TextEditingController();
TextEditingController routeController = TextEditingController();
TextEditingController frequencyController = TextEditingController();
TextEditingController indicationController = TextEditingController();
TextEditingController instructions = TextEditingController();
TextEditingController drugIdController = TextEditingController();
TextEditingController doseController = TextEditingController();
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
final double spaceBetweenTextFileds = 12; final double spaceBetweenTextFileds = 12;
showModalBottomSheet( showModalBottomSheet(
isScrollControlled: true, isScrollControlled: true,
context: context, context: context,
builder: (BuildContext bc) { builder: (BuildContext bc) {
return SingleChildScrollView( return DraggableScrollableSheet(
child: Container( initialChildSize: 0.90,
height: 700, maxChildSize: 0.90,
child: Padding( minChildSize: 0.9,
padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0), builder: (BuildContext context, ScrollController scrollController) {
child: Column( return SingleChildScrollView(
crossAxisAlignment: CrossAxisAlignment.start, child: Container(
//mainAxisAlignment: MainAxisAlignment.spaceEvenly, height: 980,
children: [ child: Padding(
AppText( padding:
TranslationBase.of(context).medicines.toUpperCase(), EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
fontWeight: FontWeight.w900, child: Column(
), crossAxisAlignment: CrossAxisAlignment.start,
SizedBox( //mainAxisAlignment: MainAxisAlignment.spaceEvenly,
height: spaceBetweenTextFileds, children: [
), AppText(
Container( TranslationBase.of(context).medicines.toUpperCase(),
child: Form( fontWeight: FontWeight.w900,
key: _formKey, ),
child: Column( SizedBox(
//mainAxisAlignment: MainAxisAlignment.end, height: spaceBetweenTextFileds,
children: [ ),
Container( Container(
decoration: BoxDecoration( child: Form(
borderRadius: key: formKey,
BorderRadius.all(Radius.circular(6.0)), child: Column(
border: Border.all( //mainAxisAlignment: MainAxisAlignment.end,
width: 1.0, color: HexColor("#CCCCCC"))), children: [
child: AppTextFormField( Container(
labelText: decoration: BoxDecoration(
TranslationBase.of(context).searchMedicine, borderRadius: BorderRadius.all(
borderColor: Colors.white, Radius.circular(6.0)),
textInputType: TextInputType.text, border: Border.all(
inputFormatter: ONLY_LETTERS, width: 1.0,
), color: HexColor("#CCCCCC"))),
), child: TextFields(
SizedBox( hintText: TranslationBase.of(context)
height: spaceBetweenTextFileds, .searchMedicine,
), controller: drugIdController,
Container( keyboardType: TextInputType.number,
decoration: BoxDecoration( validator: (value) {
borderRadius: if (value.isEmpty)
BorderRadius.all(Radius.circular(6.0)), return TranslationBase.of(context)
border: Border.all( .emptyMessage;
width: 1.0, color: HexColor("#CCCCCC"))), else
child: AppTextFormField( return null;
labelText: TranslationBase.of(context).orderType, }),
borderColor: Colors.white, ),
textInputType: TextInputType.number, SizedBox(
inputFormatter: ONLY_NUMBERS, height: spaceBetweenTextFileds,
), ),
), Container(
SizedBox(height: spaceBetweenTextFileds), decoration: BoxDecoration(
Container( borderRadius: BorderRadius.all(
decoration: BoxDecoration( Radius.circular(6.0)),
borderRadius: border: Border.all(
BorderRadius.all(Radius.circular(6.0)), width: 1.0,
border: Border.all( color: HexColor("#CCCCCC"))),
width: 1.0, color: HexColor("#CCCCCC"))), child: TextFields(
child: AppTextFormField( hintText:
labelText: TranslationBase.of(context).strength, TranslationBase.of(context).orderType,
borderColor: Colors.white, ),
textInputType: TextInputType.number, ),
inputFormatter: ONLY_NUMBERS, SizedBox(height: spaceBetweenTextFileds),
), Container(
), decoration: BoxDecoration(
SizedBox(height: spaceBetweenTextFileds), borderRadius: BorderRadius.all(
Container( Radius.circular(6.0)),
decoration: BoxDecoration( border: Border.all(
borderRadius: width: 1.0,
BorderRadius.all(Radius.circular(6.0)), color: HexColor("#CCCCCC"))),
border: Border.all( child: TextFields(
width: 1.0, color: HexColor("#CCCCCC"))), hintText:
child: AppTextFormField( TranslationBase.of(context).strength,
labelText: TranslationBase.of(context).route, keyboardType: TextInputType.number,
borderColor: Colors.white, controller: strengthController,
textInputType: TextInputType.number, validator: (value) {
inputFormatter: ONLY_NUMBERS, if (value.isEmpty)
), return TranslationBase.of(context)
), .emptyMessage;
SizedBox(height: spaceBetweenTextFileds), else
Container( return null;
decoration: BoxDecoration( },
borderRadius: ),
BorderRadius.all(Radius.circular(6.0)), ),
border: Border.all( SizedBox(height: spaceBetweenTextFileds),
width: 1.0, color: HexColor("#CCCCCC"))), Container(
child: AppTextFormField( decoration: BoxDecoration(
labelText: TranslationBase.of(context).frequency, borderRadius: BorderRadius.all(
borderColor: Colors.white, Radius.circular(6.0)),
textInputType: TextInputType.number, border: Border.all(
inputFormatter: ONLY_NUMBERS, width: 1.0,
), color: HexColor("#CCCCCC"))),
), child: TextFields(
SizedBox(height: spaceBetweenTextFileds), hintText: TranslationBase.of(context).route,
Container( controller: routeController,
decoration: BoxDecoration( keyboardType: TextInputType.number,
borderRadius: validator: (value) {
BorderRadius.all(Radius.circular(6.0)), if (value.isEmpty)
border: Border.all( return TranslationBase.of(context)
width: 1.0, color: HexColor("#CCCCCC"))), .emptyMessage;
child: AppTextFormField( else
labelText: TranslationBase.of(context).doseTime, return null;
borderColor: Colors.white, },
textInputType: TextInputType.number, ),
inputFormatter: ONLY_NUMBERS, ),
), SizedBox(height: spaceBetweenTextFileds),
), Container(
SizedBox(height: spaceBetweenTextFileds), decoration: BoxDecoration(
Container( borderRadius: BorderRadius.all(
decoration: BoxDecoration( Radius.circular(6.0)),
borderRadius: border: Border.all(
BorderRadius.all(Radius.circular(6.0)), width: 1.0,
border: Border.all( color: HexColor("#CCCCCC"))),
width: 1.0, color: HexColor("#CCCCCC"))), child: TextFields(
child: AppTextFormField( hintText:
labelText: TranslationBase.of(context).indication, TranslationBase.of(context).frequency,
borderColor: Colors.white, controller: frequencyController,
textInputType: TextInputType.number, keyboardType: TextInputType.number,
inputFormatter: ONLY_NUMBERS, validator: (value) {
), if (value.isEmpty)
), return TranslationBase.of(context)
SizedBox(height: spaceBetweenTextFileds), .emptyMessage;
Container( else
decoration: BoxDecoration( return null;
borderRadius: },
BorderRadius.all(Radius.circular(6.0)), ),
border: Border.all( ),
width: 1.0, color: HexColor("#CCCCCC"))), SizedBox(height: spaceBetweenTextFileds),
child: AppTextFormField( Container(
labelText: TranslationBase.of(context).fromDate, decoration: BoxDecoration(
borderColor: Colors.white, borderRadius: BorderRadius.all(
textInputType: TextInputType.number, Radius.circular(6.0)),
inputFormatter: ONLY_NUMBERS, border: Border.all(
), width: 1.0,
), color: HexColor("#CCCCCC"))),
SizedBox(height: spaceBetweenTextFileds), child: TextFields(
Container( hintText:
decoration: BoxDecoration( TranslationBase.of(context).doseTime,
borderRadius: controller: doseController,
BorderRadius.all(Radius.circular(6.0)), keyboardType: TextInputType.number,
border: Border.all( validator: (value) {
width: 1.0, color: HexColor("#CCCCCC"))), if (value.isEmpty)
child: AppTextFormField( return TranslationBase.of(context)
labelText: TranslationBase.of(context).duration, .emptyMessage;
borderColor: Colors.white, else
textInputType: TextInputType.number, return null;
inputFormatter: ONLY_NUMBERS, },
), ),
), ),
SizedBox(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius: BorderRadius.all(
BorderRadius.all(Radius.circular(6.0)), Radius.circular(6.0)),
border: Border.all( border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))), width: 1.0,
child: AppTextFormField( color: HexColor("#CCCCCC"))),
labelText: child: TextFields(
TranslationBase.of(context).instruction, hintText:
borderColor: Colors.white, TranslationBase.of(context).indication,
textInputType: TextInputType.number, controller: indicationController,
inputFormatter: ONLY_NUMBERS, keyboardType: TextInputType.number,
), validator: (value) {
), if (value.isEmpty)
SizedBox(height: spaceBetweenTextFileds), return TranslationBase.of(context)
Container( .emptyMessage;
margin: else
EdgeInsets.all(SizeConfig.widthMultiplier * 5), return null;
child: Wrap( },
alignment: WrapAlignment.center, ),
children: <Widget>[ ),
AppButton( SizedBox(height: spaceBetweenTextFileds),
title: Container(
TranslationBase.of(context).addMedication, decoration: BoxDecoration(
onPressed: () { borderRadius: BorderRadius.all(
Navigator.pop(context); Radius.circular(6.0)),
prescriptionWarning(context); border: Border.all(
}, width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
hintText:
TranslationBase.of(context).fromDate,
keyboardType: TextInputType.datetime,
validator: (value) {
if (value.isEmpty)
return TranslationBase.of(context)
.emptyMessage;
else
return null;
},
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
hintText:
TranslationBase.of(context).duration,
// borderColor: Colors.white,
keyboardType: TextInputType.number,
controller: durationController,
validator: (value) {
if (value.isEmpty)
return TranslationBase.of(context)
.emptyMessage;
else
return null;
}),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
hintText:
TranslationBase.of(context).instruction,
controller: indicationController,
keyboardType: TextInputType.number,
validator: (value) {
if (value.isEmpty)
return TranslationBase.of(context)
.emptyMessage;
else
return null;
},
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
margin: EdgeInsets.all(
SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: TranslationBase.of(context)
.addMedication,
onPressed: () {
formKey.currentState.save();
if (formKey.currentState.validate()) {
postPrescription(
model: model,
duration: durationController.text,
dose: doseController.text,
frequency:
frequencyController.text,
route: routeController.text,
drugId: drugIdController.text,
strength: strengthController.text,
indication:
indicationController.text,
instruction:
indicationController.text,
);
Navigator.pop(context);
}
{
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// NewPrescriptionScreen()),
// );
}
},
),
],
),
), ),
], ],
), ),
), ),
], ),
), ],
), ),
), ),
], ),
), );
), });
),
);
}); });
} }
postPrescription(
{String duration,
String dose,
String drugId,
String strength,
String route,
String frequency,
String indication,
String instruction,
PrescriptionViewModel model}) async {
PostPrescriptionReqModel postProcedureReqModel =
new PostPrescriptionReqModel();
List<PrescriptionRequestModel> sss = List();
postProcedureReqModel.appointmentNo = 2016055159;
postProcedureReqModel.clinicID = 17;
postProcedureReqModel.episodeID = 200012330;
postProcedureReqModel.patientMRN = 3120877;
postProcedureReqModel.vidaAuthTokenID =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiOGFjNDRjZGQtOWE0Mi00M2YxLWE2YTQtMWQ4NzBmZmYwNTUyIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTU2NDkiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA4NzM2NjY5LCJleHAiOjE2MDk2MDA2NjksImlhdCI6MTYwODczNjY2OX0.9EDgYrbe5fQA2CvgLdFT4s_PL7hD5R_Qggfpv4lDtUY";
sss.add(PrescriptionRequestModel(
covered: true,
dose: int.parse(dose),
itemId: int.parse(drugId),
doseUnitId: 1,
route: int.parse(route),
frequency: int.parse(frequency),
remarks: instruction,
approvalRequired: true,
icdcode10Id: "test2",
doseTime: 1,
duration: int.parse(duration),
doseStartDate: "2020-12-20T13:07:41.769Z"));
postProcedureReqModel.prescriptionRequestModel = sss;
//postProcedureReqModel.procedures = controlsProcedure;
await model.postPrescription(postProcedureReqModel);
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
} else if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast('Medication has been added');
}
}

@ -110,8 +110,8 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
addPrescriptionForm(context); addPrescriptionForm(context, model);
model.postPrescription(); //model.postPrescription();
}, },
child: CircleAvatar( child: CircleAvatar(
radius: 65, radius: 65,
@ -156,7 +156,7 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
], ],
) )
: Padding( : Padding(
padding: EdgeInsets.all(12.0), padding: EdgeInsets.all(14.0),
child: NetworkBaseView( child: NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: Column( child: Column(
@ -194,8 +194,8 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
), ),
), ),
onTap: () { onTap: () {
addPrescriptionForm(context); addPrescriptionForm(context, model);
model.postPrescription(); //model.postPrescription();
}, },
), ),
SizedBox( SizedBox(
@ -204,19 +204,22 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
...List.generate( ...List.generate(
model.prescriptionList[0].rowcount, model.prescriptionList[0].rowcount,
(index) => Container( (index) => Container(
//height: 240,
child: Column( child: Column(
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment MainAxisAlignment
.spaceBetween, .spaceBetween,
// crossAxisAlignment:
// CrossAxisAlignment.start,
children: [ children: [
Container( Container(
height: height:
MediaQuery.of(context) MediaQuery.of(context)
.size .size
.height * .height *
0.2, 0.23,
width: width:
MediaQuery.of(context) MediaQuery.of(context)
.size .size
@ -236,12 +239,12 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
MediaQuery.of(context) MediaQuery.of(context)
.size .size
.height * .height *
0.24, 0.282,
width: width:
MediaQuery.of(context) MediaQuery.of(context)
.size .size
.width * .width *
0.81, 0.77,
child: Column( child: Column(
children: [ children: [
Row( Row(
@ -250,17 +253,20 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
'Start Date:', 'Start Date:',
fontWeight: fontWeight:
FontWeight FontWeight
.w900, .w700,
fontSize: 15.0, fontSize: 14.0,
), ),
AppText( Expanded(
model child: AppText(
.prescriptionList[ model
0] .prescriptionList[
.entityList[ 0]
index] .entityList[
.startDate, index]
fontSize: 11.0, .startDate,
fontSize:
12.0,
),
), ),
SizedBox( SizedBox(
width: 6.0, width: 6.0,
@ -269,22 +275,25 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
'Order Type:', 'Order Type:',
fontWeight: fontWeight:
FontWeight FontWeight
.w900, .w700,
fontSize: 15.0, fontSize: 14.0,
), ),
AppText( Expanded(
model child: AppText(
.prescriptionList[ model
0] .prescriptionList[
.entityList[ 0]
index] .entityList[
.orderTypeDescription, index]
fontSize: 13.0, .orderTypeDescription,
fontSize:
13.0,
),
), ),
], ],
), ),
SizedBox( SizedBox(
height: 2.5, height: 5.5,
), ),
Row( Row(
children: [ children: [
@ -298,11 +307,19 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
.entityList[ .entityList[
index] index]
.medicationName, .medicationName,
fontWeight:
FontWeight
.w700,
fontSize:
15.0,
), ),
), ),
) )
], ],
), ),
SizedBox(
height: 5.5,
),
Row( Row(
children: [ children: [
Expanded( Expanded(
@ -314,7 +331,7 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
index] index]
.doseDetail, .doseDetail,
fontSize: fontSize:
13.0, 15.0,
), ),
) )
], ],
@ -328,7 +345,8 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
'Indication: ', 'Indication: ',
fontWeight: fontWeight:
FontWeight FontWeight
.w900, .w700,
fontSize: 17.0,
), ),
Expanded( Expanded(
child: AppText( child: AppText(
@ -339,40 +357,48 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
index] index]
.indication, .indication,
fontSize: fontSize:
12.9), 15.0),
) )
], ],
), ),
SizedBox( SizedBox(
height: 15.0, height: 18.0,
), ),
Row( Row(
children: [ children: [
AppText( Expanded(
model child: AppText(
.prescriptionList[ model
0] .prescriptionList[
.entityList[ 0]
index] .entityList[
.doctorName, index]
fontWeight: .doctorName,
FontWeight fontWeight:
.w900, FontWeight
.w700,
),
) )
], ],
), ),
Row( Row(
children: [ children: [
AppText(model Expanded(
.prescriptionList[ child: AppText(
0] model
.entityList[ .prescriptionList[
index] 0]
.remarks), .entityList[
index]
.remarks,
fontSize:
14.0,
),
),
], ],
), ),
SizedBox( SizedBox(
height: 15.0, height: 10.0,
), ),
Divider( Divider(
@ -386,6 +412,23 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
], ],
), ),
), ),
Container(
height:
MediaQuery.of(context)
.size
.height *
0.05,
width:
MediaQuery.of(context)
.size
.width *
0.06,
child: Column(
children: [
Icon(Icons.edit)
],
),
),
], ],
), ),
], ],

@ -0,0 +1,148 @@
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/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/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 EntityListCheckboxSearchWidget extends StatefulWidget {
final ProcedureViewModel model;
final Function addSelectedHistories;
final Function(EntityList) removeHistory;
final Function(EntityList) addHistory;
final bool Function(EntityList) isEntityListSelected;
final List<EntityList> masterList;
EntityListCheckboxSearchWidget(
{Key key,
this.model,
this.addSelectedHistories,
this.removeHistory,
this.masterList,
this.addHistory,
this.isEntityListSelected})
: super(key: key);
@override
_EntityListCheckboxSearchWidgetState createState() => _EntityListCheckboxSearchWidgetState();
}
class _EntityListCheckboxSearchWidgetState extends State<EntityListCheckboxSearchWidget> {
List<EntityList> items = List();
@override
void initState() {
items.addAll(widget.masterList);
super.initState();
}
@override
Widget build(BuildContext context) {
return Container(
child: Column(
children: [
NetworkBaseView(
baseViewModel: widget.model,
child: Container(
height: MediaQuery.of(context).size.height * 0.5,
child: Center(
child: Container(
margin: EdgeInsets.only(top: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: ListView(
children: [
TextFields(
hintText: 'Search ',
suffixIcon: EvaIcons.search,
onChanged: (value) {
filterSearchResults(value);
},
),
SizedBox(height: 15,),
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(),
),
],
),
)),
),
),
SizedBox(
height: 10,
),
if (widget.model.state == ViewState.Idle)
AppButton(//TODO change the button name
title: "Add ".toUpperCase(),
onPressed: () {
widget.addSelectedHistories();
},
),
],
),
);
}
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);
});
}
}
}

@ -2,21 +2,27 @@ import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; 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/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/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_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/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/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/patients/profile/patient_profile_widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/Text.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_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart';
import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_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:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
@ -111,7 +117,10 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
addSelectedProcedure(context); model.getCategories().then((value) {
addSelectedProcedure(context, model);
});
//model.postPrescription(); //model.postPrescription();
}, },
child: CircleAvatar( child: CircleAvatar(
@ -149,7 +158,7 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
AppText( AppText(
TranslationBase.of(context).addNow, TranslationBase.of(context).addNow,
color: Color(0XFFB8382C), color: Color(0XFFB8382C),
fontWeight: FontWeight.w900, fontWeight: FontWeight.w700,
), ),
], ],
), ),
@ -194,7 +203,12 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
), ),
), ),
onTap: () { onTap: () {
addSelectedProcedure(context); model.getCategories().then((value) {
addSelectedProcedure(
context, model);
});
//model.postPrescription();
}, },
), ),
// Container( // Container(
@ -241,121 +255,121 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
], ],
), ),
), ),
Container( Expanded(
height: 120, child: Container(
width: 325.0, height: 120,
child: Column( width: 325.0,
children: [ child: Column(
Row( children: [
children: [ Row(
AppText( children: [
'Code #: ', AppText(
fontWeight: 'Code #: ',
FontWeight fontWeight:
.w900, FontWeight
fontSize: 15.0, .w700,
), fontSize: 15.0,
AppText( ),
model AppText(
.procedureList[ model
0] .procedureList[
.entityList[ 0]
index] .entityList[
.procedureId index]
.toString(), .procedureId
fontSize: 13.0, .toString(),
), fontSize: 13.0,
SizedBox( ),
width: 12.0, SizedBox(
), width: 12.0,
AppText(
'Order Type: ',
fontWeight:
FontWeight
.w900,
fontSize: 15.0,
),
AppText(
'Urgent',
fontSize: 13.0,
color:
Colors.red,
),
],
),
Row(
children: [
Container(
child: Expanded(
child:
AppText(
model
.procedureList[
0]
.entityList[
index]
.procedureName,
fontWeight:
FontWeight
.w800,
),
), ),
) AppText(
], 'Order Type: ',
), fontWeight:
FontWeight
.w700,
fontSize: 15.0,
),
AppText(
'Urgent',
fontSize: 13.0,
color:
Colors.red,
),
],
),
Row(
children: [
Container(
child: Expanded(
child:
AppText(
model
.procedureList[
0]
.entityList[
index]
.procedureName,
fontWeight:
FontWeight
.w800,
),
),
)
],
),
Row( Row(
children: [ children: [
AppText( AppText(
'Price: ', 'Price: ',
fontWeight: fontWeight:
FontWeight FontWeight
.w900, .w700,
), ),
Expanded( Expanded(
child: AppText( child: AppText(
model model
.procedureList[ .procedureList[
0] 0]
.entityList[ .entityList[
index] index]
.price .price
.toString(), .toString(),
fontSize: fontSize:
13.0), 13.0),
) )
], ],
), ),
SizedBox( SizedBox(
height: 10.0, height: 10.0,
), ),
Row( Row(
children: [ children: [
AppText( AppText(
'Some short remark about the procedure', 'Some short remark about the procedure',
fontSize: 13.5, fontSize: 13.5,
), ),
], ],
), ),
SizedBox( SizedBox(
height: 10.0, height: 10.0,
), ),
Divider( Divider(
height: 5.0, height: 5.0,
thickness: 1.0, thickness: 1.0,
color: Colors.grey, color: Colors.grey,
) )
// SizedBox( // SizedBox(
// height: 40, // height: 40,
// ), // ),
], ],
),
), ),
), ),
Container( Container(
width: 30,
height: 120,
child: Column( child: Column(
children: [ children: [
Icon(Icons.edit) Icon(Icons.edit)
@ -382,7 +396,6 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
} }
postProcedure({ProcedureViewModel model}) async { postProcedure({ProcedureViewModel model}) async {
model = new ProcedureViewModel();
PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel();
List<Controls> controls = List(); List<Controls> controls = List();
List<Procedures> controlsProcedure = List(); List<Procedures> controlsProcedure = List();
@ -402,81 +415,200 @@ postProcedure({ProcedureViewModel model}) async {
postProcedureReqModel.procedures = controlsProcedure; postProcedureReqModel.procedures = controlsProcedure;
await model.postProcedure(postProcedureReqModel); await model.postProcedure(postProcedureReqModel);
DrAppToastMsg.showSuccesToast('Procedure had been added');
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error); helpers.showErrorToast(model.error);
} else if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast('procedure has been added');
} }
} }
void addSelectedProcedure(context) { void addSelectedProcedure(context, ProcedureViewModel model) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (BuildContext bc) {
return AddSelectedProcedure(
model: model,
);
});
}
class AddSelectedProcedure extends StatefulWidget {
final ProcedureViewModel model;
const AddSelectedProcedure({Key key, this.model}) : super(key: key);
@override
_AddSelectedProcedureState createState() => _AddSelectedProcedureState();
}
class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
TextEditingController procedureController = TextEditingController(); TextEditingController procedureController = TextEditingController();
List<EntityList> entityList= List();
@override
Widget build(BuildContext context) {
return NetworkBaseView(
baseViewModel: widget.model,
child: SingleChildScrollView(
child: Container(
//height: 490,
child: Padding(
padding: EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
'Select Procedure'.toUpperCase(),
fontWeight: FontWeight.w900,
),
if (widget.model.categoriesList.length != 0)
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),
),
SizedBox(
height: 0.0,
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: 'Add Delected Procedures'.toUpperCase(),
borderColor: Colors.white,
textInputType: TextInputType.text,
inputFormatter: ONLY_LETTERS,
controller: procedureController,
),
),
SizedBox(
height: 80.0,
),
Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: TranslationBase.of(context).addMedication,
onPressed: () {
Navigator.pop(context);
postProcedure(model: widget.model);
},
),
],
),
),
],
)
],
),
),
),
),
);
}
bool isEntityListSelected(EntityList masterKey) {
Iterable<EntityList> history =
entityList.where((element) => masterKey.procedureId == element.procedureId);
if (history.length > 0) {
return true;
}
return false;
}
}
void updateProcedureForm(context) {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true,
builder: (BuildContext bc) { builder: (BuildContext bc) {
return BaseView( return Container(
//onModelReady: (model) => model.getCategories(), height: 500,
builder: child: Form(
(BuildContext context, ProcedureViewModel model, Widget child) =>
SingleChildScrollView(
child: Container(
height: 490,
child: Padding( child: Padding(
padding: EdgeInsets.all(12.0), padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
'Select Procedure'.toUpperCase(), 'Procedure Name'.toUpperCase(),
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
), ),
// Text(model.categoriesList[0].categoryName),
SizedBox( SizedBox(
height: 9.0, height: 30.0,
), ),
Column( Container(
mainAxisAlignment: MainAxisAlignment.spaceBetween, decoration: BoxDecoration(
children: [ borderRadius: BorderRadius.all(Radius.circular(6.0)),
Container( border: Border.all(
decoration: BoxDecoration( width: 1.0, color: HexColor("#CCCCCC"))),
borderRadius: child: AppTextFormField(
BorderRadius.all(Radius.circular(6.0)), labelText: 'Order ',
border: Border.all( borderColor: Colors.white,
width: 1.0, color: HexColor("#CCCCCC"))), textInputType: TextInputType.number,
child: AppTextFormField( inputFormatter: ONLY_NUMBERS,
labelText: 'Add Delected Procedures'.toUpperCase(), ),
borderColor: Colors.white, ),
textInputType: TextInputType.text, SizedBox(
inputFormatter: ONLY_LETTERS, height: 12.0,
controller: procedureController, ),
), Container(
), decoration: BoxDecoration(
SizedBox( borderRadius: BorderRadius.all(Radius.circular(6.0)),
height: 280.0, border: Border.all(
), width: 1.0, color: HexColor("#CCCCCC"))),
Container( child: AppTextFormField(
margin: labelText: 'Password',
EdgeInsets.all(SizeConfig.widthMultiplier * 5), borderColor: Colors.white,
child: Wrap( textInputType: TextInputType.text,
alignment: WrapAlignment.center, inputFormatter: ONLY_LETTERS,
children: <Widget>[ obscureText: true,
AppButton( ),
title: ),
TranslationBase.of(context).addMedication, SizedBox(
onPressed: () { height: 190.0,
Navigator.pop(context); ),
postProcedure(); Container(
}, margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2),
), child: Wrap(
], alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: 'CONTINUE',
onPressed: () {
Navigator.pop(context);
// authorizationForm(context);
},
), ),
), ],
], ),
) ),
], ],
), ),
), ),
), ));
),
);
}); });
} }

@ -1,13 +1,16 @@
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart';
import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_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/util/helpers.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/Text.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/TextFields.dart';
@ -20,6 +23,7 @@ import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.
import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
class AssessmentPage extends StatefulWidget { class AssessmentPage extends StatefulWidget {
final Function changePageViewIndex; final Function changePageViewIndex;
@ -40,7 +44,7 @@ class _AssessmentPageState extends State<AssessmentPage> {
dynamic _referTo; dynamic _referTo;
TextEditingController remarksController = TextEditingController(); TextEditingController remarksController = TextEditingController();
Helpers helpers = Helpers();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
@ -378,15 +382,17 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
TextEditingController remarkController = TextEditingController(); TextEditingController remarkController = TextEditingController();
TextEditingController appointmentIdController = TextEditingController( TextEditingController appointmentIdController = TextEditingController(
text: "234567"); text: "234567");
GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<MasterKeyModel>>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
remarkController.text = widget.mySelectedAssessment.remark??""; remarkController.text = widget.mySelectedAssessment.remark??"";
final screenSize = MediaQuery final screenSize = MediaQuery
.of(context) .of(context)
.size; .size;
InputDecoration textFieldSelectorDecoration(String hintText, InputDecoration textFieldSelectorDecoration(String hintText,
String selectedText, bool isDropDown) { String selectedText, bool isDropDown,{IconData icon}) {
//TODO: make one Input InputDecoration for all //TODO: make one Input InputDecoration for all
return InputDecoration( return InputDecoration(
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
@ -402,7 +408,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
hintText: selectedText != null ? selectedText : hintText, hintText: selectedText != null ? selectedText : hintText,
suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, suffixIcon: isDropDown ? Icon(icon??Icons.arrow_drop_down) : null,
hintStyle: TextStyle( hintStyle: TextStyle(
fontSize: 14, fontSize: 14,
color: Colors.grey.shade600, color: Colors.grey.shade600,
@ -471,45 +477,30 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
Container( Container(
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
child: InkWell( child: InkWell(
onTap: model.listOfDiagnosisType != null onTap: model.listOfICD10 != null
? () { ? () {
MasterKeyDailog dialog = MasterKeyDailog( setState(() {
isICD: true, widget.mySelectedAssessment.selectedICD = null;
list: model.listOfDiagnosisType, });
selectedValue: widget
.mySelectedAssessment
.selectedICD,
okText: TranslationBase
.of(context)
.ok,
okFunction:
(MasterKeyModel selectedValue) {
setState(() {
widget.mySelectedAssessment
.selectedICD =
selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
} }
: null, : null,
child: TextField( child:widget.mySelectedAssessment.selectedICD == null ? AutoCompleteTextField<MasterKeyModel>(
decoration: textFieldSelectorDecoration("Name or ICD", widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.nameEn : null, true,icon: EvaIcons.search),
itemSubmitted: (item) => setState(() => widget.mySelectedAssessment.selectedICD = item),
key: key,
suggestions: model.listOfICD10,
itemBuilder: (context, suggestion) => new Padding(
child:Texts( suggestion.description +" / "+ suggestion.code.toString()),
padding: EdgeInsets.all(8.0)),
itemSorter: (a, b) => 1,
itemFilter: (suggestion, input) =>
suggestion.description.toLowerCase().startsWith(input.toLowerCase()) ||suggestion.description.toLowerCase().startsWith(input.toLowerCase())
||suggestion.code.toLowerCase().startsWith(input.toLowerCase())
,
): TextField(
decoration: textFieldSelectorDecoration( decoration: textFieldSelectorDecoration(
"Name / ICD", widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.code :"Name or ICD",
widget.mySelectedAssessment widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.nameEn : null, true,icon: EvaIcons.search),
.selectedICD !=
null
? widget.mySelectedAssessment
.selectedICD.nameEn
: null,
true),
enabled: false, enabled: false,
), ),
), ),

@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.
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/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/Text.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/TextFields.dart';
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
@ -467,98 +468,35 @@ class _AddExaminationDailogState extends State<AddExaminationDailog> {
SizedBox( SizedBox(
height: 16, height: 16,
), ),
NetworkBaseView( NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: Container( child: MasterKeyCheckboxSearchWidget(
height: model: model,
MediaQuery masterList: model.physicalExaminationList,
.of(context) removeHistory: (history){
.size setState(() {
.height * 0.5, widget.removeExamination(history);
child: Center( });
child: Container( },
margin: EdgeInsets.only(top: 15), addHistory: (history){
decoration: BoxDecoration( setState(() {
borderRadius: BorderRadius MySelectedExamination mySelectedExamination = new MySelectedExamination(
.circular(12), selectedExamination: history
color: Colors.white), );
child: ListView( widget
children: [ .mySelectedExamination
Column( .add(
children: model mySelectedExamination);
.physicalExaminationList });
.map((examinationInfo) { },
return Column( addSelectedHistories: (){
children: [
Row(
children: [
Checkbox(
value: isServiceSelected(
examinationInfo),
activeColor:
Colors.red[800],
onChanged:
(
bool newValue) {
setState(() {
if (isServiceSelected(
examinationInfo
)) {
widget
.removeExamination(
examinationInfo
);
}
else {
MySelectedExamination mySelectedExamination = new MySelectedExamination(
selectedExamination: examinationInfo
);
widget
.mySelectedExamination
.add(
mySelectedExamination);
}
});
}),
Expanded(
child: Padding(
padding:
const EdgeInsets
.symmetric(
horizontal: 10,
vertical: 0),
child: Texts(
examinationInfo
.nameEn,
variant: "bodyText",
bold: true,
color:
Colors.black),
),
),
],
),
DividerWithSpacesAround(),
],
);
}).toList(),
),
],
),
)),
),
),
SizedBox(
height: 10,
),
if (model.state == ViewState.Idle)
AppButton(
title: "Add SELECTED Examinations"
.toUpperCase(),
onPressed: () {
widget.addSelectedExamination(); widget.addSelectedExamination();
}, },
isServiceSelected: (master) =>isServiceSelected(master),
), ),
),
]), ]),
))), ))),
)), )),

@ -1,6 +1,8 @@
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
@ -14,6 +16,7 @@ import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart
import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
class AddAllergiesWidget extends StatefulWidget { class AddAllergiesWidget extends StatefulWidget {
final List<MySelectedAllergy> myAllergiesList; final List<MySelectedAllergy> myAllergiesList;
@ -43,11 +46,9 @@ class _AddAllergiesWidgetState extends State<AddAllergiesWidget> {
openAllergiesList(context); openAllergiesList(context);
}, },
readOnly: true, readOnly: true,
// hintColor: Colors.black,
suffixIcon: EvaIcons.plusCircleOutline, suffixIcon: EvaIcons.plusCircleOutline,
suffixIconColor: AppGlobal.appPrimaryColor, suffixIconColor: AppGlobal.appPrimaryColor,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
// controller: messageController,
validator: (value) { validator: (value) {
if (value == null) if (value == null)
return TranslationBase return TranslationBase
@ -147,7 +148,7 @@ class _AddAllergiesState extends State<AddAllergies> {
InputDecoration textFieldSelectorDecoration(String hintText, InputDecoration textFieldSelectorDecoration(String hintText,
String selectedText, bool isDropDown) { String selectedText, bool isDropDown,{IconData icon}) {
return InputDecoration( return InputDecoration(
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
@ -162,16 +163,19 @@ class _AddAllergiesState extends State<AddAllergies> {
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
hintText: selectedText != null ? selectedText : hintText, hintText: selectedText != null ? selectedText : hintText,
suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, suffixIcon: isDropDown ? Icon(icon?? Icons.arrow_drop_down) : null,
hintStyle: TextStyle( hintStyle: TextStyle(
fontSize: 14, fontSize: 14,
color: Colors.grey.shade600, color: Colors.grey.shade600,
), ),
); );
} }
bool _isShowSearch = false;
GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<MasterKeyModel>>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
final screenSize = MediaQuery final screenSize = MediaQuery
.of(context) .of(context)
.size; .size;
@ -214,33 +218,24 @@ class _AddAllergiesState extends State<AddAllergies> {
child: InkWell( child: InkWell(
onTap: model.allergiesList != null onTap: model.allergiesList != null
? () { ? () {
MasterKeyDailog dialog = MasterKeyDailog( setState(() {
list: model.allergiesList, _selectedAllergy = null;
okText: TranslationBase });
.of(context) }
.ok,
okFunction: (MasterKeyModel selectedValue) {
setState(() {
_selectedAllergy = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null, : null,
child: TextField( child: _selectedAllergy==null? AutoCompleteTextField<MasterKeyModel>(
decoration: textFieldSelectorDecoration( decoration: textFieldSelectorDecoration("Select Allergy", _selectedAllergy != null ? _selectedAllergy.nameEn : null, true,icon: EvaIcons.search),
"Select Allergy", itemSubmitted: (item) => setState(() => _selectedAllergy = item),
_selectedAllergy != null key: key,
? _selectedAllergy.nameEn suggestions: model.allergiesList,
: null, itemBuilder: (context, suggestion) => new Padding(
true), child:Texts( projectViewModel.isArabic? suggestion.nameAr: suggestion.nameEn),
padding: EdgeInsets.all(8.0)),
itemSorter: (a, b) => 1,
itemFilter: (suggestion, input) =>
suggestion.nameAr.toLowerCase().startsWith(input.toLowerCase()) ||suggestion.nameEn.toLowerCase().startsWith(input.toLowerCase()),
):TextField(
decoration: textFieldSelectorDecoration("Select Allergy", _selectedAllergy != null ? _selectedAllergy.nameEn : null, true,icon: EvaIcons.search),
enabled: false, enabled: false,
), ),
), ),

@ -16,6 +16,8 @@ import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import '../../../../shared/master_key_checkbox_search_widget.dart';
class AddHistoryWidget extends StatefulWidget { class AddHistoryWidget extends StatefulWidget {
final List<MasterKeyModel> myHistoryList; final List<MasterKeyModel> myHistoryList;
@ -280,273 +282,59 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
}, },
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: <Widget>[ children: <Widget>[
Container( MasterKeyCheckboxSearchWidget(
child: Column( model: model,
children: [ masterList: model.historyFamilyList,
NetworkBaseView( removeHistory: (history){
baseViewModel: model, setState(() {
child: Container( widget.removeHistory(history);
height: });
MediaQuery.of(context).size.height * 0.5, },
child: Center( addHistory: (history){
child: Container( setState(() {
margin: EdgeInsets.only(top: 15), widget.myHistoryList.add(history);
decoration: BoxDecoration( });
borderRadius: BorderRadius.circular(12), },
color: Colors.white), addSelectedHistories: (){
child: ListView( widget.addSelectedHistories();
children: [ },
Column( isServiceSelected: (master) =>isServiceSelected(master),
children: model.historyFamilyList
.map((historyInfo) {
return Column(
children: [
Row(
children: [
Checkbox(
value: isServiceSelected(
historyInfo),
activeColor:
Colors.red[800],
onChanged:
(bool newValue) {
setState(() {
if (isServiceSelected(
historyInfo
)) {
widget
.removeHistory(
historyInfo
);
}
else {
widget
.myHistoryList
.add(
historyInfo);
}
});
}),
Expanded(
child: Padding(
padding:
const EdgeInsets
.symmetric(
horizontal: 10,
vertical: 0),
child: Texts(
historyInfo.nameEn,
variant: "bodyText",
bold: true,
color:
Colors.black),
),
),
],
),
DividerWithSpacesAround(),
],
);
}).toList(),
),
],
),
)),
),
),
SizedBox(
height: 10,
),
if (model.state == ViewState.Idle)
AppButton(
title: "Add SELECTED HISTORIES"
.toUpperCase(),
onPressed: () {
widget.addSelectedHistories();
},
),
],
),
), ),
Container( MasterKeyCheckboxSearchWidget(
child: Column( model: model,
children: [ masterList: model.mergeHistorySurgicalWithHistorySportList,
NetworkBaseView( removeHistory: (history){
baseViewModel: model, setState(() {
child: Container( widget.removeHistory(history);
height: });
MediaQuery.of(context).size.height * 0.5, },
child: Center( addHistory: (history){
child: Container( setState(() {
margin: EdgeInsets.only(top: 15), widget.myHistoryList.add(history);
decoration: BoxDecoration( });
borderRadius: BorderRadius.circular(12), },
color: Colors.white), addSelectedHistories: (){
child: ListView( widget.addSelectedHistories();
children: [ },
Column( isServiceSelected: (master) =>isServiceSelected(master),
children: model.mergeHistorySurgicalWithHistorySportList
.map((historyInfo) {
return Column(
children: [
Row(
children: [
Checkbox(
value: isServiceSelected(
historyInfo),
activeColor:
Colors.red[800],
onChanged:
(
bool newValue) {
setState(() {
if (isServiceSelected(
historyInfo
)) {
widget
.removeHistory(
historyInfo
);
}
else {
widget
.myHistoryList
.add(
historyInfo);
}
});
}),
Expanded(
child: Padding(
padding:
const EdgeInsets
.symmetric(
horizontal: 10,
vertical: 0),
child: Texts(
historyInfo.nameEn,
variant: "bodyText",
bold: true,
color:
Colors.black),
),
),
],
),
DividerWithSpacesAround(),
],
);
}).toList(),
),
],
),
)),
),
),
SizedBox(
height: 10,
),
if (model.state == ViewState.Idle)
AppButton(
title: "Add SELECTED HISTORIES"
.toUpperCase(),
onPressed: () {
widget.addSelectedHistories();
},
),
],
),
), ),
Container( MasterKeyCheckboxSearchWidget(
child: Column( model: model,
children: [ masterList: model.historyMedicalList,
NetworkBaseView( removeHistory: (history){
baseViewModel: model, setState(() {
child: Container( widget.removeHistory(history);
height: });
MediaQuery.of(context).size.height * 0.5, },
child: Center( addHistory: (history){
child: Container( setState(() {
margin: EdgeInsets.only(top: 15), widget.myHistoryList.add(history);
decoration: BoxDecoration( });
borderRadius: BorderRadius.circular(12), },
color: Colors.white), addSelectedHistories: (){
child: ListView( widget.addSelectedHistories();
children: [ },
Column( isServiceSelected: (master) =>isServiceSelected(master),
children: model.historyMedicalList
.map((historyInfo) {
return Column(
children: [
Row(
children: [
Checkbox(
value: isServiceSelected(
historyInfo),
activeColor:
Colors.red[800],
onChanged:
(
bool newValue) {
setState(() {
if (isServiceSelected(
historyInfo
)) {
widget
.removeHistory(
historyInfo
);
}
else {
widget
.myHistoryList
.add(
historyInfo);
}
});
}),
Expanded(
child: Padding(
padding:
const EdgeInsets
.symmetric(
horizontal: 10,
vertical: 0),
child: Texts(
historyInfo.nameEn,
variant: "bodyText",
bold: true,
color:
Colors.black),
),
),
],
),
DividerWithSpacesAround(),
],
);
}).toList(),
),
],
),
)),
),
),
SizedBox(
height: 10,
),
if (model.state == ViewState.Idle)
AppButton(
title: "Add SELECTED HISTORIES"
.toUpperCase(),
onPressed: () {
setState(() {
widget.addSelectedHistories();
});
},
),
],
),
), ),
], ],
), ),
@ -559,12 +347,10 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
)); ));
} }
isServiceSelected(MasterKeyModel masterKey) { bool isServiceSelected(MasterKeyModel masterKey) {
Iterable<MasterKeyModel> history = Iterable<MasterKeyModel> history =
widget widget.myHistoryList.where((element) => masterKey.id == element.id && masterKey.typeId == element.typeId);
.myHistoryList
.where((element) =>
masterKey.id == element.id && masterKey.typeId == element.typeId);
if (history.length > 0) { if (history.length > 0) {
return true; return true;
} }

@ -108,15 +108,13 @@ class _SubjectivePageState extends State<SubjectivePage> {
minLines: 13, minLines: 13,
controller: complaintsController, controller: complaintsController,
validator: (value) { validator: (value) {
if (value == null || value =="") if (value == null || value == "")
return TranslationBase return TranslationBase.of(context)
.of(context)
.emptyMessage; .emptyMessage;
else if (value.length < 25) else if (value.length < 25)
return TranslationBase return TranslationBase.of(context)
.of(context)
.chiefComplaintLength; .chiefComplaintLength;
//""; //"";
else else
return null; return null;
}), }),
@ -228,15 +226,16 @@ class _SubjectivePageState extends State<SubjectivePage> {
: EvaIcons.plus)) : EvaIcons.plus))
], ],
), ),
bodyWidget:Column( bodyWidget: Column(
children: [ children: [
AddAllergiesWidget(myAllergiesList: widget.myAllergiesList,), AddAllergiesWidget(
myAllergiesList: widget.myAllergiesList,
),
SizedBox( SizedBox(
height: 30, height: 30,
), ),
], ],
) ),
,
isExpand: isAllergiesExpand, isExpand: isAllergiesExpand,
), ),
SizedBox( SizedBox(
@ -341,9 +340,11 @@ class _SubjectivePageState extends State<SubjectivePage> {
remarks: allergy.remark, remarks: allergy.remark,
createdBy: 4709, createdBy: 4709,
// //
createdOn: DateTime.now().toIso8601String(),//"2020-08-14T20:37:22.780Z", createdOn: DateTime.now()
.toIso8601String(), //"2020-08-14T20:37:22.780Z",
editedBy: 4709, editedBy: 4709,
editedOn: DateTime.now().toIso8601String(),//"2020-08-14T20:37:22.780Z", editedOn: DateTime.now()
.toIso8601String(), //"2020-08-14T20:37:22.780Z",
isChecked: false, isChecked: false,
isUpdatedByNurse: false)); isUpdatedByNurse: false));
}); });
@ -381,23 +382,21 @@ class _SubjectivePageState extends State<SubjectivePage> {
postChiefComplaint({SOAPViewModel model}) async { postChiefComplaint({SOAPViewModel model}) async {
formKey.currentState.save(); formKey.currentState.save();
if(formKey.currentState.validate()){ if (formKey.currentState.validate()) {
PostChiefComplaintRequestModel postChiefComplaintRequestModel = PostChiefComplaintRequestModel postChiefComplaintRequestModel =
//TODO: make static value dynamic //TODO: make static value dynamic
new PostChiefComplaintRequestModel( new PostChiefComplaintRequestModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo, episodeID: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo, appointmentNo: widget.patientInfo.appointmentNo,
chiefComplaint: complaintsController.text, chiefComplaint: complaintsController.text,
currentMedication: " currentMedication ", currentMedication: " currentMedication ",
hopi: illnessController.text, hopi: illnessController.text,
isLactation: false, isLactation: false,
ispregnant: false, ispregnant: false,
numberOfWeeks: 22); numberOfWeeks: 22);
await model.postChiefComplaint(postChiefComplaintRequestModel); await model.postChiefComplaint(postChiefComplaintRequestModel);
} }
} }
} }

@ -0,0 +1,151 @@
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.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/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 MasterKeyCheckboxSearchWidget extends StatefulWidget {
final SOAPViewModel model;
final Function addSelectedHistories;
final Function(MasterKeyModel) removeHistory;
final Function(MasterKeyModel) addHistory;
final bool Function(MasterKeyModel) isServiceSelected;
final List<MasterKeyModel> masterList;
final String buttonName;
final String hintSearchText;
MasterKeyCheckboxSearchWidget(
{Key key,
this.model,
this.addSelectedHistories,
this.removeHistory,
this.masterList,
this.addHistory,
this.isServiceSelected, this.buttonName, this.hintSearchText})
: super(key: key);
@override
_MasterKeyCheckboxSearchWidgetState createState() => _MasterKeyCheckboxSearchWidgetState();
}
class _MasterKeyCheckboxSearchWidgetState extends State<MasterKeyCheckboxSearchWidget> {
List<MasterKeyModel> items = List();
@override
void initState() {
items.addAll(widget.masterList);
super.initState();
}
@override
Widget build(BuildContext context) {
return Container(
child: Column(
children: [
NetworkBaseView(
baseViewModel: widget.model,
child: Container(
height: MediaQuery.of(context).size.height * 0.5,
child: Center(
child: Container(
margin: EdgeInsets.only(top: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: ListView(
children: [
TextFields(
hintText: widget.hintSearchText??'Search history',
suffixIcon: EvaIcons.search,
onChanged: (value) {
filterSearchResults(value);
},
),
SizedBox(height: 15,),
Column(
children: items.map((historyInfo) {
return Column(
children: [
Row(
children: [
Checkbox(
value:
widget.isServiceSelected(historyInfo),
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {
if (widget
.isServiceSelected(historyInfo)) {
widget.removeHistory(historyInfo);
} else {
widget.addHistory(historyInfo);
}
});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts(historyInfo.nameEn,
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
),
DividerWithSpacesAround(),
],
);
}).toList(),
),
],
),
)),
),
),
SizedBox(
height: 10,
),
if (widget.model.state == ViewState.Idle)
AppButton(
title: widget.buttonName?? "Add SELECTED HISTORIES".toUpperCase(),
onPressed: () {
widget.addSelectedHistories();
},
),
],
),
);
}
void filterSearchResults(String query) {
List<MasterKeyModel> dummySearchList = List();
dummySearchList.addAll(widget.masterList);
if (query.isNotEmpty) {
List<MasterKeyModel> dummyListData = List();
dummySearchList.forEach((item) {
if (item.nameAr.toLowerCase().contains(query.toLowerCase()) ||
item.nameEn.toLowerCase().contains(query.toLowerCase())) {
dummyListData.add(item);
}
});
setState(() {
items.clear();
items.addAll(dummyListData);
});
return;
} else {
setState(() {
items.clear();
items.addAll(widget.masterList);
});
}
}
}

@ -36,6 +36,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.0-nullsafety.1" version: "2.5.0-nullsafety.1"
autocomplete_textfield:
dependency: "direct main"
description:
name: autocomplete_textfield
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.3"
barcode_scan: barcode_scan:
dependency: "direct main" dependency: "direct main"
description: description:

@ -60,6 +60,9 @@ dependencies:
get_it: ^4.0.2 get_it: ^4.0.2
#Autocomplete TextField
autocomplete_textfield: ^1.7.3
#speech to text #speech to text

Loading…
Cancel
Save