update improvement
This commit is contained in:
@@ -178,7 +178,7 @@ export default function Detail() {
|
||||
|
||||
const [carehistory, setCarehistory] = useState<ClaimHistoryCare|null>(null);
|
||||
const [isEdit,setEdit] = useState(false);
|
||||
const [claim, setClaim] = useState<ClaimHistoryCare|null>([])
|
||||
const [service_code, setServiceType] = useState<ClaimHistoryCare|null>();
|
||||
const handleCloseDialogUpdate = () => {
|
||||
setOpenDialogRequest(false);
|
||||
reset()
|
||||
@@ -190,9 +190,10 @@ export default function Detail() {
|
||||
.then((response) => {
|
||||
setCorporateId(response.data.data.corporate_id)
|
||||
setCurrentClaimHistoryCare(response.data.data.history_hospital_care)
|
||||
setClaim(response.data.data)
|
||||
setServiceType(response.data.data.service_code)
|
||||
|
||||
})
|
||||
}, [])
|
||||
}, [id])
|
||||
|
||||
useEffect( () => {
|
||||
// setMainDiagnosis
|
||||
@@ -227,6 +228,12 @@ export default function Detail() {
|
||||
symptoms: response.data.data.symptoms,
|
||||
sign: response.data.data.sign,
|
||||
main_diagnosis_id: response.data.data.main_diagnosis_id,
|
||||
secondary_diagnosis_id: response.data.data.secondary_diagnosis.map((row: any) => ({
|
||||
value: {
|
||||
id: row.id,
|
||||
name: row.icd.name
|
||||
}
|
||||
}))
|
||||
});
|
||||
|
||||
setCarehistory(response.data.data);
|
||||
@@ -353,7 +360,7 @@ export default function Detail() {
|
||||
|
||||
const defaultValues = useMemo(
|
||||
() => ({
|
||||
service_code: claim?.service_code,
|
||||
service_code: service_code,
|
||||
secondary_diagnosis_id: [{
|
||||
value: {
|
||||
name: "",
|
||||
@@ -369,7 +376,7 @@ export default function Detail() {
|
||||
sign: isEdit ? carehistory?.sign : '',
|
||||
main_diagnosis_id: isEdit ? carehistory?.main_diagnosis_id : 0,
|
||||
}),
|
||||
[]
|
||||
[service_code]
|
||||
)
|
||||
|
||||
let NewClaimHistoryCareSchema = Yup.object().shape({
|
||||
@@ -402,6 +409,7 @@ export default function Detail() {
|
||||
} = methods;
|
||||
|
||||
const values = watch();
|
||||
const valueOfLocation = organization.find((row) => row.organization_id === values.organization_id)
|
||||
|
||||
const {fields, append, remove} = useFieldArray<FormValuesProps>({name: "secondary_diagnosis_id", control})
|
||||
|
||||
@@ -499,9 +507,7 @@ export default function Detail() {
|
||||
setClaimHistoryId(id);
|
||||
setEdit(true);
|
||||
setOpenHospitalCare(true);
|
||||
// reset(defaultValues);
|
||||
console.log(defaultValues, 'debugs')
|
||||
console.log(organization, 'debugs')
|
||||
reset(defaultValues);
|
||||
}
|
||||
|
||||
function handleUpdateHospitalCare(id: number) {
|
||||
@@ -830,34 +836,38 @@ export default function Detail() {
|
||||
): ''}
|
||||
<Grid item xs={12}>
|
||||
<Card sx={{padding: 3}}>
|
||||
{customerData?.status === 'received' ? (
|
||||
|
||||
<Stack direction="row" alignItems="center" sx={{marginBottom: 4}}>
|
||||
<Typography variant='subtitle1' sx={{color: '#19BBBB'}} gutterBottom>History of Hospital Care</Typography>
|
||||
<Button variant="outlined" startIcon={<AddIcon/>} sx={{marginLeft: 'auto'}} onClick={handleNewHospitalCare}>
|
||||
<Typography variant="button" display="block">History</Typography>
|
||||
</Button>
|
||||
{customerData?.status === 'received' ? (
|
||||
<Button variant="outlined" startIcon={<AddIcon/>} sx={{marginLeft: 'auto'}} onClick={handleNewHospitalCare}>
|
||||
<Typography variant="button" display="block">History</Typography>
|
||||
</Button>
|
||||
) : ''}
|
||||
</Stack>
|
||||
) : ''}
|
||||
|
||||
<Stack direction="column" spacing={2} sx={{marginBottom: 2}}>
|
||||
{currentClaimHistoryCare?.map((claimHistoryCare, index) =>
|
||||
claimHistoryCare.status === 0 ? (
|
||||
<Grid item xs={12} md={12} key={index}> {/* Tambahkan key untuk setiap elemen dalam loop */}
|
||||
<Card sx={{padding: 2}}>
|
||||
<Stack direction="row" alignItems="center" justifyContent="space-between" sx={{marginBottom: 4}}>
|
||||
<Label variant="outlined" color='primary' >
|
||||
<Typography variant="button" display="block">{claimHistoryCare.service_code = 'OP' ? 'Outpatient' : 'Inpatient'}</Typography>
|
||||
</Label>
|
||||
<TableMoreMenu actions={
|
||||
<>
|
||||
<MenuItem onClick={() => handleEditHospitalCare(claimHistoryCare.id)}>
|
||||
<EditTwoTone />Edit
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => handleUpdateHospitalCare(claimHistoryCare.id)}>
|
||||
<LoopOutlined />Update Status
|
||||
</MenuItem>
|
||||
</>
|
||||
}/>
|
||||
</Stack>
|
||||
{customerData?.status === 'received' ? (
|
||||
<Stack direction="row" alignItems="center" justifyContent="space-between" sx={{marginBottom: 4}}>
|
||||
<Label variant="outlined" color='primary' >
|
||||
<Typography variant="button" display="block">{claimHistoryCare.service_code = 'OP' ? 'Outpatient' : 'Inpatient'}</Typography>
|
||||
</Label>
|
||||
<TableMoreMenu actions={
|
||||
<>
|
||||
<MenuItem onClick={() => handleEditHospitalCare(claimHistoryCare.id)}>
|
||||
<EditTwoTone />Edit
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => handleUpdateHospitalCare(claimHistoryCare.id)}>
|
||||
<LoopOutlined />Update Status
|
||||
</MenuItem>
|
||||
</>
|
||||
}/>
|
||||
</Stack>
|
||||
) : ''}
|
||||
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
||||
<Typography variant='subtitle2' sx={style1} gutterBottom>Admission Date :</Typography>
|
||||
<Typography variant='subtitle2' sx={style2} gutterBottom>{ fDate(claimHistoryCare.admission_date)}</Typography> {/* Perbaikan typo di 'admission_date' */}
|
||||
@@ -946,11 +956,12 @@ export default function Detail() {
|
||||
handleLocationChange(selectedOrganizationId);
|
||||
}
|
||||
}}
|
||||
value={organization.find(row => row.organization_id == values.organization_id)}
|
||||
// value={organization.find(row => row.organization_id == values.organization_id)}
|
||||
value={valueOfLocation ?? null}
|
||||
|
||||
renderInput={(params) => (
|
||||
<RHFTextField
|
||||
name="organization_id"
|
||||
name="organization_id_test"
|
||||
{...params}
|
||||
label="Location"
|
||||
variant="outlined"
|
||||
@@ -976,7 +987,7 @@ export default function Detail() {
|
||||
return option.id === value.id
|
||||
}}
|
||||
|
||||
value={doctor.find(row => row.id == values.practitioner_id)}
|
||||
value={doctor.find(row => row.id == values.practitioner_id) ?? null}
|
||||
|
||||
onChange={handleDoctorChange}
|
||||
renderInput={(params) => (
|
||||
@@ -1027,7 +1038,7 @@ export default function Detail() {
|
||||
isOptionEqualToValue={(option, value) =>{
|
||||
return option.id == value.main_diagnosis_id
|
||||
}}
|
||||
value={main_diagnosis.find(row => row.id == values.main_diagnosis_id)}
|
||||
value={main_diagnosis.find(row => row.id == values.main_diagnosis_id) ?? null}
|
||||
onChange={handleMainDiagnosisChange}
|
||||
renderInput={(params) => (
|
||||
<RHFTextField required {...params} label="Main Diagnosis (ICD-X)" variant="outlined" name='main_diagnosis_id' />
|
||||
|
||||
Reference in New Issue
Block a user