up
This commit is contained in:
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.core.common.utils.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -11,10 +12,6 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
import com.core.common.enums.AssignSeqEnum;
|
import com.core.common.enums.AssignSeqEnum;
|
||||||
import com.core.common.utils.AssignSeqUtil;
|
|
||||||
import com.core.common.utils.ChineseConvertUtils;
|
|
||||||
import com.core.common.utils.MessageUtils;
|
|
||||||
import com.core.common.utils.StringUtils;
|
|
||||||
import com.core.common.utils.bean.BeanUtils;
|
import com.core.common.utils.bean.BeanUtils;
|
||||||
import com.openhis.administration.domain.Patient;
|
import com.openhis.administration.domain.Patient;
|
||||||
import com.openhis.administration.service.IPatientService;
|
import com.openhis.administration.service.IPatientService;
|
||||||
@@ -184,7 +181,11 @@ public class PatientInformationController {
|
|||||||
patient.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(patient.getName()));
|
patient.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(patient.getName()));
|
||||||
// 设置五笔首拼
|
// 设置五笔首拼
|
||||||
patient.setWbStr(ChineseConvertUtils.toWBFirstLetter(patient.getName()));
|
patient.setWbStr(ChineseConvertUtils.toWBFirstLetter(patient.getName()));
|
||||||
|
//设置死亡时间
|
||||||
|
if(patientService.isFuture(patientInformationDto.getDeceasedDate())){
|
||||||
|
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00003, new Object[] {"死亡时间未来时"}));
|
||||||
|
}
|
||||||
|
patient.setDeceasedDate(DateUtils.parseDate(patientInformationDto.getDeceasedDate()));
|
||||||
// 调用服务层保存病人信息
|
// 调用服务层保存病人信息
|
||||||
boolean savePatientSuccess = patientService.save(patient);
|
boolean savePatientSuccess = patientService.save(patient);
|
||||||
|
|
||||||
@@ -212,6 +213,11 @@ public class PatientInformationController {
|
|||||||
patient.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(patient.getName()));
|
patient.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(patient.getName()));
|
||||||
// 设置五笔首拼
|
// 设置五笔首拼
|
||||||
patient.setWbStr(ChineseConvertUtils.toWBFirstLetter(patient.getName()));
|
patient.setWbStr(ChineseConvertUtils.toWBFirstLetter(patient.getName()));
|
||||||
|
//设置死亡时间
|
||||||
|
if(patientService.isFuture(patientInformationDto.getDeceasedDate())){
|
||||||
|
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"死亡时间未来时"}));
|
||||||
|
}
|
||||||
|
patient.setDeceasedDate(DateUtils.parseDate(patientInformationDto.getDeceasedDate()));
|
||||||
|
|
||||||
// 调用服务层更新病人信息
|
// 调用服务层更新病人信息
|
||||||
return patientService.updateById(patient)
|
return patientService.updateById(patient)
|
||||||
|
|||||||
@@ -20,4 +20,12 @@ public interface IPatientService extends IService<Patient> {
|
|||||||
* @return 出生日
|
* @return 出生日
|
||||||
*/
|
*/
|
||||||
Date extractBirthday(String idCard);
|
Date extractBirthday(String idCard);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断日期是否为未来时间
|
||||||
|
*
|
||||||
|
* @param date 字符串日期
|
||||||
|
* @return 是/否
|
||||||
|
*/
|
||||||
|
boolean isFuture(String date);
|
||||||
}
|
}
|
||||||
@@ -43,4 +43,23 @@ public class PatientServiceImpl extends ServiceImpl<PatientMapper, Patient> impl
|
|||||||
return Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
return Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFuture(String dateString) {
|
||||||
|
// 创建 DateTimeFormatter 对象,并设置所需的日期时间格式
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 解析字符串为 LocalDate 对象
|
||||||
|
LocalDate dateToCheck = LocalDate.parse(dateString, formatter);
|
||||||
|
// 获取当前日期
|
||||||
|
LocalDate currentDate = LocalDate.now();
|
||||||
|
// 检查日期是否是未来的时间
|
||||||
|
return dateToCheck.isAfter(currentDate);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
// 解析失败或其他异常,返回 false 或根据需要处理异常
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user