Browse Source

模板引用记录

gaodm 5 years ago
parent
commit
2fdb0d1ca2

+ 7 - 150
icss-service/src/main/java/com/diagbot/entity/TemplateInfo.java

@@ -1,11 +1,13 @@
 package com.diagbot.entity;
 
-import java.io.Serializable;
-import java.util.Date;
-
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.Date;
 
 /**
  * <p>
@@ -15,6 +17,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
  * @author wangfeng
  * @since 2018-11-19
  */
+@Getter
+@Setter
 @TableName("icss_template_info")
 public class TemplateInfo implements Serializable {
 
@@ -103,151 +107,4 @@ public class TemplateInfo implements Serializable {
      * 备注
      */
     private String remark;
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-    public String getIsDeleted() {
-        return isDeleted;
-    }
-
-    public void setIsDeleted(String isDeleted) {
-        this.isDeleted = isDeleted;
-    }
-    public Date getGmtCreate() {
-        return gmtCreate;
-    }
-
-    public void setGmtCreate(Date gmtCreate) {
-        this.gmtCreate = gmtCreate;
-    }
-    public Date getGmtModified() {
-        return gmtModified;
-    }
-
-    public void setGmtModified(Date gmtModified) {
-        this.gmtModified = gmtModified;
-    }
-    public String getCreator() {
-        return creator;
-    }
-
-    public void setCreator(String creator) {
-        this.creator = creator;
-    }
-    public String getModifier() {
-        return modifier;
-    }
-
-    public void setModifier(String modifier) {
-        this.modifier = modifier;
-    }
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-    public Long getDoctorId() {
-        return doctorId;
-    }
-
-    public void setDoctorId(Long doctorId) {
-        this.doctorId = doctorId;
-    }
-   
-    public Long getHospitalDeptId() {
-		return hospitalDeptId;
-	}
-
-	public void setHospitalDeptId(Long hospitalDeptId) {
-		this.hospitalDeptId = hospitalDeptId;
-	}
-
-	public Long getHospitalId() {
-        return hospitalId;
-    }
-
-    public void setHospitalId(Long hospitalId) {
-        this.hospitalId = hospitalId;
-    }
-    
-    public Integer getSex() {
-		return sex;
-	}
-
-	public void setSex(Integer sex) {
-		this.sex = sex;
-	}
-
-	public String getType() {
-        return type;
-    }
-
-    public void setType(String type) {
-        this.type = type;
-    }
-    public String getPreview() {
-        return preview;
-    }
-
-    public void setPreview(String preview) {
-        this.preview = preview;
-    }
-    public String getDataJson() {
-        return dataJson;
-    }
-
-    public void setDataJson(String dataJson) {
-        this.dataJson = dataJson;
-    }
-    public String getRemark() {
-        return remark;
-    }
-
-    public void setRemark(String remark) {
-        this.remark = remark;
-    }
-
-    public Integer getTemplateType() {
-        return templateType;
-    }
-
-    public void setTemplateType(Integer templateType) {
-        this.templateType = templateType;
-    }
-
-    public static long getSerialVersionUID() {
-        return serialVersionUID;
-    }
-
-    public void setSpell(String spell) {
-        this.spell = spell;
-    }
-
-    @Override
-    public String toString() {
-        return "TemplateInfo{" +
-        "id=" + id +
-        ", isDeleted=" + isDeleted +
-        ", gmtCreate=" + gmtCreate +
-        ", gmtModified=" + gmtModified +
-        ", creator=" + creator +
-        ", modifier=" + modifier +
-        ", name=" + name +
-        ", doctorId=" + doctorId +
-        ", hospitalDeptId=" + hospitalDeptId +
-        ", hospitalId=" + hospitalId +
-        ", sex" + sex +
-        ", type=" + type +
-        ", preview=" + preview +
-        ", dataJson=" + dataJson +
-        ", remark=" + remark +
-        "}";
-    }
 }

+ 9 - 1
icss-service/src/main/java/com/diagbot/facade/TemplateQuoteFacade.java

@@ -7,6 +7,7 @@ import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.TemplateInfo;
 import com.diagbot.entity.TemplateQuote;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.TemplateTypeEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.TemplateQuoteServiceImpl;
@@ -44,13 +45,20 @@ public class TemplateQuoteFacade extends TemplateQuoteServiceImpl {
         templateInfoQuery
                 .eq("id", templateQuoteVO.getTemplateId())
                 .eq("is_deleted", IsDeleteEnum.N.getKey());
-        if (templateInfoFacade.count(templateInfoQuery) < 1) {
+        TemplateInfo templateInfo = templateInfoFacade.getOne(templateInfoQuery, false);
+        if (null == templateInfo) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "该模板不存在!");
         }
         //医生存在性验证
         RespDTO<DoctorInfoDTO> res
                 = tranServiceClient.getDoctorInfoById(templateQuoteVO.getDoctorId());
         RespDTOUtil.respNGDeal(res, "该医生不存在!");
+        //逻辑验证
+        if (templateInfo.getTemplateType().equals(TemplateTypeEnum.PersonalTemplate.getKey())){
+            if (!templateInfo.getDoctorId().equals(templateQuoteVO.getDoctorId())){
+                throw new CommonException(CommonErrorCode.NO_PERMISSION, "无权引用该模板!");
+            }
+        }
 
         //引用模板
         Date now = DateUtil.now();

+ 3 - 0
icss-service/src/main/java/com/diagbot/vo/TemplateInfoRevampVO.java

@@ -38,4 +38,7 @@ public class TemplateInfoRevampVO{
 	
 	@NotBlank(message = "请输入模板类型")
 	private String type;//模板名
+
+	@NotBlank(message = "请输入模板拼音首字母")
+	private String spell;//拼音
 }

+ 21 - 20
icss-service/src/main/java/com/diagbot/vo/TemplateInfosVO.java

@@ -1,13 +1,12 @@
 package com.diagbot.vo;
 
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-
 import lombok.Getter;
 import lombok.Setter;
 
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
 /**
- * 
  * @author wangfeng
  * @Description: 病历保存
  * @date 2018年11月16日 下午3:35:05
@@ -15,20 +14,22 @@ import lombok.Setter;
 @Getter
 @Setter
 public class TemplateInfosVO {
-	@NotBlank(message = "请输入模板名字")
-	private String modeName;//模板名字
-	@NotNull(message = "请输入医生id")
-	private Long doctorId;//医生id
-	@NotNull(message = "请输入医院id")
-	private Long hospitalId;//医院id
-	@NotNull(message = "请输入部门id")
-	private Long hospitalDeptId;//部门id
-	@NotNull(message = "请输入性别")
-	private Integer sex;//性别
-	@NotBlank(message = "请输入模板类型")
-	private String modeType;//模板类型
-	@NotNull(message = "请输入预览文本")
-	private ContentsVO preview;//预览文本
-	@NotBlank(message = "请输入模板数据")
-	private String dataJson;//模板数据
+    @NotBlank(message = "请输入模板名字")
+    private String modeName;//模板名字
+    @NotNull(message = "请输入医生id")
+    private Long doctorId;//医生id
+    @NotNull(message = "请输入医院id")
+    private Long hospitalId;//医院id
+    @NotNull(message = "请输入部门id")
+    private Long hospitalDeptId;//部门id
+    @NotNull(message = "请输入性别")
+    private Integer sex;//性别
+    @NotBlank(message = "请输入模板类型")
+    private String modeType;//模板类型
+    @NotNull(message = "请输入预览文本")
+    private ContentsVO preview;//预览文本
+    @NotBlank(message = "请输入模板数据")
+    private String dataJson;//模板数据
+    @NotBlank(message = "请输入模板拼音首字母")
+    private String spell;//拼音
 }