|
@ -45,7 +45,7 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
|
|
|
@Autowired
|
|
|
private FileUploadService fileUploadService;
|
|
|
|
|
|
@Value("fastDFS.fastdfs_file_url")
|
|
|
@Value("${fastDFS.fastdfs_file_url}")
|
|
|
private String fastdfsUrl;
|
|
|
|
|
|
public Map<String,Object> regist(String mobile, String captcha, String password, String openid){
|
|
@ -161,10 +161,14 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public BasePatientDO completePatientDetails(MultipartFile headPortrait, String json){
|
|
|
BasePatientDO patientDO = JSONObject.parseObject(json,BasePatientDO.class);
|
|
|
//如果未上传头像,使用默认头像
|
|
|
if(null == headPortrait){
|
|
|
patientDO.setPhoto("default");
|
|
|
BasePatientDO patientDetail = JSONObject.parseObject(json,BasePatientDO.class);
|
|
|
BasePatientDO patientBrief = basePatientDao.findOne(patientDetail.getId());
|
|
|
if(null == patientBrief){
|
|
|
throw new PatientNotFoundException("未找到该居民!");
|
|
|
}
|
|
|
//如果未上传头像,使用默认头像,默认头像由客户端来处理,后台默认存null
|
|
|
if(null == headPortrait && !StringUtils.isEmpty(patientBrief.getPhoto())){
|
|
|
patientDetail.setPhoto(patientBrief.getPhoto());
|
|
|
}else{
|
|
|
UploadVO uploadedFile = null;
|
|
|
try {
|
|
@ -176,15 +180,16 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
|
|
|
} catch (MyException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
patientDO.setPhoto(uploadedFile.getFullUrl());
|
|
|
patientDetail.setPhoto(uploadedFile.getFullUrl());
|
|
|
}
|
|
|
Assert.notNull(patientDO.getName(),"姓名不可为空!");
|
|
|
Assert.notNull(patientDO.getSex(),"性别不可为空!");
|
|
|
Assert.notNull(patientDO.getIdcard(),"身份证不可为空!");
|
|
|
Assert.notNull(patientDO.getCommitteeCode(),"居委会不可为空!");
|
|
|
Assert.notNull(patientDO.getCommitteeName(),"居委会不可为空!");
|
|
|
this.save(patientDO);
|
|
|
return patientDO;
|
|
|
patientDetail.setMobile(patientBrief.getMobile());
|
|
|
Assert.notNull(patientDetail.getName(),"姓名不可为空!");
|
|
|
Assert.notNull(patientDetail.getSex(),"性别不可为空!");
|
|
|
Assert.notNull(patientDetail.getIdcard(),"身份证不可为空!");
|
|
|
Assert.notNull(patientDetail.getCommitteeCode(),"居委会不可为空!");
|
|
|
Assert.notNull(patientDetail.getCommitteeName(),"居委会不可为空!");
|
|
|
this.save(patientDetail);
|
|
|
return patientDetail;
|
|
|
}
|
|
|
|
|
|
|