Merge branch 'development' into medical-profile-services

merge-requests/689/head
mosazaid 5 years ago
commit ac460f1d19

@ -1,12 +1,18 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart'; import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/livecare/end_call_req.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
class LiveCarePatientServices extends BaseService{ class LiveCarePatientServices extends BaseService{
List<PatiantInformtion> _patientList = []; List<PatiantInformtion> _patientList = [];
List<PatiantInformtion> get patientList => _patientList; List<PatiantInformtion> get patientList => _patientList;
bool _isFinished = false;
bool get isFinished => _isFinished;
var endCallResponse = {};
Future getPendingPatientERForDoctorApp(PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel) async{ Future getPendingPatientERForDoctorApp(PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel) async{
hasError = false; hasError = false;
await baseAppClient.post( await baseAppClient.post(
@ -25,4 +31,15 @@ class LiveCarePatientServices extends BaseService{
); );
} }
Future endCall(EndCallReq endCallReq) async {
await baseAppClient.post(END_CALL, onSuccess: (response, statusCode) async {
_isFinished = true;
endCallResponse = response;
}, onFailure: (String error, int statusCode) {
_isFinished = true;
throw error;
}, body: endCallReq.toJson());
}
} }

@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDocto
import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart'; import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart';
import 'package:doctor_app_flutter/core/service/patient/LiveCarePatientServices.dart'; import 'package:doctor_app_flutter/core/service/patient/LiveCarePatientServices.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/models/livecare/end_call_req.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import '../../locator.dart'; import '../../locator.dart';
@ -13,6 +14,8 @@ class LiveCarePatientViewModel extends BaseViewModel {
LiveCarePatientServices _liveCarePatientServices = LiveCarePatientServices _liveCarePatientServices =
locator<LiveCarePatientServices>(); locator<LiveCarePatientServices>();
bool get isFinished => _liveCarePatientServices.isFinished;
DashboardService _dashboardService = DashboardService _dashboardService =
locator<DashboardService>(); locator<DashboardService>();
@ -33,6 +36,27 @@ class LiveCarePatientViewModel extends BaseViewModel {
} }
} }
Future endCall(request, isPatient, doctorID) async {
EndCallReq endCallReq = new EndCallReq();
endCallReq.doctorId = doctorID; //profile["DoctorID"];
endCallReq.generalid = 'Cs2020@2016\$2958';
endCallReq.vCID = request.vCID; //["VC_ID"];
endCallReq.isDestroy = isPatient;
setState(ViewState.BusyLocal);
await _liveCarePatientServices
.endCall(endCallReq);
if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error;
setState(ViewState.ErrorLocal);
} else {
filterData = _liveCarePatientServices.patientList;
setState(ViewState.Idle);
}
}
searchData(String str) { searchData(String str) {
var strExist= str.length > 0 ? true : false; var strExist= str.length > 0 ? true : false;
if (strExist) { if (strExist) {

@ -1,227 +0,0 @@
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import '../../../routes.dart';
class InPatientProfileScreen extends StatefulWidget {
@override
_InPatientProfileScreenState createState() => _InPatientProfileScreenState();
}
class _InPatientProfileScreenState extends State<InPatientProfileScreen>with SingleTickerProviderStateMixin {
PatiantInformtion patient;
bool isFromSearch = false;
bool isInpatient = false;
bool isDischargedPatient = false;
String patientType;
String arrivalType;
String from;
String to;
@override
void didChangeDependencies() {
super.didChangeDependencies();
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
patient = routeArgs['patient'];
patientType = routeArgs['patientType'];
arrivalType = routeArgs['arrivalType'];
from = routeArgs['from'];
to = routeArgs['to'];
if (routeArgs.containsKey("isSearch")) {
isFromSearch = routeArgs['isSearch'];
}
if (routeArgs.containsKey("isInpatient")) {
isInpatient = routeArgs['isInpatient'];
}
if (routeArgs.containsKey("isDischargedPatient")) {
isDischargedPatient = routeArgs['isDischargedPatient'];
}
}
@override
Widget build(BuildContext context) {
return BaseView<PatientViewModel>(
builder: (_, patientViewModel, w) => AppScaffold(
baseViewModel: patientViewModel,
appBarTitle: TranslationBase.of(context).patientProfile,
isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar(patient,arrivalType??'0',patientType),
body: SingleChildScrollView(
child: Container(
margin: EdgeInsets.only(top: 10),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 15.0,horizontal: 15),
child: GridView.count(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
crossAxisSpacing: 10,
mainAxisSpacing: 10,
childAspectRatio: 1 / 1.0,
crossAxisCount: 3,
children: [
PatientProfileButton(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
from: from,
to: to,
nameLine1: TranslationBase.of(context).vital,
nameLine2: TranslationBase.of(context).signs,
route: VITAL_SIGN_DETAILS,
isInPatient: true,
icon: 'patient/vital_signs.png'),
PatientProfileButton(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
route: LAB_RESULT,
isInPatient: true,
nameLine1: TranslationBase.of(context).lab,
nameLine2: TranslationBase.of(context).result,
icon: 'patient/lab_results.png'),
PatientProfileButton(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
isInPatient: isInpatient,
route: RADIOLOGY_PATIENT,
nameLine1: TranslationBase.of(context).radiology,
nameLine2: TranslationBase.of(context).result,
icon: 'patient/health_summary.png'),
PatientProfileButton(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
route: ORDER_PRESCRIPTION_NEW,
nameLine1: TranslationBase.of(context).patient,
nameLine2: TranslationBase.of(context).prescription,
icon: 'patient/order_prescription.png'),
PatientProfileButton(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
route: PROGRESS_NOTE,
isDischargedPatient: isDischargedPatient,
nameLine1: TranslationBase.of(context).progress,
nameLine2: TranslationBase.of(context).note,
icon: 'patient/Progress_notes.png'),
PatientProfileButton(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
route: ORDER_NOTE,
isDischargedPatient: isDischargedPatient,
nameLine1: "Order", //"Text",
nameLine2:
"Sheet", //TranslationBase.of(context).orders,
icon: 'patient/Progress_notes.png'),
PatientProfileButton(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
route: ORDER_PROCEDURE,
nameLine1: TranslationBase.of(context).orders,
nameLine2: TranslationBase.of(context).procedures,
icon: 'patient/Order_Procedures.png'),
PatientProfileButton(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
route: HEALTH_SUMMARY,
nameLine1: "Health",
//TranslationBase.of(context).medicalReport,
nameLine2: "Summary",
//TranslationBase.of(context).summaryReport,
icon: 'patient/health_summary.png'),
PatientProfileButton(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
isDisable: true,
route: HEALTH_SUMMARY,
nameLine1: "Medical", //Health
//TranslationBase.of(context).medicalReport,
nameLine2: "Report", //Report
//TranslationBase.of(context).summaryReport,
icon: 'patient/health_summary.png'),
PatientProfileButton(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
route: REFER_IN_PATIENT_TO_DOCTOR,
isInPatient: true,
nameLine1: TranslationBase.of(context).referral,
nameLine2: TranslationBase.of(context).patient,
icon: 'patient/refer_patient.png'),
PatientProfileButton(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
route: PATIENT_INSURANCE_APPROVALS_NEW,
nameLine1: TranslationBase.of(context).insurance,
nameLine2: TranslationBase.of(context).approvals,
icon: 'patient/vital_signs.png'),
PatientProfileButton(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
isDisable: true,
route: null,
nameLine1: "Discharge",
nameLine2: "Summery",
icon: 'patient/patient_sick_leave.png'),
PatientProfileButton(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
route: ADD_SICKLEAVE,
nameLine1: TranslationBase.of(context).patientSick,
nameLine2: TranslationBase.of(context).leave,
icon: 'patient/patient_sick_leave.png'),
],
),
),
),
),
));
}
}
class AvatarWidget extends StatelessWidget {
final Widget avatarIcon;
AvatarWidget(this.avatarIcon);
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.08),
offset: Offset(0.0, 5.0),
blurRadius: 16.0)
],
borderRadius: BorderRadius.all(Radius.circular(35.0)),
color: Color(0xffCCCCCC),
),
child: avatarIcon,
);
}
}

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart';
@ -85,9 +86,9 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
return BaseView<PatientViewModel>( return BaseView<LiveCarePatientViewModel>(
builder: (_, patientViewModel, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: patientViewModel, baseViewModel: model,
appBarTitle: TranslationBase.of(context).patientProfile, appBarTitle: TranslationBase.of(context).patientProfile,
isShowAppBar: false, isShowAppBar: false,
body: Column( body: Column(
@ -142,6 +143,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
isInpatient: isInpatient, isInpatient: isInpatient,
isFromLiveCare: isFromLiveCare,
from: from, from: from,
to: to, to: to,
), ),
@ -270,14 +272,19 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
child: Center( child: Center(
child: AppButton( child: AppButton(
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Colors.green[600], color: model.isFinished?Colors.red[600]:Colors.green[600],
title: TranslationBase title: model.isFinished?"End":TranslationBase
.of(context) .of(context)
.initiateCall, .initiateCall,
onPressed: () async { onPressed: () async {
if(model.isFinished) {
Navigator.push(context, MaterialPageRoute( Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) => builder: (BuildContext context) =>
EndCallScreen(patient:patient))); EndCallScreen(patient:patient)));
} else {
// TODO Call initiateCall service
}
}, },
), ),
), ),

@ -14,6 +14,7 @@ class ProfileGridForOther extends StatelessWidget {
final String arrivalType; final String arrivalType;
final double height; final double height;
final bool isInpatient; final bool isInpatient;
final bool isFromLiveCare;
String from; String from;
String to; String to;
@ -25,7 +26,8 @@ class ProfileGridForOther extends StatelessWidget {
this.height, this.height,
this.isInpatient, this.isInpatient,
this.from, this.from,
this.to}) this.to,
this.isFromLiveCare})
: super(key: key); : super(key: key);
@override @override
@ -74,41 +76,67 @@ class ProfileGridForOther extends StatelessWidget {
'patient/Order_Procedures.png', 'patient/Order_Procedures.png',
isInPatient: isInpatient), isInPatient: isInpatient),
PatientProfileCardModel( PatientProfileCardModel(
TranslationBase.of(context).insurance, TranslationBase
TranslationBase.of(context).service, .of(context)
.insurance,
TranslationBase
.of(context)
.service,
PATIENT_INSURANCE_APPROVALS_NEW, PATIENT_INSURANCE_APPROVALS_NEW,
'patient/vital_signs.png', 'patient/vital_signs.png',
isInPatient: isInpatient), isInPatient: isInpatient),
PatientProfileCardModel( PatientProfileCardModel(
TranslationBase.of(context).patientSick, TranslationBase
TranslationBase.of(context).leave, .of(context)
.patientSick,
TranslationBase
.of(context)
.leave,
ADD_SICKLEAVE, ADD_SICKLEAVE,
'patient/patient_sick_leave.png', 'patient/patient_sick_leave.png',
isInPatient: isInpatient), isInPatient: isInpatient),
if (patient.appointmentNo != null && patient.appointmentNo != 0) if (isFromLiveCare ||
(patient.appointmentNo != null && patient.appointmentNo != 0))
PatientProfileCardModel( PatientProfileCardModel(
TranslationBase.of(context).patient, TranslationBase
TranslationBase.of(context).ucaf, .of(context)
.patient,
TranslationBase
.of(context)
.ucaf,
PATIENT_UCAF_REQUEST, PATIENT_UCAF_REQUEST,
'patient/ucaf.png', 'patient/ucaf.png',
isInPatient: isInpatient, isInPatient: isInpatient,
isDisable: patient.patientStatusType != 43 ? true : false), isDisable: patient.patientStatusType != 43 ||
if (patient.appointmentNo != null && patient.appointmentNo != 0) patient.appointmentNo == null ? true : false),
if (isFromLiveCare ||
(patient.appointmentNo != null && patient.appointmentNo != 0))
PatientProfileCardModel( PatientProfileCardModel(
TranslationBase.of(context).referral, TranslationBase
TranslationBase.of(context).patient, .of(context)
.referral,
TranslationBase
.of(context)
.patient,
REFER_PATIENT_TO_DOCTOR, REFER_PATIENT_TO_DOCTOR,
'patient/refer_patient.png', 'patient/refer_patient.png',
isInPatient: isInpatient, isInPatient: isInpatient,
isDisable: patient.patientStatusType != 43 ? true : false), isDisable: patient.patientStatusType != 43 ||
if (patient.appointmentNo != null && patient.appointmentNo != 0) patient.appointmentNo == null ? true : false),
if (isFromLiveCare ||
(patient.appointmentNo != null && patient.appointmentNo != 0))
PatientProfileCardModel( PatientProfileCardModel(
TranslationBase.of(context).admission, TranslationBase
TranslationBase.of(context).request, .of(context)
.admission,
TranslationBase
.of(context)
.request,
PATIENT_ADMISSION_REQUEST, PATIENT_ADMISSION_REQUEST,
'patient/admission_req.png', 'patient/admission_req.png',
isInPatient: isInpatient, isInPatient: isInpatient,
isDisable: patient.patientStatusType != 43 ? true : false), isDisable: patient.patientStatusType != 43 ||
patient.appointmentNo == null ? true : false),
]; ];
return Column( return Column(
@ -138,6 +166,8 @@ class ProfileGridForOther extends StatelessWidget {
isDisable: cardsList[index].isDisable, isDisable: cardsList[index].isDisable,
onTap: cardsList[index].onTap, onTap: cardsList[index].onTap,
isLoading: cardsList[index].isLoading, isLoading: cardsList[index].isLoading,
isFromLiveCare: isFromLiveCare
), ),
), ),
), ),

@ -25,6 +25,7 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
PatiantInformtion patient; PatiantInformtion patient;
String arrivalType; String arrivalType;
bool isInpatient; bool isInpatient;
bool isFromLiveCare;
@override @override
void didChangeDependencies() { void didChangeDependencies() {
@ -34,6 +35,7 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
patientType = routeArgs['patientType']; patientType = routeArgs['patientType'];
arrivalType = routeArgs['arrivalType']; arrivalType = routeArgs['arrivalType'];
isInpatient = routeArgs['isInpatient']; isInpatient = routeArgs['isInpatient'];
isFromLiveCare = routeArgs['isFromLiveCare'];
print(arrivalType); print(arrivalType);
} }
@ -97,21 +99,25 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
fontSize: 13, fontSize: 13,
), ),
AppText( AppText(
TranslationBase.of(context).result, TranslationBase
.of(context)
.result,
bold: true, bold: true,
fontSize: 22, fontSize: 22,
), ),
], ],
), ),
), ),
if (patient.patientStatusType != null && if ((patient.patientStatusType != null &&
patient.patientStatusType == 43) patient.patientStatusType == 43) ||
(isFromLiveCare && patient.appointmentNo != null))
AddNewOrder( AddNewOrder(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => AddSelectedRadiologyOrder( builder: (context) =>
AddSelectedRadiologyOrder(
patient: patient, patient: patient,
model: model, model: model,
)), )),

@ -9,9 +9,9 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
class VitalSignDetailsScreen extends StatelessWidget { class VitalSignDetailsScreen extends StatelessWidget {
int appointmentNo; int appointmentNo;
@ -39,6 +39,7 @@ class VitalSignDetailsScreen extends StatelessWidget {
builder: (_, mode, widget) => AppScaffold( builder: (_, mode, widget) => AppScaffold(
baseViewModel: mode, baseViewModel: mode,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: PatientProfileHeaderNewDesignAppBar( appBar: PatientProfileHeaderNewDesignAppBar(
patient, patientType, arrivalType), patient, patientType, arrivalType),
appBarTitle: TranslationBase.of(context).vitalSign, appBarTitle: TranslationBase.of(context).vitalSign,
@ -592,26 +593,13 @@ class VitalSignDetailsScreen extends StatelessWidget {
), ),
], ],
) )
: Center( : Container(
child: Column( color: Theme
crossAxisAlignment: CrossAxisAlignment.center, .of(context)
children: [ .scaffoldBackgroundColor,
SizedBox( child: ErrorMessage(error: TranslationBase
height: 100, .of(context)
), .vitalSignEmptyMsg,)),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
TranslationBase.of(context).vitalSignEmptyMsg,
fontWeight: FontWeight.normal,
color: HexColor("#B8382B"),
fontSize: SizeConfig.textMultiplier * 2.5,
),
)
],
),
),
), ),
); );
} }

@ -5,10 +5,12 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
@ -23,12 +25,16 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package: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/app-textfield-custom.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:speech_to_text/speech_recognition_error.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt;
addPrescriptionForm(context, PrescriptionViewModel model, addPrescriptionForm(context, PrescriptionViewModel model,
PatiantInformtion patient, prescription) { PatiantInformtion patient, prescription) {
@ -102,6 +108,13 @@ class PrescriptionFormWidget extends StatefulWidget {
} }
class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> { class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
String routeError;
String frequencyError;
String doseTimeError;
String durationError;
String unitError;
String strengthError;
int selectedType; int selectedType;
TextEditingController durationController = TextEditingController(); TextEditingController durationController = TextEditingController();
TextEditingController strengthController = TextEditingController(); TextEditingController strengthController = TextEditingController();
@ -124,6 +137,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
TextEditingController drugIdController = TextEditingController(); TextEditingController drugIdController = TextEditingController();
TextEditingController doseController = TextEditingController(); TextEditingController doseController = TextEditingController();
final searchController = TextEditingController(); final searchController = TextEditingController();
stt.SpeechToText speech = stt.SpeechToText();
var event = RobotProvider();
var reconizedWord;
var notesList; var notesList;
var filteredNotesList; var filteredNotesList;
@ -188,6 +204,60 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
}); });
} }
onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speech.initialize(
onStatus: statusListener, onError: errorListener);
if (available) {
speech.listen(
onResult: resultListener,
listenMode: stt.ListenMode.confirmation,
localeId: lang == 'en' ? 'en-US' : 'ar-SA',
);
} else {
print("The user has denied the use of speech recognition.");
}
}
void errorListener(SpeechRecognitionError error) {
event.setValue({"searchText": 'null'});
//SpeechToText.closeAlertDialog(context);
print(error);
}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
}
void requestPermissions() async {
Map<Permission, PermissionStatus> statuses = await [
Permission.microphone,
].request();
}
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speech.stop();
indicationController.text += reconizedWord + '\n';
});
} else {
print(result.finalResult);
}
}
Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize(
onError: errorListener, onStatus: statusListener);
print(hasSpeech);
if (!mounted) return;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ListSelectDialog drugDialog; ListSelectDialog drugDialog;
@ -244,7 +314,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
(BuildContext context, ScrollController scrollController) { (BuildContext context, ScrollController scrollController) {
return SingleChildScrollView( return SingleChildScrollView(
child: Container( child: Container(
height: MediaQuery.of(context).size.height * 1.45, height: MediaQuery.of(context).size.height * 1.65,
color: Color(0xffF8F8F8), color: Color(0xffF8F8F8),
child: Padding( child: Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
@ -437,11 +507,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
SizedBox( SizedBox(
height: spaceBetweenTextFileds), height: spaceBetweenTextFileds),
Container( Container(
//height: screenSize.height * 0.062,
height: MediaQuery.of(context)
.size
.height *
0.0749,
width: double.infinity, width: double.infinity,
child: Row( child: Row(
children: [ children: [
@ -451,18 +516,16 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
.size .size
.width * .width *
0.35, 0.35,
child: TextField( child: AppTextFieldCustom(
decoration: height: 40,
textFieldSelectorDecorationStreangrh( validationError:
strengthController strengthError,
.text, hintText: 'Strength',
'Strength', //strengthController.text, isTextFieldHasSuffix: false,
false),
enabled: true, enabled: true,
controller: controller:
strengthController, strengthController,
onChanged: onChanged: (String value) {
(String value) {
setState(() { setState(() {
strengthChar = strengthChar =
value.length; value.length;
@ -476,19 +539,20 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
); );
} }
}, },
keyboardType: TextInputType inputType: TextInputType
.numberWithOptions( .numberWithOptions(
decimal: true, decimal: true,
)), ),
// keyboardType: TextInputType
// .numberWithOptions(
// decimal: true,
// ),
),
), ),
SizedBox( SizedBox(
width: 5.0, width: 5.0,
), ),
Container( Container(
// height: MediaQuery.of(context)
// .size
// .height *
// 0.06,
color: Colors.white, color: Colors.white,
width: MediaQuery.of(context) width: MediaQuery.of(context)
.size .size
@ -538,23 +602,23 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
); );
} }
: null, : null,
child: TextField( child: AppTextFieldCustom(
decoration: hintText: 'Select',
textFieldSelectorDecoration( isTextFieldHasSuffix:
'Select', true,
model.itemMedicineListUnit dropDownText: model
.itemMedicineListUnit
.length == .length ==
1 1
? units = model ? units = model
.itemMedicineListUnit[0] .itemMedicineListUnit[0]
[ ['description']
'description'] : units != null
: units !=
null
? units['description'] ? units['description']
.toString() .toString()
: null, : null,
true), validationError:
unitError,
enabled: false), enabled: false),
), ),
), ),
@ -564,7 +628,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
SizedBox( SizedBox(
height: spaceBetweenTextFileds), height: spaceBetweenTextFileds),
Container( Container(
height: screenSize.height * 0.070, //height: screenSize.height * 0.070,
color: Colors.white, color: Colors.white,
child: InkWell( child: InkWell(
onTap: onTap:
@ -613,23 +677,44 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
); );
} }
: null, : null,
child: TextField( child: AppTextFieldCustom(
decoration: // decoration:
textFieldSelectorDecoration( // textFieldSelectorDecoration(
TranslationBase.of( // TranslationBase.of(
context) // context)
// .route,
// model.itemMedicineListRoute
// .length ==
// 1
// ? model.itemMedicineListRoute[
// 0]
// ['description']
// : route != null
// ? route[
// 'description']
// : null,
// true),
hintText:
TranslationBase.of(context)
.route, .route,
model.itemMedicineListRoute dropDownText: model
.itemMedicineListRoute
.length == .length ==
1 1
? model.itemMedicineListRoute[ ? model.itemMedicineListRoute[
0] 0]['description']
['description']
: route != null : route != null
? route[ ? route['description']
'description']
: null, : null,
true), isTextFieldHasSuffix: true,
//height: 45,
validationError:
model.itemMedicineListRoute
.length !=
1
? routeError
: null,
enabled: false, enabled: false,
), ),
), ),
@ -637,7 +722,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
SizedBox( SizedBox(
height: spaceBetweenTextFileds), height: spaceBetweenTextFileds),
Container( Container(
height: screenSize.height * 0.070, //height: screenSize.height * 0.070,
color: Colors.white, color: Colors.white,
child: InkWell( child: InkWell(
onTap: onTap:
@ -704,23 +789,22 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
); );
} }
: null, : null,
child: TextField( child: AppTextFieldCustom(
decoration: isTextFieldHasSuffix: true,
textFieldSelectorDecoration( hintText:
TranslationBase.of( TranslationBase.of(context)
context)
.frequency, .frequency,
model.itemMedicineList dropDownText: model
.itemMedicineList
.length == .length ==
1 1
? model.itemMedicineList[ ? model.itemMedicineList[0]
0]
['description'] ['description']
: frequency != null : frequency != null
? frequency[ ? frequency[
'description'] 'description']
: null, : null,
true), validationError: frequencyError,
enabled: false, enabled: false,
), ),
), ),
@ -728,7 +812,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
SizedBox( SizedBox(
height: spaceBetweenTextFileds), height: spaceBetweenTextFileds),
Container( Container(
height: screenSize.height * 0.070, //height: screenSize.height * 0.070,
color: Colors.white, color: Colors.white,
child: InkWell( child: InkWell(
onTap: onTap:
@ -770,17 +854,18 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
); );
} }
: null, : null,
child: TextField( child: AppTextFieldCustom(
decoration: hintText:
textFieldSelectorDecoration( TranslationBase.of(context)
TranslationBase.of(
context)
.doseTime, .doseTime,
doseTime != null isTextFieldHasSuffix: true,
dropDownText: doseTime != null
? doseTime['nameEn'] ? doseTime['nameEn']
: null, : null,
true), //height: 45,
enabled: false, enabled: false,
validationError: doseTimeError,
), ),
), ),
), ),
@ -894,7 +979,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
SizedBox( SizedBox(
height: spaceBetweenTextFileds), height: spaceBetweenTextFileds),
Container( Container(
height: screenSize.height * 0.070, //height: screenSize.height * 0.070,
color: Colors.white, color: Colors.white,
child: InkWell( child: InkWell(
onTap: onTap:
@ -963,16 +1048,15 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
); );
} }
: null, : null,
child: TextField( child: AppTextFieldCustom(
decoration: validationError: durationError,
textFieldSelectorDecoration( isTextFieldHasSuffix: true,
TranslationBase.of( dropDownText: duration != null
context)
.duration,
duration != null
? duration['nameEn'] ? duration['nameEn']
: null, : null,
true), hintText:
TranslationBase.of(context)
.duration,
enabled: false, enabled: false,
), ),
), ),
@ -1101,15 +1185,37 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
width: 1.0, width: 1.0,
color: color:
HexColor("#CCCCCC"))), HexColor("#CCCCCC"))),
child: TextFields( child: Stack(
children: [
TextFields(
maxLines: 6, maxLines: 6,
minLines: 4, minLines: 4,
hintText: hintText: TranslationBase.of(
TranslationBase.of(context) context)
.instruction, .instruction,
controller: instructionController, controller:
instructionController,
//keyboardType: TextInputType.number, //keyboardType: TextInputType.number,
), ),
Positioned(
top:
0, //MediaQuery.of(context).size.height * 0,
right: 15,
child: IconButton(
icon: Icon(
DoctorApp.speechtotext,
color: Colors.black,
size: 35,
),
onPressed: () {
initSpeechState().then(
(value) =>
{onVoiceText()});
},
),
),
],
),
), ),
SizedBox( SizedBox(
height: spaceBetweenTextFileds), height: spaceBetweenTextFileds),
@ -1125,23 +1231,16 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
context) context)
.addMedication, .addMedication,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
onPressed: () { onPressed: () async {
formKey.currentState.save(); if (route != null &&
// Navigator.pop(context); duration != null &&
// openDrugToDrug(); doseTime != null &&
if (frequency == null || frequency != null &&
units != null &&
selectedDate != null &&
strengthController strengthController
.text == .text !=
"" || "") {
doseTime == null ||
duration == null ||
selectedDate == null) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(
context)
.pleaseFillAllFields);
return;
}
if (_selectedMedication if (_selectedMedication
.isNarcotic == .isNarcotic ==
true) { true) {
@ -1157,7 +1256,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
strengthController strengthController
.text) > .text) >
1000.0) { 1000.0) {
DrAppToastMsg.showErrorToast( DrAppToastMsg
.showErrorToast(
"1000 is the MAX for the strength"); "1000 is the MAX for the strength");
return; return;
} }
@ -1165,7 +1265,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
strengthController strengthController
.text) < .text) <
0.0) { 0.0) {
DrAppToastMsg.showErrorToast( DrAppToastMsg
.showErrorToast(
"strength can't be zero"); "strength can't be zero");
return; return;
} }
@ -1257,6 +1358,77 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
// ); // );
} }
} }
} else {
setState(() {
if (duration == null) {
durationError =
TranslationBase.of(
context)
.fieldRequired;
} else {
durationError = null;
}
if (doseTime == null) {
doseTimeError =
TranslationBase.of(
context)
.fieldRequired;
} else {
doseTimeError = null;
}
if (route == null) {
routeError =
TranslationBase.of(
context)
.fieldRequired;
} else {
routeError = null;
}
if (frequency == null) {
frequencyError =
TranslationBase.of(
context)
.fieldRequired;
} else {
frequencyError = null;
}
if (units == null) {
unitError =
TranslationBase.of(
context)
.fieldRequired;
} else {
unitError = null;
}
if (strengthController
.text ==
"") {
strengthError =
TranslationBase.of(
context)
.fieldRequired;
} else {
strengthError = null;
}
});
}
formKey.currentState.save();
// Navigator.pop(context);
// openDrugToDrug();
// if (frequency == null ||
// strengthController
// .text ==
// "" ||
// doseTime == null ||
// duration == null ||
// selectedDate == null) {
// DrAppToastMsg.showErrorToast(
// TranslationBase.of(
// context)
// .pleaseFillAllFields);
// return;
// }
{ {
// Navigator.push( // Navigator.push(
@ -1430,17 +1602,20 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
// .join(' '), // .join(' '),
dose: strengthController.text, dose: strengthController.text,
doseUnit: model.itemMedicineListUnit.length == 1 doseUnit: model.itemMedicineListUnit.length == 1
? model.itemMedicineListUnit[0]['parameterCode'].toString() ? model.itemMedicineListUnit[0]['parameterCode']
.toString()
: units['parameterCode'].toString(), : units['parameterCode'].toString(),
patient: widget.patient, patient: widget.patient,
doseTimeIn: doseTime['id'].toString(), doseTimeIn: doseTime['id'].toString(),
model: widget.model, model: widget.model,
duration: duration['id'].toString(), duration: duration['id'].toString(),
frequency: model.itemMedicineList.length == 1 frequency: model.itemMedicineList.length == 1
? model.itemMedicineList[0]['parameterCode'].toString() ? model.itemMedicineList[0]['parameterCode']
.toString()
: frequency['parameterCode'].toString(), : frequency['parameterCode'].toString(),
route: model.itemMedicineListRoute.length == 1 route: model.itemMedicineListRoute.length == 1
? model.itemMedicineListRoute[0]['parameterCode'].toString() ? model.itemMedicineListRoute[0]['parameterCode']
.toString()
: route['parameterCode'].toString(), : route['parameterCode'].toString(),
drugId: _selectedMedication.itemId.toString(), drugId: _selectedMedication.itemId.toString(),
strength: strengthController.text, strength: strengthController.text,

@ -26,8 +26,8 @@ class PrescriptionsPage extends StatelessWidget {
String patientType = routeArgs['patientType']; String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType']; String arrivalType = routeArgs['arrivalType'];
bool isInpatient = routeArgs['isInpatient']; bool isInpatient = routeArgs['isInpatient'];
bool isFromLiveCare = routeArgs['isFromLiveCare'];
bool isSelectInpatient = routeArgs['isSelectInpatient']; bool isSelectInpatient = routeArgs['isSelectInpatient'];
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PrescriptionViewModel>( return BaseView<PrescriptionViewModel>(
onModelReady: (model) => isSelectInpatient onModelReady: (model) => isSelectInpatient
? model.getPrescriptionsInPatient(patient) ? model.getPrescriptionsInPatient(patient)
@ -86,21 +86,25 @@ class PrescriptionsPage extends StatelessWidget {
fontSize: 13, fontSize: 13,
), ),
AppText( AppText(
TranslationBase.of(context).prescriptions, TranslationBase
.of(context)
.prescriptions,
bold: true, bold: true,
fontSize: 22, fontSize: 22,
), ),
], ],
), ),
), ),
if (patient.patientStatusType != null && if ((patient.patientStatusType != null &&
patient.patientStatusType == 43) patient.patientStatusType == 43) ||
(isFromLiveCare && patient.appointmentNo != null))
AddNewOrder( AddNewOrder(
onTap: () { onTap: () {
addPrescriptionForm(context, model, patient, addPrescriptionForm(context, model, patient,
model.prescriptionList); model.prescriptionList);
}, },
label: TranslationBase.of(context) label: TranslationBase
.of(context)
.applyForNewPrescriptionsOrder, .applyForNewPrescriptionsOrder,
), ),
...List.generate( ...List.generate(

@ -5,7 +5,6 @@ import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.dart';
import 'package:doctor_app_flutter/screens/procedures/add_procedure_homeScreen.dart'; import 'package:doctor_app_flutter/screens/procedures/add_procedure_homeScreen.dart';
import 'package:doctor_app_flutter/screens/procedures/update-procedure.dart'; import 'package:doctor_app_flutter/screens/procedures/update-procedure.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
@ -14,6 +13,7 @@ import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-head
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'ProcedureCard.dart'; import 'ProcedureCard.dart';
class ProcedureScreen extends StatelessWidget { class ProcedureScreen extends StatelessWidget {
@ -31,6 +31,7 @@ class ProcedureScreen extends StatelessWidget {
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType']; String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType']; String arrivalType = routeArgs['arrivalType'];
bool isFromLiveCare = routeArgs['isFromLiveCare'];
bool isInpatient = routeArgs['isInpatient']; bool isInpatient = routeArgs['isInpatient'];
return BaseView<ProcedureViewModel>( return BaseView<ProcedureViewModel>(
onModelReady: (model) => model.getProcedure( onModelReady: (model) => model.getProcedure(
@ -91,21 +92,25 @@ class ProcedureScreen extends StatelessWidget {
fontSize: 13, fontSize: 13,
), ),
AppText( AppText(
TranslationBase.of(context).procedure, TranslationBase
.of(context)
.procedure,
bold: true, bold: true,
fontSize: 22, fontSize: 22,
), ),
], ],
), ),
), ),
if (patient.patientStatusType != null && if ((patient.patientStatusType != null &&
patient.patientStatusType == 43) patient.patientStatusType == 43) ||
(isFromLiveCare && patient.appointmentNo != null))
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => AddProcedureHome( builder: (context) =>
AddProcedureHome(
patient: patient, patient: patient,
model: model, model: model,
)), )),

@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indei
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
// ignore: must_be_immutable
class PatientProfileButton extends StatelessWidget { class PatientProfileButton extends StatelessWidget {
final String nameLine1; final String nameLine1;
final String nameLine2; final String nameLine2;
@ -26,6 +27,7 @@ class PatientProfileButton extends StatelessWidget {
final bool isSelectInpatient; final bool isSelectInpatient;
final bool isDartIcon; final bool isDartIcon;
final IconData dartIcon; final IconData dartIcon;
final bool isFromLiveCare;
PatientProfileButton({ PatientProfileButton({
Key key, Key key,
@ -45,7 +47,7 @@ class PatientProfileButton extends StatelessWidget {
this.isDischargedPatient = false, this.isDischargedPatient = false,
this.isSelectInpatient = false, this.isSelectInpatient = false,
this.isDartIcon = false, this.isDartIcon = false,
this.dartIcon, this.dartIcon, this.isFromLiveCare = false,
}) : super(key: key); }) : super(key: key);
@override @override
@ -142,6 +144,7 @@ class PatientProfileButton extends StatelessWidget {
'isInpatient': isInPatient, 'isInpatient': isInPatient,
'isDischargedPatient': isDischargedPatient, 'isDischargedPatient': isDischargedPatient,
'isSelectInpatient': isSelectInpatient, 'isSelectInpatient': isSelectInpatient,
"isFromLiveCare":isFromLiveCare
}); });
} }
} }

Loading…
Cancel
Save