Преглед изворни кода

医生咨询-快捷回复相关接口

huangwenjie пре 7 година
родитељ
комит
9eb827fe40

+ 20 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/reply/DoctorQuickReply.java

@ -23,6 +23,10 @@ public class DoctorQuickReply extends IdEntity {
    private Date updateTime;
    // 状态 1:有效  0:无效
    private Integer status;
    // 类型 0为健康教育,1为续方咨询
    private Integer type;
    // 1为默认消息,0为自定义消息
    private Integer systag;
    public String getDoctor() {
        return doctor;
@ -59,4 +63,20 @@ public class DoctorQuickReply extends IdEntity {
    public void setStatus(Integer status) {
        this.status = status;
    }
    
    public Integer getType() {
        return type;
    }
    
    public void setType(Integer type) {
        this.type = type;
    }
    
    public Integer getSystag() {
        return systag;
    }
    
    public void setSystag(Integer systag) {
        this.systag = systag;
    }
}

+ 5 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorQuickReplyDao.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.repository.doctor;
import com.yihu.wlyy.entity.doctor.reply.DoctorQuickReply;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -11,7 +12,7 @@ import java.util.List;
/**
 * Created by lyr-pc on 2016/12/28.
 */
public interface DoctorQuickReplyDao extends PagingAndSortingRepository<DoctorQuickReply, Long> {
public interface DoctorQuickReplyDao extends PagingAndSortingRepository<DoctorQuickReply, Long> ,JpaSpecificationExecutor<DoctorQuickReply> {
    @Query("select max(q.sort) from DoctorQuickReply q where q.doctor = ?1 and q.status = 1")
    Integer findMaxSort(String doctor);
@ -30,4 +31,7 @@ public interface DoctorQuickReplyDao extends PagingAndSortingRepository<DoctorQu
    @Query("select q from DoctorQuickReply q where q.doctor = ?1 and q.status = 1")
    List<DoctorQuickReply> findDoctorReplies(String doctor, Sort sort);
    
    @Query("select q from DoctorQuickReply q where q.doctor = ?1 and q.status = 1")
    List<DoctorQuickReply> findDoctorRepliesByType(String doctor, Integer type ,Sort sort);
}

+ 0 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionFollowupContentService.java

@ -19,7 +19,6 @@ import com.yihu.wlyy.service.app.health.PatientHealthIndexService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ImUtill;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

+ 21 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/reply/DoctorQuickReplyService.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.service.app.reply;
import com.yihu.wlyy.entity.doctor.reply.DoctorQuickReply;
import com.yihu.wlyy.repository.doctor.DoctorQuickReplyDao;
import com.yihu.wlyy.service.BaseService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
@ -10,6 +11,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.print.Doc;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -29,7 +31,7 @@ public class DoctorQuickReplyService extends BaseService {
     * @param content 快捷回复内容
     * @return
     */
    public DoctorQuickReply addReply(String doctor, String content) {
    public DoctorQuickReply addReply(String doctor, String content,String type) {
        DoctorQuickReply reply = new DoctorQuickReply();
        Integer sort = quickReplyDao.findMaxSort(doctor);
        sort = sort == null ? 1 : sort + 1;
@ -38,6 +40,7 @@ public class DoctorQuickReplyService extends BaseService {
        reply.setStatus(1);
        reply.setSort(sort);
        reply.setUpdateTime(new Date());
        reply.setType(Integer.parseInt(type));
        return quickReplyDao.save(reply);
    }
@ -49,7 +52,7 @@ public class DoctorQuickReplyService extends BaseService {
     * @param content 快捷回复内容
     * @return
     */
    public DoctorQuickReply modifyReply(long id, String content) throws Exception {
    public DoctorQuickReply modifyReply(long id, String content,String type) throws Exception {
        DoctorQuickReply reply = quickReplyDao.findOne(id);
        if (reply == null) {
@ -57,6 +60,7 @@ public class DoctorQuickReplyService extends BaseService {
        }
        reply.setContent(content);
        reply.setType(Integer.parseInt(type));
        return quickReplyDao.save(reply);
    }
@ -91,9 +95,22 @@ public class DoctorQuickReplyService extends BaseService {
     * @param doctor
     * @return
     */
    public List<DoctorQuickReply> getDoctorReplyList(String doctor) {
    public List<DoctorQuickReply> getDoctorReplyList(String doctor,String type) {
        Sort sort = new Sort(Sort.Direction.DESC, "sort");
        List<DoctorQuickReply> replies = quickReplyDao.findDoctorReplies(doctor, sort);
        List<DoctorQuickReply> replies = quickReplyDao.findDoctorRepliesByType(doctor, Integer.parseInt(type),sort);
        
        if("1".equals(type)){
            //如果是续方咨询,拿到的列表为空,则默认添加系统消息
            List<DoctorQuickReply> defaults = quickReplyDao.findDoctorReplies("default",sort);
            for (DoctorQuickReply doctorQuickReply:defaults) {
                doctorQuickReply.setId(null);
                doctorQuickReply.setDoctor(doctor);
            }
            quickReplyDao.save(defaults);
    
            replies = quickReplyDao.findDoctorRepliesByType(doctor, Integer.parseInt(type),sort);
        }
        
        return replies;
    }

+ 0 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java

@ -1182,8 +1182,4 @@ public class DoctorConsultController extends WeixinBaseController {
            return error(-1,"添加失败");
        }
    }
    
}

+ 12 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/reply/DoctorQuickReplyController.java

@ -28,13 +28,16 @@ public class DoctorQuickReplyController extends BaseController {
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ApiOperation(value = "添加快捷回复")
    public String addReply(@RequestParam @ApiParam(value = "快捷回复内容") String content) {
    public String addReply(
            @RequestParam(value = "content", required = true) @ApiParam(value = "快捷回复内容") String content,
            @ApiParam(name = "type", value = "快捷回复类型(1为续方咨询)", defaultValue = "0")
            @RequestParam(value = "type", required = false, defaultValue = "0") String type) {
        try {
            if (StringUtils.isEmpty(content)) {
                return error(-1, "快捷回复内容不能为空");
            }
            DoctorQuickReply reply = quickReplyService.addReply(getUID(), content);
            DoctorQuickReply reply = quickReplyService.addReply(getUID(), content,type);
            if (reply != null) {
                return write(200, "添加成功", "data", reply);
@ -50,7 +53,9 @@ public class DoctorQuickReplyController extends BaseController {
    @ApiOperation(value = "修改快捷回复")
    @ObserverRequired
    public String modifyReply(@RequestParam @ApiParam(value = "快捷回复ID") Long id,
                              @RequestParam @ApiParam(value = "快捷回复内容") String content) {
                              @RequestParam @ApiParam(value = "快捷回复内容") String content,
                              @ApiParam(name = "type", value = "快捷回复类型(1为续方咨询)", defaultValue = "0")
                                  @RequestParam(value = "type", required = false, defaultValue = "0") String type) {
        try {
            if (id == null || id < 1) {
                return error(-1, "快捷回复ID不能为空");
@ -59,7 +64,7 @@ public class DoctorQuickReplyController extends BaseController {
                return error(-1, "快捷回复内容不能为空");
            }
            DoctorQuickReply reply = quickReplyService.modifyReply(id, content);
            DoctorQuickReply reply = quickReplyService.modifyReply(id, content,type);
            if (reply != null) {
                return write(200, "添加成功", "data", reply);
@ -150,9 +155,10 @@ public class DoctorQuickReplyController extends BaseController {
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ApiOperation(value = "快捷回复列表")
    public String replyList() {
    public String replyList(@ApiParam(name = "type", value = "快捷回复类型(1为续方咨询)", defaultValue = "0")
                                @RequestParam(value = "type", required = false, defaultValue = "0") String type) {
        try {
            List<DoctorQuickReply> replies = quickReplyService.getDoctorReplyList(getUID());
            List<DoctorQuickReply> replies = quickReplyService.getDoctorReplyList(getUID(),type);
            return write(200, "查询成功", "data", replies);
        } catch (Exception e) {
            e.printStackTrace();

+ 0 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionFollowupContentController.java

@ -28,7 +28,6 @@ public class PatientPrescriptionFollowupContentController extends BaseController
	@Autowired
	private PrescriptionFollowupContentService prescriptionFollowupContentService;
	
	
	@RequestMapping(value = "/getinfo", method = RequestMethod.GET)
	@ApiOperation("根据续方CODE、类型CODE,获取随访调查分类数据")
	public String getinfoByPrescriptionCodeAndFollowupProject(
@ -37,19 +36,14 @@ public class PatientPrescriptionFollowupContentController extends BaseController
			@ApiParam(name = "followupProject", value = "续方CODE", defaultValue = "问卷类型(症状、体征和问卷)")
			@RequestParam(value = "followupProject", required = true) String followupProject){
		try {
			
			List<PrescriptionFollowupContent> result = prescriptionFollowupContentService.getByPrescriptionCodeAndFollowupProject(prescriptioncode,followupProject);
			
			Map<String, String> datamap = new HashMap<>();
			
			if(!result.isEmpty()){
				for (PrescriptionFollowupContent prescriptionFollowupContent: result) {
					datamap.put(prescriptionFollowupContent.getFollowupKey(),prescriptionFollowupContent.getFollowupValue());
				}
			}
			
			return write(200, "请求成功!","data",datamap);
			
		}catch (Exception e){
			//日志文件中记录异常信息
			error(e);
@ -75,6 +69,5 @@ public class PatientPrescriptionFollowupContentController extends BaseController
			//返回接口异常信息处理结果
			return error(-1, "请求失败!"+e.getMessage());
		}
		
	}
}