Merge branch 'design-updates' into 'development'

post prescription

See merge request Cloud_Solution/doctor_app_flutter!203
merge-requests/209/head
Elham 4 years ago
commit 88c2c04d68

@ -136,7 +136,7 @@ const POST_ASSESSMENT =
'Services/DoctorApplication.svc/REST/PostAssessment';
const GET_CATEGORISE_PROCEDURE =
'Services/DoctorApplication.svc/REST/GetCategories';
'Services/DoctorApplication.svc/REST/GetProcedure';
var selectedPatientType = 1;

@ -7,12 +7,11 @@ class PostPrescriptionReqModel {
List<PrescriptionRequestModel> prescriptionRequestModel;
PostPrescriptionReqModel(
{this.vidaAuthTokenID =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiYTYxZjAyZjItNzUwZS00MTZkLWEzOTQtZTRjZmViZGVjMDE5IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUzNTIiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODUzMDAyNywiZXhwIjoxNjA5Mzk0MDI3LCJpYXQiOjE2MDg1MzAwMjd9.M1NTREPgz5vQH_GTZ_KGb0xQW5HEDs47AtNR3jbqnms",
this.clinicID = 1,
this.episodeID = 200012117,
this.appointmentNo = 2016054573,
this.patientMRN = 3120690,
{this.vidaAuthTokenID,
this.clinicID,
this.episodeID,
this.appointmentNo,
this.patientMRN,
this.prescriptionRequestModel});
PostPrescriptionReqModel.fromJson(Map<String, dynamic> json) {
@ -58,19 +57,20 @@ class PrescriptionRequestModel {
String remarks;
String icdcode10Id;
PrescriptionRequestModel(
{this.itemId = 4,
this.doseStartDate = "2020-12-20T13:07:41.769Z",
this.duration = 2,
this.dose = 1,
this.doseUnitId = 1,
this.route = 1,
this.frequency = 1,
this.doseTime = 1,
this.covered = true,
this.approvalRequired = true,
this.remarks = "test1",
this.icdcode10Id = "test3"});
PrescriptionRequestModel({
this.itemId,
this.doseStartDate,
this.duration,
this.dose,
this.doseUnitId,
this.route,
this.frequency,
this.doseTime,
this.covered,
this.approvalRequired,
this.remarks,
this.icdcode10Id,
});
PrescriptionRequestModel.fromJson(Map<String, dynamic> json) {
itemId = json['itemId'];

@ -1,18 +1,90 @@
class CategoriseProcedureModel {
String categoryID;
String categoryName;
List<EntityList> entityList;
int rowcount;
dynamic statusMessage;
CategoriseProcedureModel({this.categoryID, this.categoryName});
CategoriseProcedureModel(
{this.entityList, this.rowcount, this.statusMessage});
CategoriseProcedureModel.fromJson(Map<String, dynamic> json) {
categoryID = json['CategoryID'];
categoryName = json['CategoryName'];
if (json['entityList'] != null) {
entityList = new List<EntityList>();
json['entityList'].forEach((v) {
entityList.add(new EntityList.fromJson(v));
});
}
rowcount = json['rowcount'];
statusMessage = json['statusMessage'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.entityList != null) {
data['entityList'] = this.entityList.map((v) => v.toJson()).toList();
}
data['rowcount'] = this.rowcount;
data['statusMessage'] = this.statusMessage;
return data;
}
}
class EntityList {
bool allowedClinic;
String category;
String categoryID;
String genderValidation;
String group;
String orderedValidation;
dynamic price;
String procedureId;
String procedureName;
String specialPermission;
String subGroup;
String template;
EntityList(
{this.allowedClinic,
this.category,
this.categoryID,
this.genderValidation,
this.group,
this.orderedValidation,
this.price,
this.procedureId,
this.procedureName,
this.specialPermission,
this.subGroup,
this.template});
EntityList.fromJson(Map<String, dynamic> json) {
allowedClinic = json['allowedClinic'];
category = json['category'];
categoryID = json['categoryID'];
genderValidation = json['genderValidation'];
group = json['group'];
orderedValidation = json['orderedValidation'];
price = json['price'];
procedureId = json['procedureId'];
procedureName = json['procedureName'];
specialPermission = json['specialPermission'];
subGroup = json['subGroup'];
template = json['template'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['CategoryID'] = this.categoryID;
data['CategoryName'] = this.categoryName;
data['allowedClinic'] = this.allowedClinic;
data['category'] = this.category;
data['categoryID'] = this.categoryID;
data['genderValidation'] = this.genderValidation;
data['group'] = this.group;
data['orderedValidation'] = this.orderedValidation;
data['price'] = this.price;
data['procedureId'] = this.procedureId;
data['procedureName'] = this.procedureName;
data['specialPermission'] = this.specialPermission;
data['subGroup'] = this.subGroup;
data['template'] = this.template;
return data;
}
}

@ -30,19 +30,20 @@ class PrescriptionService extends BaseService {
}, body: _prescriptionReqModel.toJson());
}
Future postPrescription() async {
Future postPrescription(
PostPrescriptionReqModel postProcedureReqModel) async {
hasError = false;
//_prescriptionList.clear();
await baseAppClient.post(
GET_CATEGORISE_PROCEDURE,
POST_PRESCRIPTION_LIST,
onSuccess: (dynamic response, int statusCode) {
_prescriptionList
.add(PrescriptionModel.fromJson(response['PrescriptionList']));
print("Success");
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: postProcedureReqModel.toJson(),
);
}
}

@ -13,11 +13,6 @@ class ProcedureService extends BaseService {
List<CategoriseProcedureModel> get categoriesList => _categoriesList;
List<Procedures> procedureslist = List();
Procedures t1 = Procedures(
category: '02',
procedure: '02011002',
);
GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel(
clinicId: 0,
pageSize: 10,
@ -29,8 +24,17 @@ class ProcedureService extends BaseService {
search: ["lab"],
);
GetProcedureReqModel _getProcedureCategoriseReqModel = GetProcedureReqModel(
clinicId: 0,
pageSize: 100,
pageIndex: 1,
patientMRN: 0,
//categoryId: null,
vidaAuthTokenID:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI",
PostProcedureReqModel _postProcedureReqModel = PostProcedureReqModel();
search: ["lab"],
);
Future getProcedure() async {
hasError = false;
@ -47,17 +51,14 @@ class ProcedureService extends BaseService {
Future getCategories() async {
hasError = false;
_categoriesList.clear();
await baseAppClient.post(
GET_CATEGORISE_PROCEDURE,
onSuccess: (dynamic response, int statusCode) {
_categoriesList
.add(CategoriseProcedureModel.fromJson(response['listCategories']));
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
);
await baseAppClient.post(GET_CATEGORISE_PROCEDURE,
onSuccess: (dynamic response, int statusCode) {
_categoriesList
.add(CategoriseProcedureModel.fromJson(response['ProcedureList']));
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _getProcedureCategoriseReqModel.toJson());
}
Future postProcedure(PostProcedureReqModel postProcedureReqModel) async {

@ -24,11 +24,12 @@ class PrescriptionViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future postPrescription() async {
Future postPrescription(
PostPrescriptionReqModel postProcedureReqModel) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _prescriptionService.postPrescription();
await _prescriptionService.postPrescription(postProcedureReqModel);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);

@ -1,7 +1,12 @@
import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.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_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart';
@ -10,6 +15,8 @@ import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
void addPrescriptionForm(context) {
TextEditingController durationController = TextEditingController();
TextEditingController doseController = TextEditingController();
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
final double spaceBetweenTextFileds = 12;
showModalBottomSheet(
@ -122,6 +129,7 @@ void addPrescriptionForm(context) {
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
controller: doseController,
),
),
SizedBox(height: spaceBetweenTextFileds),
@ -160,11 +168,18 @@ void addPrescriptionForm(context) {
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: TranslationBase.of(context).duration,
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
),
labelText: TranslationBase.of(context).duration,
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
controller: durationController,
validator: (value) {
if (value == null || value == "")
return TranslationBase.of(context)
.emptyMessage;
else
return null;
}),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
@ -192,8 +207,11 @@ void addPrescriptionForm(context) {
title:
TranslationBase.of(context).addMedication,
onPressed: () {
//prescriptionWarning(context);
postProcedure(
duration: durationController.text,
dose: doseController.text);
Navigator.pop(context);
prescriptionWarning(context);
},
),
],
@ -210,3 +228,40 @@ void addPrescriptionForm(context) {
);
});
}
postProcedure({String duration, String dose}) async {
PrescriptionViewModel model = new PrescriptionViewModel();
PostPrescriptionReqModel postProcedureReqModel =
new PostPrescriptionReqModel();
List<PrescriptionRequestModel> sss = List();
postProcedureReqModel.appointmentNo = 2016055175;
postProcedureReqModel.clinicID = 1;
postProcedureReqModel.episodeID = 200012335;
postProcedureReqModel.patientMRN = 1234;
postProcedureReqModel.vidaAuthTokenID =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiOGFjNDRjZGQtOWE0Mi00M2YxLWE2YTQtMWQ4NzBmZmYwNTUyIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTU2NDkiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA4NzM2NjY5LCJleHAiOjE2MDk2MDA2NjksImlhdCI6MTYwODczNjY2OX0.9EDgYrbe5fQA2CvgLdFT4s_PL7hD5R_Qggfpv4lDtUY";
sss.add(PrescriptionRequestModel(
covered: true,
dose: int.parse(dose),
itemId: 8,
doseUnitId: 1,
route: 1,
frequency: 1,
remarks: "test2",
approvalRequired: true,
icdcode10Id: "test2",
doseTime: 1,
duration: int.parse(duration),
doseStartDate: "2020-12-20T13:07:41.769Z"));
postProcedureReqModel.prescriptionRequestModel = sss;
//postProcedureReqModel.procedures = controlsProcedure;
await model.postPrescription(postProcedureReqModel);
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
} else {
DrAppToastMsg.showSuccesToast('Medication has been added');
}
}

@ -111,7 +111,7 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
InkWell(
onTap: () {
addPrescriptionForm(context);
model.postPrescription();
//model.postPrescription();
},
child: CircleAvatar(
radius: 65,
@ -195,7 +195,7 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
),
onTap: () {
addPrescriptionForm(context);
model.postPrescription();
//model.postPrescription();
},
),
SizedBox(

@ -414,65 +414,82 @@ void addSelectedProcedure(context) {
context: context,
builder: (BuildContext bc) {
return BaseView(
//onModelReady: (model) => model.getCategories(),
onModelReady: (model) => model.getCategories(),
builder:
(BuildContext context, ProcedureViewModel model, Widget child) =>
SingleChildScrollView(
child: Container(
height: 490,
child: Padding(
padding: EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
'Select Procedure'.toUpperCase(),
fontWeight: FontWeight.w900,
),
// Text(model.categoriesList[0].categoryName),
SizedBox(
height: 9.0,
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
NetworkBaseView(
baseViewModel: model,
child: SingleChildScrollView(
child: Container(
height: 490,
child: Padding(
padding: EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
'Select Procedure'.toUpperCase(),
fontWeight: FontWeight.w900,
),
if (model.categoriesList.length != 0)
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: 'Add Delected Procedures'.toUpperCase(),
borderColor: Colors.white,
textInputType: TextInputType.text,
inputFormatter: ONLY_LETTERS,
controller: procedureController,
),
height: 120.0,
child: ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model.categoriesList[0].rowcount,
itemBuilder: (BuildContext ctxt, int index) {
return Container(
child: AppText(model.categoriesList[0]
.entityList[index].procedureName),
);
}),
),
SizedBox(
height: 280.0,
),
Container(
margin:
EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title:
TranslationBase.of(context).addMedication,
onPressed: () {
Navigator.pop(context);
postProcedure();
},
),
],
SizedBox(
height: 0.0,
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText:
'Add Delected Procedures'.toUpperCase(),
borderColor: Colors.white,
textInputType: TextInputType.text,
inputFormatter: ONLY_LETTERS,
controller: procedureController,
),
),
),
],
)
],
SizedBox(
height: 80.0,
),
Container(
margin:
EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title:
TranslationBase.of(context).addMedication,
onPressed: () {
Navigator.pop(context);
postProcedure();
},
),
],
),
),
],
)
],
),
),
),
),

Loading…
Cancel
Save