Merge branch 'design-updates' into 'development'

post prescription

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

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

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

@ -1,18 +1,90 @@
class CategoriseProcedureModel { class CategoriseProcedureModel {
String categoryID; List<EntityList> entityList;
String categoryName; int rowcount;
dynamic statusMessage;
CategoriseProcedureModel({this.categoryID, this.categoryName}); CategoriseProcedureModel(
{this.entityList, this.rowcount, this.statusMessage});
CategoriseProcedureModel.fromJson(Map<String, dynamic> json) { CategoriseProcedureModel.fromJson(Map<String, dynamic> json) {
categoryID = json['CategoryID']; if (json['entityList'] != null) {
categoryName = json['CategoryName']; 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() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['CategoryID'] = this.categoryID; data['allowedClinic'] = this.allowedClinic;
data['CategoryName'] = this.categoryName; 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; return data;
} }
} }

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

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

@ -24,11 +24,12 @@ class PrescriptionViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future postPrescription() async { Future postPrescription(
PostPrescriptionReqModel postProcedureReqModel) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard(); //_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionService.postPrescription(); await _prescriptionService.postPrescription(postProcedureReqModel);
if (_prescriptionService.hasError) { if (_prescriptionService.hasError) {
error = _prescriptionService.error; error = _prescriptionService.error;
setState(ViewState.ErrorLocal); 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/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/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/models/livecare/transfer_to_admin.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.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/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.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'; import 'package:hexcolor/hexcolor.dart';
void addPrescriptionForm(context) { void addPrescriptionForm(context) {
TextEditingController durationController = TextEditingController();
TextEditingController doseController = TextEditingController();
final GlobalKey<FormState> _formKey = GlobalKey<FormState>(); final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
final double spaceBetweenTextFileds = 12; final double spaceBetweenTextFileds = 12;
showModalBottomSheet( showModalBottomSheet(
@ -122,6 +129,7 @@ void addPrescriptionForm(context) {
borderColor: Colors.white, borderColor: Colors.white,
textInputType: TextInputType.number, textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS, inputFormatter: ONLY_NUMBERS,
controller: doseController,
), ),
), ),
SizedBox(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
@ -160,11 +168,18 @@ void addPrescriptionForm(context) {
border: Border.all( border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))), width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField( child: AppTextFormField(
labelText: TranslationBase.of(context).duration, labelText: TranslationBase.of(context).duration,
borderColor: Colors.white, borderColor: Colors.white,
textInputType: TextInputType.number, textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS, inputFormatter: ONLY_NUMBERS,
), controller: durationController,
validator: (value) {
if (value == null || value == "")
return TranslationBase.of(context)
.emptyMessage;
else
return null;
}),
), ),
SizedBox(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
Container( Container(
@ -192,8 +207,11 @@ void addPrescriptionForm(context) {
title: title:
TranslationBase.of(context).addMedication, TranslationBase.of(context).addMedication,
onPressed: () { onPressed: () {
//prescriptionWarning(context);
postProcedure(
duration: durationController.text,
dose: doseController.text);
Navigator.pop(context); 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( InkWell(
onTap: () { onTap: () {
addPrescriptionForm(context); addPrescriptionForm(context);
model.postPrescription(); //model.postPrescription();
}, },
child: CircleAvatar( child: CircleAvatar(
radius: 65, radius: 65,
@ -195,7 +195,7 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
), ),
onTap: () { onTap: () {
addPrescriptionForm(context); addPrescriptionForm(context);
model.postPrescription(); //model.postPrescription();
}, },
), ),
SizedBox( SizedBox(

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