Преглед на файлове

医生端新增指导模板参数修改

wujunjie преди 8 години
родител
ревизия
9b70835d66

+ 23 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/template/DoctorGuidanceTemp.java

@ -26,11 +26,32 @@ public class DoctorGuidanceTemp extends IdEntity{
    // 最后一次发送时间
    private Date lastTime;
//    模板名称
    private String modelName;
//    图片地址
    private String imagesUrl;
    public String getModelName() {
        return modelName;
    }
    public void setModelName(String modelName) {
        this.modelName = modelName;
    }
    public String getImagesUrl() {
        return imagesUrl;
    }
    public void setImagesUrl(String imagesUrl) {
        this.imagesUrl = imagesUrl;
    }
    public String getCode() {
        return code;
    }
//=================
    public void setCode(String code) {
        this.code = code;
    }
@ -76,4 +97,6 @@ public class DoctorGuidanceTemp extends IdEntity{
    public void setLastTime(Date lastTime) {
        this.lastTime = lastTime;
    }
}

+ 20 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorGuidanceTempService.java

@ -3,9 +3,8 @@ package com.yihu.wlyy.service.template;
import com.yihu.wlyy.entity.template.DoctorGuidanceTemp;
import com.yihu.wlyy.repository.template.DoctorGuidanceTempDao;
import com.yihu.wlyy.service.BaseService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.Date;
@ -21,6 +20,21 @@ public class DoctorGuidanceTempService extends BaseService {
    @Autowired
    DoctorGuidanceTempDao guidanceTempDao;
    @Autowired
    JdbcTemplate jdbcTemplate;
    /**
     * 记录医生健康指导模板使用次数
     * @param modelCode 健康指导模板编码
     */
    public void countSend(String modelCode){
        synchronized (this){
            String sql = "UPDATE wlyy_doctor_guidance_temp  " +
                    "SET send_times=send_times+1 " +
                    "WHERE CODE=?";
            jdbcTemplate.update(sql,modelCode);
        }
    }
    /**
     * 添加指导模板
@ -29,7 +43,7 @@ public class DoctorGuidanceTempService extends BaseService {
     * @param content 指导内容
     * @return
     */
    public DoctorGuidanceTemp add(String doctor, String content) {
    public DoctorGuidanceTemp add(String doctor, String content,String modelName,String imagesUrl) {
        DoctorGuidanceTemp guidanceTemp = new DoctorGuidanceTemp();
        guidanceTemp.setCode(getCode());
@ -38,6 +52,9 @@ public class DoctorGuidanceTempService extends BaseService {
        guidanceTemp.setSendTimes(0);
        guidanceTemp.setCreateTime(new Date());
        guidanceTemp.setModelName(modelName);
        guidanceTemp.setImagesUrl(imagesUrl);
        return guidanceTempDao.save(guidanceTemp);
    }

+ 28 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorGuidanceTempController.java

@ -35,7 +35,7 @@ public class DoctorGuidanceTempController extends BaseController {
     * @param content
     * @return
     */
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    /*@RequestMapping(value = "/add", method = RequestMethod.POST)
    @ApiOperation(value = "添加指导模板")
    public String add(@RequestParam @ApiParam(value = "指导内容") String content) {
        try {
@ -45,6 +45,32 @@ public class DoctorGuidanceTempController extends BaseController {
            DoctorGuidanceTemp temp = guidanceTempService.add(getUID(), content);
            if (temp != null) {
                return write(200, "添加成功");
            } else {
                return write(-1, "添加失败");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "添加失败");
        }
    }*/
//  =====================
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ApiOperation(value = "添加指导模板")
    public String add(@RequestParam @ApiParam(value = "指导内容") String content,
                      @RequestParam @ApiParam(value = "模板名称") String modelName,
                      @RequestParam(required = false) @ApiParam(value = "图片内容") String imagesUrl) {
        try {
            if (StringUtils.isEmpty(content)) {
                return error(-1, "内容不能为空");
            }
            if(modelName.length()<1||modelName.length()>10){
                return error(-1,"模板名称不能为空且再10字之内");
            }
            DoctorGuidanceTemp temp = guidanceTempService.add(getUID(), content,modelName,imagesUrl);
            if (temp != null) {
                return write(200, "添加成功");
            } else {
@ -55,6 +81,7 @@ public class DoctorGuidanceTempController extends BaseController {
            return error(-1, "添加失败");
        }
    }
//  =====================
    /**
     * 修改指导模板