|
@ -9,9 +9,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 医生健康指导模板
|
|
@ -55,11 +53,15 @@ public class DoctorGuidanceTempService extends BaseService {
|
|
|
String content= (String)temp.get("content");
|
|
|
String imagesUrl= (String)temp.get("images_url");
|
|
|
// 多图按逗号分割保存成数组
|
|
|
String [] imagesArray = imagesUrl.split(",");
|
|
|
String head = "htttp://";
|
|
|
for (int i=0;i<imagesArray.length;i++) {
|
|
|
imagesArray[i]=head +imagesArray[i];
|
|
|
String [] imagesArray = null;
|
|
|
if(imagesUrl != null){
|
|
|
imagesArray = imagesUrl.split(",");
|
|
|
String head = "htttp://";
|
|
|
for (int i=0;i<imagesArray.length;i++) {
|
|
|
imagesArray[i]=head +imagesArray[i];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
String createTime = (String)temp.get("create_time").toString();
|
|
|
String sendTimes = (String)temp.get("send_times").toString();
|
|
|
JSONObject json = new JSONObject();
|
|
@ -124,13 +126,11 @@ public class DoctorGuidanceTempService extends BaseService {
|
|
|
String[] codes = code.split(",");
|
|
|
|
|
|
if (codes != null && codes.length > 0) {
|
|
|
String sql = "SELECT t.owner FROM wlyy_doctor_guidance_temp t WHERE t.code=?";
|
|
|
String owner = jdbcTemplate.queryForObject(sql,String.class,code);
|
|
|
for (String temp : codes) {
|
|
|
String sql = "SELECT t.owner FROM wlyy_doctor_guidance_temp t WHERE t.code=?";
|
|
|
String owner = jdbcTemplate.queryForObject(sql,String.class,temp);
|
|
|
if(!"system".equals(owner)){
|
|
|
// String sqlDetele = "DELETE FROM wlyy_doctor_guidance_temp WHERE code=?";
|
|
|
guidanceTempDao.deleteByCode(temp);
|
|
|
// jdbcTemplate.update(sqlDetele,temp);
|
|
|
}
|
|
|
|
|
|
}
|
|
@ -146,19 +146,47 @@ public class DoctorGuidanceTempService extends BaseService {
|
|
|
* @param type 模板类型
|
|
|
* @return
|
|
|
*/
|
|
|
public List<DoctorGuidanceTemp> list(String doctor, String type) throws Exception {
|
|
|
public List<Map<String,Object>> list(String doctor, String type) throws Exception {
|
|
|
List<DoctorGuidanceTemp> temps = null;
|
|
|
|
|
|
List<Map<String,Object>> listMap = new ArrayList<>();
|
|
|
|
|
|
if (type.equals("1")) {
|
|
|
temps = guidanceTempDao.findByOwner("system");
|
|
|
for(DoctorGuidanceTemp temp : temps){
|
|
|
Map<String,Object> tem = new HashMap<>();
|
|
|
tem.put("code:",temp.getCode());
|
|
|
tem.put("owner:",temp.getOwner());
|
|
|
tem.put("sendTimes",temp.getSendTimes());
|
|
|
tem.put("lastTime",temp.getLastTime());
|
|
|
tem.put("modelName",temp.getModelName());
|
|
|
listMap.add(tem);
|
|
|
}
|
|
|
} else if (type.equals("2")) {
|
|
|
temps = guidanceTempDao.findByOwner(doctor);
|
|
|
for(DoctorGuidanceTemp temp : temps){
|
|
|
Map<String,Object> tem = new HashMap<>();
|
|
|
tem.put("code:",temp.getCode());
|
|
|
tem.put("owner:",temp.getOwner());
|
|
|
tem.put("sendTimes",temp.getSendTimes());
|
|
|
tem.put("lastTime",temp.getLastTime());
|
|
|
tem.put("modelName",temp.getModelName());
|
|
|
listMap.add(tem);
|
|
|
}
|
|
|
} else {
|
|
|
temps = guidanceTempDao.findByOwnerAndSystem(doctor);
|
|
|
for(DoctorGuidanceTemp temp : temps){
|
|
|
Map<String,Object> tem = new HashMap<>();
|
|
|
tem.put("code:",temp.getCode());
|
|
|
tem.put("owner:",temp.getOwner());
|
|
|
tem.put("sendTimes",temp.getSendTimes());
|
|
|
tem.put("lastTime",temp.getLastTime());
|
|
|
tem.put("modelName",temp.getModelName());
|
|
|
listMap.add(tem);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return temps;
|
|
|
return listMap;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|