Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into favourite_prescription
Conflicts: lib/core/service/patient/LiveCarePatientServices.dartfavourite_prescription
commit
25583d7bee
@ -1,15 +0,0 @@
|
|||||||
package com.example.doctor_app_flutter.Service;
|
|
||||||
|
|
||||||
import com.example.doctor_app_flutter.Model.GetSessionStatusModel;
|
|
||||||
import com.example.doctor_app_flutter.Model.SessionStatusModel;
|
|
||||||
|
|
||||||
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.http.Body;
|
|
||||||
import retrofit2.http.POST;
|
|
||||||
|
|
||||||
public interface SessionStatusAPI {
|
|
||||||
|
|
||||||
@POST("LiveCareApi/DoctorApp/GetSessionStatus")
|
|
||||||
Call<SessionStatusModel> getSessionStatusModelData(@Body GetSessionStatusModel getSessionStatusModel);
|
|
||||||
}
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
package com.example.doctor_app_flutter.ui;
|
|
||||||
|
|
||||||
import com.example.doctor_app_flutter.Model.GetSessionStatusModel;
|
|
||||||
import com.example.doctor_app_flutter.Model.SessionStatusModel;
|
|
||||||
|
|
||||||
public interface VideoCallContract {
|
|
||||||
|
|
||||||
interface VideoCallView{
|
|
||||||
|
|
||||||
void onCallSuccessful(SessionStatusModel sessionStatusModel);
|
|
||||||
void onFailure();
|
|
||||||
}
|
|
||||||
|
|
||||||
interface VideoCallPresenter {
|
|
||||||
|
|
||||||
void callClintConnected(GetSessionStatusModel statusModel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,137 @@
|
|||||||
|
package com.hmg.hmgDr.Model;
|
||||||
|
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
|
||||||
|
public class ChangeCallStatusRequestModel implements Parcelable {
|
||||||
|
|
||||||
|
@SerializedName("CallStatus")
|
||||||
|
@Expose
|
||||||
|
private Integer callStatus;
|
||||||
|
@SerializedName("DoctorId")
|
||||||
|
@Expose
|
||||||
|
private Integer doctorId;
|
||||||
|
@SerializedName("generalid")
|
||||||
|
@Expose
|
||||||
|
private String generalid;
|
||||||
|
@SerializedName("TokenID")
|
||||||
|
@Expose
|
||||||
|
private String tokenID;
|
||||||
|
@SerializedName("VC_ID")
|
||||||
|
@Expose
|
||||||
|
private Integer vcId;
|
||||||
|
|
||||||
|
public ChangeCallStatusRequestModel(Integer callStatus, Integer doctorId, String generalid, String tokenID, Integer vcId) {
|
||||||
|
this.callStatus = callStatus;
|
||||||
|
this.doctorId = doctorId;
|
||||||
|
this.generalid = generalid;
|
||||||
|
this.tokenID = tokenID;
|
||||||
|
this.vcId = vcId;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ChangeCallStatusRequestModel(Parcel in) {
|
||||||
|
if (in.readByte() == 0) {
|
||||||
|
callStatus = null;
|
||||||
|
} else {
|
||||||
|
callStatus = in.readInt();
|
||||||
|
}
|
||||||
|
if (in.readByte() == 0) {
|
||||||
|
doctorId = null;
|
||||||
|
} else {
|
||||||
|
doctorId = in.readInt();
|
||||||
|
}
|
||||||
|
generalid = in.readString();
|
||||||
|
tokenID = in.readString();
|
||||||
|
if (in.readByte() == 0) {
|
||||||
|
vcId = null;
|
||||||
|
} else {
|
||||||
|
vcId = in.readInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Creator<ChangeCallStatusRequestModel> CREATOR = new Creator<ChangeCallStatusRequestModel>() {
|
||||||
|
@Override
|
||||||
|
public ChangeCallStatusRequestModel createFromParcel(Parcel in) {
|
||||||
|
return new ChangeCallStatusRequestModel(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ChangeCallStatusRequestModel[] newArray(int size) {
|
||||||
|
return new ChangeCallStatusRequestModel[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public Integer getCallStatus() {
|
||||||
|
return callStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCallStatus(Integer callStatus) {
|
||||||
|
this.callStatus = callStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getDoctorId() {
|
||||||
|
return doctorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDoctorId(Integer doctorId) {
|
||||||
|
this.doctorId = doctorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGeneralid() {
|
||||||
|
return generalid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGeneralid(String generalid) {
|
||||||
|
this.generalid = generalid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTokenID() {
|
||||||
|
return tokenID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTokenID(String tokenID) {
|
||||||
|
this.tokenID = tokenID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getVcId() {
|
||||||
|
return vcId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVcId(Integer vcId) {
|
||||||
|
this.vcId = vcId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
if (callStatus == null) {
|
||||||
|
dest.writeByte((byte) 0);
|
||||||
|
} else {
|
||||||
|
dest.writeByte((byte) 1);
|
||||||
|
dest.writeInt(callStatus);
|
||||||
|
}
|
||||||
|
if (doctorId == null) {
|
||||||
|
dest.writeByte((byte) 0);
|
||||||
|
} else {
|
||||||
|
dest.writeByte((byte) 1);
|
||||||
|
dest.writeInt(doctorId);
|
||||||
|
}
|
||||||
|
dest.writeString(generalid);
|
||||||
|
dest.writeString(tokenID);
|
||||||
|
if (vcId == null) {
|
||||||
|
dest.writeByte((byte) 0);
|
||||||
|
} else {
|
||||||
|
dest.writeByte((byte) 1);
|
||||||
|
dest.writeInt(vcId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.example.doctor_app_flutter.Model;
|
package com.hmg.hmgDr.Model;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.example.doctor_app_flutter.Model;
|
package com.hmg.hmgDr.Model;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.example.doctor_app_flutter.Service;
|
package com.hmg.hmgDr.Service;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.hmg.hmgDr.Service;
|
||||||
|
|
||||||
|
import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel;
|
||||||
|
import com.hmg.hmgDr.Model.GetSessionStatusModel;
|
||||||
|
import com.hmg.hmgDr.Model.SessionStatusModel;
|
||||||
|
|
||||||
|
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.http.Body;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
|
||||||
|
public interface SessionStatusAPI {
|
||||||
|
|
||||||
|
@POST("LiveCareApi/DoctorApp/GetSessionStatus")
|
||||||
|
Call<SessionStatusModel> getSessionStatusModelData(@Body GetSessionStatusModel getSessionStatusModel);
|
||||||
|
|
||||||
|
@POST("LiveCareApi/DoctorApp/ChangeCallStatus")
|
||||||
|
Call<SessionStatusModel> changeCallStatus(@Body ChangeCallStatusRequestModel changeCallStatusRequestModel);
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.hmg.hmgDr.ui;
|
||||||
|
|
||||||
|
import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel;
|
||||||
|
import com.hmg.hmgDr.Model.GetSessionStatusModel;
|
||||||
|
import com.hmg.hmgDr.Model.SessionStatusModel;
|
||||||
|
|
||||||
|
public interface VideoCallContract {
|
||||||
|
|
||||||
|
interface VideoCallView {
|
||||||
|
|
||||||
|
void onCallSuccessful(SessionStatusModel sessionStatusModel);
|
||||||
|
|
||||||
|
void onCallChangeCallStatusSuccessful(SessionStatusModel sessionStatusModel);
|
||||||
|
|
||||||
|
void onFailure();
|
||||||
|
}
|
||||||
|
|
||||||
|
interface VideoCallPresenter {
|
||||||
|
|
||||||
|
void callClintConnected(GetSessionStatusModel statusModel);
|
||||||
|
|
||||||
|
void callChangeCallStatus(ChangeCallStatusRequestModel statusModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,118 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_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/procedure_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/screens/prescription/prescription_checkout_screen.dart';
|
|
||||||
import 'package:doctor_app_flutter/screens/procedures/entity_list_fav_procedure.dart';
|
|
||||||
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class AddFavPrescription extends StatefulWidget {
|
|
||||||
final PrescriptionViewModel model;
|
|
||||||
final PatiantInformtion patient;
|
|
||||||
final String categoryID;
|
|
||||||
|
|
||||||
const AddFavPrescription({Key key, this.model, this.patient, this.categoryID}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_AddFavPrescriptionState createState() => _AddFavPrescriptionState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AddFavPrescriptionState extends State<AddFavPrescription> {
|
|
||||||
MedicineViewModel model;
|
|
||||||
PatiantInformtion patient;
|
|
||||||
|
|
||||||
List<ProcedureTempleteDetailsModel> entityList = List();
|
|
||||||
ProcedureTempleteDetailsModel groupProcedures;
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return BaseView<ProcedureViewModel>(
|
|
||||||
onModelReady: (model) => model.getProcedureTemplate(categoryID: widget.categoryID),
|
|
||||||
builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold(
|
|
||||||
isShowAppBar: false,
|
|
||||||
baseViewModel: model,
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
height: MediaQuery.of(context).size.height * 0.070,
|
|
||||||
),
|
|
||||||
if (model.templateList.length != 0)
|
|
||||||
Expanded(
|
|
||||||
child: NetworkBaseView(
|
|
||||||
baseViewModel: model,
|
|
||||||
child: EntityListCheckboxSearchFavProceduresWidget(
|
|
||||||
isProcedure: false,
|
|
||||||
model: model,
|
|
||||||
removeFavProcedure: (item) {
|
|
||||||
setState(() {
|
|
||||||
entityList.remove(item);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addFavProcedure: (history) {
|
|
||||||
setState(() {
|
|
||||||
entityList.add(history);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
isEntityFavListSelected: (master) => isEntityListSelected(master),
|
|
||||||
groupProcedures: groupProcedures,
|
|
||||||
selectProcedures: (valasd) {
|
|
||||||
setState(() {
|
|
||||||
groupProcedures = valasd;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
|
||||||
child: Wrap(
|
|
||||||
alignment: WrapAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
AppButton(
|
|
||||||
title: 'Add Selected Prescription',
|
|
||||||
color: Color(0xff359846),
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
onPressed: () {
|
|
||||||
if (groupProcedures == null) {
|
|
||||||
DrAppToastMsg.showErrorToast(
|
|
||||||
'Please Select item ',
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => PrescriptionCheckOutScreen(
|
|
||||||
patient: widget.patient,
|
|
||||||
model: widget.model,
|
|
||||||
groupProcedures: groupProcedures,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isEntityListSelected(ProcedureTempleteDetailsModel masterKey) {
|
|
||||||
Iterable<ProcedureTempleteDetailsModel> history = entityList.where(
|
|
||||||
(element) => masterKey.templateID == element.templateID && masterKey.procedureName == element.procedureName);
|
|
||||||
if (history.length > 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,203 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
||||||
import 'package:doctor_app_flutter/screens/prescription/add_favourite_prescription.dart';
|
|
||||||
import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.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/network_base_view.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class PrescriptionHomeScreen extends StatefulWidget {
|
|
||||||
final PrescriptionViewModel model;
|
|
||||||
final PatiantInformtion patient;
|
|
||||||
|
|
||||||
const PrescriptionHomeScreen({Key key, this.model, this.patient}) : super(key: key);
|
|
||||||
@override
|
|
||||||
_PrescriptionHomeScreenState createState() => _PrescriptionHomeScreenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PrescriptionHomeScreenState extends State<PrescriptionHomeScreen> with SingleTickerProviderStateMixin {
|
|
||||||
PrescriptionViewModel model;
|
|
||||||
PatiantInformtion patient;
|
|
||||||
TabController _tabController;
|
|
||||||
int _activeTab = 0;
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_tabController = TabController(length: 2, vsync: this);
|
|
||||||
_tabController.addListener(_handleTabSelection);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
_tabController.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
_handleTabSelection() {
|
|
||||||
setState(() {
|
|
||||||
_activeTab = _tabController.index;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final screenSize = MediaQuery.of(context).size;
|
|
||||||
return BaseView<ProcedureViewModel>(
|
|
||||||
//onModelReady: (model) => model.getCategory(),
|
|
||||||
builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold(
|
|
||||||
isShowAppBar: false,
|
|
||||||
body: NetworkBaseView(
|
|
||||||
baseViewModel: model,
|
|
||||||
child: DraggableScrollableSheet(
|
|
||||||
minChildSize: 0.90,
|
|
||||||
initialChildSize: 0.95,
|
|
||||||
maxChildSize: 1.0,
|
|
||||||
builder: (BuildContext context, ScrollController scrollController) {
|
|
||||||
return Container(
|
|
||||||
height: MediaQuery.of(context).size.height * 1.20,
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(12.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Row(children: [
|
|
||||||
InkWell(
|
|
||||||
child: Icon(
|
|
||||||
Icons.arrow_back_ios,
|
|
||||||
size: 24.0,
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 7.0,
|
|
||||||
),
|
|
||||||
AppText(
|
|
||||||
'Add prescription',
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 20,
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
SizedBox(
|
|
||||||
height: MediaQuery.of(context).size.height * 0.04,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Scaffold(
|
|
||||||
extendBodyBehindAppBar: true,
|
|
||||||
appBar: PreferredSize(
|
|
||||||
preferredSize: Size.fromHeight(MediaQuery.of(context).size.height * 0.070),
|
|
||||||
child: Container(
|
|
||||||
height: MediaQuery.of(context).size.height * 0.070,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border(
|
|
||||||
bottom:
|
|
||||||
BorderSide(color: Theme.of(context).dividerColor, width: 0.5), //width: 0.7
|
|
||||||
),
|
|
||||||
color: Colors.white),
|
|
||||||
child: Center(
|
|
||||||
child: TabBar(
|
|
||||||
isScrollable: false,
|
|
||||||
controller: _tabController,
|
|
||||||
indicatorColor: Colors.transparent,
|
|
||||||
indicatorWeight: 1.0,
|
|
||||||
indicatorSize: TabBarIndicatorSize.tab,
|
|
||||||
labelColor: Theme.of(context).primaryColor,
|
|
||||||
labelPadding: EdgeInsets.only(top: 0, left: 0, right: 0, bottom: 0),
|
|
||||||
unselectedLabelColor: Colors.grey[800],
|
|
||||||
tabs: [
|
|
||||||
tabWidget(
|
|
||||||
screenSize,
|
|
||||||
_activeTab == 0,
|
|
||||||
"Favorite Templates",
|
|
||||||
),
|
|
||||||
tabWidget(
|
|
||||||
screenSize,
|
|
||||||
_activeTab == 1,
|
|
||||||
'All Prescription',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: TabBarView(
|
|
||||||
physics: BouncingScrollPhysics(),
|
|
||||||
controller: _tabController,
|
|
||||||
children: [
|
|
||||||
AddFavPrescription(
|
|
||||||
model: widget.model,
|
|
||||||
patient: widget.patient,
|
|
||||||
categoryID: '55',
|
|
||||||
),
|
|
||||||
PrescriptionFormWidget(
|
|
||||||
widget.model, widget.patient, widget.model.prescriptionList),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget tabWidget(Size screenSize, bool isActive, String title, {int counter = -1}) {
|
|
||||||
return Center(
|
|
||||||
child: Container(
|
|
||||||
height: screenSize.height * 0.070,
|
|
||||||
decoration: TextFieldsUtils.containerBorderDecoration(
|
|
||||||
isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA),
|
|
||||||
isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA),
|
|
||||||
borderRadius: 4,
|
|
||||||
borderWidth: 0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
AppText(
|
|
||||||
title,
|
|
||||||
fontSize: SizeConfig.textMultiplier * 1.5,
|
|
||||||
color: isActive ? Colors.white : Color(0xFF2B353E),
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
if (counter != -1)
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.all(4),
|
|
||||||
width: 15,
|
|
||||||
height: 15,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: isActive ? Colors.white : Color(0xFFD02127),
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
child: Center(
|
|
||||||
child: FittedBox(
|
|
||||||
child: AppText(
|
|
||||||
"$counter",
|
|
||||||
fontSize: SizeConfig.textMultiplier * 1.5,
|
|
||||||
color: !isActive ? Colors.white : Color(0xFFD02127),
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
enum ProcedureType {
|
||||||
|
PROCEDURE,
|
||||||
|
LAB_RESULT,
|
||||||
|
RADIOLOGY,
|
||||||
|
PRESCRIPTION,
|
||||||
|
}
|
||||||
|
|
||||||
|
extension procedureType on ProcedureType {
|
||||||
|
String getFavouriteTabName(BuildContext context) {
|
||||||
|
return TranslationBase.of(context).favoriteTemplates;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getAllLabelName(BuildContext context) {
|
||||||
|
switch (this) {
|
||||||
|
case ProcedureType.PROCEDURE:
|
||||||
|
return TranslationBase.of(context).allProcedures;
|
||||||
|
case ProcedureType.LAB_RESULT:
|
||||||
|
return TranslationBase.of(context).allLab;
|
||||||
|
case ProcedureType.RADIOLOGY:
|
||||||
|
return TranslationBase.of(context).allRadiology;
|
||||||
|
case ProcedureType.PRESCRIPTION:
|
||||||
|
return TranslationBase.of(context).allPrescription;
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getToolbarLabel(BuildContext context) {
|
||||||
|
switch (this) {
|
||||||
|
case ProcedureType.PROCEDURE:
|
||||||
|
return TranslationBase.of(context).addProcedures;
|
||||||
|
case ProcedureType.LAB_RESULT:
|
||||||
|
return TranslationBase.of(context).addLabOrder;
|
||||||
|
case ProcedureType.RADIOLOGY:
|
||||||
|
return TranslationBase.of(context).addRadiologyOrder;
|
||||||
|
case ProcedureType.PRESCRIPTION:
|
||||||
|
return TranslationBase.of(context).addPrescription;
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getAddButtonTitle(BuildContext context) {
|
||||||
|
switch (this) {
|
||||||
|
case ProcedureType.PROCEDURE:
|
||||||
|
return TranslationBase.of(context).addProcedures;
|
||||||
|
case ProcedureType.LAB_RESULT:
|
||||||
|
return TranslationBase.of(context).addLabOrder;
|
||||||
|
case ProcedureType.RADIOLOGY:
|
||||||
|
return TranslationBase.of(context).addRadiologyOrder;
|
||||||
|
case ProcedureType.PRESCRIPTION:
|
||||||
|
return TranslationBase.of(context).addPrescription;
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getCategoryId() {
|
||||||
|
switch (this) {
|
||||||
|
case ProcedureType.PROCEDURE:
|
||||||
|
return null;
|
||||||
|
case ProcedureType.LAB_RESULT:
|
||||||
|
return "02";
|
||||||
|
case ProcedureType.RADIOLOGY:
|
||||||
|
return "03";
|
||||||
|
case ProcedureType.PRESCRIPTION:
|
||||||
|
return "55";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getCategoryName() {
|
||||||
|
switch (this) {
|
||||||
|
case ProcedureType.PROCEDURE:
|
||||||
|
return null;
|
||||||
|
case ProcedureType.LAB_RESULT:
|
||||||
|
return "Laboratory";
|
||||||
|
case ProcedureType.RADIOLOGY:
|
||||||
|
return "Radiology";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,355 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/procedure_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/dr_app_toast_msg.dart';
|
|
||||||
import 'package:doctor_app_flutter/util/helpers.dart';
|
|
||||||
import 'package:doctor_app_flutter/util/translations_delegate_base.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/buttons/app_buttons_widget.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'entity_list_checkbox_search_widget.dart';
|
|
||||||
|
|
||||||
valdateProcedure(ProcedureViewModel model, PatiantInformtion patient,
|
|
||||||
List<EntityList> entityList) async {
|
|
||||||
ProcedureValadteRequestModel procedureValadteRequestModel =
|
|
||||||
new ProcedureValadteRequestModel();
|
|
||||||
|
|
||||||
procedureValadteRequestModel.patientMRN = patient.appointmentNo;
|
|
||||||
procedureValadteRequestModel.episodeID = patient.episodeNo;
|
|
||||||
procedureValadteRequestModel.appointmentNo = patient.appointmentNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
postProcedure(
|
|
||||||
{ProcedureViewModel model,
|
|
||||||
String remarks,
|
|
||||||
String orderType,
|
|
||||||
PatiantInformtion patient,
|
|
||||||
List<EntityList> entityList}) async {
|
|
||||||
PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel();
|
|
||||||
ProcedureValadteRequestModel procedureValadteRequestModel =
|
|
||||||
new ProcedureValadteRequestModel();
|
|
||||||
procedureValadteRequestModel.patientMRN = patient.patientMRN;
|
|
||||||
procedureValadteRequestModel.episodeID = patient.episodeNo;
|
|
||||||
procedureValadteRequestModel.appointmentNo = patient.appointmentNo;
|
|
||||||
|
|
||||||
List<Procedures> controlsProcedure = List();
|
|
||||||
|
|
||||||
postProcedureReqModel.appointmentNo = patient.appointmentNo;
|
|
||||||
|
|
||||||
postProcedureReqModel.episodeID = patient.episodeNo;
|
|
||||||
postProcedureReqModel.patientMRN = patient.patientMRN;
|
|
||||||
|
|
||||||
entityList.forEach((element) {
|
|
||||||
procedureValadteRequestModel.procedure = [element.procedureId];
|
|
||||||
List<Controls> controls = List();
|
|
||||||
controls.add(
|
|
||||||
Controls(
|
|
||||||
code: "remarks",
|
|
||||||
controlValue: element.remarks != null ? element.remarks : ""),
|
|
||||||
);
|
|
||||||
controls.add(
|
|
||||||
Controls(code: "ordertype", controlValue: element.type ?? "1"),
|
|
||||||
);
|
|
||||||
controlsProcedure.add(Procedures(
|
|
||||||
category: element.categoryID,
|
|
||||||
procedure: element.procedureId,
|
|
||||||
controls: controls));
|
|
||||||
});
|
|
||||||
|
|
||||||
postProcedureReqModel.procedures = controlsProcedure;
|
|
||||||
await model.valadteProcedure(procedureValadteRequestModel);
|
|
||||||
if (model.state == ViewState.Idle) {
|
|
||||||
if (model.valadteProcedureList[0].entityList.length == 0) {
|
|
||||||
await model.postProcedure(postProcedureReqModel, patient.patientMRN);
|
|
||||||
|
|
||||||
if (model.state == ViewState.ErrorLocal) {
|
|
||||||
Helpers.showErrorToast(model.error);
|
|
||||||
model.getProcedure(mrn: patient.patientMRN);
|
|
||||||
} else if (model.state == ViewState.Idle) {
|
|
||||||
DrAppToastMsg.showSuccesToast('procedure has been added');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (model.state == ViewState.ErrorLocal) {
|
|
||||||
Helpers.showErrorToast(model.error);
|
|
||||||
model.getProcedure(mrn: patient.patientMRN);
|
|
||||||
} else if (model.state == ViewState.Idle) {
|
|
||||||
Helpers.showErrorToast(
|
|
||||||
model.valadteProcedureList[0].entityList[0].warringMessages);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Helpers.showErrorToast(model.error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void addSelectedProcedure(
|
|
||||||
context, ProcedureViewModel model, PatiantInformtion patient) {
|
|
||||||
showModalBottomSheet(
|
|
||||||
context: context,
|
|
||||||
isScrollControlled: true,
|
|
||||||
builder: (BuildContext bc) {
|
|
||||||
return AddSelectedProcedure(
|
|
||||||
model: model,
|
|
||||||
patient: patient,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
class AddSelectedProcedure extends StatefulWidget {
|
|
||||||
final ProcedureViewModel model;
|
|
||||||
final PatiantInformtion patient;
|
|
||||||
|
|
||||||
const AddSelectedProcedure({Key key, this.model, this.patient})
|
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_AddSelectedProcedureState createState() =>
|
|
||||||
_AddSelectedProcedureState(patient: patient, model: model);
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
|
|
||||||
int selectedType;
|
|
||||||
ProcedureViewModel model;
|
|
||||||
PatiantInformtion patient;
|
|
||||||
|
|
||||||
_AddSelectedProcedureState({this.patient, this.model});
|
|
||||||
|
|
||||||
TextEditingController procedureController = TextEditingController();
|
|
||||||
TextEditingController remarksController = TextEditingController();
|
|
||||||
List<EntityList> entityList = List();
|
|
||||||
List<EntityList> entityListProcedure = List();
|
|
||||||
TextEditingController procedureName = TextEditingController();
|
|
||||||
|
|
||||||
dynamic selectedCategory;
|
|
||||||
|
|
||||||
setSelectedType(int val) {
|
|
||||||
setState(() {
|
|
||||||
selectedType = val;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return BaseView<ProcedureViewModel>(
|
|
||||||
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
|
||||||
AppScaffold(
|
|
||||||
isShowAppBar: false,
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
height: MediaQuery.of(context).size.height * 0.070,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: NetworkBaseView(
|
|
||||||
baseViewModel: model,
|
|
||||||
child: DraggableScrollableSheet(
|
|
||||||
minChildSize: 0.90,
|
|
||||||
initialChildSize: 0.95,
|
|
||||||
maxChildSize: 1.0,
|
|
||||||
builder: (BuildContext context,
|
|
||||||
ScrollController scrollController) {
|
|
||||||
return SingleChildScrollView(
|
|
||||||
child: Container(
|
|
||||||
height: MediaQuery.of(context).size.height * 1.20,
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(12.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
AppText(
|
|
||||||
TranslationBase.of(context)
|
|
||||||
.pleaseEnterProcedure,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 20,
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
SizedBox(
|
|
||||||
height:
|
|
||||||
MediaQuery.of(context).size.height * 0.04,
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: MediaQuery.of(context).size.width *
|
|
||||||
0.79,
|
|
||||||
child: AppTextFieldCustom(
|
|
||||||
hintText: TranslationBase.of(context)
|
|
||||||
.searchProcedureHere,
|
|
||||||
isTextFieldHasSuffix: false,
|
|
||||||
|
|
||||||
maxLines: 1,
|
|
||||||
minLines: 1,
|
|
||||||
hasBorder: true,
|
|
||||||
controller: procedureName,
|
|
||||||
// onSubmitted: (_) {
|
|
||||||
// model.getProcedureCategory(
|
|
||||||
// categoryName: procedureName.text);
|
|
||||||
// },
|
|
||||||
onClick: () {
|
|
||||||
if (procedureName.text.isNotEmpty &&
|
|
||||||
procedureName.text.length >= 3)
|
|
||||||
model.getProcedureCategory(
|
|
||||||
patientId: patient.patientId,
|
|
||||||
categoryName:
|
|
||||||
procedureName.text);
|
|
||||||
else
|
|
||||||
DrAppToastMsg.showErrorToast(
|
|
||||||
TranslationBase.of(context)
|
|
||||||
.atLeastThreeCharacters,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: MediaQuery.of(context).size.width *
|
|
||||||
0.02,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
if (procedureName.text.isNotEmpty &&
|
|
||||||
procedureName.text.length >= 3)
|
|
||||||
model.getProcedureCategory(
|
|
||||||
patientId: patient.patientId,
|
|
||||||
categoryName: procedureName.text);
|
|
||||||
else
|
|
||||||
DrAppToastMsg.showErrorToast(
|
|
||||||
TranslationBase.of(context)
|
|
||||||
.atLeastThreeCharacters,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Icon(
|
|
||||||
Icons.search,
|
|
||||||
size: 25.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
if (procedureName.text.isNotEmpty &&
|
|
||||||
model.procedureList.length != 0)
|
|
||||||
NetworkBaseView(
|
|
||||||
baseViewModel: model,
|
|
||||||
child: EntityListCheckboxSearchWidget(
|
|
||||||
model: widget.model,
|
|
||||||
masterList: widget
|
|
||||||
.model.categoriesList[0].entityList,
|
|
||||||
removeHistory: (item) {
|
|
||||||
setState(() {
|
|
||||||
entityList.remove(item);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addHistory: (history) {
|
|
||||||
setState(() {
|
|
||||||
entityList.add(history);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addSelectedHistories: () {
|
|
||||||
//TODO build your fun herr
|
|
||||||
// widget.addSelectedHistories();
|
|
||||||
},
|
|
||||||
isEntityListSelected: (master) =>
|
|
||||||
isEntityListSelected(master),
|
|
||||||
)),
|
|
||||||
SizedBox(
|
|
||||||
height: 115.0,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
|
||||||
child: Wrap(
|
|
||||||
alignment: WrapAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
AppButton(
|
|
||||||
title: TranslationBase.of(context).addSelectedProcedures,
|
|
||||||
color: Color(0xff359846),
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
onPressed: () {
|
|
||||||
if (entityList.isEmpty == true) {
|
|
||||||
DrAppToastMsg.showErrorToast(
|
|
||||||
TranslationBase.of(context)
|
|
||||||
.fillTheMandatoryProcedureDetails,
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Navigator.pop(context);
|
|
||||||
postProcedure(
|
|
||||||
orderType: selectedType.toString(),
|
|
||||||
entityList: entityList,
|
|
||||||
patient: patient,
|
|
||||||
model: widget.model,
|
|
||||||
remarks: remarksController.text);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isEntityListSelected(EntityList masterKey) {
|
|
||||||
Iterable<EntityList> history = entityList
|
|
||||||
.where((element) => masterKey.procedureId == element.procedureId);
|
|
||||||
if (history.length > 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
InputDecoration textFieldSelectorDecoration(
|
|
||||||
String hintText, String selectedText, bool isDropDown,
|
|
||||||
{Icon suffixIcon}) {
|
|
||||||
return InputDecoration(
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
enabledBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
disabledBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
hintText: selectedText != null ? selectedText : hintText,
|
|
||||||
suffixIcon: isDropDown
|
|
||||||
? suffixIcon != null
|
|
||||||
? suffixIcon
|
|
||||||
: Icon(
|
|
||||||
Icons.arrow_drop_down,
|
|
||||||
color: Colors.black,
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
hintStyle: TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
color: Colors.grey.shade600,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,221 @@
|
|||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||||
|
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/network_base_view.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'ProcedureType.dart';
|
||||||
|
import 'entity_list_checkbox_search_widget.dart';
|
||||||
|
|
||||||
|
class AddProcedurePage extends StatefulWidget {
|
||||||
|
final ProcedureViewModel model;
|
||||||
|
final PatiantInformtion patient;
|
||||||
|
final ProcedureType procedureType;
|
||||||
|
|
||||||
|
const AddProcedurePage(
|
||||||
|
{Key key, this.model, this.patient, @required this.procedureType})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AddProcedurePageState createState() => _AddProcedurePageState(
|
||||||
|
patient: patient, model: model, procedureType: this.procedureType);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddProcedurePageState extends State<AddProcedurePage> {
|
||||||
|
int selectedType;
|
||||||
|
ProcedureViewModel model;
|
||||||
|
PatiantInformtion patient;
|
||||||
|
ProcedureType procedureType;
|
||||||
|
|
||||||
|
_AddProcedurePageState({this.patient, this.model, this.procedureType});
|
||||||
|
|
||||||
|
TextEditingController procedureController = TextEditingController();
|
||||||
|
TextEditingController remarksController = TextEditingController();
|
||||||
|
List<EntityList> entityList = List();
|
||||||
|
List<EntityList> entityListProcedure = List();
|
||||||
|
TextEditingController procedureName = TextEditingController();
|
||||||
|
|
||||||
|
dynamic selectedCategory;
|
||||||
|
|
||||||
|
setSelectedType(int val) {
|
||||||
|
setState(() {
|
||||||
|
selectedType = val;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<ProcedureViewModel>(
|
||||||
|
onModelReady: (model) {
|
||||||
|
model.getProcedureCategory(
|
||||||
|
categoryName: procedureType.getCategoryName(),
|
||||||
|
categoryID: procedureType.getCategoryId(),
|
||||||
|
patientId: patient.patientId);
|
||||||
|
},
|
||||||
|
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
||||||
|
AppScaffold(
|
||||||
|
isShowAppBar: false,
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.070,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Container(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(12.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
if (procedureType == ProcedureType.PROCEDURE)
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
TranslationBase.of(context)
|
||||||
|
.pleaseEnterProcedure,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 20,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height:
|
||||||
|
MediaQuery.of(context).size.height * 0.02,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width *
|
||||||
|
0.79,
|
||||||
|
child: AppTextFieldCustom(
|
||||||
|
hintText: TranslationBase.of(context)
|
||||||
|
.searchProcedureHere,
|
||||||
|
isTextFieldHasSuffix: false,
|
||||||
|
maxLines: 1,
|
||||||
|
minLines: 1,
|
||||||
|
hasBorder: true,
|
||||||
|
controller: procedureName,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: MediaQuery.of(context).size.width *
|
||||||
|
0.02,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
if (procedureName.text.isNotEmpty &&
|
||||||
|
procedureName.text.length >= 3)
|
||||||
|
model.getProcedureCategory(
|
||||||
|
patientId: patient.patientId,
|
||||||
|
categoryName:
|
||||||
|
procedureName.text);
|
||||||
|
else
|
||||||
|
DrAppToastMsg.showErrorToast(
|
||||||
|
TranslationBase.of(context)
|
||||||
|
.atLeastThreeCharacters,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Icon(
|
||||||
|
Icons.search,
|
||||||
|
size: 25.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if ((procedureType == ProcedureType.PROCEDURE
|
||||||
|
? procedureName.text.isNotEmpty
|
||||||
|
: true) &&
|
||||||
|
model.categoriesList.length != 0)
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: EntityListCheckboxSearchWidget(
|
||||||
|
model: widget.model,
|
||||||
|
masterList:
|
||||||
|
model.categoriesList[0].entityList,
|
||||||
|
removeHistory: (item) {
|
||||||
|
setState(() {
|
||||||
|
entityList.remove(item);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addHistory: (history) {
|
||||||
|
setState(() {
|
||||||
|
entityList.add(history);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addSelectedHistories: () {
|
||||||
|
//TODO build your fun herr
|
||||||
|
// widget.addSelectedHistories();
|
||||||
|
},
|
||||||
|
isEntityListSelected: (master) =>
|
||||||
|
isEntityListSelected(master),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
||||||
|
child: Wrap(
|
||||||
|
alignment: WrapAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
AppButton(
|
||||||
|
title: procedureType.getAddButtonTitle(context),
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: Color(0xff359846),
|
||||||
|
onPressed: () async {
|
||||||
|
if (entityList.isEmpty == true) {
|
||||||
|
DrAppToastMsg.showErrorToast(
|
||||||
|
TranslationBase.of(context)
|
||||||
|
.fillTheMandatoryProcedureDetails,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.model.preparePostProcedure(
|
||||||
|
orderType: selectedType.toString(),
|
||||||
|
entityList: entityList,
|
||||||
|
patient: patient,
|
||||||
|
remarks: remarksController.text);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isEntityListSelected(EntityList masterKey) {
|
||||||
|
Iterable<EntityList> history = entityList
|
||||||
|
.where((element) => masterKey.procedureId == element.procedureId);
|
||||||
|
if (history.length > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,218 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/procedure_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/screens/procedures/add-favourite-procedure.dart';
|
|
||||||
import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.dart';
|
|
||||||
import 'package:doctor_app_flutter/util/translations_delegate_base.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/network_base_view.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'add_lab_orders.dart';
|
|
||||||
|
|
||||||
class AddLabHomeScreen extends StatefulWidget {
|
|
||||||
final ProcedureViewModel model;
|
|
||||||
final PatiantInformtion patient;
|
|
||||||
const AddLabHomeScreen({Key key, this.model, this.patient}) : super(key: key);
|
|
||||||
@override
|
|
||||||
_AddLabHomeScreenState createState() =>
|
|
||||||
_AddLabHomeScreenState(patient: patient, model: model);
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AddLabHomeScreenState extends State<AddLabHomeScreen>
|
|
||||||
with SingleTickerProviderStateMixin {
|
|
||||||
_AddLabHomeScreenState({this.patient, this.model});
|
|
||||||
ProcedureViewModel model;
|
|
||||||
PatiantInformtion patient;
|
|
||||||
TabController _tabController;
|
|
||||||
int _activeTab = 0;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_tabController = TabController(length: 2, vsync: this);
|
|
||||||
_tabController.addListener(_handleTabSelection);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
_tabController.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
_handleTabSelection() {
|
|
||||||
setState(() {
|
|
||||||
_activeTab = _tabController.index;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final screenSize = MediaQuery.of(context).size;
|
|
||||||
return BaseView<ProcedureViewModel>(
|
|
||||||
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
|
||||||
AppScaffold(
|
|
||||||
isShowAppBar: false,
|
|
||||||
body: NetworkBaseView(
|
|
||||||
baseViewModel: model,
|
|
||||||
child: DraggableScrollableSheet(
|
|
||||||
minChildSize: 0.90,
|
|
||||||
initialChildSize: 0.95,
|
|
||||||
maxChildSize: 1.0,
|
|
||||||
builder:
|
|
||||||
(BuildContext context, ScrollController scrollController) {
|
|
||||||
return Container(
|
|
||||||
height: MediaQuery.of(context).size.height * 1.20,
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(12.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
AppText(
|
|
||||||
'Add Procedure',
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 20,
|
|
||||||
),
|
|
||||||
InkWell(
|
|
||||||
child: Icon(
|
|
||||||
Icons.close,
|
|
||||||
size: 24.0,
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
SizedBox(
|
|
||||||
height: MediaQuery.of(context).size.height * 0.04,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Scaffold(
|
|
||||||
extendBodyBehindAppBar: true,
|
|
||||||
appBar: PreferredSize(
|
|
||||||
preferredSize: Size.fromHeight(
|
|
||||||
MediaQuery.of(context).size.height * 0.070),
|
|
||||||
child: Container(
|
|
||||||
height:
|
|
||||||
MediaQuery.of(context).size.height * 0.070,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border(
|
|
||||||
bottom: BorderSide(
|
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
width: 0.5), //width: 0.7
|
|
||||||
),
|
|
||||||
color: Colors.white),
|
|
||||||
child: Center(
|
|
||||||
child: TabBar(
|
|
||||||
isScrollable: false,
|
|
||||||
controller: _tabController,
|
|
||||||
indicatorColor: Colors.transparent,
|
|
||||||
indicatorWeight: 1.0,
|
|
||||||
indicatorSize: TabBarIndicatorSize.tab,
|
|
||||||
labelColor: Theme.of(context).primaryColor,
|
|
||||||
labelPadding: EdgeInsets.only(
|
|
||||||
top: 0, left: 0, right: 0, bottom: 0),
|
|
||||||
unselectedLabelColor: Colors.grey[800],
|
|
||||||
tabs: [
|
|
||||||
tabWidget(
|
|
||||||
screenSize,
|
|
||||||
_activeTab == 0,
|
|
||||||
"Favorite Templates",
|
|
||||||
),
|
|
||||||
tabWidget(
|
|
||||||
screenSize,
|
|
||||||
_activeTab == 1,
|
|
||||||
'All Lab',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: TabBarView(
|
|
||||||
physics: BouncingScrollPhysics(),
|
|
||||||
controller: _tabController,
|
|
||||||
children: [
|
|
||||||
AddFavouriteProcedure(
|
|
||||||
patient: patient,
|
|
||||||
model: model,
|
|
||||||
addButtonTitle: TranslationBase.of(context).addLabOrder,
|
|
||||||
toolbarTitle: TranslationBase.of(context).applyForNewLabOrder,
|
|
||||||
categoryID: "02",
|
|
||||||
),
|
|
||||||
AddSelectedLabOrder(
|
|
||||||
model: model,
|
|
||||||
patient: patient,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget tabWidget(Size screenSize, bool isActive, String title,
|
|
||||||
{int counter = -1}) {
|
|
||||||
return Center(
|
|
||||||
child: Container(
|
|
||||||
height: screenSize.height * 0.070,
|
|
||||||
decoration: TextFieldsUtils.containerBorderDecoration(
|
|
||||||
isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA),
|
|
||||||
isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA),
|
|
||||||
borderRadius: 4,
|
|
||||||
borderWidth: 0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
AppText(
|
|
||||||
title,
|
|
||||||
fontSize: SizeConfig.textMultiplier * 1.5,
|
|
||||||
color: isActive ? Colors.white : Color(0xFF2B353E),
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
if (counter != -1)
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.all(4),
|
|
||||||
width: 15,
|
|
||||||
height: 15,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: isActive ? Colors.white : Color(0xFFD02127),
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
child: Center(
|
|
||||||
child: FittedBox(
|
|
||||||
child: AppText(
|
|
||||||
"$counter",
|
|
||||||
fontSize: SizeConfig.textMultiplier * 1.5,
|
|
||||||
color: !isActive ? Colors.white : Color(0xFFD02127),
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,269 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/procedure_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/dr_app_toast_msg.dart';
|
|
||||||
import 'package:doctor_app_flutter/util/helpers.dart';
|
|
||||||
import 'package:doctor_app_flutter/util/translations_delegate_base.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/buttons/app_buttons_widget.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'entity_list_checkbox_search_widget.dart';
|
|
||||||
|
|
||||||
valdateProcedure(ProcedureViewModel model, PatiantInformtion patient,
|
|
||||||
List<EntityList> entityList) async {
|
|
||||||
ProcedureValadteRequestModel procedureValadteRequestModel =
|
|
||||||
new ProcedureValadteRequestModel();
|
|
||||||
|
|
||||||
procedureValadteRequestModel.patientMRN = patient.appointmentNo;
|
|
||||||
procedureValadteRequestModel.episodeID = patient.episodeNo;
|
|
||||||
procedureValadteRequestModel.appointmentNo = patient.appointmentNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
postProcedure(
|
|
||||||
{ProcedureViewModel model,
|
|
||||||
String remarks,
|
|
||||||
String orderType,
|
|
||||||
PatiantInformtion patient,
|
|
||||||
List<EntityList> entityList}) async {
|
|
||||||
PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel();
|
|
||||||
ProcedureValadteRequestModel procedureValadteRequestModel =
|
|
||||||
new ProcedureValadteRequestModel();
|
|
||||||
procedureValadteRequestModel.patientMRN = patient.patientMRN;
|
|
||||||
procedureValadteRequestModel.episodeID = patient.episodeNo;
|
|
||||||
procedureValadteRequestModel.appointmentNo = patient.appointmentNo;
|
|
||||||
|
|
||||||
List<Procedures> controlsProcedure = List();
|
|
||||||
|
|
||||||
postProcedureReqModel.appointmentNo = patient.appointmentNo;
|
|
||||||
|
|
||||||
postProcedureReqModel.episodeID = patient.episodeNo;
|
|
||||||
postProcedureReqModel.patientMRN = patient.patientMRN;
|
|
||||||
|
|
||||||
entityList.forEach((element) {
|
|
||||||
procedureValadteRequestModel.procedure = [element.procedureId];
|
|
||||||
List<Controls> controls = List();
|
|
||||||
controls.add(
|
|
||||||
Controls(
|
|
||||||
code: "remarks",
|
|
||||||
controlValue: element.remarks != null ? element.remarks : ""),
|
|
||||||
);
|
|
||||||
controls.add(
|
|
||||||
Controls(code: "ordertype", controlValue: "0"),
|
|
||||||
);
|
|
||||||
controlsProcedure.add(Procedures(
|
|
||||||
category: element.categoryID,
|
|
||||||
procedure: element.procedureId,
|
|
||||||
controls: controls));
|
|
||||||
});
|
|
||||||
|
|
||||||
postProcedureReqModel.procedures = controlsProcedure;
|
|
||||||
await model.valadteProcedure(procedureValadteRequestModel);
|
|
||||||
if (model.state == ViewState.Idle) {
|
|
||||||
if (model.valadteProcedureList[0].entityList.length == 0) {
|
|
||||||
await model.postProcedure(postProcedureReqModel, patient.patientMRN);
|
|
||||||
|
|
||||||
if (model.state == ViewState.ErrorLocal) {
|
|
||||||
Helpers.showErrorToast(model.error);
|
|
||||||
model.getLabs(patient);
|
|
||||||
} else if (model.state == ViewState.Idle) {
|
|
||||||
DrAppToastMsg.showSuccesToast('procedure has been added');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (model.state == ViewState.ErrorLocal) {
|
|
||||||
Helpers.showErrorToast(model.error);
|
|
||||||
model.getLabs(patient);
|
|
||||||
} else if (model.state == ViewState.Idle) {
|
|
||||||
Helpers.showErrorToast(
|
|
||||||
model.valadteProcedureList[0].entityList[0].warringMessages);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Helpers.showErrorToast(model.error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void addSelectedLabOrder(
|
|
||||||
context, ProcedureViewModel model, PatiantInformtion patient) {
|
|
||||||
showModalBottomSheet(
|
|
||||||
context: context,
|
|
||||||
isScrollControlled: true,
|
|
||||||
builder: (BuildContext bc) {
|
|
||||||
return AddSelectedLabOrder(
|
|
||||||
model: model,
|
|
||||||
patient: patient,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
class AddSelectedLabOrder extends StatefulWidget {
|
|
||||||
final ProcedureViewModel model;
|
|
||||||
final PatiantInformtion patient;
|
|
||||||
|
|
||||||
const AddSelectedLabOrder({Key key, this.model, this.patient})
|
|
||||||
: super(key: key);
|
|
||||||
@override
|
|
||||||
_AddSelectedLabOrderState createState() =>
|
|
||||||
_AddSelectedLabOrderState(patient: patient, model: model);
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AddSelectedLabOrderState extends State<AddSelectedLabOrder> {
|
|
||||||
int selectedType;
|
|
||||||
ProcedureViewModel model;
|
|
||||||
PatiantInformtion patient;
|
|
||||||
_AddSelectedLabOrderState({this.patient, this.model});
|
|
||||||
TextEditingController procedureController = TextEditingController();
|
|
||||||
TextEditingController remarksController = TextEditingController();
|
|
||||||
List<EntityList> entityList = List();
|
|
||||||
List<EntityList> entityListProcedure = List();
|
|
||||||
|
|
||||||
dynamic selectedCategory;
|
|
||||||
|
|
||||||
setSelectedType(int val) {
|
|
||||||
setState(() {
|
|
||||||
selectedType = val;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final screenSize = MediaQuery.of(context).size;
|
|
||||||
return BaseView<ProcedureViewModel>(
|
|
||||||
onModelReady: (model) => model.getProcedureCategory(
|
|
||||||
categoryName: "Laboratory", categoryID: "02",patientId: patient.patientId),
|
|
||||||
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
|
||||||
AppScaffold(
|
|
||||||
isShowAppBar: false,
|
|
||||||
body: NetworkBaseView(
|
|
||||||
baseViewModel: model,
|
|
||||||
child: DraggableScrollableSheet(
|
|
||||||
minChildSize: 0.90,
|
|
||||||
initialChildSize: 0.95,
|
|
||||||
maxChildSize: 1.0,
|
|
||||||
builder:
|
|
||||||
(BuildContext context, ScrollController scrollController) {
|
|
||||||
return SingleChildScrollView(
|
|
||||||
child: Container(
|
|
||||||
height: MediaQuery.of(context).size.height * .90,
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(12.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
height: 10.0,
|
|
||||||
),
|
|
||||||
if (widget.model.categoriesList.length != 0)
|
|
||||||
NetworkBaseView(
|
|
||||||
baseViewModel: model,
|
|
||||||
child: EntityListCheckboxSearchWidget(
|
|
||||||
model: widget.model,
|
|
||||||
masterList:
|
|
||||||
widget.model.categoriesList[0].entityList,
|
|
||||||
removeHistory: (item) {
|
|
||||||
setState(() {
|
|
||||||
entityList.remove(item);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addHistory: (history) {
|
|
||||||
setState(() {
|
|
||||||
entityList.add(history);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addSelectedHistories: () {
|
|
||||||
//TODO build your fun herr
|
|
||||||
// widget.addSelectedHistories();
|
|
||||||
},
|
|
||||||
isEntityListSelected: (master) =>
|
|
||||||
isEntityListSelected(master),
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
bottomSheet: Container(
|
|
||||||
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
|
||||||
child: Wrap(
|
|
||||||
alignment: WrapAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
AppButton(
|
|
||||||
title: TranslationBase.of(context).addLabOrder,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: Color(0xff359846),
|
|
||||||
onPressed: () {
|
|
||||||
if (entityList.isEmpty == true) {
|
|
||||||
DrAppToastMsg.showErrorToast(
|
|
||||||
TranslationBase.of(context)
|
|
||||||
.fillTheMandatoryProcedureDetails,
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Navigator.pop(context);
|
|
||||||
postProcedure(
|
|
||||||
orderType: selectedType.toString(),
|
|
||||||
entityList: entityList,
|
|
||||||
patient: patient,
|
|
||||||
model: widget.model,
|
|
||||||
remarks: remarksController.text);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isEntityListSelected(EntityList masterKey) {
|
|
||||||
Iterable<EntityList> history = entityList
|
|
||||||
.where((element) => masterKey.procedureId == element.procedureId);
|
|
||||||
if (history.length > 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
InputDecoration textFieldSelectorDecoration(
|
|
||||||
String hintText, String selectedText, bool isDropDown,
|
|
||||||
{Icon suffixIcon}) {
|
|
||||||
return InputDecoration(
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
enabledBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
disabledBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
hintText: selectedText != null ? selectedText : hintText,
|
|
||||||
suffixIcon: isDropDown
|
|
||||||
? suffixIcon != null
|
|
||||||
? suffixIcon
|
|
||||||
: Icon(
|
|
||||||
Icons.arrow_drop_down,
|
|
||||||
color: Colors.black,
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
hintStyle: TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
color: Colors.grey.shade600,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,270 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/procedure_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/dr_app_toast_msg.dart';
|
|
||||||
import 'package:doctor_app_flutter/util/helpers.dart';
|
|
||||||
import 'package:doctor_app_flutter/util/translations_delegate_base.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/buttons/app_buttons_widget.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'entity_list_checkbox_search_widget.dart';
|
|
||||||
|
|
||||||
valdateProcedure(ProcedureViewModel model, PatiantInformtion patient,
|
|
||||||
List<EntityList> entityList) async {
|
|
||||||
ProcedureValadteRequestModel procedureValadteRequestModel =
|
|
||||||
new ProcedureValadteRequestModel();
|
|
||||||
|
|
||||||
procedureValadteRequestModel.patientMRN = patient.appointmentNo;
|
|
||||||
procedureValadteRequestModel.episodeID = patient.episodeNo;
|
|
||||||
procedureValadteRequestModel.appointmentNo = patient.appointmentNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
postProcedure(
|
|
||||||
{ProcedureViewModel model,
|
|
||||||
String remarks,
|
|
||||||
String orderType,
|
|
||||||
PatiantInformtion patient,
|
|
||||||
List<EntityList> entityList}) async {
|
|
||||||
PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel();
|
|
||||||
ProcedureValadteRequestModel procedureValadteRequestModel =
|
|
||||||
new ProcedureValadteRequestModel();
|
|
||||||
procedureValadteRequestModel.patientMRN = patient.patientMRN;
|
|
||||||
procedureValadteRequestModel.episodeID = patient.episodeNo;
|
|
||||||
procedureValadteRequestModel.appointmentNo = patient.appointmentNo;
|
|
||||||
|
|
||||||
List<Procedures> controlsProcedure = List();
|
|
||||||
|
|
||||||
postProcedureReqModel.appointmentNo = patient.appointmentNo;
|
|
||||||
|
|
||||||
postProcedureReqModel.episodeID = patient.episodeNo;
|
|
||||||
postProcedureReqModel.patientMRN = patient.patientMRN;
|
|
||||||
|
|
||||||
entityList.forEach((element) {
|
|
||||||
procedureValadteRequestModel.procedure = [element.procedureId];
|
|
||||||
List<Controls> controls = List();
|
|
||||||
controls.add(
|
|
||||||
Controls(
|
|
||||||
code: "remarks",
|
|
||||||
controlValue: element.remarks != null ? element.remarks : ""),
|
|
||||||
);
|
|
||||||
controls.add(
|
|
||||||
Controls(code: "ordertype", controlValue: "0"),
|
|
||||||
);
|
|
||||||
controlsProcedure.add(Procedures(
|
|
||||||
category: element.categoryID,
|
|
||||||
procedure: element.procedureId,
|
|
||||||
controls: controls));
|
|
||||||
});
|
|
||||||
|
|
||||||
postProcedureReqModel.procedures = controlsProcedure;
|
|
||||||
await model.valadteProcedure(procedureValadteRequestModel);
|
|
||||||
if (model.state == ViewState.Idle) {
|
|
||||||
if (model.valadteProcedureList[0].entityList.length == 0) {
|
|
||||||
await model.postProcedure(postProcedureReqModel, patient.patientMRN);
|
|
||||||
|
|
||||||
if (model.state == ViewState.ErrorLocal) {
|
|
||||||
Helpers.showErrorToast(model.error);
|
|
||||||
model.getPatientRadOrders(patient);
|
|
||||||
} else if (model.state == ViewState.Idle) {
|
|
||||||
DrAppToastMsg.showSuccesToast('procedure has been added');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (model.state == ViewState.ErrorLocal) {
|
|
||||||
Helpers.showErrorToast(model.error);
|
|
||||||
model.getPatientRadOrders(patient);
|
|
||||||
} else if (model.state == ViewState.Idle) {
|
|
||||||
Helpers.showErrorToast(
|
|
||||||
model.valadteProcedureList[0].entityList[0].warringMessages);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Helpers.showErrorToast(model.error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void addSelectedRadiologyOrder(
|
|
||||||
context, ProcedureViewModel model, PatiantInformtion patient) {
|
|
||||||
showModalBottomSheet(
|
|
||||||
context: context,
|
|
||||||
isScrollControlled: true,
|
|
||||||
builder: (BuildContext bc) {
|
|
||||||
return AddSelectedRadiologyOrder(
|
|
||||||
model: model,
|
|
||||||
patient: patient,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
class AddSelectedRadiologyOrder extends StatefulWidget {
|
|
||||||
final ProcedureViewModel model;
|
|
||||||
final PatiantInformtion patient;
|
|
||||||
|
|
||||||
const AddSelectedRadiologyOrder({Key key, this.model, this.patient})
|
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_AddSelectedRadiologyOrderState createState() =>
|
|
||||||
_AddSelectedRadiologyOrderState(patient: patient, model: model);
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AddSelectedRadiologyOrderState extends State<AddSelectedRadiologyOrder> {
|
|
||||||
int selectedType;
|
|
||||||
ProcedureViewModel model;
|
|
||||||
PatiantInformtion patient;
|
|
||||||
|
|
||||||
_AddSelectedRadiologyOrderState({this.patient, this.model});
|
|
||||||
|
|
||||||
TextEditingController procedureController = TextEditingController();
|
|
||||||
TextEditingController remarksController = TextEditingController();
|
|
||||||
List<EntityList> entityList = List();
|
|
||||||
List<EntityList> entityListProcedure = List();
|
|
||||||
|
|
||||||
dynamic selectedCategory;
|
|
||||||
|
|
||||||
setSelectedType(int val) {
|
|
||||||
setState(() {
|
|
||||||
selectedType = val;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final screenSize = MediaQuery.of(context).size;
|
|
||||||
return BaseView<ProcedureViewModel>(
|
|
||||||
onModelReady: (model) => model.getProcedureCategory(
|
|
||||||
categoryName: "Radiology", categoryID: "03",patientId: patient.patientId),
|
|
||||||
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
|
||||||
AppScaffold(
|
|
||||||
isShowAppBar: false,
|
|
||||||
body: NetworkBaseView(
|
|
||||||
baseViewModel: model,
|
|
||||||
child: DraggableScrollableSheet(
|
|
||||||
minChildSize: 0.90,
|
|
||||||
initialChildSize: 0.95,
|
|
||||||
maxChildSize: 1.0,
|
|
||||||
builder:
|
|
||||||
(BuildContext context, ScrollController scrollController) {
|
|
||||||
return SingleChildScrollView(
|
|
||||||
child: Container(
|
|
||||||
height: MediaQuery.of(context).size.height * 1.0,
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(12.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
height: 10.0,
|
|
||||||
),
|
|
||||||
if (widget.model.categoriesList.length != 0)
|
|
||||||
NetworkBaseView(
|
|
||||||
baseViewModel: model,
|
|
||||||
child: EntityListCheckboxSearchWidget(
|
|
||||||
model: widget.model,
|
|
||||||
masterList:
|
|
||||||
widget.model.categoriesList[0].entityList,
|
|
||||||
removeHistory: (item) {
|
|
||||||
setState(() {
|
|
||||||
entityList.remove(item);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addHistory: (history) {
|
|
||||||
setState(() {
|
|
||||||
entityList.add(history);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addSelectedHistories: () {
|
|
||||||
//TODO build your fun herr
|
|
||||||
// widget.addSelectedHistories();
|
|
||||||
},
|
|
||||||
isEntityListSelected: (master) =>
|
|
||||||
isEntityListSelected(master),
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
bottomSheet: Container(
|
|
||||||
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
|
||||||
child: Wrap(
|
|
||||||
alignment: WrapAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
AppButton(
|
|
||||||
title: TranslationBase.of(context).addRadiologyOrder,
|
|
||||||
color: Color(0xff359846),
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
onPressed: () {
|
|
||||||
if (entityList.isEmpty == true) {
|
|
||||||
DrAppToastMsg.showErrorToast(TranslationBase.of(context)
|
|
||||||
.fillTheMandatoryProcedureDetails);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Navigator.pop(context);
|
|
||||||
postProcedure(
|
|
||||||
orderType: selectedType.toString(),
|
|
||||||
entityList: entityList,
|
|
||||||
patient: patient,
|
|
||||||
model: widget.model,
|
|
||||||
remarks: remarksController.text);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isEntityListSelected(EntityList masterKey) {
|
|
||||||
Iterable<EntityList> history = entityList
|
|
||||||
.where((element) => masterKey.procedureId == element.procedureId);
|
|
||||||
if (history.length > 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
InputDecoration textFieldSelectorDecoration(
|
|
||||||
String hintText, String selectedText, bool isDropDown,
|
|
||||||
{Icon suffixIcon}) {
|
|
||||||
return InputDecoration(
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
enabledBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
disabledBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
hintText: selectedText != null ? selectedText : hintText,
|
|
||||||
suffixIcon: isDropDown
|
|
||||||
? suffixIcon != null
|
|
||||||
? suffixIcon
|
|
||||||
: Icon(
|
|
||||||
Icons.arrow_drop_down,
|
|
||||||
color: Colors.black,
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
hintStyle: TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
color: Colors.grey.shade600,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,219 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/procedure_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/screens/procedures/add-favourite-procedure.dart';
|
|
||||||
import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.dart';
|
|
||||||
import 'package:doctor_app_flutter/util/translations_delegate_base.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/network_base_view.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'add_lab_orders.dart';
|
|
||||||
import 'add_radiology_order.dart';
|
|
||||||
|
|
||||||
class AddRadiologyScreen extends StatefulWidget {
|
|
||||||
final ProcedureViewModel model;
|
|
||||||
final PatiantInformtion patient;
|
|
||||||
const AddRadiologyScreen({Key key, this.model, this.patient}) : super(key: key);
|
|
||||||
@override
|
|
||||||
_AddRadiologyScreenState createState() =>
|
|
||||||
_AddRadiologyScreenState(patient: patient, model: model);
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AddRadiologyScreenState extends State<AddRadiologyScreen>
|
|
||||||
with SingleTickerProviderStateMixin {
|
|
||||||
_AddRadiologyScreenState({this.patient, this.model});
|
|
||||||
ProcedureViewModel model;
|
|
||||||
PatiantInformtion patient;
|
|
||||||
TabController _tabController;
|
|
||||||
int _activeTab = 0;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_tabController = TabController(length: 2, vsync: this);
|
|
||||||
_tabController.addListener(_handleTabSelection);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
_tabController.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
_handleTabSelection() {
|
|
||||||
setState(() {
|
|
||||||
_activeTab = _tabController.index;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final screenSize = MediaQuery.of(context).size;
|
|
||||||
return BaseView<ProcedureViewModel>(
|
|
||||||
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
|
||||||
AppScaffold(
|
|
||||||
isShowAppBar: false,
|
|
||||||
body: NetworkBaseView(
|
|
||||||
baseViewModel: model,
|
|
||||||
child: DraggableScrollableSheet(
|
|
||||||
minChildSize: 0.90,
|
|
||||||
initialChildSize: 0.95,
|
|
||||||
maxChildSize: 1.0,
|
|
||||||
builder:
|
|
||||||
(BuildContext context, ScrollController scrollController) {
|
|
||||||
return Container(
|
|
||||||
height: MediaQuery.of(context).size.height * 1.20,
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(12.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
AppText(
|
|
||||||
TranslationBase.of(context).addRadiologyOrder,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 20,
|
|
||||||
),
|
|
||||||
InkWell(
|
|
||||||
child: Icon(
|
|
||||||
Icons.close,
|
|
||||||
size: 24.0,
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
SizedBox(
|
|
||||||
height: MediaQuery.of(context).size.height * 0.04,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Scaffold(
|
|
||||||
extendBodyBehindAppBar: true,
|
|
||||||
appBar: PreferredSize(
|
|
||||||
preferredSize: Size.fromHeight(
|
|
||||||
MediaQuery.of(context).size.height * 0.070),
|
|
||||||
child: Container(
|
|
||||||
height:
|
|
||||||
MediaQuery.of(context).size.height * 0.070,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border(
|
|
||||||
bottom: BorderSide(
|
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
width: 0.5), //width: 0.7
|
|
||||||
),
|
|
||||||
color: Colors.white),
|
|
||||||
child: Center(
|
|
||||||
child: TabBar(
|
|
||||||
isScrollable: false,
|
|
||||||
controller: _tabController,
|
|
||||||
indicatorColor: Colors.transparent,
|
|
||||||
indicatorWeight: 1.0,
|
|
||||||
indicatorSize: TabBarIndicatorSize.tab,
|
|
||||||
labelColor: Theme.of(context).primaryColor,
|
|
||||||
labelPadding: EdgeInsets.only(
|
|
||||||
top: 0, left: 0, right: 0, bottom: 0),
|
|
||||||
unselectedLabelColor: Colors.grey[800],
|
|
||||||
tabs: [
|
|
||||||
tabWidget(
|
|
||||||
screenSize,
|
|
||||||
_activeTab == 0,
|
|
||||||
"Favorite Templates",
|
|
||||||
),
|
|
||||||
tabWidget(
|
|
||||||
screenSize,
|
|
||||||
_activeTab == 1,
|
|
||||||
'All Radiology',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: TabBarView(
|
|
||||||
physics: BouncingScrollPhysics(),
|
|
||||||
controller: _tabController,
|
|
||||||
children: [
|
|
||||||
AddFavouriteProcedure(
|
|
||||||
patient: patient,
|
|
||||||
model: model,
|
|
||||||
addButtonTitle: TranslationBase.of(context).addRadiologyOrder,
|
|
||||||
toolbarTitle: TranslationBase.of(context).addRadiologyOrder,
|
|
||||||
categoryID: "03",
|
|
||||||
),
|
|
||||||
AddSelectedRadiologyOrder(
|
|
||||||
model: model,
|
|
||||||
patient: patient,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget tabWidget(Size screenSize, bool isActive, String title,
|
|
||||||
{int counter = -1}) {
|
|
||||||
return Center(
|
|
||||||
child: Container(
|
|
||||||
height: screenSize.height * 0.070,
|
|
||||||
decoration: TextFieldsUtils.containerBorderDecoration(
|
|
||||||
isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA),
|
|
||||||
isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA),
|
|
||||||
borderRadius: 4,
|
|
||||||
borderWidth: 0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
AppText(
|
|
||||||
title,
|
|
||||||
fontSize: SizeConfig.textMultiplier * 1.5,
|
|
||||||
color: isActive ? Colors.white : Color(0xFF2B353E),
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
if (counter != -1)
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.all(4),
|
|
||||||
width: 15,
|
|
||||||
height: 15,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: isActive ? Colors.white : Color(0xFFD02127),
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
child: Center(
|
|
||||||
child: FittedBox(
|
|
||||||
child: AppText(
|
|
||||||
"$counter",
|
|
||||||
fontSize: SizeConfig.textMultiplier * 1.5,
|
|
||||||
color: !isActive ? Colors.white : Color(0xFFD02127),
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,168 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
|
||||||
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
|
||||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart';
|
|
||||||
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
|
||||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class ProcedureListWidget extends StatefulWidget {
|
|
||||||
final ProcedureViewModel model;
|
|
||||||
final Function addSelectedHistories;
|
|
||||||
final Function(EntityList) removeHistory;
|
|
||||||
final Function(EntityList) addHistory;
|
|
||||||
final Function(EntityList) addRemarks;
|
|
||||||
|
|
||||||
final bool Function(EntityList) isEntityListSelected;
|
|
||||||
final List<EntityList> masterList;
|
|
||||||
|
|
||||||
ProcedureListWidget(
|
|
||||||
{Key key,
|
|
||||||
this.model,
|
|
||||||
this.addSelectedHistories,
|
|
||||||
this.removeHistory,
|
|
||||||
this.masterList,
|
|
||||||
this.addHistory,
|
|
||||||
this.isEntityListSelected,
|
|
||||||
this.addRemarks})
|
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_ProcedureListWidgetState createState() => _ProcedureListWidgetState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ProcedureListWidgetState extends State<ProcedureListWidget> {
|
|
||||||
int selectedType = 0;
|
|
||||||
int typeUrgent;
|
|
||||||
int typeRegular;
|
|
||||||
|
|
||||||
setSelectedType(int val) {
|
|
||||||
setState(() {
|
|
||||||
selectedType = val;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
List<EntityList> items = List();
|
|
||||||
List<String> remarksList = List();
|
|
||||||
List<int> typeList = List();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
items.addAll(widget.masterList);
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
TextEditingController remarksController = TextEditingController();
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
NetworkBaseView(
|
|
||||||
baseViewModel: widget.model,
|
|
||||||
child: Container(
|
|
||||||
height: MediaQuery.of(context).size.height * 0.75,
|
|
||||||
child: Center(
|
|
||||||
child: Container(
|
|
||||||
margin: EdgeInsets.only(top: 15),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
color: Colors.white),
|
|
||||||
child: ListView(
|
|
||||||
children: [
|
|
||||||
TextFields(
|
|
||||||
hintText: TranslationBase.of(context).searchProcedures,
|
|
||||||
suffixIcon: EvaIcons.search,
|
|
||||||
onChanged: (value) {
|
|
||||||
filterSearchResults(value);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
items.length != 0
|
|
||||||
? Column(
|
|
||||||
children: items.map((historyInfo) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Checkbox(
|
|
||||||
value: widget.isEntityListSelected(
|
|
||||||
historyInfo),
|
|
||||||
activeColor: Colors.red[800],
|
|
||||||
onChanged: (bool newValue) {
|
|
||||||
setState(() {
|
|
||||||
if (widget.isEntityListSelected(
|
|
||||||
historyInfo)) {
|
|
||||||
widget
|
|
||||||
.removeHistory(historyInfo);
|
|
||||||
} else {
|
|
||||||
widget.addHistory(historyInfo);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
Expanded(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 10, vertical: 0),
|
|
||||||
child: AppText(
|
|
||||||
historyInfo.procedureName,
|
|
||||||
variant: "bodyText",
|
|
||||||
bold: true,
|
|
||||||
color: Colors.black),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
DividerWithSpacesAround(),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}).toList(),
|
|
||||||
)
|
|
||||||
: Center(
|
|
||||||
child: Container(
|
|
||||||
child: AppText(
|
|
||||||
"There's no procedures for this category",
|
|
||||||
color: Color(0xFFB9382C)),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void filterSearchResults(String query) {
|
|
||||||
List<EntityList> dummySearchList = List();
|
|
||||||
dummySearchList.addAll(widget.masterList);
|
|
||||||
if (query.isNotEmpty) {
|
|
||||||
List<EntityList> dummyListData = List();
|
|
||||||
dummySearchList.forEach((item) {
|
|
||||||
if (item.procedureName.toLowerCase().contains(query.toLowerCase())) {
|
|
||||||
dummyListData.add(item);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
setState(() {
|
|
||||||
items.clear();
|
|
||||||
items.addAll(dummyListData);
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
setState(() {
|
|
||||||
items.clear();
|
|
||||||
items.addAll(widget.masterList);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue