/** * 医疗期计算器 * 根据员工工龄和地区计算法定医疗期天数 * 法律依据:《企业职工患病或非因工负伤医疗期规定》(劳部发[1994]479号) * 上海特殊规定:沪府发[2015]40号 */ import { useState } from 'react' import { Calculator, HeartPulse, Info } from 'lucide-react' import Card from '../../components/ui/Card' import Button from '../../components/ui/Button' interface MedicalPeriodResult { totalMonths: number cumulativeDays: number actualDays: number endDate: string legalBasis: string notes: string[] } /** * 计算医疗期 * @param workYears 本单位工作年限 * @param region 地区(上海/全国) * @param sickDays 累计病休天数 * @param startDate 开始病休日期 */ function calculateMedicalPeriod( workYears: number, region: 'shanghai' | 'national', sickDays: number, startDate: string, ): MedicalPeriodResult | null { if (!startDate || workYears < 0) return null let totalMonths: number let cumulativeDays: number let legalBasis: string const notes: string[] = [] if (region === 'shanghai') { // 上海特殊规定:直接按工龄分档 if (workYears < 1) { totalMonths = 3 cumulativeDays = 6 * 30 // 6个月周期 legalBasis = '《上海市关于本市劳动者在履行劳动合同期间患病或者非因工负伤的医疗期标准的规定》' } else if (workYears < 4) { totalMonths = 3 cumulativeDays = 6 * 30 legalBasis = '《上海市关于本市劳动者在履行劳动合同期间患病或者非因工负伤的医疗期标准的规定》' } else if (workYears < 10) { totalMonths = 6 cumulativeDays = 12 * 30 legalBasis = '《上海市关于本市劳动者在履行劳动合同期间患病或者非因工负伤的医疗期标准的规定》' } else { totalMonths = 9 cumulativeDays = 18 * 30 legalBasis = '《上海市关于本市劳动者在履行劳动合同期间患病或者非因工负伤的医疗期标准的规定》' } notes.push('上海地区适用特殊规定,医疗期不按累计病休天数折算') } else { // 全国通用规定:劳部发[1994]479号 if (workYears < 5) { totalMonths = 3 cumulativeDays = 6 * 30 // 6个月内累计病休 legalBasis = '《企业职工患病或非因工负伤医疗期规定》第三条(劳部发[1994]479号)' } else if (workYears < 10) { totalMonths = 6 cumulativeDays = 12 * 30 // 12个月内累计病休 legalBasis = '《企业职工患病或非因工负伤医疗期规定》第三条(劳部发[1994]479号)' } else if (workYears < 15) { totalMonths = 9 cumulativeDays = 15 * 30 // 15个月内累计病休 legalBasis = '《企业职工患病或非因工负伤医疗期规定》第三条(劳部发[1994]479号)' } else if (workYears < 20) { totalMonths = 12 cumulativeDays = 18 * 30 // 18个月内累计病休 legalBasis = '《企业职工患病或非因工负伤医疗期规定》第三条(劳部发[1994]479号)' } else { totalMonths = 24 cumulativeDays = 30 * 30 // 30个月内累计病休 legalBasis = '《企业职工患病或非因工负伤医疗期规定》第三条(劳部发[1994]479号)' } notes.push(`在 ${cumulativeDays / 30} 个月的累计周期内,病休累计不超过 ${totalMonths} 个月即享有医疗期保护`) } // 计算实际可用天数 const actualDays = Math.max(0, totalMonths * 30 - sickDays) // 计算医疗期结束日期 const start = new Date(startDate) const endDate = new Date(start) endDate.setMonth(endDate.getMonth() + totalMonths) notes.push('医疗期内企业不得解除劳动合同(法定情形除外)') notes.push('医疗期满后不能从事原工作也不能从事另行安排的工作,企业可提前30天通知或支付代通知金解除') return { totalMonths, cumulativeDays, actualDays, endDate: endDate.toISOString().slice(0, 10), legalBasis, notes, } } /** * 医疗期计算器页面 */ export default function MedicalPeriodCalculator() { const [region, setRegion] = useState<'national' | 'shanghai'>('national') const [workYears, setWorkYears] = useState('') const [sickDays, setSickDays] = useState('0') const [startDate, setStartDate] = useState('') const [result, setResult] = useState(null) const handleCalculate = () => { const years = parseFloat(workYears) || 0 const days = parseInt(sickDays) || 0 const r = calculateMedicalPeriod(years, region, days, startDate) setResult(r) } const handleReset = () => { setRegion('national') setWorkYears('') setSickDays('0') setStartDate('') setResult(null) } return (

医疗期计算器

{/* 地区选择 */}
{/* 工龄输入 */}
setWorkYears(e.target.value)} placeholder="如:5.5" step="0.5" min="0" className="w-full px-3 py-2 text-sm border rounded-md focus:outline-none focus:ring-1 focus:ring-primary" />
{/* 病休开始日期 */}
setStartDate(e.target.value)} className="w-full px-3 py-2 text-sm border rounded-md focus:outline-none focus:ring-1 focus:ring-primary" />
{/* 累计病休天数 */}
setSickDays(e.target.value)} placeholder="0" min="0" className="w-full px-3 py-2 text-sm border rounded-md focus:outline-none focus:ring-1 focus:ring-primary" />
{/* 计算结果 */} {result && (

计算结果

法定医疗期
{result.totalMonths} 个月
累计计算周期
{result.cumulativeDays / 30} 个月
剩余可用天数
0 ? 'text-safe' : 'text-danger'}`}> {result.actualDays} 天
医疗期截止日
{result.endDate}
{/* 法律依据 */}
法律依据:{result.legalBasis}
{/* 注意事项 */}
注意事项
{result.notes.map((note, i) => (
{note}
))}
)} {/* 工龄分档表 */}

医疗期分档表(全国通用)

工作年限 医疗期 累计周期
不满 5 年3 个月6 个月
5-10 年6 个月12 个月
10-15 年9 个月15 个月
15-20 年12 个月18 个月
20 年以上24 个月30 个月
) }