import style from "../index.less";
import { filterDataArr } from '@utils/tools';

const ItemPart = (props) => {
  let {dataStr,title,type,dataJson,other_yjs,lastDot} = props;
  if(lastDot){
    dataStr=dataStr.trim().replace(/;$/g,'。');
  }
  return <tr className={style['patInfoFst']}>
    <td className={style['patInfoSec']}>{title}</td>
    {
      type === 2?
      <td className={style['patInfoSec']}>
        {
          dataStr && dataStr != '' && dataStr.split('^;').map((item) => {
            return <div className={style.checkAssist} dangerouslySetInnerHTML={{__html:item}}></div>
          })
        }
      </td>:
      type === 1?
      <td className={style['patInfoSec']}>
        {
          filterDataArr(JSON.parse(dataStr))
        }
      </td>:
      <td className={style['patInfoSec']}>
      {
        other_yjs&&other_yjs.str1
      }
      {(dataJson&&dataJson['yjs_1'])||(dataJson&&dataJson['yjs_2'])||(dataJson&&dataJson['yjs_3'])||(dataJson&&dataJson['yjs_4'])?<table className={style['formulaTable']}>
        <tr>
          <td rowSpan='2' className={style['alignMiddle']}>月经史：（</td>
          <td rowSpan='2' className={style['alignMiddle']}>{dataJson['yjs_1']||'初潮年龄'}</td>
          <td className={style['formulaTd']}>{dataJson['yjs_2']||'行经天数'}</td>
          <td rowSpan='2' className={style['alignMiddle']}>{dataJson['yjs_4']||'停经时间'}）</td>
        </tr>
        <tr>
          <td className={style.alignCenter}>{dataJson['yjs_3']||'周期'}</td>
        </tr>
      </table>:''}
      {
       other_yjs&&other_yjs.str2
      }
    </td>

    }
  </tr>
}

export default ItemPart;