wujunjie пре 8 година
родитељ
комит
2762986309

+ 27 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorGuidanceTempService.java

@ -3,12 +3,14 @@ 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.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * 医生健康指导模板
@ -36,6 +38,31 @@ public class DoctorGuidanceTempService extends BaseService {
        }
    }
    /**
     * 查询单个指导模板详情
     * @param modelCode
     * @return
     * @throws Exception
     */
    public JSONObject listDetail(String modelCode) throws Exception {
        String sql = "SELECT wdgt.`model_name`,wdgt.`content`,wdgt.`images_url`,wdgt.`create_time`,wdgt.`send_times` " +
                "FROM wlyy_doctor_guidance_temp wdgt " +
                "WHERE wdgt.`code`=?";
        Map temp=(Map)jdbcTemplate.queryForMap(sql,modelCode);
        String modelName= (String)temp.get("model_name");
        String content= (String)temp.get("content");
        String imagesUrl= (String)temp.get("images_url");
        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("createTime",createTime);
        json.put("sendTimes",sendTimes);
        return json;
    }
    /**
     * 添加指导模板
     *

+ 23 - 8
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthGuidanceController.java

@ -58,20 +58,21 @@ public class DoctorHealthGuidanceController extends WeixinBaseController {
	 */
	@RequestMapping(value = "/id")
	@ResponseBody
	public String getHealthGuidance(Long id){
	public String getHealthGuidance(@RequestParam String id){
		Long idl = Long.parseLong(id);
		try{
			if(id == null || id < 1){
			if(idl == null || idl < 1){
				return error(-1,"参数错误");
			}
			JSONObject guidance = patientHealthGuidanceService.findById(id);
			JSONObject guidance = patientHealthGuidanceService.findById(idl);
			return write(200,"查询成功","data",guidance);
		}catch (Exception e){
			return error(-1,"查询失败");
		}
	}
	/**
	/*/**
	 * 添加患者健康指导
	 * @param patient 患者标识
	 * @param content 指导内容
@ -111,6 +112,12 @@ public class DoctorHealthGuidanceController extends WeixinBaseController {
		}
	}*/
	//  ====================修改代码========================
	/**
	 * 添加患者健康指导
	 * @param patient 患者标识
	 * @param content 指导内容
	 * @return
	 */
	@RequestMapping(value = "add")
	@ResponseBody
	public String add(@RequestParam String patient,@RequestParam String content, @RequestParam(required = false) String images, @RequestParam(required = false) String voice) {
@ -152,21 +159,29 @@ public class DoctorHealthGuidanceController extends WeixinBaseController {
	/**
	 * 查询患者的健康指导
	 * @param patient 患者标识
	 * @param begin 开始时间
	 * @param end 结束时间
	 * @param begin   开始时间
	 * @param end     结束时间
	 * @param id	  指导编码
	 * @param pagesize 展示页数
	 * @return
	 */
	@RequestMapping(value = "list")
	@ResponseBody
	public String list(@RequestParam(required = false) String patient, @RequestParam(required = false) String begin, @RequestParam(required = false) String end, long id, int pagesize) {
	public String list(@RequestParam(required = false) String patient,
					   @RequestParam(required = false) String begin,
					   @RequestParam(required = false) String end,
					   @RequestParam String id,
					   @RequestParam String pagesize) {
		try {
			Long idl = Long.parseLong(id);
			int  page = Integer.parseInt(pagesize);
			if (StringUtils.isNotEmpty(begin)) {
				begin = begin + " 00:00:00";
			}
			if (StringUtils.isNotEmpty(end)) {
				end = end + " 23:59:59";
			}
			JSONArray array = patientHealthGuidanceService.findPatientGuidanceByDoctor(getUID(), patient, begin, end, id, pagesize);
			JSONArray array = patientHealthGuidanceService.findPatientGuidanceByDoctor(getUID(), patient, begin, end, idl, page);
			return write(200, "查询成功!", "list", array);
		} catch (Exception e) {
			error(e);

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

@ -8,6 +8,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -29,6 +30,23 @@ public class DoctorGuidanceTempController extends BaseController {
    @Autowired
    DoctorGuidanceTempService guidanceTempService;
    /**
     * 查询单个模板详情
     * @return
     */
    @RequestMapping(value = "/listDetail", method = RequestMethod.GET)
    @ApiOperation(value = "查询单个模板详情")
    public String listDetail(@RequestParam @ApiParam(value = "指导模板编码") String modelCode) {
        JSONObject temp = null;
        try {
            temp = guidanceTempService.listDetail(modelCode);
        } catch (Exception e) {
            e.printStackTrace();
            return invalidUserException(e, -1, "查询失败!");
        }
        return write(200, "查询成功!", "data", temp);
    }
    /**
     * 添加指导模板
     *