fix logic

merge-requests/552/head
mosazaid 5 years ago
parent b1951296cd
commit bf9ce4694f

@ -13,21 +13,21 @@ class LabsService extends BaseService {
List<PatientLabOrders> patientLabOrdersList = List();
Future getPatientLabOrdersList(
PatiantInformtion patient, bool isArrived) async {
PatiantInformtion patient, bool isInpatient) async {
hasError = false;
Map<String, dynamic> body = Map();
String url = "";
if (isArrived) {
if (isInpatient) {
url = GET_PATIENT_LAB_OREDERS;
} else {
body['isDentalAllowedBackend'] = false;
url = GET_Patient_LAB_ORDERS;
} else {
url = GET_PATIENT_LAB_OREDERS;
}
await baseAppClient.postPatient(url, patient: patient,
onSuccess: (dynamic response, int statusCode) {
patientLabOrdersList.clear();
if (isArrived) {
if (!isInpatient) {
response['ListPLO'].forEach((hospital) {
patientLabOrdersList.add(PatientLabOrders.fromJson(hospital));
});

@ -226,14 +226,11 @@ class ProcedureViewModel extends BaseViewModel {
return labResultLists;
}
void getLabs(PatiantInformtion patient,{bool isArrived}) async {
void getLabs(PatiantInformtion patient, {bool isInpatient = false}) async {
setState(ViewState.Busy);
await _labsService.getPatientLabOrdersList(patient, isArrived);
await _labsService.getPatientLabOrdersList(patient, isInpatient);
if (_labsService.hasError) {
error = _labsService.error;
if(isArrived)
setState(ViewState.ErrorLocal);
else
setState(ViewState.Error);
} else {
_labsService.patientLabOrdersList.forEach((element) {

@ -642,6 +642,8 @@ class _PatientsScreenState extends State<PatientsScreen> {
.getTo,
"isSearch":
isSearch,
"isInpatient":
isInpatient,
"arrivalType":
arrivalType,
});

@ -29,9 +29,10 @@ class LabsHomePage extends StatelessWidget {
PatiantInformtion patient = routeArgs['patient'];
patientType = routeArgs['patientType'];
arrivalType = routeArgs['arrivalType'];
bool isInpatient = routeArgs['isInpatient'];
print(arrivalType);
return BaseView<ProcedureViewModel>(
onModelReady: (model) => model.getLabs(patient,isArrived: ( patient.patientStatusType == 43)),
onModelReady: (model) => model.getLabs(patient, isInpatient: isInpatient),
builder: (context, ProcedureViewModel model, widget) => AppScaffold(
baseViewModel: model,
backgroundColor: Colors.grey[100],

@ -26,6 +26,7 @@ import '../../../routes.dart';
class PatientProfileScreen extends StatelessWidget {
PatiantInformtion patient;
bool isFromSearch = false;
bool isInpatient = false;
@override
Widget build(BuildContext context) {
@ -40,6 +41,9 @@ class PatientProfileScreen extends StatelessWidget {
if (routeArgs.containsKey("isSearch")) {
isFromSearch = routeArgs['isSearch'];
}
if (routeArgs.containsKey("isInpatient")) {
isInpatient = routeArgs['isInpatient'];
}
return BaseView<PatientViewModel>(
onModelReady: (patientViewModel) async {
@ -66,14 +70,14 @@ class PatientProfileScreen extends StatelessWidget {
PatientOutSA: false);
if (patientType == "1" &&
(patient.admissionNo == null ||
patient.admissionNo == "0")) {
(patient.admissionNo == null || patient.admissionNo == "0")) {
patientViewModel
.getPatientList(patientReq, "1", isBusyLocal: false)
.then((response) {
if (response['MessageStatus'] == 1) {
if (response['List_MyInPatient'] != null) {
List<PatiantInformtion> patientList = ModelResponse.fromJson(response['List_MyInPatient']).list;
List<PatiantInformtion> patientList =
ModelResponse.fromJson(response['List_MyInPatient']).list;
patient.admissionNo = patientList[0].admissionNo;
patient.admissionDate = patientList[0].admissionDate;
} else {
@ -81,7 +85,7 @@ class PatientProfileScreen extends StatelessWidget {
}
}
}).catchError((error) {
print(error);
print(error);
});
}
},
@ -108,16 +112,16 @@ class PatientProfileScreen extends StatelessWidget {
child: SingleChildScrollView(
child: Column(
children: [
isFromSearch
? ProfileMedicalInfoWidgetSearch(
isInpatient
? ProfileMedicalInfoWidgetInPatient(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
from: from,
to: to,
)
: patientType == "1"
? ProfileMedicalInfoWidgetInPatient(
: isFromSearch
? ProfileMedicalInfoWidgetSearch(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
@ -139,7 +143,8 @@ class PatientProfileScreen extends StatelessWidget {
],
),
),
if (patient.patientStatusType !=null && patient.patientStatusType == 43 )
if (patient.patientStatusType != null &&
patient.patientStatusType == 43)
BaseView<SOAPViewModel>(
onModelReady: (model) async {},
builder: (_, model, w) => Positioned(

@ -30,12 +30,13 @@ class VitalSignDetailsScreen extends StatelessWidget {
String arrivalType = routeArgs['arrivalType'];
String from = routeArgs['from'];
String to = routeArgs['to'];
bool isInpatient = routeArgs['isInpatient'];
String imageBasePath = 'assets/images/';
String assetBasePath = "${imageBasePath}patient/vital_signs/";
return BaseView<VitalSignsViewModel>(
onModelReady: (model) =>
model.getPatientVitalSignHistory(patient, from, to, patientType == "1"),
model.getPatientVitalSignHistory(patient, from, to, isInpatient),
builder: (_, mode, widget) => AppScaffold(
baseViewModel: mode,
isShowAppBar: true,

@ -13,6 +13,7 @@ class PatientProfileButton extends StatelessWidget {
final PatiantInformtion patient;
final String patientType;
String arrivalType;
final bool isInPatient;
String from;
String to;
final String url = "assets/images/";
@ -33,7 +34,9 @@ class PatientProfileButton extends StatelessWidget {
this.onTap,
this.isLoading = false,
this.from,
this.to})
this.to,
this.isInPatient = false,
})
: super(key: key);
@override
@ -127,7 +130,8 @@ class PatientProfileButton extends StatelessWidget {
'from': from,
'to': to,
'patientType': patientType,
'arrivalType': arrivalType
'arrivalType': arrivalType,
'isInpatient': isInPatient,
});
}
}

@ -43,7 +43,6 @@ class ProfileMedicalInfoWidget extends StatelessWidget {
childAspectRatio: 1 / 1.0,
crossAxisCount: 3,
children: [
// if (int.parse(patientType) == 7 || int.parse(patientType) == 6)
PatientProfileButton(
key: key,
patient: patient,
@ -132,7 +131,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget {
nameLine1: TranslationBase.of(context).patientSick,
nameLine2: TranslationBase.of(context).leave,
icon: 'patient/patient_sick_leave.png'),
// if (int.parse(patientType) == 7 || int.parse(patientType) == 6)
if (patient.appointmentNo!=null && patient.appointmentNo!=0)
PatientProfileButton(
key: key,
patient: patient,
@ -143,7 +142,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget {
nameLine1: TranslationBase.of(context).patient,
nameLine2: TranslationBase.of(context).ucaf,
icon: 'patient/ucaf.png'),
// if (int.parse(patientType) == 7 || int.parse(patientType) == 6)
if (patient.appointmentNo!=null && patient.appointmentNo!=0)
PatientProfileButton(
key: key,
patient: patient,
@ -154,7 +153,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget {
nameLine1: TranslationBase.of(context).referral,
nameLine2: TranslationBase.of(context).patient,
icon: 'patient/refer_patient.png'),
// if (int.parse(patientType) == 7 || int.parse(patientType) == 6)
if (patient.appointmentNo!=null && patient.appointmentNo!=0)
PatientProfileButton(
key: key,
patient: patient,
@ -165,7 +164,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget {
nameLine1: TranslationBase.of(context).admission,
nameLine2: TranslationBase.of(context).request,
icon: 'patient/admission_req.png'),
if (patientType == "1")
if (patient.admissionNo!=null && patient.admissionNo!="0")
PatientProfileButton(
key: key,
patient: patient,

@ -53,6 +53,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget {
nameLine1: TranslationBase.of(context).vital,
nameLine2: TranslationBase.of(context).signs,
route: VITAL_SIGN_DETAILS,
isInPatient: true,
icon: 'patient/vital_signs.png'),
PatientProfileButton(
key: key,
@ -60,6 +61,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget {
patientType: patientType,
arrivalType: arrivalType,
route: LAB_RESULT,
isInPatient: true,
nameLine1: TranslationBase.of(context).lab,
nameLine2: TranslationBase.of(context).result,
icon: 'patient/lab_results.png'),
@ -137,6 +139,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget {
patientType: patientType,
arrivalType: arrivalType,
route: REFER_IN_PATIENT_TO_DOCTOR,
isInPatient: true,
nameLine1: TranslationBase.of(context).referral,
nameLine2: TranslationBase.of(context).patient,
icon: 'patient/refer_patient.png'),

Loading…
Cancel
Save