Merge branch 'medical_report_changes' into 'development'

Medical report changes

See merge request Cloud_Solution/doctor_app_flutter!770
merge-requests/771/merge
Mohammad Aljammal 3 years ago
commit d63fa42178

@ -231,6 +231,7 @@ const GET_SPECIAL_CLINICAL_CARE_MAPPING_LIST = "Services/DoctorApplication.svc/R
const INSERT_MEDICAL_REPORT = "Services/Patients.svc/REST/DAPP_InsertMedicalReport_New"; const INSERT_MEDICAL_REPORT = "Services/Patients.svc/REST/DAPP_InsertMedicalReport_New";
const UPDATE_MEDICAL_REPORT = "Services/Patients.svc/REST/DAPP_UpdateMedicalReport"; const UPDATE_MEDICAL_REPORT = "Services/Patients.svc/REST/DAPP_UpdateMedicalReport";
const GET_SICK_LEAVE_DOCTOR_APP = "Services/DoctorApplication.svc/REST/GetAllSickLeaves";
var selectedPatientType = 1; var selectedPatientType = 1;

@ -0,0 +1,28 @@
class GetSickLeaveDoctorRequestModel {
int patientMRN;
String appointmentNo;
int status;
String vidaAuthTokenID;
String vidaRefreshTokenID;
GetSickLeaveDoctorRequestModel(
{this.patientMRN, this.appointmentNo, this.status, this.vidaAuthTokenID, this.vidaRefreshTokenID});
GetSickLeaveDoctorRequestModel.fromJson(Map<String, dynamic> json) {
patientMRN = json['PatientMRN'];
appointmentNo = json['AppointmentNo'];
status = json['status'];
vidaAuthTokenID = json['VidaAuthTokenID'];
vidaRefreshTokenID = json['VidaRefreshTokenID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['PatientMRN'] = this.patientMRN;
data['AppointmentNo'] = this.appointmentNo;
data['status'] = this.status;
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['VidaRefreshTokenID'] = this.vidaRefreshTokenID;
return data;
}
}

@ -36,6 +36,11 @@ class SickLeavePatientModel {
String strRequestDate; String strRequestDate;
String startDate; String startDate;
String endDate; String endDate;
dynamic isExtendedLeave;
dynamic noOfDays;
dynamic patientMRN;
dynamic remarks;
dynamic status;
SickLeavePatientModel( SickLeavePatientModel(
{this.setupID, {this.setupID,
@ -72,10 +77,19 @@ class SickLeavePatientModel {
// this.speciality, // this.speciality,
this.strRequestDate, this.strRequestDate,
this.startDate, this.startDate,
this.endDate}); this.endDate,
this.isExtendedLeave,
this.noOfDays,
this.patientMRN,
this.remarks,
this.status});
SickLeavePatientModel.fromJson(Map<String, dynamic> json) { SickLeavePatientModel.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID']; setupID = json['SetupID'];
isExtendedLeave = json['isExtendedLeave'];
noOfDays = json['noOfDays'];
patientMRN = json['patientMRN'];
status = json['status'];
projectID = json['ProjectID']; projectID = json['ProjectID'];
patientID = json['PatientID']; patientID = json['PatientID'];
@ -109,13 +123,17 @@ class SickLeavePatientModel {
qR = json['QR']; qR = json['QR'];
// speciality = json['Speciality'].cast<String>(); // speciality = json['Speciality'].cast<String>();
strRequestDate = json['StrRequestDate']; strRequestDate = json['StrRequestDate'];
startDate = json['StartDate']; startDate = json['StartDate'] ?? json['startDate'];
endDate = json['EndDate']; endDate = json['EndDate'];
} }
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['SetupID'] = this.setupID; data['SetupID'] = this.setupID;
data['status'] = this.status;
data['isExtendedLeave'] = this.isExtendedLeave;
data['noOfDays'] = this.noOfDays;
data['patientMRN'] = this.patientMRN;
data['ProjectID'] = this.projectID; data['ProjectID'] = this.projectID;
data['PatientID'] = this.patientID; data['PatientID'] = this.patientID;

@ -10,6 +10,7 @@ class SickLeavePatientRequestModel {
int patientTypeID; int patientTypeID;
String tokenID; String tokenID;
int patientID; int patientID;
int patientMRN;
String sessionID; String sessionID;
SickLeavePatientRequestModel( SickLeavePatientRequestModel(
@ -24,10 +25,12 @@ class SickLeavePatientRequestModel {
this.patientTypeID, this.patientTypeID,
this.tokenID, this.tokenID,
this.patientID, this.patientID,
this.sessionID}); this.sessionID,
this.patientMRN});
SickLeavePatientRequestModel.fromJson(Map<String, dynamic> json) { SickLeavePatientRequestModel.fromJson(Map<String, dynamic> json) {
versionID = json['VersionID']; versionID = json['VersionID'];
patientMRN = json['PatientMRN'];
channel = json['Channel']; channel = json['Channel'];
languageID = json['LanguageID']; languageID = json['LanguageID'];
iPAdress = json['IPAdress']; iPAdress = json['IPAdress'];
@ -44,6 +47,7 @@ class SickLeavePatientRequestModel {
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['VersionID'] = this.versionID; data['VersionID'] = this.versionID;
data['PatientMRN'] = this.patientMRN;
data['Channel'] = this.channel; data['Channel'] = this.channel;
data['LanguageID'] = this.languageID; data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress; data['IPAdress'] = this.iPAdress;

@ -1,4 +1,5 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_doctor_request_model.dart';
import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_patient_model.dart'; import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_patient_model.dart';
import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_patient_request_model.dart'; import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_patient_request_model.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart';
@ -21,8 +22,7 @@ class SickLeaveService extends BaseService {
List get coveringDoctorsList => _coveringDoctors; List get coveringDoctorsList => _coveringDoctors;
List _coveringDoctors = []; List _coveringDoctors = [];
List<GetRescheduleLeavesResponse> get getAllRescheduleLeave => List<GetRescheduleLeavesResponse> get getAllRescheduleLeave => _getReScheduleLeave;
_getReScheduleLeave;
List<GetRescheduleLeavesResponse> _getReScheduleLeave = []; List<GetRescheduleLeavesResponse> _getReScheduleLeave = [];
dynamic get postReschedule => _postReschedule; dynamic get postReschedule => _postReschedule;
dynamic _postReschedule; dynamic _postReschedule;
@ -31,9 +31,11 @@ class SickLeaveService extends BaseService {
dynamic _sickLeaveResponse; dynamic _sickLeaveResponse;
List<SickLeavePatientModel> getAllSickLeavePatient = List(); List<SickLeavePatientModel> getAllSickLeavePatient = List();
List<SickLeavePatientModel> getAllSickLeaveDoctor = List();
//getAllSickLeavePatient.addAll(getAllSickLeaveDoctor);
SickLeavePatientRequestModel _sickLeavePatientRequestModel = SickLeavePatientRequestModel _sickLeavePatientRequestModel = SickLeavePatientRequestModel();
SickLeavePatientRequestModel(); GetSickLeaveDoctorRequestModel _sickLeaveDoctorRequestModel = GetSickLeaveDoctorRequestModel();
Future getStatistics(appoNo, patientMRN) async { Future getStatistics(appoNo, patientMRN) async {
hasError = false; hasError = false;
@ -56,6 +58,7 @@ class SickLeaveService extends BaseService {
// addSickLeaveRequest.appointmentNo = '2016054661'; // addSickLeaveRequest.appointmentNo = '2016054661';
// addSickLeaveRequest.patientMRN = '3120746'; // addSickLeaveRequest.patientMRN = '3120746';
hasError = false; hasError = false;
_sickLeaveResponse.clear();
await baseAppClient.post( await baseAppClient.post(
ADD_SICK_LEAVE, ADD_SICK_LEAVE,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
@ -73,8 +76,7 @@ class SickLeaveService extends BaseService {
Future extendSickLeave(GetAllSickLeaveResponse request) async { Future extendSickLeave(GetAllSickLeaveResponse request) async {
var extendSickLeaveRequest = ExtendSickLeaveRequest(); var extendSickLeaveRequest = ExtendSickLeaveRequest();
extendSickLeaveRequest.patientMRN = extendSickLeaveRequest.patientMRN = request.patientMRN.toString(); //'3120746';
request.patientMRN.toString(); //'3120746';
extendSickLeaveRequest.previousRequestNo = request.requestNo.toString(); extendSickLeaveRequest.previousRequestNo = request.requestNo.toString();
extendSickLeaveRequest.noOfDays = request.noOfDays.toString(); extendSickLeaveRequest.noOfDays = request.noOfDays.toString();
extendSickLeaveRequest.remarks = request.remarks; extendSickLeaveRequest.remarks = request.remarks;
@ -114,8 +116,8 @@ class SickLeaveService extends BaseService {
} }
Future getSickLeavePatient(patientMRN) async { Future getSickLeavePatient(patientMRN) async {
_sickLeavePatientRequestModel = SickLeavePatientRequestModel( _sickLeavePatientRequestModel =
patientID: patientMRN, patientTypeID: 2, patientType: 1); SickLeavePatientRequestModel(patientID: patientMRN, patientTypeID: 2, patientType: 1);
hasError = false; hasError = false;
getAllSickLeavePatient = []; getAllSickLeavePatient = [];
getAllSickLeavePatient.clear(); getAllSickLeavePatient.clear();
@ -136,6 +138,28 @@ class SickLeaveService extends BaseService {
); );
} }
Future getSickLeaveDoctor(patientMRN) async {
_sickLeaveDoctorRequestModel = GetSickLeaveDoctorRequestModel(patientMRN: patientMRN);
hasError = false;
getAllSickLeaveDoctor = [];
getAllSickLeaveDoctor.clear();
await baseAppClient.post(
GET_SICK_LEAVE_DOCTOR_APP,
onSuccess: (dynamic response, int statusCode) {
Future.value(response);
getAllSickLeaveDoctor.clear();
response['SickLeavesList']['entityList'].forEach((v) {
getAllSickLeaveDoctor.add(SickLeavePatientModel.fromJson(v));
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: _sickLeaveDoctorRequestModel.toJson(),
);
}
Future getRescheduleLeave() async { Future getRescheduleLeave() async {
hasError = false; hasError = false;
await baseAppClient.post( await baseAppClient.post(

@ -10,13 +10,17 @@ class SickLeaveViewModel extends BaseViewModel {
SickLeaveService _sickLeaveService = locator<SickLeaveService>(); SickLeaveService _sickLeaveService = locator<SickLeaveService>();
get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics; get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics;
get getAllSIckLeave => _sickLeaveService.getAllSickLeave; get getAllSIckLeave => _sickLeaveService.getAllSickLeave;
get getAllSIckLeavePatient => _sickLeaveService.getAllSickLeavePatient; //get getAllSIckLeavePatient => _sickLeaveService.getAllSickLeavePatient;
get sickleaveResponse => _sickLeaveService.sickLeaveResponse;
List get allOffTime => _sickLeaveService.getOffTimeList; List get allOffTime => _sickLeaveService.getOffTimeList;
List get allReasons => _sickLeaveService.getReasons; List get allReasons => _sickLeaveService.getReasons;
List get coveringDoctors => _sickLeaveService.coveringDoctorsList; List get coveringDoctors => _sickLeaveService.coveringDoctorsList;
List get sickLeaveDoctor => _sickLeaveService.getAllSickLeaveDoctor;
get getReschduleLeave => _sickLeaveService.getAllRescheduleLeave; get getReschduleLeave => _sickLeaveService.getAllRescheduleLeave;
get postSechedule => _sickLeaveService.postReschedule; get postSechedule => _sickLeaveService.postReschedule;
get sickleaveResponse => _sickLeaveService.sickLeaveResponse; get getAllSIckLeavePatient =>
[..._sickLeaveService.getAllSickLeavePatient, ..._sickLeaveService.getAllSickLeaveDoctor];
Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _sickLeaveService.addSickLeave(addSickLeaveRequest); await _sickLeaveService.addSickLeave(addSickLeaveRequest);
@ -67,6 +71,16 @@ class SickLeaveViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getSickLeaveDoctor(patientMRN) async {
setState(ViewState.Busy);
await _sickLeaveService.getSickLeaveDoctor(patientMRN);
if (_sickLeaveService.hasError) {
error = _sickLeaveService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future getRescheduleLeave() async { Future getRescheduleLeave() async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _sickLeaveService.getRescheduleLeave(); await _sickLeaveService.getRescheduleLeave();

@ -43,7 +43,9 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
String txtOfMedicalReport; String txtOfMedicalReport;
return BaseView<PatientMedicalReportViewModel>( return BaseView<PatientMedicalReportViewModel>(
onModelReady: (model) async {}, onModelReady: (model) async {
model.getMedicalReportTemplate();
},
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,

@ -28,8 +28,10 @@ class AddSickLeavScreen extends StatelessWidget {
patient = routeArgs['patient']; patient = routeArgs['patient'];
bool isInpatient = routeArgs['isInpatient']; bool isInpatient = routeArgs['isInpatient'];
return BaseView<SickLeaveViewModel>( return BaseView<SickLeaveViewModel>(
onModelReady: (model) => onModelReady: (model) async {
model.getSickLeavePatient(patient.patientMRN ?? patient.patientId), await model.getSickLeavePatient(patient.patientMRN ?? patient.patientId);
await model.getSickLeaveDoctor(patient.patientMRN ?? patient.patientId);
},
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
@ -61,56 +63,59 @@ class AddSickLeavScreen extends StatelessWidget {
), ),
], ],
)), )),
Container( InkWell(
width: SizeConfig.screenWidth, onTap: () {
margin: EdgeInsets.only( openSickLeave(
left: 20, right: 20, top: 10, bottom: 10), context,
padding: EdgeInsets.all(20), false,
decoration: BoxDecoration( );
borderRadius: BorderRadius.circular(10), },
color: HexColor('#EAEAEA')), child: Container(
child: Column( width: SizeConfig.screenWidth,
mainAxisAlignment: MainAxisAlignment.start, margin: EdgeInsets.only(left: 20, right: 20, top: 10, bottom: 10),
children: [ padding: EdgeInsets.all(20),
Container( decoration:
child: Container( BoxDecoration(borderRadius: BorderRadius.circular(10), color: HexColor('#EAEAEA')),
decoration: BoxDecoration( child: Column(
color: Colors.grey, mainAxisAlignment: MainAxisAlignment.start,
borderRadius: BorderRadius.circular(10)), children: [
padding: EdgeInsets.all(3), Container(
child: IconButton( child: Container(
decoration:
BoxDecoration(color: Colors.grey, borderRadius: BorderRadius.circular(10)),
padding: EdgeInsets.all(3),
child: IconButton(
icon: Icon( icon: Icon(
Icons.add, Icons.add,
size: 35, size: 35,
color: Colors.white, color: Colors.white,
), ),
onPressed: () { // onPressed: () {
openSickLeave( // openSickLeave(
context, // context,
false, // false,
); // );
}), // },
)), ),
Padding( )),
child: AppText( Padding(
TranslationBase.of(context) child: AppText(TranslationBase.of(context).noSickLeaveApplied,
.noSickLeaveApplied, fontWeight: FontWeight.bold,
fontWeight: FontWeight.bold, fontFamily: 'Poppins',
fontFamily: 'Poppins', fontSize: 16,
fontSize: 16, textAlign: TextAlign.center,
textAlign: TextAlign.center, color: HexColor('#7E7E7E')),
color: HexColor('#7E7E7E')), padding: EdgeInsets.all(10),
padding: EdgeInsets.all(10), ),
), ],
], )),
)), ),
], ],
) )
: SizedBox(), : SizedBox(),
model.getAllSIckLeavePatient.length > 0 model.getAllSIckLeavePatient.length > 0
? Column( ? Column(
children: model.getAllSIckLeavePatient children: model.getAllSIckLeavePatient.map<Widget>((SickLeavePatientModel item) {
.map<Widget>((SickLeavePatientModel item) {
return RoundedContainer( return RoundedContainer(
margin: EdgeInsets.all(10), margin: EdgeInsets.all(10),
child: Column( child: Column(
@ -129,8 +134,7 @@ class AddSickLeavScreen extends StatelessWidget {
// ))), // ))),
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 4, flex: 4,
@ -139,13 +143,12 @@ class AddSickLeavScreen extends StatelessWidget {
// MainAxisAlignment.start, // MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Column( Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Container( Container(
padding: EdgeInsets.all(3), padding: EdgeInsets.all(3),
child: AppText( child: AppText(
item.doctorName, item.doctorName ?? "",
// item.status == 1 // item.status == 1
// ? TranslationBase.of( // ? TranslationBase.of(
// context) // context)
@ -158,8 +161,7 @@ class AddSickLeavScreen extends StatelessWidget {
// : TranslationBase // : TranslationBase
// .of(context) // .of(context)
// .all, // .all,
fontWeight: fontWeight: FontWeight.bold,
FontWeight.bold,
// color: item.status == 1 // color: item.status == 1
// ? Colors.yellow[800] // ? Colors.yellow[800]
// : item.status == 2 // : item.status == 2
@ -170,34 +172,25 @@ class AddSickLeavScreen extends StatelessWidget {
), ),
Row( Row(
children: [ children: [
AppText(TranslationBase AppText(TranslationBase.of(context).daysSickleave + ": "),
.of(context)
.daysSickleave +
": "),
AppText( AppText(
item.sickLeaveDays item.sickLeaveDays ?? item.noOfDays.toString(),
.toString(), fontWeight: FontWeight.bold,
fontWeight:
FontWeight.bold,
), ),
], ],
), ),
Row( Row(
children: [ children: [
AppText( AppText(
TranslationBase.of( TranslationBase.of(context).startDate + ' ' ?? "",
context)
.startDate +
' ',
), ),
Flexible( Flexible(
child: AppText( child: AppText(
AppDateUtils.getDayMonthYearDateFormatted( AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils item.startDate.contains("/Date(")
.convertStringToDate( ? AppDateUtils.convertStringToDate(item.startDate)
item.startDate)), : DateTime.parse(item.startDate)),
fontWeight: fontWeight: FontWeight.bold,
FontWeight.bold,
), ),
) )
], ],
@ -205,42 +198,21 @@ class AddSickLeavScreen extends StatelessWidget {
Row( Row(
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).endDate + ' ' ?? "",
.endDate +
' ',
), ),
Flexible( Flexible(
child: AppText( child: AppText(
AppDateUtils AppDateUtils.getDayMonthYearDateFormatted(
.getDayMonthYearDateFormatted( item.startDate.contains("/Date(")
AppDateUtils ? AppDateUtils.convertStringToDate(item.endDate)
.convertStringToDate( .add(Duration(days: item.noOfDays))
item.endDate, : DateTime.parse(item.startDate)
)), .add(Duration(days: item.noOfDays))),
fontWeight: fontWeight: FontWeight.bold,
FontWeight.bold,
), ),
) )
], ],
), ),
Row(children: [
AppText(TranslationBase.of(
context)
.branch +
": "),
AppText(
item.projectName ?? "",
),
]),
Row(children: [
AppText(TranslationBase.of(
context)
.clinic +
": "),
AppText(
item.clinicName ?? "",
),
]),
], ],
), ),
SizedBox( SizedBox(
@ -266,8 +238,7 @@ class AddSickLeavScreen extends StatelessWidget {
Image.asset('assets/images/no-data.png'), Image.asset('assets/images/no-data.png'),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: AppText( child: AppText(TranslationBase.of(context).noSickLeave),
TranslationBase.of(context).noSickLeave),
) )
], ],
), ),
@ -276,8 +247,7 @@ class AddSickLeavScreen extends StatelessWidget {
])))); ]))));
} }
openSickLeave(BuildContext context, isExtend, openSickLeave(BuildContext context, isExtend, {GetAllSickLeaveResponse extendedData}) {
{GetAllSickLeaveResponse extendedData}) {
// showModalBottomSheet( // showModalBottomSheet(
// context: context, // context: context,
// builder: (context) { // builder: (context) {
@ -287,12 +257,9 @@ class AddSickLeavScreen extends StatelessWidget {
context, context,
FadePage( FadePage(
page: SickLeaveScreen( page: SickLeaveScreen(
appointmentNo: isExtend == true appointmentNo:
? extendedData.appointmentNo isExtend == true ? extendedData.appointmentNo : patient.appointmentNo, //extendedData.appointmentNo,
: patient.appointmentNo, //extendedData.appointmentNo, patientMRN: isExtend == true ? extendedData.patientMRN : patient.patientMRN,
patientMRN: isExtend == true
? extendedData.patientMRN
: patient.patientMRN,
isExtended: isExtend, isExtended: isExtend,
extendedData: extendedData, extendedData: extendedData,
patient: patient))); patient: patient)));

@ -1,12 +1,14 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.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/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart';
import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart';
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart';
import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/routes.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/sick-leave/add-sickleave.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.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/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
@ -28,12 +30,7 @@ class SickLeaveScreen extends StatefulWidget {
final appointmentNo; final appointmentNo;
final patientMRN; final patientMRN;
final patient; final patient;
SickLeaveScreen( SickLeaveScreen({this.appointmentNo, this.patientMRN, this.isExtended = false, this.extendedData, this.patient});
{this.appointmentNo,
this.patientMRN,
this.isExtended = false,
this.extendedData,
this.patient});
@override @override
_SickLeaveScreenState createState() => _SickLeaveScreenState(); _SickLeaveScreenState createState() => _SickLeaveScreenState();
} }
@ -76,8 +73,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
return BaseView<PatientViewModel>( return BaseView<PatientViewModel>(
onModelReady: (model) => model.getClinicsList(), onModelReady: (model) => model.getClinicsList(),
builder: (_, model, w) => BaseView<SickLeaveViewModel>( builder: (_, model, w) => BaseView<SickLeaveViewModel>(
onModelReady: (model2) => model2.preSickLeaveStatistics( onModelReady: (model2) => model2.preSickLeaveStatistics(widget.appointmentNo, widget.patientMRN),
widget.appointmentNo, widget.patientMRN),
builder: (_, model2, w) => GestureDetector( builder: (_, model2, w) => GestureDetector(
onTap: () { onTap: () {
FocusScope.of(context).requestFocus(new FocusNode()); FocusScope.of(context).requestFocus(new FocusNode());
@ -108,46 +104,35 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
Container( Container(
margin: EdgeInsets.only(left: 10, right: 10), margin: EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius: BorderRadius.all(Radius.circular(6.0)),
BorderRadius.all(Radius.circular(6.0)),
border: Border.all( border: Border.all(
width: 1.0, width: 1.0,
color: HexColor("#CCCCCC"), color: HexColor("#CCCCCC"),
), ),
color: Colors.white), color: Colors.white),
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
child: Column( child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
crossAxisAlignment: Padding(
CrossAxisAlignment.start, padding: EdgeInsets.only(top: 5, left: 10, right: 10),
children: [ child: AppText(TranslationBase.of(context).sickLeave +
Padding( ' ' +
padding: EdgeInsets.only( TranslationBase.of(context).days)),
top: 5, left: 10, right: 10), AppTextFormField(
child: AppText( borderColor: Colors.white,
TranslationBase.of(context) onChanged: (value) {
.sickLeave + addSickLeave.noOfDays = value;
' ' + if (widget.extendedData != null) {
TranslationBase.of(context) widget.extendedData.noOfDays = int.parse(value);
.days)), }
AppTextFormField( },
borderColor: Colors.white, hintText:
onChanged: (value) { widget.extendedData != null ? widget.extendedData.noOfDays.toString() : '',
addSickLeave.noOfDays = value; // validator: (value) {
if (widget.extendedData != null) { // return TextValidator().validateName(value);
widget.extendedData.noOfDays = // },
int.parse(value); textInputType: TextInputType.number,
} inputFormatter: ONLY_NUMBERS)
}, ]),
hintText: widget.extendedData != null
? widget.extendedData.noOfDays
.toString()
: '',
// validator: (value) {
// return TextValidator().validateName(value);
// },
textInputType:TextInputType.number,
inputFormatter: ONLY_NUMBERS)
]),
), ),
SizedBox( SizedBox(
height: 10, height: 10,
@ -155,146 +140,107 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
Container( Container(
margin: EdgeInsets.only(left: 10, right: 10), margin: EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius: BorderRadius.all(Radius.circular(6.0)),
BorderRadius.all(Radius.circular(6.0)), border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC")),
color: Colors.white, color: Colors.white,
), ),
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(top: 5, left: 10, right: 10),
top: 5, left: 10, right: 10),
child: AppText( child: AppText(
TranslationBase.of(context) TranslationBase.of(context).sickLeaveDate,
.sickLeaveDate,
)), )),
AppTextFormField( AppTextFormField(
hintText: widget.extendedData != null hintText: widget.extendedData != null ? widget.extendedData.startDate : '',
? widget.extendedData.startDate
: '',
borderColor: Colors.white, borderColor: Colors.white,
prefix: IconButton( prefix: IconButton(icon: Icon(Icons.calendar_today)),
icon: Icon(Icons.calendar_today)),
textInputType: TextInputType.number, textInputType: TextInputType.number,
controller: _toDateController, controller: _toDateController,
onTap: () { onTap: () {
_presentDatePicker( _presentDatePicker('_selectedToDate');
'_selectedToDate');
}, },
inputFormatter: ONLY_DATE, inputFormatter: ONLY_DATE,
onChanged: (value) { onChanged: (value) {
addSickLeave.startDate = value; addSickLeave.startDate = value;
if (widget.extendedData != null) { if (widget.extendedData != null) {
widget.extendedData.startDate = widget.extendedData.startDate = value;
value;
} }
}), }),
], ],
)), )),
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(top: 10, left: 10, right: 10),
top: 10, left: 10, right: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius: BorderRadius.all(Radius.circular(6.0)),
BorderRadius.all(Radius.circular(6.0)), border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC")),
color: Colors.white, color: Colors.white,
), ),
width: double.infinity, width: double.infinity,
child: Padding( child: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: SizeConfig.widthMultiplier * 0.9, top: SizeConfig.widthMultiplier * 0.9,
bottom: bottom: SizeConfig.widthMultiplier * 0.9,
SizeConfig.widthMultiplier * 0.9,
right: SizeConfig.widthMultiplier * 3, right: SizeConfig.widthMultiplier * 3,
left: SizeConfig.widthMultiplier * 3), left: SizeConfig.widthMultiplier * 3),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only(top: 5), padding: EdgeInsets.only(top: 5),
child: AppText( child: AppText(
TranslationBase.of(context) TranslationBase.of(context).clinicName,
.clinicName,
)), )),
Row( Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
// add Expanded to have your dropdown button fill remaining space // add Expanded to have your dropdown button fill remaining space
child: child: DropdownButtonHideUnderline(
DropdownButtonHideUnderline( child: new IgnorePointer(
child: new IgnorePointer( ignoring: true,
ignoring: true, child: DropdownButton(
child: DropdownButton( isExpanded: true,
isExpanded: true, value: getClinicName(model) ?? "",
value: getClinicName( iconSize: 0,
model) ?? elevation: 16,
"", selectedItemBuilder: (BuildContext context) {
iconSize: 0, return model.getClinicNameList().map((item) {
elevation: 16, return Row(
selectedItemBuilder: mainAxisSize: MainAxisSize.max,
(BuildContext children: <Widget>[
context) { AppText(
return model
.getClinicNameList()
.map((item) {
return Row(
mainAxisSize:
MainAxisSize
.max,
children: <
Widget>[
AppText(
item,
fontSize:
SizeConfig.textMultiplier *
2.1,
color: Colors
.grey,
),
],
);
}).toList();
},
onChanged:
(newValue) =>
{},
items: model
.getClinicNameList()
.map((item) {
return DropdownMenuItem(
value: item
.toString(),
child: Text(
item, item,
textAlign: fontSize: SizeConfig.textMultiplier * 2.1,
TextAlign color: Colors.grey,
.end,
), ),
); ],
}).toList(), );
))), }).toList();
},
onChanged: (newValue) => {},
items: model.getClinicNameList().map((item) {
return DropdownMenuItem(
value: item.toString(),
child: Text(
item,
textAlign: TextAlign.end,
),
);
}).toList(),
))),
), ),
], ],
) )
], ],
), ),
)), )),
model2.sickLeaveStatistics[ model2.sickLeaveStatistics['recommendedSickLeaveDays'] != null
'recommendedSickLeaveDays'] !=
null
? Padding( ? Padding(
child: AppText( child: AppText(
model2.sickLeaveStatistics[ model2.sickLeaveStatistics['recommendedSickLeaveDays'],
'recommendedSickLeaveDays'],
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
textAlign: TextAlign.start, textAlign: TextAlign.start,
), ),
@ -306,10 +252,8 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
Container( Container(
margin: EdgeInsets.only(left: 10, right: 10), margin: EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius: BorderRadius.all(Radius.circular(6.0)),
BorderRadius.all(Radius.circular(6.0)), border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC")),
color: Colors.white, color: Colors.white,
), ),
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
@ -317,11 +261,9 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(top: 5, left: 10, right: 10),
top: 5, left: 10, right: 10),
child: AppText( child: AppText(
TranslationBase.of(context) TranslationBase.of(context).doctorName,
.doctorName,
)), )),
new IgnorePointer( new IgnorePointer(
ignoring: true, ignoring: true,
@ -343,10 +285,8 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
Container( Container(
margin: EdgeInsets.only(left: 10, right: 10), margin: EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius: BorderRadius.all(Radius.circular(6.0)),
BorderRadius.all(Radius.circular(6.0)), border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC")),
color: Colors.white, color: Colors.white,
), ),
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
@ -354,8 +294,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(top: 5, left: 10, right: 10),
top: 5, left: 10, right: 10),
child: AppText( child: AppText(
TranslationBase.of(context).remarks, TranslationBase.of(context).remarks,
)), )),
@ -364,9 +303,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: EdgeInsets.all(20.0), contentPadding: EdgeInsets.all(20.0),
border: InputBorder.none, border: InputBorder.none,
hintText: widget.extendedData != null hintText: widget.extendedData != null ? widget.extendedData.remarks : ''),
? widget.extendedData.remarks
: ''),
onChanged: (value) { onChanged: (value) {
addSickLeave.remarks = value; addSickLeave.remarks = value;
if (widget.extendedData != null) { if (widget.extendedData != null) {
@ -378,40 +315,60 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
), ),
), ),
Container( Container(
margin: EdgeInsets.all( margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
SizeConfig.widthMultiplier * 5),
child: Wrap( child: Wrap(
alignment: WrapAlignment.center, alignment: WrapAlignment.center,
children: <Widget>[ children: <Widget>[
AppButton( AppButton(
title: widget.isExtended == true title: widget.isExtended == true
? TranslationBase.of(context).extend ? TranslationBase.of(context).extend
: TranslationBase.of(context) : TranslationBase.of(context).addSickLeaverequest,
.addSickLeaverequest,
color: Colors.green, color: Colors.green,
onPressed: () async { onPressed: () async {
if (widget.isExtended) { if (widget.isExtended) {
await model2.extendSickLeave( await model2.extendSickLeave(widget.extendedData);
widget.extendedData);
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(
model2.sickleaveResponse[ model2.sickleaveResponse['ListSickLeavesToExtent']['success']);
'ListSickLeavesToExtent'] Navigator.of(context).popUntil((route) {
['success']); return route.settings.name == PATIENTS_PROFILE;
Navigator.of(context)
.popUntil((route) {
return route.settings.name ==
PATIENTS_PROFILE;
}); });
Navigator.of(context).pushNamed( Navigator.of(context)
ADD_SICKLEAVE, .pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
arguments: {
'patient': widget.patient
});
//print(value); //print(value);
//}); //});
} else { } else {
_validateInputs(model2); try {
if (addSickLeave.noOfDays == null) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseEnterNoOfDays);
} else if (addSickLeave.remarks == null) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseEnterRemarks);
} else if (addSickLeave.startDate == null) {
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterDate);
} else {
addSickLeave.patientMRN = widget.patient.patientMRN.toString();
addSickLeave.appointmentNo = widget.patient.appointmentNo.toString();
await model2.addSickLeave(addSickLeave);
if (model2.sickleaveResponse['SickLeavesList']['success'] != null)
DrAppToastMsg.showSuccesToast(
model2.sickleaveResponse['SickLeavesList']['success']);
}
// Navigator.push(
// context,
// MaterialPageRoute(builder: (context) => AddSickLeavScreen()),
// );
// Navigator.of(context).popUntil((route) {
// return route.settings.name == PATIENTS_PROFILE;
// });
// Navigator.of(context)
// .pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
} catch (err) {
print(err);
}
} }
}, },
), ),
@ -437,26 +394,21 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
void _validateInputs(model2) async { void _validateInputs(model2) async {
try { try {
if (addSickLeave.noOfDays == null) { if (addSickLeave.noOfDays == null) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterNoOfDays);
TranslationBase.of(context).pleaseEnterNoOfDays);
} else if (addSickLeave.remarks == null) { } else if (addSickLeave.remarks == null) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterRemarks);
TranslationBase.of(context).pleaseEnterRemarks);
} else if (addSickLeave.startDate == null) { } else if (addSickLeave.startDate == null) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterDate);
TranslationBase.of(context).pleaseEnterDate);
} else { } else {
addSickLeave.patientMRN = widget.patient.patientMRN.toString(); addSickLeave.patientMRN = widget.patient.patientMRN.toString();
addSickLeave.appointmentNo = widget.patient.appointmentNo.toString(); addSickLeave.appointmentNo = widget.patient.appointmentNo.toString();
await model2.addSickLeave(addSickLeave).then((value) => print(value)); await model2.addSickLeave(addSickLeave).then((value) => print(value));
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(model2.sickleaveResponse['ListSickLeavesToExtent']['success']);
model2.sickleaveResponse['ListSickLeavesToExtent']['success']);
Navigator.of(context).popUntil((route) { Navigator.of(context).popUntil((route) {
return route.settings.name == PATIENTS_PROFILE; return route.settings.name == PATIENTS_PROFILE;
}); });
Navigator.of(context) Navigator.of(context).pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
.pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient});
} }
} catch (err) { } catch (err) {
print(err); print(err);
@ -471,9 +423,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
} }
getClinicName(model) { getClinicName(model) {
var clinicInfo = model.clinicsList var clinicInfo = model.clinicsList.where((i) => i['ClinicID'] == this.profile['ClinicID']).toList();
.where((i) => i['ClinicID'] == this.profile['ClinicID'])
.toList();
return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : "";
} }
} }

Loading…
Cancel
Save