|
@ -10,6 +10,7 @@ import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
|
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
|
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
|
import com.yihu.utils.security.MD5;
|
|
|
import net.sf.json.JSONObject;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@ -21,6 +22,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Random;
|
|
|
|
|
|
@Service
|
|
|
public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDao> {
|
|
@ -251,4 +253,28 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
|
baseDoctorDao.updateStatus(doctorId,status);
|
|
|
}
|
|
|
|
|
|
public Boolean updateDoctorPw(String id,String pw){
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findOne(id);
|
|
|
//认证信息设置
|
|
|
String salt = randomString(5);
|
|
|
doctorDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
doctorDO.setSalt(salt);
|
|
|
|
|
|
baseDoctorDao.save(doctorDO);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
public String randomString(int length) {
|
|
|
String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
|
StringBuffer buffer = new StringBuffer();
|
|
|
Random random = new Random();
|
|
|
|
|
|
for(int i = 0; i < length; ++i) {
|
|
|
int pos = random.nextInt(str.length());
|
|
|
buffer.append(str.charAt(pos));
|
|
|
}
|
|
|
|
|
|
return buffer.toString();
|
|
|
}
|
|
|
|
|
|
}
|