diff --git a/assets/images/progress-loading-red.gif b/assets/images/progress-loading-red.gif new file mode 100644 index 00000000..517c3dab Binary files /dev/null and b/assets/images/progress-loading-red.gif differ diff --git a/lib/config/config.dart b/lib/config/config.dart index 1a25afa0..9fd3f14a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -71,6 +71,10 @@ const CREATE_REFERRAL_PATIENT = const RESPONSE_PENDING_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/CreateReferral'; +const GET_PATIENT_REFERRAL = 'Services/DoctorApplication.svc/REST/GetRefferal'; + +const POST_UCAF = 'Services/DoctorApplication.svc/REST/PostUCAF'; + const GET_DOCTOR_WORKING_HOURS_TABLE = 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable'; @@ -127,7 +131,8 @@ const GET_PRESCRIPTION_LIST = const POST_PRESCRIPTION_LIST = 'Services/DoctorApplication.svc/REST/PostPrescription'; -const GET_PROCEDURE_LIST = 'Services/DoctorApplication.svc/REST/GetProcedure'; +const GET_PROCEDURE_LIST = + 'Services/DoctorApplication.svc/REST/GetOrderedProcedure'; const POST_PROCEDURE_LIST = 'Services/DoctorApplication.svc/REST/PostProcedure'; const GET_PATIENT_ARRIVAL_LIST = @@ -172,6 +177,9 @@ const GET_ASSESSMENT = 'Services/DoctorApplication.svc/REST/GetAssessment'; const GET_ORDER_PROCEDURE = 'Services/DoctorApplication.svc/REST/GetOrderedProcedure'; +const GET_LIST_CATEGORISE = + 'Services/DoctorApplication.svc/REST/GetProcedureCategories'; + const GET_CATEGORISE_PROCEDURE = 'Services/DoctorApplication.svc/REST/GetProcedure'; const UPDATE_PROCEDURE = 'Services/DoctorApplication.svc/REST/PatchProcedure'; diff --git a/lib/core/model/procedure/get_ordered_procedure_model.dart b/lib/core/model/procedure/get_ordered_procedure_model.dart new file mode 100644 index 00000000..b7185711 --- /dev/null +++ b/lib/core/model/procedure/get_ordered_procedure_model.dart @@ -0,0 +1,138 @@ +class GetOrderedProcedureModel { + List entityList; + int rowcount; + dynamic statusMessage; + + GetOrderedProcedureModel( + {this.entityList, this.rowcount, this.statusMessage}); + + GetOrderedProcedureModel.fromJson(Map json) { + if (json['entityList'] != null) { + entityList = new List(); + json['entityList'].forEach((v) { + entityList.add(new EntityList.fromJson(v)); + }); + } + rowcount = json['rowcount']; + statusMessage = json['statusMessage']; + } + + Map toJson() { + final Map data = new Map(); + 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 { + String achiCode; + String appointmentDate; + int appointmentNo; + int categoryID; + String clinicDescription; + String cptCode; + int createdBy; + String createdOn; + String doctorName; + bool isApprovalCreated; + bool isApprovalRequired; + bool isCovered; + bool isInvoiced; + bool isReferralInvoiced; + bool isUncoveredByDoctor; + int lineItemNo; + String orderDate; + int orderNo; + int orderType; + String procedureId; + String procedureName; + String remarks; + String status; + String template; + + EntityList( + {this.achiCode, + this.appointmentDate, + this.appointmentNo, + this.categoryID, + this.clinicDescription, + this.cptCode, + this.createdBy, + this.createdOn, + this.doctorName, + this.isApprovalCreated, + this.isApprovalRequired, + this.isCovered, + this.isInvoiced, + this.isReferralInvoiced, + this.isUncoveredByDoctor, + this.lineItemNo, + this.orderDate, + this.orderNo, + this.orderType, + this.procedureId, + this.procedureName, + this.remarks, + this.status, + this.template}); + + EntityList.fromJson(Map json) { + achiCode = json['achiCode']; + appointmentDate = json['appointmentDate']; + appointmentNo = json['appointmentNo']; + categoryID = json['categoryID']; + clinicDescription = json['clinicDescription']; + cptCode = json['cptCode']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + doctorName = json['doctorName']; + isApprovalCreated = json['isApprovalCreated']; + isApprovalRequired = json['isApprovalRequired']; + isCovered = json['isCovered']; + isInvoiced = json['isInvoiced']; + isReferralInvoiced = json['isReferralInvoiced']; + isUncoveredByDoctor = json['isUncoveredByDoctor']; + lineItemNo = json['lineItemNo']; + orderDate = json['orderDate']; + orderNo = json['orderNo']; + orderType = json['orderType']; + procedureId = json['procedureId']; + procedureName = json['procedureName']; + remarks = json['remarks']; + status = json['status']; + template = json['template']; + } + + Map toJson() { + final Map data = new Map(); + data['achiCode'] = this.achiCode; + data['appointmentDate'] = this.appointmentDate; + data['appointmentNo'] = this.appointmentNo; + data['categoryID'] = this.categoryID; + data['clinicDescription'] = this.clinicDescription; + data['cptCode'] = this.cptCode; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['doctorName'] = this.doctorName; + data['isApprovalCreated'] = this.isApprovalCreated; + data['isApprovalRequired'] = this.isApprovalRequired; + data['isCovered'] = this.isCovered; + data['isInvoiced'] = this.isInvoiced; + data['isReferralInvoiced'] = this.isReferralInvoiced; + data['isUncoveredByDoctor'] = this.isUncoveredByDoctor; + data['lineItemNo'] = this.lineItemNo; + data['orderDate'] = this.orderDate; + data['orderNo'] = this.orderNo; + data['orderType'] = this.orderType; + data['procedureId'] = this.procedureId; + data['procedureName'] = this.procedureName; + data['remarks'] = this.remarks; + data['status'] = this.status; + data['template'] = this.template; + return data; + } +} diff --git a/lib/core/model/procedure/get_ordered_procedure_request_model.dart b/lib/core/model/procedure/get_ordered_procedure_request_model.dart new file mode 100644 index 00000000..dfbd444c --- /dev/null +++ b/lib/core/model/procedure/get_ordered_procedure_request_model.dart @@ -0,0 +1,18 @@ +class GetOrderedProcedureRequestModel { + String vidaAuthTokenID; + int patientMRN; + + GetOrderedProcedureRequestModel({this.vidaAuthTokenID, this.patientMRN}); + + GetOrderedProcedureRequestModel.fromJson(Map json) { + vidaAuthTokenID = json['VidaAuthTokenID']; + patientMRN = json['PatientMRN']; + } + + Map toJson() { + final Map data = new Map(); + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['PatientMRN'] = this.patientMRN; + return data; + } +} diff --git a/lib/core/model/procedure/procedure_category_list_model.dart b/lib/core/model/procedure/procedure_category_list_model.dart new file mode 100644 index 00000000..849e84e5 --- /dev/null +++ b/lib/core/model/procedure/procedure_category_list_model.dart @@ -0,0 +1,48 @@ +class ProcedureCategoryListModel { + List entityList; + int rowcount; + dynamic statusMessage; + + ProcedureCategoryListModel( + {this.entityList, this.rowcount, this.statusMessage}); + + ProcedureCategoryListModel.fromJson(Map json) { + if (json['entityList'] != null) { + entityList = new List(); + json['entityList'].forEach((v) { + entityList.add(new EntityList.fromJson(v)); + }); + } + rowcount = json['rowcount']; + statusMessage = json['statusMessage']; + } + + Map toJson() { + final Map data = new Map(); + 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 { + int categoryId; + String categoryName; + + EntityList({this.categoryId, this.categoryName}); + + EntityList.fromJson(Map json) { + categoryId = json['categoryId']; + categoryName = json['categoryName']; + } + + Map toJson() { + final Map data = new Map(); + data['categoryId'] = this.categoryId; + data['categoryName'] = this.categoryName; + return data; + } +} diff --git a/lib/core/service/patient-doctor-referral-service.dart b/lib/core/service/patient-doctor-referral-service.dart index 7eb8001b..2f18540a 100644 --- a/lib/core/service/patient-doctor-referral-service.dart +++ b/lib/core/service/patient-doctor-referral-service.dart @@ -18,6 +18,7 @@ class PatientReferralService extends LookupService { List doctorsList = []; List listMyReferredPatientModel = []; List pendingReferralList = []; + List patientReferralList = []; String setupID = "0"; Future getProjectsList() async { @@ -163,6 +164,33 @@ class PatientReferralService extends LookupService { ); } + Future getPatientReferral(PatiantInformtion patient) async { + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + + await baseAppClient.post( + GET_PATIENT_REFERRAL, + onSuccess: (dynamic response, int statusCode) { + patientReferralList.clear(); + + response['ReferralList']['entityList'].forEach((v) { + PendingReferral item = PendingReferral.fromJson(v); + item.isReferralDoctorSameBranch = + item.targetProjectId == item.sourceProjectId; + patientReferralList.add(item); + }); + }, + onFailure: (String error, int statusCode) { + patientReferralList.clear(); + hasError = true; + super.error = error; + }, + body: body, + ); + } + Future responseReferral(PendingReferral pendingReferral, bool isAccepted) async { hasError = false; DoctorProfileModel doctorProfile = await getDoctorProfile(); @@ -221,6 +249,7 @@ class PatientReferralService extends LookupService { CREATE_REFERRAL_PATIENT, onSuccess: (dynamic response, int statusCode) { print(response.toString()); + print("create referral status code = ${statusCode}"); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index 14ae072d..90b12041 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -18,14 +18,14 @@ class PrescriptionService extends BaseService { List specialityList = []; List drugToDrug = []; - PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel( - //patientMRN: 3120877, - - ); + PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel(); SearchDrugRequestModel _drugRequestModel = SearchDrugRequestModel( - search: ["Acetaminophen"], + //search: ["Acetaminophen"], // vidaAuthTokenID: // "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiY2QwOWU3MTEtZDEwYy00NjZhLWEwNDctMjc4MDBmNmRkMTYxIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYyMDMiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkhFQUQgTlVSU0VTIiwiRE9DVE9SUyIsIkhFQUQgRE9DVE9SUyIsIkFETUlOSVNUUkFUT1JTIiwiUkVDRVBUSU9OSVNUIiwiRVIgTlVSU0UiLCJJVkYgUkVDRVBUSU9OSVNUIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIklWRiBET0NUT1IiLCJJVkYgTlVSU0UiLCJJVkYgQ09PUkRJTkFUT1IiLCJJVkYgTEFCIFNUQUZGIiwiQ09OU0VOVCAiLCJNRURJQ0FMIFJFUE9SVCAtIFNJQ0sgTEVBVkUgTUFOQUdFUiJdLCJuYmYiOjE2MDkyNjQ2MTQsImV4cCI6MTYxMDEyODYxNCwiaWF0IjoxNjA5MjY0NjE0fQ.xCJ0jGtSFf36G8uZpdmHVoLfXDyP6e9mBpuOPSlzuio", + search: ["Amoxicillin"], + //vidaAuthTokenID: + // "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiY2QwOWU3MTEtZDEwYy00NjZhLWEwNDctMjc4MDBmNmRkMTYxIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYyMDMiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkhFQUQgTlVSU0VTIiwiRE9DVE9SUyIsIkhFQUQgRE9DVE9SUyIsIkFETUlOSVNUUkFUT1JTIiwiUkVDRVBUSU9OSVNUIiwiRVIgTlVSU0UiLCJJVkYgUkVDRVBUSU9OSVNUIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIklWRiBET0NUT1IiLCJJVkYgTlVSU0UiLCJJVkYgQ09PUkRJTkFUT1IiLCJJVkYgTEFCIFNUQUZGIiwiQ09OU0VOVCAiLCJNRURJQ0FMIFJFUE9SVCAtIFNJQ0sgTEVBVkUgTUFOQUdFUiJdLCJuYmYiOjE2MDkyNjQ2MTQsImV4cCI6MTYxMDEyODYxNCwiaWF0IjoxNjA5MjY0NjE0fQ.xCJ0jGtSFf36G8uZpdmHVoLfXDyP6e9mBpuOPSlzuio", ); PostPrescriptionReqModel _postPrescriptionReqModel = diff --git a/lib/core/service/procedure_service.dart b/lib/core/service/procedure_service.dart index 8122f0a7..5836beec 100644 --- a/lib/core/service/procedure_service.dart +++ b/lib/core/service/procedure_service.dart @@ -1,29 +1,37 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; + import 'package:flutter/foundation.dart'; class ProcedureService extends BaseService { - List _procedureList = List(); - List get procedureList => _procedureList; + List _procedureList = List(); + List get procedureList => _procedureList; List _categoriesList = List(); List get categoriesList => _categoriesList; List procedureslist = List(); + List categoryList = []; + + GetOrderedProcedureRequestModel _getOrderedProcedureRequestModel = + GetOrderedProcedureRequestModel(); GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( - clinicId: 17, - pageSize: 10, - pageIndex: 1, - patientMRN: 3120725, - //categoryId: null, - vidaAuthTokenID: - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI", + // clinicId: 17, + // pageSize: 10, + // pageIndex: 1, + // //patientMRN: 3120725, + // //categoryId: null, + // vidaAuthTokenID: + // "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI", + // + // search: ["lab"], + ); - search: ["lab"], - ); GetProcedureReqModel _getProcedureCategoriseReqModel = GetProcedureReqModel( clinicId: 0, pageSize: 100, @@ -33,22 +41,45 @@ class ProcedureService extends BaseService { vidaAuthTokenID: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI", - search: ["lab"], + //search: ["DENTAL"], ); - Future getProcedure() async { + Future getProcedure({int mrn}) async { + _getOrderedProcedureRequestModel = + GetOrderedProcedureRequestModel(patientMRN: mrn); hasError = false; _procedureList.clear(); await baseAppClient.post(GET_PROCEDURE_LIST, onSuccess: (dynamic response, int statusCode) { - _procedureList.add(GetProcedureModel.fromJson(response['ProcedureList'])); + _procedureList.add( + GetOrderedProcedureModel.fromJson(response['OrderedProcedureList'])); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _getOrderedProcedureRequestModel.toJson()); + } + + Future getCategory() async { + hasError = false; + + await baseAppClient.post(GET_LIST_CATEGORISE, + onSuccess: (dynamic response, int statusCode) { + categoryList = []; + categoryList = response['listProcedureCategories']['entityList']; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: _getProcedureReqModel.toJson()); + }, body: Map()); } - Future getCategories() async { + Future getProcedureCategory({String categoryName}) async { + _getProcedureCategoriseReqModel = GetProcedureReqModel( + search: [categoryName], + patientMRN: 0, + pageIndex: 1, + clinicId: 0, + pageSize: 100, + ); hasError = false; _categoriesList.clear(); await baseAppClient.post(GET_CATEGORISE_PROCEDURE, diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index 028eac0d..a1fc73fb 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -27,9 +27,27 @@ class PatientReferralViewModel extends BaseViewModel { List get pendingReferral => _referralPatientService.pendingReferralList; + List get patientReferral => + _referralPatientService.patientReferralList; + List get patientArrivalList => _referralPatientService.patientArrivalList; + Future getPatientReferral(PatiantInformtion patient) async { + setState(ViewState.Busy); + await _referralPatientService.getPatientReferral(patient); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else { + if(patientReferral.length == 0){ + await getMasterLookup(MasterKeysService.physiotherapyGoals); + } else { + setState(ViewState.Idle); + } + } + } + Future getMasterLookup(MasterKeysService masterKeys) async { setState(ViewState.Busy); await _referralPatientService.getMasterLookup(masterKeys); @@ -37,7 +55,7 @@ class PatientReferralViewModel extends BaseViewModel { error = _referralPatientService.error; setState(ViewState.Error); } else - await getBranches(); + await getBranches(); } Future getBranches() async { diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index da258e23..5e1d8d0c 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -1,5 +1,6 @@ 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/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/service/procedure_service.dart'; @@ -9,15 +10,17 @@ import 'package:doctor_app_flutter/locator.dart'; class ProcedureViewModel extends BaseViewModel { bool hasError = false; ProcedureService _procedureService = locator(); - List get procedureList => _procedureService.procedureList; + List get procedureList => + _procedureService.procedureList; List get categoriesList => _procedureService.categoriesList; + List get categoryList => _procedureService.categoryList; - Future getProcedure() async { + Future getProcedure({int mrn}) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _procedureService.getProcedure(); + await _procedureService.getProcedure(mrn: mrn); if (_procedureService.hasError) { error = _procedureService.error; setState(ViewState.ErrorLocal); @@ -25,11 +28,11 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getCategories() async { + Future getProcedureCategory({String categoryName}) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _procedureService.getCategories(); + await _procedureService.getProcedureCategory(categoryName: categoryName); if (_procedureService.hasError) { error = _procedureService.error; setState(ViewState.ErrorLocal); @@ -37,7 +40,20 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future postProcedure(PostProcedureReqModel postProcedureReqModel) async { + Future getCategory() async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _procedureService.getCategory(); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future postProcedure( + PostProcedureReqModel postProcedureReqModel, int mrn) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); @@ -46,12 +62,13 @@ class ProcedureViewModel extends BaseViewModel { error = _procedureService.error; setState(ViewState.ErrorLocal); } else { - await getProcedure(); + await getProcedure(mrn: mrn); setState(ViewState.Idle); } } - Future updateProcedure(PostProcedureReqModel postProcedureReqModel) async { + Future updateProcedure( + PostProcedureReqModel postProcedureReqModel, int mrn) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); @@ -61,5 +78,6 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); + await getProcedure(mrn: mrn); } } diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 62952108..2c5311cc 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; @@ -50,16 +51,21 @@ class _PatientMakeReferralScreenState extends State { patient = routeArgs['patient']; referToList = List(); - dynamic sameBranch = {"id": 1, "name": TranslationBase.of(context).sameBranch}; - dynamic otherBranch = {"id": 2, "name": TranslationBase.of(context).otherBranch}; + dynamic sameBranch = { + "id": 1, + "name": TranslationBase.of(context).sameBranch + }; + dynamic otherBranch = { + "id": 2, + "name": TranslationBase.of(context).otherBranch + }; referToList.add(sameBranch); referToList.add(otherBranch); final screenSize = MediaQuery.of(context).size; return BaseView( - onModelReady: (model) => - model.getMasterLookup(MasterKeysService.physiotherapyGoals), + onModelReady: (model) => model.getPatientReferral(patient), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).referPatient, @@ -86,279 +92,50 @@ class _PatientMakeReferralScreenState extends State { indent: 0, endIndent: 0, ), - Container( - margin: - EdgeInsets.symmetric(vertical: 16, horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).referPatient, - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: referToList != null - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: referToList, - attributeName: 'name', - attributeValueId: 'id', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _referTo = selectedValue; - _selectedBranch = null; - _selectedClinic = null; - _selectedDoctor = null; - model - .getDoctorBranch() - .then((value) { - _selectedBranch = value; - if (_referTo['id'] == 1) { - model.getClinics( - _selectedBranch['ID']); - } - }); - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).referTo, - _referTo != null ? _referTo['name'] : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.branchesList != null && - model.branchesList.length > 0 && - _referTo != null && - _referTo['id'] == 2 - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: model.branchesList, - attributeName: 'Desciption', - attributeValueId: 'ID', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedBranch = selectedValue; - _selectedClinic = null; - _selectedDoctor = null; - model.getClinics( - _selectedBranch['ID']); - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).branch, - _selectedBranch != null - ? _selectedBranch['Desciption'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: _selectedBranch != null && - model.clinicsList != null && - model.clinicsList.length > 0 - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: model.clinicsList, - attributeName: 'ClinicDescription', - attributeValueId: 'ClinicID', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedDoctor = null; - _selectedClinic = selectedValue; - model.getClinicDoctors( - _selectedClinic['ClinicID'] - .toString()); - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).clinic, - _selectedClinic != null - ? _selectedClinic['ClinicDescription'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: _selectedClinic != null && - model.doctorsList != null && - model.doctorsList.length > 0 - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: model.doctorsList, - attributeName: 'DoctorName', - attributeValueId: 'DoctorID', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedDoctor = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).doctor, - _selectedDoctor != null - ? _selectedDoctor['DoctorName'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: () => _selectDate(context, model), - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context) - .chooseAppointment, - appointmentDate != null - ? "${DateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}" - : null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Colors.black, - )), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).remarks, - null, - false), - enabled: true, - controller: _remarksController, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_LETTERS)) - ], - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - ], - ), + model.patientReferral.length == 0 + ? ReferralForm(model, screenSize) + : PatientReferralItemWidget( + patientName: model.patientReferral[0].patientName, + referralStatus: "${model.patientReferral[0].referralStatus}", + isReferredTo: true, + isSameBranch: model.patientReferral[0] + .isReferralDoctorSameBranch, + referralDoctorName: + model.patientReferral[0].referredByDoctorInfo, + clinicDescription: null, + remark: + model.patientReferral[0].remarksFromSource ), ], ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).refer, - color: HexColor("#B8382B"), - onPressed: () { - if (appointmentDate == null || - _selectedBranch == null || - _selectedClinic == null || - _selectedDoctor == null || - _remarksController.text == null) return; - model - .makeReferral( - patient, - appointmentDate.toIso8601String(), - _selectedBranch['ID'], - _selectedClinic['ClinicID'], - _selectedDoctor['DoctorID'], - _remarksController.text) - .then((_) { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context).referralSuccessMsg); - Navigator.pop(context); - }); - }, - ), - ) + if (model.patientReferral.length == 0) + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).refer, + color: HexColor("#B8382B"), + onPressed: () { + if (appointmentDate == null || + _selectedBranch == null || + _selectedClinic == null || + _selectedDoctor == null || + _remarksController.text == null) return; + model + .makeReferral( + patient, + appointmentDate.toIso8601String(), + _selectedBranch['ID'], + _selectedClinic['ClinicID'], + _selectedDoctor['DoctorID'], + _remarksController.text) + .then((_) { + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context).referralSuccessMsg); + Navigator.pop(context); + }); + }, + ), + ) ], ), ), @@ -367,6 +144,239 @@ class _PatientMakeReferralScreenState extends State { ); } + Widget ReferralForm(PatientReferralViewModel model, Size screenSize) { + return Container( + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).referPatient, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: referToList != null + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: referToList, + attributeName: 'name', + attributeValueId: 'id', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _referTo = selectedValue; + _selectedBranch = null; + _selectedClinic = null; + _selectedDoctor = null; + model.getDoctorBranch().then((value) { + _selectedBranch = value; + if (_referTo['id'] == 1) { + model.getClinics(_selectedBranch['ID']); + } + }); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).referTo, + _referTo != null ? _referTo['name'] : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.branchesList != null && + model.branchesList.length > 0 && + _referTo != null && + _referTo['id'] == 2 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.branchesList, + attributeName: 'Desciption', + attributeValueId: 'ID', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedBranch = selectedValue; + _selectedClinic = null; + _selectedDoctor = null; + model.getClinics(_selectedBranch['ID']); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).branch, + _selectedBranch != null + ? _selectedBranch['Desciption'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: _selectedBranch != null && + model.clinicsList != null && + model.clinicsList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.clinicsList, + attributeName: 'ClinicDescription', + attributeValueId: 'ClinicID', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = null; + _selectedClinic = selectedValue; + model.getClinicDoctors( + _selectedClinic['ClinicID'].toString()); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).clinic, + _selectedClinic != null + ? _selectedClinic['ClinicDescription'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: _selectedClinic != null && + model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.doctorsList, + attributeName: 'DoctorName', + attributeValueId: 'DoctorID', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).doctor, + _selectedDoctor != null + ? _selectedDoctor['DoctorName'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () => _selectDate(context, model), + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).chooseAppointment, + appointmentDate != null + ? "${DateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).remarks, null, false), + enabled: true, + controller: _remarksController, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(ONLY_LETTERS)) + ], + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + ], + ), + ); + } + _selectDate(BuildContext context, PatientReferralViewModel model) async { // https://medium.com/flutter-community/a-deep-dive-into-datepicker-in-flutter-37e84f7d8d6c good reference // https://stackoverflow.com/a/63147062/6246772 to customize a date picker diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index afd4136d..8714327d 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -301,7 +301,7 @@ class _PrescriptionFormWidgetState extends State { ListSelectDialog dialog = ListSelectDialog( list: model.drugsList, - attributeName: 'GenericName', + attributeName: 'Description', attributeValueId: 'ItemId', okText: TranslationBase.of(context) diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index a6b9791b..60a04480 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -19,6 +19,7 @@ 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_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/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'; @@ -40,7 +41,7 @@ class _ProcedureScreenState extends State { final routeArgs = ModalRoute.of(context).settings.arguments as Map; patient = routeArgs['patient']; return BaseView( - onModelReady: (model) => model.getProcedure(), + onModelReady: (model) => model.getProcedure(mrn: patient.patientMRN), builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( isShowAppBar: true, @@ -122,8 +123,11 @@ class _ProcedureScreenState extends State { children: [ InkWell( onTap: () { - model.getCategories().then((value) { - addSelectedProcedure(context, model); + model + .getProcedureCategory() + .then((value) { + addSelectedProcedure( + context, model, patient); }); //model.postPrescription(); @@ -208,9 +212,11 @@ class _ProcedureScreenState extends State { ), ), onTap: () { - model.getCategories().then((value) { + model + .getProcedureCategory() + .then((value) { addSelectedProcedure( - context, model); + context, model, patient); }); //model.postPrescription(); @@ -299,7 +305,11 @@ class _ProcedureScreenState extends State { 15.0, ), AppText( - 'Urgent', + model.procedureList[0].entityList[index] + .orderType == + 1 + ? 'Regular' + : 'Urgent', fontSize: 13.0, color: Colors @@ -337,18 +347,18 @@ class _ProcedureScreenState extends State { FontWeight .w700, ), - Expanded( - child: AppText( - model - .procedureList[ - 0] - .entityList[ - index] - .price - .toString(), - fontSize: - 13.0), - ) + // Expanded( + // child: AppText( + // model + // .procedureList[ + // 0] + // .entityList[ + // index] + // .price + // .toString(), + // fontSize: + // 13.0), + // ) ], ), SizedBox( @@ -357,10 +367,19 @@ class _ProcedureScreenState extends State { Row( children: [ - AppText( - 'Some short remark about the procedure', - fontSize: - 13.5, + Expanded( + child: + AppText( + model + .procedureList[ + 0] + .entityList[ + index] + .remarks + .toString(), + fontSize: + 13.5, + ), ), ], ), @@ -395,7 +414,22 @@ class _ProcedureScreenState extends State { 0] .entityList[ index] - .procedureName); + .procedureName, + patient: + patient, + procedureId: model + .procedureList[ + 0] + .entityList[ + index] + .procedureId, + categoreId: model + .procedureList[ + 0] + .entityList[ + index] + .categoryID + .toString()); }, ) ], @@ -420,26 +454,36 @@ class _ProcedureScreenState extends State { } } -postProcedure({ProcedureViewModel model, String remarks}) async { +postProcedure( + {ProcedureViewModel model, + String remarks, + PatiantInformtion patient, + List entityList}) async { PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); List controls = List(); List controlsProcedure = List(); - postProcedureReqModel.appointmentNo = 2016054575; + postProcedureReqModel.appointmentNo = patient.appointmentNo; - postProcedureReqModel.episodeID = 200012166; - postProcedureReqModel.patientMRN = 3120725; + postProcedureReqModel.episodeID = patient.episodeNo; + postProcedureReqModel.patientMRN = patient.patientMRN; postProcedureReqModel.vidaAuthTokenID = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI'; controls.add( - Controls(code: remarks.isEmpty ? '' : remarks, controlValue: 'sssssssss'), + Controls( + code: remarks.isEmpty ? 'ssss' : remarks, controlValue: 'sssssssss'), ); - controlsProcedure.add( - Procedures(category: "02", procedure: "02011009", controls: controls)); + + entityList.forEach((element) { + controlsProcedure.add(Procedures( + category: element.categoryID, + procedure: element.procedureId, + controls: controls)); + }); postProcedureReqModel.procedures = controlsProcedure; - await model.postProcedure(postProcedureReqModel); + await model.postProcedure(postProcedureReqModel, patient.patientMRN); if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); @@ -449,15 +493,19 @@ postProcedure({ProcedureViewModel model, String remarks}) async { } updateProcedure( - {ProcedureViewModel model, String remarks, String procedureId}) async { + {ProcedureViewModel model, + String remarks, + String procedureId, + PatiantInformtion patient, + String categorieId}) async { PostProcedureReqModel updateProcedureReqModel = new PostProcedureReqModel(); List controls = List(); List controlsProcedure = List(); - updateProcedureReqModel.appointmentNo = 2016054575; + updateProcedureReqModel.appointmentNo = patient.appointmentNo; - updateProcedureReqModel.episodeID = 200012166; - updateProcedureReqModel.patientMRN = 3120725; + updateProcedureReqModel.episodeID = patient.episodeNo; + updateProcedureReqModel.patientMRN = patient.patientMRN; updateProcedureReqModel.vidaAuthTokenID = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI'; @@ -467,11 +515,11 @@ updateProcedure( controlValue: 'Testing', ), ); - controlsProcedure.add( - Procedures(category: "02", procedure: "02011002", controls: controls)); + controlsProcedure.add(Procedures( + category: categorieId, procedure: procedureId, controls: controls)); updateProcedureReqModel.procedures = controlsProcedure; - await model.updateProcedure(updateProcedureReqModel); + await model.updateProcedure(updateProcedureReqModel, patient.patientMRN); if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); @@ -480,114 +528,176 @@ updateProcedure( } } -void addSelectedProcedure(context, ProcedureViewModel model) { +void addSelectedProcedure( + context, ProcedureViewModel model, PatiantInformtion patient) { showModalBottomSheet( context: context, isScrollControlled: true, builder: (BuildContext bc) { return AddSelectedProcedure( model: model, + patient: patient, ); }); } class AddSelectedProcedure extends StatefulWidget { final ProcedureViewModel model; + final PatiantInformtion patient; - const AddSelectedProcedure({Key key, this.model}) : super(key: key); + const AddSelectedProcedure({Key key, this.model, this.patient}) + : super(key: key); @override - _AddSelectedProcedureState createState() => _AddSelectedProcedureState(); + _AddSelectedProcedureState createState() => + _AddSelectedProcedureState(patient: patient, model: model); } class _AddSelectedProcedureState extends State { + ProcedureViewModel model; + PatiantInformtion patient; + _AddSelectedProcedureState({this.patient, this.model}); TextEditingController procedureController = TextEditingController(); TextEditingController remarksController = TextEditingController(); List entityList = List(); + dynamic selectedCategory; @override Widget build(BuildContext context) { - return NetworkBaseView( - baseViewModel: widget.model, - child: SingleChildScrollView( - child: Container( - height: 810, - 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), + final screenSize = MediaQuery.of(context).size; + return BaseView( + onModelReady: (model) => model.getCategory(), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Container( + height: 810, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'Select Procedure'.toUpperCase(), + fontWeight: FontWeight.w900, ), - SizedBox( - height: 15.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: TextFields( - hintText: 'Order Type'.toUpperCase(), - controller: procedureController, + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.categoryList != null && + model.categoryList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.categoryList, + attributeName: 'categoryName', + attributeValueId: 'categoryId', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + selectedCategory = selectedValue; + model.getProcedureCategory( + categoryName: + selectedCategory['categoryName']); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + //model.getProcedureCategory(); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + 'Procedure Categorey', + selectedCategory != null + ? selectedCategory['categoryName'] + : null, + true, + suffixIcon: Icon( + Icons.search, + color: Colors.black, + )), + enabled: false, ), ), - SizedBox( - height: 15.0, - ), - TextFields( - hintText: 'Remarks', - controller: remarksController, - minLines: 3, - maxLines: 5, - ), - SizedBox( - height: 50.0, + ), + 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), ), - Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: 'add Selected Procedures'.toUpperCase(), - onPressed: () { - Navigator.pop(context); - postProcedure( - model: widget.model, - remarks: remarksController.text); - }, - ), - ], + SizedBox( + height: 15.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: TextFields( + hintText: 'Order Type'.toUpperCase(), + controller: procedureController, + ), ), - ), - ], - ) - ], + SizedBox( + height: 15.0, + ), + TextFields( + hintText: 'Remarks', + controller: remarksController, + minLines: 3, + maxLines: 5, + ), + SizedBox( + height: 50.0, + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: 'add Selected Procedures'.toUpperCase(), + onPressed: () { + Navigator.pop(context); + postProcedure( + entityList: entityList, + patient: patient, + model: widget.model, + remarks: remarksController.text); + }, + ), + ], + ), + ), + ], + ) + ], + ), ), ), ), @@ -603,10 +713,46 @@ class _AddSelectedProcedureState extends State { } return false; } + + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.arrow_drop_down, + color: Colors.black, + ) + : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } } -void updateProcedureForm(context, {String procedureName}) { - ProcedureViewModel procedureViewModel = ProcedureViewModel(); +void updateProcedureForm(context, + {String procedureName, + PatiantInformtion patient, + String procedureId, + String categoreId}) { + ProcedureViewModel model = ProcedureViewModel(); TextEditingController remarksController = TextEditingController(); TextEditingController orderController = TextEditingController(); showModalBottomSheet( @@ -666,7 +812,10 @@ void updateProcedureForm(context, {String procedureName}) { onPressed: () { Navigator.pop(context); updateProcedure( - model: procedureViewModel, + categorieId: categoreId, + procedureId: procedureId, + patient: patient, + model: model, remarks: remarksController.text); // authorizationForm(context); }, diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index 662e7fee..17f33793 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -37,7 +37,7 @@ class PatientReferralItemWidget extends StatelessWidget { children: [ Center( child: AppText( - patientName, + "${patientName}", color: Colors.black, fontWeight: FontWeight.bold, fontSize: 16, @@ -48,9 +48,10 @@ class PatientReferralItemWidget extends StatelessWidget { color: Color(0xFF4BA821), padding: EdgeInsets.all(4), child: AppText( - referralStatus == "46" + referralStatus + /*referralStatus == "46" ? TranslationBase.of(context).approved - : TranslationBase.of(context).rejected, + : TranslationBase.of(context).rejected*/, color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12, diff --git a/lib/widgets/shared/app_loader_widget.dart b/lib/widgets/shared/app_loader_widget.dart index 65a5f231..7b1f1718 100644 --- a/lib/widgets/shared/app_loader_widget.dart +++ b/lib/widgets/shared/app_loader_widget.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:progress_hud_v2/progress_hud.dart'; +import 'loader/gif_loader_container.dart'; + /* *@author: Elham Rababah *@Date:19/4/2020 @@ -41,6 +43,18 @@ class _AppLoaderWidgetState extends State { @override Widget build(BuildContext context) { - return Positioned(child: _progressHUD); + return Container( + height: MediaQuery.of(context).size.height, + + child: Stack( + children: [ + Container( + color: Colors.grey.withOpacity(0.6), + ), + Container(child: GifLoaderContainer(), margin: EdgeInsets.only( + bottom: MediaQuery.of(context).size.height * 0.09)) + ], + ), + ); } } diff --git a/lib/widgets/shared/loader/gif_loader_container.dart b/lib/widgets/shared/loader/gif_loader_container.dart new file mode 100644 index 00000000..b7a20339 --- /dev/null +++ b/lib/widgets/shared/loader/gif_loader_container.dart @@ -0,0 +1,43 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter_gifimage/flutter_gifimage.dart'; + +class GifLoaderContainer extends StatefulWidget { + @override + _GifLoaderContainerState createState() => _GifLoaderContainerState(); +} + +class _GifLoaderContainerState extends State + with TickerProviderStateMixin { + GifController controller1; + + @override + void initState() { + controller1 = GifController(vsync: this); + + WidgetsBinding.instance.addPostFrameCallback((_) { + controller1.repeat( + min: 0, max: 11, period: Duration(milliseconds: 750), reverse: true); + }); + super.initState(); + } + + @override + void dispose() { + controller1.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Center( + //progress-loading.gif + child: Container( + // margin: EdgeInsets.only(bottom: 40), + child: GifImage( + controller: controller1, + image: AssetImage( + "assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"), + ), + )); + } +} \ No newline at end of file diff --git a/lib/widgets/shared/loader/gif_loader_dialog_utils.dart b/lib/widgets/shared/loader/gif_loader_dialog_utils.dart new file mode 100644 index 00000000..9b45bba1 --- /dev/null +++ b/lib/widgets/shared/loader/gif_loader_dialog_utils.dart @@ -0,0 +1,14 @@ +import 'package:flutter/material.dart'; + +import 'gif_loader_container.dart'; + + +class GifLoaderDialogUtils { + static showMyDialog(BuildContext context) { + showDialog(context: context, child: GifLoaderContainer()); + } + + static hideDialog(BuildContext context) { + Navigator.of(context).pop(); + } +} diff --git a/pubspec.lock b/pubspec.lock index 4d8e049b..7f3738b5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -370,6 +370,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.4" + flutter_gifimage: + dependency: "direct main" + description: + name: flutter_gifimage + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" flutter_localizations: dependency: "direct main" description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index e0e4ce33..35afa76a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -61,6 +61,8 @@ dependencies: #firebase firebase_messaging: ^7.0.0 + #GIF image + flutter_gifimage: ^1.0.1 #Autocomplete TextField autocomplete_textfield: ^1.7.3