Création et modification des consultations

This commit is contained in:
Brice Zele 2022-04-07 14:48:10 +01:00
parent 66fbbe0bf4
commit 6b053091a3
7 changed files with 352 additions and 232 deletions

View File

@ -25,7 +25,7 @@
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCz4B9uUu3gkuu78Sf72gPWZ3t_qKqf5zg"/>
android:value="AIzaSyBUQoQYY31-S3DPp7aRRIAjEda8T2pZvJE"/>
<activity
android:name=".MainActivity"

View File

@ -5,7 +5,6 @@ import {Animated, Easing, Image, Platform, StyleSheet, View,} from 'react-native
const userposi = require('./../../datas/img/png/user_place.png');
const mnetwork = require('./../../datas/img/png/home_network.png');
const othernetwork = require('./../../datas/img/png/other_net.png');
class IMarker extends PureComponent {
constructor(props) {
super(props)

View File

@ -78,7 +78,7 @@ import * as Utils from "../../../utils/UtilsFunction";
import {displayToast, uppercaseFirstLetter} from "../../../utils/UtilsFunction";
import {store} from "../../../redux/store";
import Fontisto from "react-native-vector-icons/Fontisto";
import {Typography} from "../../../config/typography";
import {FontWeight, Typography} from "../../../config/typography";
let moment = require('moment-timezone');
@ -530,6 +530,8 @@ const ExecuterPrescriptionScreen = ({
const PriceModal = Yup.object().shape({
price: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
examen_quantite: Yup.number(),
code_acte: Yup.object()
});
const renderDialogQRCodeScanner = () => {
@ -564,7 +566,9 @@ const ExecuterPrescriptionScreen = ({
const renderPriceModal = () => (
<Formik validationSchema={PriceModal}
initialValues={{
price: '',
examen_quantite: '' + elementToSetPrice !== null ? !elementToSetPrice.drugs ? elementToSetPrice.quantity : '' : '',
code_acte: '' + elementToSetPrice !== null ? !elementToSetPrice.drugs ? elementToSetPrice.act : '' : '',
price: elementToSetPrice !== null ? !elementToSetPrice.drugs ? elementToSetPrice.act.amount : '' : ''
}}
onSubmit={(values) => {
console.log("Value", elementToSetPrice);
@ -664,6 +668,53 @@ const ExecuterPrescriptionScreen = ({
keyboardType='numeric'
/>
{values.code_acte !== '' ?
values.code_acte.billing_type === 'UNIT_PRICE' && (<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('QUANTITE')}
value={'' + values.examen_quantite}
onChangeText={handleChange('examen_quantite')}
onBlur={handleBlur('examen_quantite')}
success={touched.examen_quantite && !errors.examen_quantite}
touched={touched.examen_quantite}
error={errors.examen_quantite}
keyboardType='numeric'
/>) : null}
<View>
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('AMOUNT')}
value={'' + ((values.code_acte.amount !== null) ? parseFloat(values.examen_quantite) * parseFloat(values.price) : values.price)}
editable={values.code_acte.amount === null}
onChangeText={handleChange('price')}
onBlur={handleBlur('price')}
success={touched.price && !errors.price}
touched={touched.price}
error={errors.price}
keyboardType='numeric'
/>
<View style={{
position: 'absolute',
left: responsiveWidth(82),
top: 20,
flexDirection: 'row'
}}>
<View
style={{
width: 1,
borderLeftColor: '#f0f0f0',
height: 40,
left: -8,
borderLeftWidth: 1,
}}
/>
<Text style={[Typography.body1, FontWeight.bold]}>{values.code_acte.code}</Text>
</View>
</View>
<Button
loading={checkInsuranceCoverageAmount.loading}
full

View File

@ -540,6 +540,7 @@ const ModifierExecutionPrescriptionScreen = ({
const PriceModal = Yup.object().shape({
price: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
examen_quantite: Yup.number(),
});
const renderDialogQRCodeScanner = () => {

View File

@ -616,13 +616,15 @@ const ModifierFeuilleSoinScreen = ({
const AddNewExamen = Yup.object().shape({
examen_name: Yup.string().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
code_acte: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
examen_quantite: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED'))
examen_quantite: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
amount: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED'))
});
const ModifyNewExamen = Yup.object().shape({
examen_name: Yup.string().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
examen_quantite: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED'))
examen_quantite: Yup.number(),
amount: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED'))
});
const AddNewMedicament = Yup.object().shape({
@ -779,7 +781,7 @@ const ModifierFeuilleSoinScreen = ({
care_condition: consultation._care_condition,
act_action: "UPDATE",
act_type: "PERFORMANCE",
act_id: values.code_acte.id,
act_id: elementToSetPrice.id,
tmp_sheet_id: tmpSheetId,
performances: [
{
@ -846,12 +848,20 @@ const ModifierFeuilleSoinScreen = ({
}}>
<Dropdown
label={I18n.t('CODE_ACTE')}
data={getNetworkAct.result !== null ? getNetworkAct.result?.response : []}
data={getNetworkAct.result !== null ? getNetworkAct.result?.response.filter(act => act.type === 'CONSULTATION') : []}
useNativeDriver={true}
value={typeof values.code_acte !== "number" && values.code_acte.name}
onChangeText={(value, index, data) => {
setFieldTouched('code_acte');
setFieldValue('code_acte', value);
if (value.amount !== null) {
setFieldValue('amount_prestation', value.amount);
fetchGetAmountConsultation({
network_id: wallet.id_network,
amount: '' + value.amount,
care_condition: consultation._care_condition
});
}
}}
valueExtractor={(value) => {
return value
@ -868,17 +878,13 @@ const ModifierFeuilleSoinScreen = ({
value={values.amount_prestation}
onChangeText={(value) => {
setFieldValue('amount_prestation', value);
console.log({
network_id: wallet.id_network,
amount: '' + value,
care_condition: careConditon
});
fetchGetAmountConsultation({
network_id: wallet.id_network,
amount: '' + value,
care_condition: consultation._care_condition
});
}}
editable={false}
onBlur={handleBlur('amount_prestation')}
success={touched.amount_prestation && !errors.amount_prestation}
touched={touched.amount_prestation}
@ -901,7 +907,7 @@ const ModifierFeuilleSoinScreen = ({
editable={false}
value={getAmountConsultation.result !== null ? getAmountConsultation.result.response.insurance_amount :
elementToSetPrice !== null ? elementToSetPrice.drugs === null
? values.moderator_ticket
? values.insurance_amount
: '' : ''}/>
<View style={{
@ -1036,11 +1042,20 @@ const ModifierFeuilleSoinScreen = ({
}}>
<Dropdown
label={I18n.t('CODE_ACTE')}
data={getNetworkAct.result !== null ? getNetworkAct.result?.response : []}
data={getNetworkAct.result !== null ? getNetworkAct.result?.response.filter(act => act.type === 'CONSULTATION') : []}
useNativeDriver={true}
onChangeText={(value, index, data) => {
setFieldTouched('code_acte');
setFieldValue('code_acte', value);
if (value.billing_type !== 'FREE') {
setFieldValue('amount_prestation', value.amount);
fetchGetAmountConsultation({
network_id: wallet.id_network,
amount: '' + value.amount,
care_condition: consultation._care_condition
});
}
}}
valueExtractor={(value) => {
return value
@ -1054,6 +1069,7 @@ const ModifierFeuilleSoinScreen = ({
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('AMOUNT')}
editable={values.code_acte !== '' ? values.code_acte.billing_type === 'FREE' : true}
value={values.amount_prestation}
onChangeText={handleChange('amount_prestation')}
onBlur={handleBlur('amount_prestation')}
@ -1574,7 +1590,7 @@ const ModifierFeuilleSoinScreen = ({
}}>
<Dropdown
label={I18n.t('CODE_ACTE')}
data={getNetworkAct.result !== null ? getNetworkAct.result?.response : []}
data={getNetworkAct.result !== null ? getNetworkAct.result?.response.filter(act => act.type === 'EXAM') : []}
useNativeDriver={true}
onChangeText={(value, index, data) => {
console.log("Value", value);
@ -1636,7 +1652,8 @@ const ModifierFeuilleSoinScreen = ({
initialValues={{
examen_name: elementToSetPrice !== null ? !elementToSetPrice.drugs ? elementToSetPrice.description : '' : '',
examen_quantite: '' + elementToSetPrice !== null ? !elementToSetPrice.drugs ? elementToSetPrice.quantity : '' : '',
code_acte: '' + elementToSetPrice !== null ? !elementToSetPrice.drugs ? elementToSetPrice.act : '' : ''
code_acte: '' + elementToSetPrice !== null ? !elementToSetPrice.drugs ? elementToSetPrice.act : '' : '',
amount: elementToSetPrice !== null ? !elementToSetPrice.drugs ? elementToSetPrice.act.amount : null : null
}}
onSubmit={(values) => {
@ -1646,10 +1663,11 @@ const ModifierFeuilleSoinScreen = ({
return elementToSetPrice.id === exam.id ? {
...exam,
id: exam.id,
amount: values.amount,
act_id: values.code_acte.id,
act: values.code_acte,
description: values.examen_name,
quantity: values.examen_quantite,
quantity: null,
unit_price: exam.unit_price,
to_delete: false
} : exam;
@ -1708,7 +1726,7 @@ const ModifierFeuilleSoinScreen = ({
}}>
<Dropdown
label={I18n.t('CODE_ACTE')}
data={getNetworkAct.result !== null ? getNetworkAct.result?.response : []}
data={getNetworkAct.result !== null ? getNetworkAct.result?.response.filter(act => (act.type === "EXAM_OR_OTHER")) : []}
useNativeDriver={true}
value={typeof values.code_acte !== "number" && values.code_acte.name}
onChangeText={(value, index, data) => {
@ -1727,7 +1745,7 @@ const ModifierFeuilleSoinScreen = ({
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('NAME')}
placeholder={I18n.t('DESCRIPTION')}
value={values.examen_name}
onChangeText={handleChange('examen_name')}
onBlur={handleBlur('examen_name')}
@ -1736,7 +1754,8 @@ const ModifierFeuilleSoinScreen = ({
error={errors.examen_name}
/>
<TextInput
{/* {values.code_acte !== '' ?
values.code_acte.billing_type === 'UNIT_PRICE' && (<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('QUANTITE')}
value={'' + values.examen_quantite}
@ -1746,7 +1765,41 @@ const ModifierFeuilleSoinScreen = ({
touched={touched.examen_quantite}
error={errors.examen_quantite}
keyboardType='numeric'
/>) : null}*/}
<View>
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('AMOUNT')}
value={values.code_acte !== '' ? values.code_acte.billing_type === 'FREE' ? I18n.t('AMOUNT_FREE') : `${values.code_acte.unit_value} = ${values.code_acte.amount}` : ''}
editable={false}
onChangeText={handleChange('amount')}
onBlur={handleBlur('amount')}
success={touched.amount && !errors.amount}
touched={touched.amount}
error={errors.amount}
keyboardType='numeric'
/>
{/* <View style={{
position: 'absolute',
left: responsiveWidth(82),
top: 20,
flexDirection: 'row'
}}>
<View
style={{
width: 1,
borderLeftColor: '#f0f0f0',
height: 40,
left: -8,
borderLeftWidth: 1,
}}
/>
<Text
style={[Typography.body1, FontWeight.bold]}>{values.code_acte.unit_value}</Text>
</View>*/}
</View>
<Button
style={{marginTop: 20, marginBottom: 20}}
@ -1984,7 +2037,7 @@ const ModifierFeuilleSoinScreen = ({
]}
key={item.id}>
<Text body2 semibold numberOfLines={2}>
{`${item.quantity} ${item.description} ${item.unit_price ? ' - ' + item.unit_price : ''} \n ${item.act.name}`}
{`${item.description} ${item.unit_price ? ' - ' + item.unit_price : ''} \n ${item.act.name}`}
</Text>
<View style={styles.iconRight}>
<TouchableOpacity onPress={() => {
@ -2924,7 +2977,7 @@ const ModifierFeuilleSoinScreen = ({
styles.iconNavigationButton,
{
borderRadius: 5,
width: 100,
width: 150,
height: 30,
flexDirection: "row",
backgroundColor:
@ -2936,7 +2989,7 @@ const ModifierFeuilleSoinScreen = ({
onPress={e => {
setModalListPrestation(true);
}}>
<Text whiteColor>{I18n.t('PRESTATION')}</Text>
<Text whiteColor>{I18n.t('CONSULTATION')}</Text>
<MaterialCommunityIcons
name="medical-bag"
size={20}
@ -2949,7 +3002,7 @@ const ModifierFeuilleSoinScreen = ({
styles.iconNavigationButton,
{
borderRadius: 5,
width: 100,
width: 170,
height: 30,
flexDirection: "row",
backgroundColor:
@ -2961,7 +3014,7 @@ const ModifierFeuilleSoinScreen = ({
onPress={e => {
setModalExamen(true);
}}>
<Text whiteColor>{I18n.t('EXAMEN')}</Text>
<Text whiteColor>{I18n.t('ACTE_EXAMEN')}</Text>
<FontAwesome5
name="file-medical"
size={20}
@ -2974,7 +3027,7 @@ const ModifierFeuilleSoinScreen = ({
styles.iconNavigationButton,
{
borderRadius: 5,
width: 110,
width: 120,
height: 30,
flexDirection: "row",
backgroundColor:

View File

@ -677,7 +677,7 @@ const SaisirFeuilleSoinScreen = ({
const AddNewPrestation = Yup.object().shape({
amount_prestation: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
code_acte: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
code_acte: Yup.object().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
frais_deplacement: Yup.number(),
date_prestation: Yup.date(),
ticker_moderateur: Yup.number(),
@ -685,8 +685,8 @@ const SaisirFeuilleSoinScreen = ({
const AddNewExamen = Yup.object().shape({
examen_name: Yup.string().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
code_acte: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
examen_quantite: Yup.number().required(I18n.t('THIS_FIELD_IS_REQUIRED'))
code_acte: Yup.object().required(I18n.t('THIS_FIELD_IS_REQUIRED')),
amount: Yup.number(),
});
const AddNewMedicament = Yup.object().shape({
@ -818,7 +818,7 @@ const SaisirFeuilleSoinScreen = ({
codeActeRef.shake(200)
else {
setPrestations([{
act_id: values.code_acte,
act_id: values.code_acte.id,
amount: values.amount_prestation,
home_visit_fees: values.frais_deplacement
}, ...prestations]);
@ -852,6 +852,7 @@ const SaisirFeuilleSoinScreen = ({
isSubmitting,
}) => (
<ScrollView style={{flex: 1}}>
{console.log("Errors", errors)}
<View style={[styles.containModal, {backgroundColor: Color.containerBackgroundColor}]}>
<Modal
isVisible={modalPrestation}
@ -893,11 +894,20 @@ const SaisirFeuilleSoinScreen = ({
}}>
<Dropdown
label={I18n.t('CODE_ACTE')}
data={getNetworkAct.result !== null ? getNetworkAct.result?.response : []}
data={getNetworkAct.result !== null ? getNetworkAct.result?.response.filter(act => act.type === 'CONSULTATION') : []}
useNativeDriver={true}
onChangeText={(value, index, data) => {
setFieldTouched('code_acte');
setFieldValue('code_acte', value.id);
console.log("Value", value);
setFieldValue('code_acte', value);
if (value.billing_type !== 'FREE') {
setFieldValue('amount_prestation', value.amount);
fetchGetAmountConsultation({
network_id: wallet.id_network,
amount: '' + value.amount,
care_condition: careConditon
});
}
}}
valueExtractor={(value) => {
return value
@ -910,6 +920,7 @@ const SaisirFeuilleSoinScreen = ({
<TextInput
style={{marginTop: 10}}
editable={values.code_acte !== '' ? values.code_acte.billing_type === 'FREE' : true}
placeholder={I18n.t('AMOUNT')}
value={values.amount_prestation}
onChangeText={(text) => {
@ -922,7 +933,7 @@ const SaisirFeuilleSoinScreen = ({
}}
onBlur={handleBlur('amount_prestation')}
success={touched.amount_prestation && !errors.amount_prestation}
touched={touched.amount_prestation} A
touched={touched.amount_prestation}
error={errors.amount_prestation}
/>
@ -1261,15 +1272,15 @@ const SaisirFeuilleSoinScreen = ({
<Formik validationSchema={AddNewExamen}
initialValues={{
examen_name: '',
examen_quantite: '',
code_acte: ''
code_acte: '',
amount: ''
}}
onSubmit={(values) => {
console.log("Value", values);
setExamens([{
act_id: values.code_acte,
act_id: values.code_acte.id,
description: values.examen_name,
quantity: values.examen_quantite
quantity: null
}, ...examens]);
setModalExamen(false);
Utils.displayToast(I18n.t('EXAMENS_SUCCESSFULLY_ADD'));
@ -1321,12 +1332,12 @@ const SaisirFeuilleSoinScreen = ({
}}>
<Dropdown
label={I18n.t('CODE_ACTE')}
data={getNetworkAct.result !== null ? getNetworkAct.result?.response : []}
data={getNetworkAct.result !== null ? getNetworkAct.result?.response.filter(act => (act.type === "EXAM_OR_OTHER")) : []}
useNativeDriver={true}
onChangeText={(value, index, data) => {
console.log("Value", value);
setFieldTouched('code_acte');
setFieldValue('code_acte', value.id);
setFieldValue('code_acte', value);
}}
valueExtractor={(value) => {
return value
@ -1339,7 +1350,7 @@ const SaisirFeuilleSoinScreen = ({
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('NAME')}
placeholder={I18n.t('DESCRIPTION')}
value={values.examen_name}
onChangeText={handleChange('examen_name')}
onBlur={handleBlur('examen_name')}
@ -1350,13 +1361,14 @@ const SaisirFeuilleSoinScreen = ({
<TextInput
style={{marginTop: 10}}
placeholder={I18n.t('QUANTITE')}
value={values.examen_quantite}
onChangeText={handleChange('examen_quantite')}
onBlur={handleBlur('examen_quantite')}
success={touched.examen_quantite && !errors.examen_quantite}
touched={touched.examen_quantite}
error={errors.examen_quantite}
placeholder={I18n.t('AMOUNT')}
value={values.code_acte !== '' ? values.code_acte.billing_type === 'FREE' ? I18n.t('AMOUNT_FREE') : `${values.code_acte.unit_value} = ${values.code_acte.amount}` : ''}
editable={false}
onChangeText={handleChange('amount')}
onBlur={handleBlur('amount')}
success={touched.amount && !errors.amount}
touched={touched.amount}
error={errors.amount}
keyboardType='numeric'
/>
@ -2018,7 +2030,7 @@ const SaisirFeuilleSoinScreen = ({
styles.iconNavigationButton,
{
borderRadius: 5,
width: 100,
width: 150,
height: 30,
flexDirection: "row",
backgroundColor:
@ -2038,7 +2050,7 @@ const SaisirFeuilleSoinScreen = ({
);
} else setModalPrestation(true);
}}>
<Text whiteColor>{I18n.t('PRESTATION')}</Text>
<Text whiteColor>{I18n.t('CONSULTATION')}</Text>
<MaterialCommunityIcons
name="medical-bag"
size={20}
@ -2051,7 +2063,7 @@ const SaisirFeuilleSoinScreen = ({
styles.iconNavigationButton,
{
borderRadius: 5,
width: 100,
width: 170,
height: 30,
flexDirection: "row",
backgroundColor:
@ -2063,7 +2075,7 @@ const SaisirFeuilleSoinScreen = ({
onPress={e => {
setModalExamen(true);
}}>
<Text whiteColor>{I18n.t('EXAMEN')}</Text>
<Text whiteColor>{I18n.t('ACTE_EXAMEN')}</Text>
<FontAwesome5
name="file-medical"
size={20}
@ -2076,7 +2088,7 @@ const SaisirFeuilleSoinScreen = ({
styles.iconNavigationButton,
{
borderRadius: 5,
width: 110,
width: 120,
height: 30,
flexDirection: "row",
backgroundColor:

View File

@ -628,7 +628,7 @@
"LONGUE": "Longue",
"ACCIDENT": "Accident",
"GROSSESSE": "Grossesse",
"ADD_PRESTATION": "Ajouter une prestation",
"ADD_PRESTATION": "Ajouter une consultation",
"ADD_PRESCRIPTION": "Ajouter une prescription",
"VISITE_DOMICILE": "Visite domicile ",
"CODE_ACTE": "Code acte ",
@ -689,8 +689,8 @@
"MODIFIER_EXAMEN": "Modifier examen",
"EXAMENS_SUCCESSFULLY_MODIFY": "Examen modifié avec succès",
"PRESTATION_SUCCESSFULLY_MODIFY": "Prestation modifié avec succès",
"MODIFY_PRESTATION": "Modifier une prestation",
"LIST_PRESTATION": "Liste des prestations",
"MODIFY_PRESTATION": "Modifier une consultation",
"LIST_PRESTATION": "Liste des consultations",
"NO_CONSULTATION": "Aucune consultation",
"NO_EXECUTION": "Aucune exécution",
"LISTE_CONSULTATION": "Liste des consultations",
@ -725,5 +725,9 @@
"ECH": "Ech.",
"PER": "Per.",
"ASSURE_SUSPENDU": "Cet assuré est suspendu",
"ASSURE_PRINCIPAL_SUSPENDU": "L'assuré principal est suspendu"
"ASSURE_PRINCIPAL_SUSPENDU": "L'assuré principal est suspendu",
"CONSULTATION": "Consultation",
"ACTE_EXAMEN": "Autre acte et examen",
"AMOUNT_FREE": "Montant libre",
"DESCRIPTION": "Description"
}