|
@ -7,6 +7,7 @@ import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
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;
|
|
@ -17,6 +18,7 @@ import java.util.Map;
|
|
|
* <p>
|
|
|
* Created by lyr-pc on 2017/2/3.
|
|
|
*/
|
|
|
@Transactional
|
|
|
@Service
|
|
|
public class DoctorGuidanceTempService extends BaseService {
|
|
|
|
|
@ -52,12 +54,18 @@ public class DoctorGuidanceTempService extends BaseService {
|
|
|
String modelName= (String)temp.get("model_name");
|
|
|
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 createTime = (String)temp.get("create_time").toString();
|
|
|
String sendTimes = (String)temp.get("send_times").toString();
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("modelName",modelName);
|
|
|
json.put("content",content);
|
|
|
json.put("imagesUrl",imagesUrl);
|
|
|
json.put("imagesUrls",imagesArray);
|
|
|
json.put("createTime",createTime);
|
|
|
json.put("sendTimes",sendTimes);
|
|
|
return json;
|
|
@ -92,14 +100,16 @@ public class DoctorGuidanceTempService extends BaseService {
|
|
|
* @param content 指导内容
|
|
|
* @return
|
|
|
*/
|
|
|
public DoctorGuidanceTemp modify(String code, String content) throws Exception {
|
|
|
public DoctorGuidanceTemp modify(String code, String modelName, String content, String imagesUrl) throws Exception {
|
|
|
DoctorGuidanceTemp guidanceTemp = guidanceTempDao.findByCode(code);
|
|
|
|
|
|
if (guidanceTemp == null) {
|
|
|
throw new Exception("模板不存在");
|
|
|
}
|
|
|
|
|
|
guidanceTemp.setModelName(modelName);
|
|
|
guidanceTemp.setContent(content);
|
|
|
guidanceTemp.setImagesUrl(imagesUrl);
|
|
|
|
|
|
return guidanceTempDao.save(guidanceTemp);
|
|
|
}
|
|
@ -114,8 +124,15 @@ 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) {
|
|
|
guidanceTempDao.deleteByCode(temp);
|
|
|
if(!"system".equals(owner)){
|
|
|
// String sqlDetele = "DELETE FROM wlyy_doctor_guidance_temp WHERE code=?";
|
|
|
guidanceTempDao.deleteByCode(temp);
|
|
|
// jdbcTemplate.update(sqlDetele,temp);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|