15 changed files with 348 additions and 123 deletions
@ -0,0 +1,45 @@ |
|||||
|
package com.ccsens.wisdomcar.bean.dto; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author 马 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PatientAndFamilyDto { |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("修改(补录)患者信息") |
||||
|
public static class PatientInfo { |
||||
|
@ApiModelProperty("患者id") |
||||
|
private Long id; |
||||
|
@ApiModelProperty("患者姓名") |
||||
|
private String name; |
||||
|
@ApiModelProperty("患者性别(0-女,1-男)") |
||||
|
private Byte sex; |
||||
|
@ApiModelProperty("患者年龄") |
||||
|
private Integer age; |
||||
|
@ApiModelProperty("患者身份证号") |
||||
|
private String idCard; |
||||
|
@ApiModelProperty("患者手机号") |
||||
|
private String phone; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("修改(补录)患者家属信息") |
||||
|
public static class PatientFamilyInfo { |
||||
|
@ApiModelProperty("患者家属id") |
||||
|
private Long id; |
||||
|
@ApiModelProperty("患者家属姓名") |
||||
|
private String name; |
||||
|
@ApiModelProperty("患者家属手机号") |
||||
|
private String phone; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.ccsens.wisdomcar.service; |
||||
|
|
||||
|
|
||||
|
import com.ccsens.wisdomcar.bean.dto.PatientAndFamilyDto; |
||||
|
|
||||
|
/** |
||||
|
* @author 马 |
||||
|
*/ |
||||
|
public interface IPatientAndFamilyService { |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 修改(补录)患者信息 |
||||
|
* @param param 患者信息 |
||||
|
*/ |
||||
|
void updatePatientInfo(PatientAndFamilyDto.PatientInfo param); |
||||
|
|
||||
|
/** |
||||
|
* 修改(补录)患者家属信息 |
||||
|
* @param param 家属信息 |
||||
|
*/ |
||||
|
void updatePatientFamilyInfo(PatientAndFamilyDto.PatientFamilyInfo param); |
||||
|
} |
||||
@ -0,0 +1,58 @@ |
|||||
|
package com.ccsens.wisdomcar.service; |
||||
|
|
||||
|
|
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import com.ccsens.util.exception.BaseException; |
||||
|
import com.ccsens.wisdomcar.bean.dto.PatientAndFamilyDto; |
||||
|
import com.ccsens.wisdomcar.bean.po.PatientProject; |
||||
|
import com.ccsens.wisdomcar.persist.dao.PatientProjectDao; |
||||
|
import com.ccsens.wisdomcar.util.Constant; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Propagation; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
|
||||
|
/** |
||||
|
* @author 马 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
||||
|
public class PatientAndFamilyService implements IPatientAndFamilyService{ |
||||
|
|
||||
|
@Resource |
||||
|
private PatientProjectDao patientProjectDao; |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public void updatePatientInfo(PatientAndFamilyDto.PatientInfo param) { |
||||
|
PatientProject patient = patientProjectDao.selectByPrimaryKey(param.getId()); |
||||
|
if (ObjectUtil.isNotNull(param)){ |
||||
|
if (ObjectUtil.isNotNull(param.getName())){ |
||||
|
patient.setName(param.getName()); |
||||
|
} |
||||
|
if (ObjectUtil.isNotNull(param.getPhone())){ |
||||
|
patient.setPhone(param.getPhone()); |
||||
|
} |
||||
|
if (ObjectUtil.isNotNull(param.getAge())){ |
||||
|
patient.setAge(param.getAge()); |
||||
|
} |
||||
|
if (ObjectUtil.isNotNull(param.getIdCard())){ |
||||
|
patient.setIdCard(param.getIdCard()); |
||||
|
} |
||||
|
if (ObjectUtil.isNotNull(param.getSex())){ |
||||
|
patient.setSex(param.getSex()); |
||||
|
} |
||||
|
patientProjectDao.updateByPrimaryKeySelective(patient); |
||||
|
}else{ |
||||
|
throw new BaseException(Constant.PATIENT_NOT_FOUND); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void updatePatientFamilyInfo(PatientAndFamilyDto.PatientFamilyInfo param) { |
||||
|
|
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue