|
|
|
|
@ -17,6 +17,7 @@ import 'package:doctor_app_flutter/models/operation_report/create_update_operati
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/progress_note_request.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.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/helpers.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
|
@ -28,6 +29,7 @@ import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:speech_to_text/speech_recognition_error.dart';
|
|
|
|
|
@ -38,13 +40,10 @@ import 'CustomEditableText.dart';
|
|
|
|
|
class RegisterConfirmationPatientPage extends StatefulWidget {
|
|
|
|
|
final OperationReportViewModel operationReportViewModel;
|
|
|
|
|
final PatiantInformtion patient;
|
|
|
|
|
final PatientRegistrationViewModel model;
|
|
|
|
|
|
|
|
|
|
final PatientRegistrationViewModel model;
|
|
|
|
|
|
|
|
|
|
const RegisterConfirmationPatientPage(
|
|
|
|
|
{Key key,
|
|
|
|
|
this.operationReportViewModel,
|
|
|
|
|
this.patient, this.model})
|
|
|
|
|
{Key key, this.operationReportViewModel, this.patient, this.model})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -56,17 +55,28 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
extends State<RegisterConfirmationPatientPage> {
|
|
|
|
|
bool isSubmitted = false;
|
|
|
|
|
ProjectViewModel projectViewModel;
|
|
|
|
|
TextEditingController firstName;
|
|
|
|
|
TextEditingController middleName ;
|
|
|
|
|
TextEditingController lastName;
|
|
|
|
|
TextEditingController firstNameN;
|
|
|
|
|
TextEditingController middleNameN;
|
|
|
|
|
TextEditingController lastNameN;
|
|
|
|
|
TextEditingController firstNameAr;
|
|
|
|
|
TextEditingController middleNameAr;
|
|
|
|
|
TextEditingController lastNameAr;
|
|
|
|
|
TextEditingController emailAddressController;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
firstName = TextEditingController(text: widget.model.getPatientInfoResponseModel.firstNameEn);
|
|
|
|
|
middleName = TextEditingController(text: "");
|
|
|
|
|
lastName = TextEditingController(text: widget.model.getPatientInfoResponseModel.lastNameEn);
|
|
|
|
|
firstNameN = TextEditingController(
|
|
|
|
|
text: widget.model.getPatientInfoResponseModel.firstNameEn);
|
|
|
|
|
middleNameN = TextEditingController(text: "");
|
|
|
|
|
lastNameN = TextEditingController(
|
|
|
|
|
text: widget.model.getPatientInfoResponseModel.lastNameEn);
|
|
|
|
|
|
|
|
|
|
firstNameAr = TextEditingController(
|
|
|
|
|
text: widget.model.getPatientInfoResponseModel.firstNameAr);
|
|
|
|
|
middleNameAr = TextEditingController(text: "");
|
|
|
|
|
lastNameAr = TextEditingController(
|
|
|
|
|
text: widget.model.getPatientInfoResponseModel.lastNameAr);
|
|
|
|
|
emailAddressController = TextEditingController(text: "");
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -95,23 +105,41 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
CustomEditableText(
|
|
|
|
|
controller: firstName,
|
|
|
|
|
controller: firstNameN,
|
|
|
|
|
hint: TranslationBase.of(context).firstName),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
CustomEditableText(
|
|
|
|
|
controller: middleName,
|
|
|
|
|
controller: middleNameN,
|
|
|
|
|
hint: TranslationBase.of(context).middleName),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
CustomEditableText(
|
|
|
|
|
controller: lastName,
|
|
|
|
|
controller: lastNameN,
|
|
|
|
|
hint: TranslationBase.of(context).lastName),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
CustomEditableText(
|
|
|
|
|
controller: firstNameAr,
|
|
|
|
|
hint: "First Name Arabic"),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
CustomEditableText(
|
|
|
|
|
controller: middleNameAr,
|
|
|
|
|
hint: "Middle Name Arabic"),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
CustomEditableText(
|
|
|
|
|
controller: lastNameAr,
|
|
|
|
|
hint: "Last Name Arabic"),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
FractionallySizedBox(
|
|
|
|
|
widthFactor: .9,
|
|
|
|
|
child: Center(
|
|
|
|
|
@ -148,7 +176,6 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
color: Colors.black),
|
|
|
|
|
AppText(
|
|
|
|
|
"${widget.model.getPatientInfoResponseModel.idNumber}",
|
|
|
|
|
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: Colors.grey[600],
|
|
|
|
|
),
|
|
|
|
|
@ -193,7 +220,6 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
color: Colors.black),
|
|
|
|
|
AppText(
|
|
|
|
|
"${widget.model.getPatientInfoResponseModel.occupation}",
|
|
|
|
|
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: Colors.grey[600],
|
|
|
|
|
),
|
|
|
|
|
@ -222,7 +248,6 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
color: Colors.black),
|
|
|
|
|
AppText(
|
|
|
|
|
"${widget.model.checkPatientForRegistrationModel.patientMobileNumber}",
|
|
|
|
|
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: Colors.grey[600],
|
|
|
|
|
),
|
|
|
|
|
@ -341,32 +366,77 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
fontColor: Colors.white,
|
|
|
|
|
fontSize: 2.0,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
print(widget.model
|
|
|
|
|
.getPatientInfoResponseModel.dateOfBirth);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dateFormat = DateFormat('MM/dd/yyyy').parse(widget.model
|
|
|
|
|
.getPatientInfoResponseModel.dateOfBirth);
|
|
|
|
|
String wellFormat = "${dateFormat.day}\/${dateFormat.month}\/${dateFormat.year}";
|
|
|
|
|
print (dateFormat.toUtc().toString());
|
|
|
|
|
// return ;
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
PatientRegistrationModel
|
|
|
|
|
patientRegistrationModel =
|
|
|
|
|
PatientRegistrationModel(
|
|
|
|
|
// patientIdentificationID:
|
|
|
|
|
// int.parse(_idController.text),
|
|
|
|
|
// patientMobileNumber:
|
|
|
|
|
// int.parse(_phoneController.text),
|
|
|
|
|
// zipCode: _phoneCode.text,
|
|
|
|
|
isHijri: 0,
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
generalid: GENERAL_ID,
|
|
|
|
|
// dOB:
|
|
|
|
|
// "${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "yyyy/MM/dd")}"
|
|
|
|
|
);
|
|
|
|
|
await widget.model.registrationPatient(
|
|
|
|
|
patientRegistrationModel);
|
|
|
|
|
if(widget.model.state == ViewState.ErrorLocal){
|
|
|
|
|
PatientRegistrationModel patientRegistrationModel =
|
|
|
|
|
PatientRegistrationModel(
|
|
|
|
|
patientobject: Patientobject(
|
|
|
|
|
tempValue: true,
|
|
|
|
|
patientIdentificationNo: widget
|
|
|
|
|
.model
|
|
|
|
|
.checkPatientForRegistrationModel
|
|
|
|
|
.patientIdentificationID
|
|
|
|
|
.toString(),
|
|
|
|
|
patientIdentificationType: 1,
|
|
|
|
|
firstName: firstNameAr.text,
|
|
|
|
|
firstNameN: firstNameN.text,
|
|
|
|
|
lastName: lastNameAr.text,
|
|
|
|
|
lastNameN: lastNameN.text,
|
|
|
|
|
middleName: middleNameAr.text,
|
|
|
|
|
middleNameN: middleNameN.text,
|
|
|
|
|
strDateofBirth: dateFormat.toUtc().toString(),
|
|
|
|
|
dateofBirth: AppDateUtils.convertToServerFormat(widget.model.getPatientInfoResponseModel.dateOfBirth, 'MM/dd/yyyy'),
|
|
|
|
|
dateofBirthN: wellFormat,
|
|
|
|
|
gender: (widget.model.getPatientInfoResponseModel.gender == "M")
|
|
|
|
|
? 1
|
|
|
|
|
: 2,
|
|
|
|
|
sourceType: "1",
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
nationalityID: widget
|
|
|
|
|
.model
|
|
|
|
|
.getPatientInfoResponseModel
|
|
|
|
|
.nationalityCode,
|
|
|
|
|
//todo Elham* change static value to dynamic
|
|
|
|
|
preferredLanguage: "1",
|
|
|
|
|
marital: "0",
|
|
|
|
|
eHealthIDField: widget
|
|
|
|
|
.model.getPatientInfoResponseModel.healthId,
|
|
|
|
|
emailAddress: emailAddressController.text,
|
|
|
|
|
mobileNumber: widget
|
|
|
|
|
.model
|
|
|
|
|
.checkPatientForRegistrationModel
|
|
|
|
|
.patientMobileNumber),
|
|
|
|
|
isHijri: 0,
|
|
|
|
|
logInTokenID: "zjgvKtLC/EK+saznJ/OkiA==",
|
|
|
|
|
isDentalAllowedBackend: false,
|
|
|
|
|
patientOutSA: 0,
|
|
|
|
|
sessionID: null,
|
|
|
|
|
patientMobileNumber:
|
|
|
|
|
widget.model.checkPatientForRegistrationModel.patientMobileNumber.toString(),
|
|
|
|
|
healthId: widget.model.getPatientInfoResponseModel.healthId,
|
|
|
|
|
generalid: GENERAL_ID,
|
|
|
|
|
patientIdentificationID: widget.model.checkPatientForRegistrationModel.patientIdentificationID.toString(),
|
|
|
|
|
dOB:wellFormat,
|
|
|
|
|
zipCode: widget.model.checkPatientForRegistrationModel.zipCode);
|
|
|
|
|
await widget.model
|
|
|
|
|
.registrationPatient(patientRegistrationModel);
|
|
|
|
|
if (widget.model.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(widget.model.error);
|
|
|
|
|
} else {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -413,7 +483,6 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
@ -522,7 +591,6 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
@ -568,11 +636,9 @@ class _RegisterConfirmationPatientPageState
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|