|
@ -11,6 +11,7 @@ import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
import com.yihu.wlyy.repository.manage.UserDao;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDeviceDao;
|
|
|
import com.yihu.wlyy.service.app.concern.ConcernService;
|
|
|
import com.yihu.wlyy.util.Base64Utils;
|
|
|
import com.yihu.wlyy.util.ElasticsearchUtil;
|
|
|
import com.yihu.wlyy.util.LatitudeUtils;
|
|
@ -50,6 +51,8 @@ public class DataHandingService {
|
|
|
private PatientDeviceDao patientDeviceDao;
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
@Autowired
|
|
|
private ConcernService concernService;
|
|
|
|
|
|
@Transactional
|
|
|
public String producePatientAndDoctorPassword() {
|
|
@ -183,14 +186,14 @@ public class DataHandingService {
|
|
|
public JSONArray getAllDeviceData() {
|
|
|
JSONArray ja = new JSONArray();
|
|
|
List<Map<String, Object>> returnData = elasticsearchUtil.excuteDataModel("SELECT location,idCard FROM wlyy_patient_device");
|
|
|
returnData.stream().forEach(one->{
|
|
|
net.sf.json.JSONObject jo=new net.sf.json.JSONObject();
|
|
|
jo.put("idcard",one.get("idCard"));
|
|
|
returnData.stream().forEach(one -> {
|
|
|
net.sf.json.JSONObject jo = new net.sf.json.JSONObject();
|
|
|
jo.put("idcard", one.get("idCard"));
|
|
|
|
|
|
net.sf.json.JSONObject locatio=new net.sf.json.JSONObject();
|
|
|
locatio.put("lat",one.get("location.lat")); //纬度 -90 ~~ 90
|
|
|
locatio.put("lon",one.get("location.lon")); //经度 -180 ~~ 180
|
|
|
jo.put("location",locatio);
|
|
|
net.sf.json.JSONObject locatio = new net.sf.json.JSONObject();
|
|
|
locatio.put("lat", one.get("location.lat")); //纬度 -90 ~~ 90
|
|
|
locatio.put("lon", one.get("location.lon")); //经度 -180 ~~ 180
|
|
|
jo.put("location", locatio);
|
|
|
|
|
|
|
|
|
ja.add(jo);
|
|
@ -199,7 +202,7 @@ public class DataHandingService {
|
|
|
}
|
|
|
|
|
|
//原有CA的密码没有加密,清洗成加密密码
|
|
|
public boolean updateCAPassword(){
|
|
|
public boolean updateCAPassword() {
|
|
|
boolean flag = true;
|
|
|
try {
|
|
|
String sql = " select * from wlyy_doctor where check_password is not null and check_password <> ''";
|
|
@ -215,19 +218,27 @@ public class DataHandingService {
|
|
|
// });
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
List<Doctor> result = new ArrayList<>();
|
|
|
list.stream().forEach(one->{
|
|
|
Doctor d = doctorDao.findByCode(one.get("code")!=null?one.get("code").toString():"");
|
|
|
if(d!=null){
|
|
|
list.stream().forEach(one -> {
|
|
|
Doctor d = doctorDao.findByCode(one.get("code") != null ? one.get("code").toString() : "");
|
|
|
if (d != null) {
|
|
|
|
|
|
d.setCheckPassword(Base64Utils.encryptBASE64(d.getCheckPassword()));
|
|
|
result.add(d);
|
|
|
}
|
|
|
});
|
|
|
doctorDao.save(result);
|
|
|
}catch (Exception e){
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
flag = false;
|
|
|
}
|
|
|
return flag;
|
|
|
return flag;
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
public void addConcerns(String doctorCode, String[] patients) {
|
|
|
Random rand = new Random();
|
|
|
for (String patient : patients) {
|
|
|
concernService.addConcern(patient, doctorCode, rand.nextInt(3)+1);
|
|
|
}
|
|
|
}
|
|
|
}
|