Explorar o código

问诊保存修改

rgb %!s(int64=6) %!d(string=hai) anos
pai
achega
a687692d7f

+ 24 - 0
prec-service/src/main/java/com/diagbot/dto/SaveInquiryDTO.java

@@ -0,0 +1,24 @@
+package com.diagbot.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: rengb
+ * @time: 2018/11/19 18:56
+ */
+@ApiModel(value="问诊记录保存接口出参")
+@Getter
+@Setter
+public class SaveInquiryDTO{
+	
+	/**
+	 * 问诊记录id
+	 */
+	@ApiModelProperty(value="问诊记录id")
+	private Long inquiryId;
+		
+}

+ 0 - 281
prec-service/src/main/java/com/diagbot/entity/Evaluator.java

@@ -1,281 +0,0 @@
-package com.diagbot.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.Date;
-
-/**
- * <p>
- * 评估用户结果表
- * </p>
- *
- * @author gaodm
- * @since 2019-05-30
- */
-@TableName("prec_evaluator")
-@ApiModel
-public class Evaluator implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 主键
-     */
-    @ApiModelProperty(hidden = true)
-    @TableId(value = "id", type = IdType.AUTO)
-    private Long id;
-
-
-    /**
-     * 是否删除,N:未删除,Y:删除
-     */
-    @ApiModelProperty(hidden = true)
-    private String isDeleted;
-
-    /**
-     * 记录创建时间
-     */
-    @ApiModelProperty(hidden = true)
-    private Date gmtCreate;
-
-    /**
-     * 记录修改时间,如果时间是1970年则表示纪录未修改
-     */
-    @ApiModelProperty(hidden = true)
-    private Date gmtModified;
-
-    /**
-     * 创建人,0表示无创建人值
-     */
-    @ApiModelProperty(hidden = true)
-    private String creator;
-
-    /**
-     * 修改人,如果为0则表示纪录未修改
-     */
-    @ApiModelProperty(hidden = true)
-    private String modifier;
-
-    /**
-     * 姓名
-     */
-    @ApiModelProperty(hidden = true)
-    private String name;
-
-    /**
-     * 手机号
-     */
-    @ApiModelProperty(hidden = true)
-    private String phone;
-
-    /**
-     * 性别(1:男 2:女)
-     */
-    @ApiModelProperty(hidden = true)
-    private Integer sex;
-
-    /**
-     * 年龄
-     */
-    @ApiModelProperty(hidden = true)
-    private Integer age;
-
-    /**
-     * 平和体质转化分
-     */
-    private BigDecimal mildValue;
-
-    /**
-     * 气虚体质转化分
-     */
-    private BigDecimal faintValue;
-
-    /**
-     * 湿滞体质转化分
-     */
-    private BigDecimal wetValue;
-
-    /**
-     * 心肝火旺体质转化分
-     */
-    private BigDecimal heartValue;
-
-    /**
-     * 积滞体质转化分
-     */
-    private BigDecimal stagnantValue;
-
-    /**
-     * 异禀体质转化分
-     */
-    private BigDecimal exceptValue;
-
-    /**
-     * 体质结果
-     */
-    @ApiModelProperty(hidden = true)
-    private String physicalRes;
-
-    /**
-     * 需要显示的体质逗号隔开
-     */
-    @ApiModelProperty(hidden = true)
-    private String physicalTypes;
-
-    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 String getPhone() {
-        return phone;
-    }
-
-    public void setPhone(String phone) {
-        this.phone = phone;
-    }
-    public Integer getSex() {
-        return sex;
-    }
-
-    public void setSex(Integer sex) {
-        this.sex = sex;
-    }
-    public Integer getAge() {
-        return age;
-    }
-
-    public void setAge(Integer age) {
-        this.age = age;
-    }
-    public BigDecimal getMildValue() {
-        return mildValue;
-    }
-
-    public void setMildValue(BigDecimal mildValue) {
-        this.mildValue = mildValue;
-    }
-    public BigDecimal getFaintValue() {
-        return faintValue;
-    }
-
-    public void setFaintValue(BigDecimal faintValue) {
-        this.faintValue = faintValue;
-    }
-    public BigDecimal getWetValue() {
-        return wetValue;
-    }
-
-    public void setWetValue(BigDecimal wetValue) {
-        this.wetValue = wetValue;
-    }
-    public BigDecimal getHeartValue() {
-        return heartValue;
-    }
-
-    public void setHeartValue(BigDecimal heartValue) {
-        this.heartValue = heartValue;
-    }
-    public BigDecimal getStagnantValue() {
-        return stagnantValue;
-    }
-
-    public void setStagnantValue(BigDecimal stagnantValue) {
-        this.stagnantValue = stagnantValue;
-    }
-    public BigDecimal getExceptValue() {
-        return exceptValue;
-    }
-
-    public void setExceptValue(BigDecimal exceptValue) {
-        this.exceptValue = exceptValue;
-    }
-    public String getPhysicalRes() {
-        return physicalRes;
-    }
-
-    public void setPhysicalRes(String physicalRes) {
-        this.physicalRes = physicalRes;
-    }
-    public String getPhysicalTypes() {
-        return physicalTypes;
-    }
-
-    public void setPhysicalTypes(String physicalTypes) {
-        this.physicalTypes = physicalTypes;
-    }
-
-    @Override
-    public String toString() {
-        return "Evaluator{" +
-        "id=" + id +
-        ", isDeleted=" + isDeleted +
-        ", gmtCreate=" + gmtCreate +
-        ", gmtModified=" + gmtModified +
-        ", creator=" + creator +
-        ", modifier=" + modifier +
-        ", name=" + name +
-        ", phone=" + phone +
-        ", sex=" + sex +
-        ", age=" + age +
-        ", mildValue=" + mildValue +
-        ", faintValue=" + faintValue +
-        ", wetValue=" + wetValue +
-        ", heartValue=" + heartValue +
-        ", stagnantValue=" + stagnantValue +
-        ", exceptValue=" + exceptValue +
-        ", physicalRes=" + physicalRes +
-        ", physicalTypes=" + physicalTypes +
-        "}";
-    }
-}

+ 0 - 292
prec-service/src/main/java/com/diagbot/facade/EvaluatorFacade.java

@@ -1,292 +0,0 @@
-package com.diagbot.facade;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.PhysicalInfoDTO;
-import com.diagbot.dto.SearchEvaluatorDTO;
-import com.diagbot.entity.Evaluator;
-import com.diagbot.entity.PhysicalInfo;
-import com.diagbot.entity.PhysicalVal;
-import com.diagbot.enums.IsDeleteEnum;
-import com.diagbot.enums.PhysicalTypeEnum;
-import com.diagbot.enums.SexEnum;
-import com.diagbot.exception.CommonErrorCode;
-import com.diagbot.exception.CommonException;
-import com.diagbot.service.impl.EvaluatorServiceImpl;
-import com.diagbot.util.BeanUtil;
-import com.diagbot.util.DateUtil;
-import com.diagbot.util.ListUtil;
-import com.diagbot.util.RegexValidateUtil;
-import com.diagbot.vo.AddEvaluatorVO;
-import com.diagbot.vo.SearchEvaluatorVO;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.math.BigDecimal;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * @Description:
- * @author: gaodm
- * @time: 2019/5/30 10:41
- */
-@Component
-public class EvaluatorFacade extends EvaluatorServiceImpl {
-    @Autowired
-    private PhysicalInfoFacade physicalInfoFacade;
-
-
-    public static void main(String[] args) {
-        EvaluatorFacade evaluatorFacade = new EvaluatorFacade();
-        Evaluator evaluator = new Evaluator();
-        evaluator.setMildValue(new BigDecimal(70.0)); // 平和体质
-        evaluator.setFaintValue(new BigDecimal(50.0)); // 气虚体质
-        evaluator.setStagnantValue(new BigDecimal(49.0)); // 积滞同质
-        evaluator.setWetValue(new BigDecimal(31.0)); // 湿滞体质
-        evaluator.setHeartValue(new BigDecimal(31.000)); // 心肝火旺体质
-        evaluator.setExceptValue(new BigDecimal(22.01)); // 异禀体质
-//        evaluatorFacade.valueSort(evaluator);
-        evaluatorFacade.cal(evaluator);
-
-    }
-
-
-    /**
-     * 计算体质
-     *
-     * @param evaluator 参数
-     * @return
-     */
-    public Evaluator cal(Evaluator evaluator) {
-
-        List<PhysicalVal> list = this.valueSort(evaluator);
-        Double max = list.get(0).getValue();
-        Double min = list.get(4).getValue();
-
-        if (max >= 50) {
-            // 最大值有多个【是XX体质兼有XX体质】,最大值只有1个【是XX体质】
-            if (list.get(1).getValue() >= 50) {
-                evaluator.setPhysicalRes("是" +
-                        PhysicalTypeEnum.getName(list.get(0).getEnumNo())
-                        + "兼有" +
-                        PhysicalTypeEnum.getName(list.get(1).getEnumNo()));
-                evaluator.setPhysicalTypes("" + list.get(0).getEnumNo() + "," + list.get(1).getEnumNo());
-            } else {
-                evaluator.setPhysicalRes("是" +
-                        PhysicalTypeEnum.getName(list.get(0).getEnumNo()));
-                evaluator.setPhysicalTypes("" + list.get(0).getEnumNo());
-            }
-        } else if (max < 30) {
-            // 同时其他5种体质转化分均<30分, max[2/3/4/5/6] < 30
-            evaluator.setPhysicalRes("平和体质");
-            evaluator.setPhysicalTypes(String.valueOf(PhysicalTypeEnum.mild.getKey()));
-        } else {
-            if (evaluator.getMildValue().doubleValue() >= 60.0) {
-                if (max < 50 && min >= 30) {
-                    // 同时其他5种体质转化分均<50分,min[2/3/4/5/6] >= 30 and max[2/3/4/5/6] < 50
-                    evaluator.setPhysicalRes("基本是平和体质");
-                    evaluator.setPhysicalTypes(String.valueOf(PhysicalTypeEnum.mild.getKey()));
-                } else if (max < 50 && max >= 30 && min < 30) {
-                    // 同时其他5种体质转化分有30-49分,max[2/3/4/5/6] < 50 and max[2/3/4/5/6] >= 30 and min[2/3/4/5/6] < 30
-                    evaluator.setPhysicalRes("基本是平和体质兼倾向" + PhysicalTypeEnum.getName(list.get(0).getEnumNo()));
-                    evaluator.setPhysicalTypes(String.valueOf(PhysicalTypeEnum.mild.getKey()) + "," + list.get(0).getEnumNo());
-                }
-            } else {
-                if (list.get(0).getValue().equals(list.get(1).getValue())) {
-                    evaluator.setPhysicalRes(
-                            "倾向是" +
-                                    PhysicalTypeEnum.getName(list.get(0).getEnumNo())
-                                    + "兼有" +
-                                    PhysicalTypeEnum.getName(list.get(1).getEnumNo()));
-                    evaluator.setPhysicalTypes("" + list.get(0).getEnumNo() + "," + list.get(1).getEnumNo());
-                } else {
-                    evaluator.setPhysicalRes("倾向是" +
-                            PhysicalTypeEnum.getName(list.get(0).getEnumNo()));
-                    evaluator.setPhysicalTypes("" + list.get(0).getEnumNo());
-                }
-            }
-        }
-//        /**
-//         * 判断平和质:
-//         * 平和质转化分≥60分,同时其他5种体质转化分均<30分,判断结果:“平和质”。
-//         * 平和质转化分≥60分,同时其他5种体质转化分均<50分,判断结果:“基本是平和质”。
-//         * 平和质转化分≥60分,同时其他5种体质转化分有30-49分,判断结果:“基本是平和质兼倾向XX体质”。
-//         * 不满足上述条件,判断结果:否。
-//         */
-//        // 平和质转化分≥60分
-//        if (evaluator.getMildValue().doubleValue() >= 60.0) {
-//            if (max < 30) {
-//                // 同时其他5种体质转化分均<30分, max[2/3/4/5/6] < 30
-//                evaluator.setPhysicalRes("平和体质");
-//                evaluator.setPhysicalTypes(String.valueOf(PhysicalTypeEnum.mild.getKey()));
-//            } else if (max < 50 && min >= 30) {
-//                // 同时其他5种体质转化分均<50分,min[2/3/4/5/6] >= 30 and max[2/3/4/5/6] < 50
-//                evaluator.setPhysicalRes("基本是平和体质");
-//                evaluator.setPhysicalTypes(String.valueOf(PhysicalTypeEnum.mild.getKey()));
-//            } else if (max < 50 && max >= 30 && min < 30) {
-//                // 同时其他5种体质转化分有30-49分,max[2/3/4/5/6] < 50 and max[2/3/4/5/6] >= 30 and min[2/3/4/5/6] < 30
-//                evaluator.setPhysicalRes("基本是平和体质兼倾向" + PhysicalTypeEnum.getName(list.get(0).getEnumNo()));
-//                evaluator.setPhysicalTypes(String.valueOf(PhysicalTypeEnum.mild.getKey()) + "," + list.get(0).getEnumNo());
-//            } else if (max >= 50) {
-//                // 同时其他5种体质转化分有>=50分, max[2/3/4/5/6] >= 50
-//                if ((list.get(0).getValue() == list.get(1).getValue()) || (list.get(1).getValue() > 50)) {
-//                    evaluator.setPhysicalRes("是" + PhysicalTypeEnum.getName(list.get(0).getEnumNo()) + "兼有" + PhysicalTypeEnum.getName(list.get(1).getEnumNo()));
-//                    evaluator.setPhysicalTypes(list.get(0).getEnumNo() + "," + list.get(1).getEnumNo());
-//                } else {
-//                    evaluator.setPhysicalRes("是" + PhysicalTypeEnum.getName(list.get(0).getEnumNo()));
-//                    evaluator.setPhysicalTypes("" + list.get(0).getEnumNo());
-//                }
-//            }
-//        }
-//
-//        /**
-//         * 判断偏颇体质:
-//         * 转化分≥50分,判断结果:是XX体质。
-//         * 转化分30-49分,判断结果:倾向XX体质。
-//         * 转化分<30分,判断结果:否。
-//         * 结论:按照偏颇体质得分高低顺序排序,得分最高的为主要偏颇体质,结论按此体质显示,并在结果中按分值顺序提选兼有体质。
-//         * 首先判定5种偏颇体质得分是否均大于或等于≧50分。
-//         * 有一个或多个大于等于50分的情况,按照偏颇体质选择分值最大的为偏颇体质,排名第二的为兼有体质,其余的不考虑;如果得分排名第一的有两个或以上,则按照自然顺序将第一个列为主要偏颇体质,第二个列为兼有体质,其余的不予考虑。
-//         * 如出现得分一样的两种偏颇体质,则按照5种偏颇体质的排列顺序为:气虚质、积滞质、湿滞质、心火偏旺质、异禀质,
-//         * 5种全部小于<30分的情况,按照平和质判定条件执行。
-//         * 平和质转化分<60分,同时其他6种体质转化分30-49分,判断结果:倾向是XX体质。如果有两种或以上的得分一样,则按照6种偏颇体质的排列顺序为:气虚质、积滞质、湿滞质、心肝火旺质、异禀质,判断结果:“倾向是XX体质兼XX体质”,其余不考虑。如果等分倾向是体质有3个或以上,则仅选择分值最高的前两个,判断结果:“倾向是XX体质兼XX体质”,其余不考虑。
-//         * 注意:有偏颇体质的不再考虑倾向体质。
-//         */
-//        else if (evaluator.getMildValue().doubleValue() < 60.0) {
-//            if (max < 30) { // max[2/3/4/5/6] < 30
-//                evaluator.setPhysicalRes("平和体质");
-//                evaluator.setPhysicalTypes(String.valueOf(PhysicalTypeEnum.mild.getKey()));
-//            } else if (max < 50 && max >= 30) { // min[2/3/4/5/6] >= 30 and max[2/3/4/5/6] < 50
-//                // 最大值有多个【倾向XX体质兼有XX体质】, 最大值只有1个【倾向XX体质】
-//                if (list.get(0).getValue() == list.get(1).getValue()) {
-//                    evaluator.setPhysicalRes(
-//                            "倾向是" +
-//                                    PhysicalTypeEnum.getName(list.get(0).getEnumNo())
-//                                    + "兼有" +
-//                                    PhysicalTypeEnum.getName(list.get(1).getEnumNo()));
-//                    evaluator.setPhysicalTypes("" + list.get(0).getEnumNo() + "," + list.get(1).getEnumNo());
-//                } else {
-//                    evaluator.setPhysicalRes("倾向是" +
-//                            PhysicalTypeEnum.getName(list.get(0).getEnumNo()));
-//                    evaluator.setPhysicalTypes("" + list.get(0).getEnumNo());
-//                }
-//            } else if (max >= 50) { // max[2/3/4/5/6] >= 50
-//                // 最大值有多个【是XX体质兼有XX体质】,最大值只有1个【是XX体质】
-//                if ((list.get(0).getValue() == list.get(1).getValue()) || (list.get(1).getValue() > 50)) {
-//                    evaluator.setPhysicalRes("是" +
-//                            PhysicalTypeEnum.getName(list.get(0).getEnumNo())
-//                            + "兼有" +
-//                            PhysicalTypeEnum.getName(list.get(1).getEnumNo()));
-//                    evaluator.setPhysicalTypes("" + list.get(0).getEnumNo() + "," + list.get(1).getEnumNo());
-//                } else {
-//                    evaluator.setPhysicalRes("是" +
-//                            PhysicalTypeEnum.getName(list.get(0).getEnumNo()));
-//                    evaluator.setPhysicalTypes("" + list.get(0).getEnumNo());
-//                }
-//            }
-//        }
-        System.out.println(evaluator.getPhysicalRes());
-        System.out.println(evaluator.getPhysicalTypes());
-        return evaluator;
-    }
-
-
-    /**
-     * 对偏颇体质排序
-     *
-     * @param evaluator
-     * @return 列表
-     */
-    private List<PhysicalVal> valueSort(Evaluator evaluator){
-        List<PhysicalVal> res = ListUtil.newArrayList();
-        //气虚体质转化分
-        PhysicalVal faintValue = new PhysicalVal();
-        faintValue.setValue(evaluator.getFaintValue().doubleValue());
-        faintValue.setEnumNo(PhysicalTypeEnum.faint.getKey());
-        faintValue.setOrderNo(1);
-        res.add(faintValue);
-        //积滞体质转化分
-        PhysicalVal stagnantValue = new PhysicalVal();
-        stagnantValue.setValue(evaluator.getStagnantValue().doubleValue());
-        stagnantValue.setEnumNo(PhysicalTypeEnum.stagnant.getKey());
-        stagnantValue.setOrderNo(2);
-        res.add(stagnantValue);
-        //湿滞体质转化分
-        PhysicalVal wetValue = new PhysicalVal();
-        wetValue.setValue(evaluator.getWetValue().doubleValue());
-        wetValue.setEnumNo(PhysicalTypeEnum.wet.getKey());
-        wetValue.setOrderNo(3);
-        res.add(wetValue);
-        //心肝火旺体质转化分
-        PhysicalVal heartValue = new PhysicalVal();
-        heartValue.setValue(evaluator.getHeartValue().doubleValue());
-        heartValue.setEnumNo(PhysicalTypeEnum.heart.getKey());
-        heartValue.setOrderNo(4);
-        res.add(heartValue);
-        //异禀体质转化分
-        PhysicalVal exceptValue = new PhysicalVal();
-        exceptValue.setValue(evaluator.getExceptValue().doubleValue());
-        exceptValue.setEnumNo(PhysicalTypeEnum.except.getKey());
-        exceptValue.setOrderNo(5);
-        res.add(exceptValue);
-
-        List<PhysicalVal> collect
-                = res.stream()
-                .sorted(Comparator.comparing(PhysicalVal::getValue).reversed()
-                        .thenComparing(PhysicalVal::getOrderNo))
-                .collect(Collectors.toList());
-        return collect;
-    }
-
-    public Boolean addEvaluator(AddEvaluatorVO addDeptInfoVO) {
-        //参数验证
-        if (!RegexValidateUtil.checkMobileNumber(addDeptInfoVO.getPhone())) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
-                    "请输入正确的手机号");
-        }
-        if (null == SexEnum.getName(addDeptInfoVO.getSex())) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
-                    "请输入正确的性别类型");
-        }
-
-        Evaluator evaluator = new Evaluator();
-        BeanUtil.copyProperties(addDeptInfoVO, evaluator);
-        //计算
-        this.cal(evaluator);
-
-        //保存结果
-        Date now = DateUtil.now();
-        evaluator.setIsDeleted(IsDeleteEnum.N.getKey());
-        evaluator.setGmtCreate(now);
-        evaluator.setGmtModified(now);
-        Boolean res = this.save(evaluator);
-        if (!res) {
-            throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "评估结果提交失败!");
-        }
-        return res;
-    }
-
-    public IPage<SearchEvaluatorDTO> getEvaluatorPage(SearchEvaluatorVO searchEvaluatorVO) {
-        IPage<SearchEvaluatorDTO> res = this.getEvaluators(searchEvaluatorVO);
-        if (ListUtil.isNotEmpty(res.getRecords())) {
-            Map<String, PhysicalInfo> pMap = physicalInfoFacade.getPhysicalMap();
-
-            for (SearchEvaluatorDTO searchEvaluatorDTO : res.getRecords()) {
-                String[] physicalTypes = searchEvaluatorDTO.getPhysicalTypes().split(",");
-                List<PhysicalInfoDTO> physicalInfoDTOList = ListUtil.newArrayList();
-                for (String s : physicalTypes) {
-                    PhysicalInfoDTO physicalInfoDTO = new PhysicalInfoDTO();
-                    if (null != pMap.get(s)) {
-                        BeanUtil.copyProperties(pMap.get(s), physicalInfoDTO);
-                        physicalInfoDTOList.add(physicalInfoDTO);
-                    }
-                }
-                searchEvaluatorDTO.setPhysicalInfoDTOList(physicalInfoDTOList);
-            }
-        }
-        return res;
-    }
-}

+ 220 - 1
prec-service/src/main/java/com/diagbot/facade/InquiryEvaluatorFacade.java

@@ -1,8 +1,35 @@
 package com.diagbot.facade;
 
+import java.math.BigDecimal;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.PhysicalInfoDTO;
+import com.diagbot.dto.SearchEvaluatorDTO;
+import com.diagbot.entity.InquiryEvaluator;
+import com.diagbot.entity.InquiryInfo;
+import com.diagbot.entity.PhysicalInfo;
+import com.diagbot.entity.PhysicalVal;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.PhysicalTypeEnum;
+import com.diagbot.enums.SexEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.InquiryEvaluatorServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.RegexValidateUtil;
+import com.diagbot.vo.AddEvaluatorVO;
+import com.diagbot.vo.SearchEvaluatorVO;
 
 /**
  * @author: zhoutg
@@ -10,7 +37,199 @@ import com.diagbot.service.impl.InquiryEvaluatorServiceImpl;
  */
 @Component
 public class InquiryEvaluatorFacade extends InquiryEvaluatorServiceImpl {
+	@Autowired
+    private PhysicalInfoFacade physicalInfoFacade;
+	@Autowired
+    private InquiryInfoFacade inquiryInfoFacade;
+
+    public static void main(String[] args) {
+    	InquiryEvaluatorFacade inquiryEvaluatorFacade = new InquiryEvaluatorFacade();
+        InquiryEvaluator inquiryEvaluator = new InquiryEvaluator();
+        inquiryEvaluator.setMildValue(new BigDecimal(70.0)); // 平和体质
+        inquiryEvaluator.setFaintValue(new BigDecimal(50.0)); // 气虚体质
+        inquiryEvaluator.setStagnantValue(new BigDecimal(49.0)); // 积滞同质
+        inquiryEvaluator.setWetValue(new BigDecimal(31.0)); // 湿滞体质
+        inquiryEvaluator.setHeartValue(new BigDecimal(31.000)); // 心肝火旺体质
+        inquiryEvaluator.setExceptValue(new BigDecimal(22.01)); // 异禀体质
+        //inquiryEvaluatorFacade.valueSort(inquiryEvaluator);
+        inquiryEvaluatorFacade.cal(inquiryEvaluator);
+    }
+
+
+    /**
+     * 计算体质
+     *
+     * @param evaluator 参数
+     * @return
+     */
+    public InquiryEvaluator cal(InquiryEvaluator evaluator) {
+
+        List<PhysicalVal> list = this.valueSort(evaluator);
+        Double max = list.get(0).getValue();
+        Double min = list.get(4).getValue();
+
+        if (max >= 50) {
+            // 最大值有多个【是XX体质兼有XX体质】,最大值只有1个【是XX体质】
+            if (list.get(1).getValue() >= 50) {
+                evaluator.setPhysicalRes("是" +
+                        PhysicalTypeEnum.getName(list.get(0).getEnumNo())
+                        + "兼有" +
+                        PhysicalTypeEnum.getName(list.get(1).getEnumNo()));
+                evaluator.setPhysicalTypes("" + list.get(0).getEnumNo() + "," + list.get(1).getEnumNo());
+            } else {
+                evaluator.setPhysicalRes("是" +
+                        PhysicalTypeEnum.getName(list.get(0).getEnumNo()));
+                evaluator.setPhysicalTypes("" + list.get(0).getEnumNo());
+            }
+        } else if (max < 30) {
+            // 同时其他5种体质转化分均<30分, max[2/3/4/5/6] < 30
+            evaluator.setPhysicalRes("平和体质");
+            evaluator.setPhysicalTypes(String.valueOf(PhysicalTypeEnum.mild.getKey()));
+        } else {
+            if (evaluator.getMildValue().doubleValue() >= 60.0) {
+                if (max < 50 && min >= 30) {
+                    // 同时其他5种体质转化分均<50分,min[2/3/4/5/6] >= 30 and max[2/3/4/5/6] < 50
+                    evaluator.setPhysicalRes("基本是平和体质");
+                    evaluator.setPhysicalTypes(String.valueOf(PhysicalTypeEnum.mild.getKey()));
+                } else if (max < 50 && max >= 30 && min < 30) {
+                    // 同时其他5种体质转化分有30-49分,max[2/3/4/5/6] < 50 and max[2/3/4/5/6] >= 30 and min[2/3/4/5/6] < 30
+                    evaluator.setPhysicalRes("基本是平和体质兼倾向" + PhysicalTypeEnum.getName(list.get(0).getEnumNo()));
+                    evaluator.setPhysicalTypes(String.valueOf(PhysicalTypeEnum.mild.getKey()) + "," + list.get(0).getEnumNo());
+                }
+            } else {
+                if (list.get(0).getValue().equals(list.get(1).getValue())) {
+                    evaluator.setPhysicalRes(
+                            "倾向是" +
+                                    PhysicalTypeEnum.getName(list.get(0).getEnumNo())
+                                    + "兼有" +
+                                    PhysicalTypeEnum.getName(list.get(1).getEnumNo()));
+                    evaluator.setPhysicalTypes("" + list.get(0).getEnumNo() + "," + list.get(1).getEnumNo());
+                } else {
+                    evaluator.setPhysicalRes("倾向是" +
+                            PhysicalTypeEnum.getName(list.get(0).getEnumNo()));
+                    evaluator.setPhysicalTypes("" + list.get(0).getEnumNo());
+                }
+            }
+        }
+        return evaluator;
+    }
+
+
+    /**
+     * 对偏颇体质排序
+     *
+     * @param evaluator
+     * @return 列表
+     */
+    private List<PhysicalVal> valueSort(InquiryEvaluator evaluator){
+        List<PhysicalVal> res = ListUtil.newArrayList();
+        //气虚体质转化分
+        PhysicalVal faintValue = new PhysicalVal();
+        faintValue.setValue(evaluator.getFaintValue().doubleValue());
+        faintValue.setEnumNo(PhysicalTypeEnum.faint.getKey());
+        faintValue.setOrderNo(1);
+        res.add(faintValue);
+        //积滞体质转化分
+        PhysicalVal stagnantValue = new PhysicalVal();
+        stagnantValue.setValue(evaluator.getStagnantValue().doubleValue());
+        stagnantValue.setEnumNo(PhysicalTypeEnum.stagnant.getKey());
+        stagnantValue.setOrderNo(2);
+        res.add(stagnantValue);
+        //湿滞体质转化分
+        PhysicalVal wetValue = new PhysicalVal();
+        wetValue.setValue(evaluator.getWetValue().doubleValue());
+        wetValue.setEnumNo(PhysicalTypeEnum.wet.getKey());
+        wetValue.setOrderNo(3);
+        res.add(wetValue);
+        //心肝火旺体质转化分
+        PhysicalVal heartValue = new PhysicalVal();
+        heartValue.setValue(evaluator.getHeartValue().doubleValue());
+        heartValue.setEnumNo(PhysicalTypeEnum.heart.getKey());
+        heartValue.setOrderNo(4);
+        res.add(heartValue);
+        //异禀体质转化分
+        PhysicalVal exceptValue = new PhysicalVal();
+        exceptValue.setValue(evaluator.getExceptValue().doubleValue());
+        exceptValue.setEnumNo(PhysicalTypeEnum.except.getKey());
+        exceptValue.setOrderNo(5);
+        res.add(exceptValue);
+
+        List<PhysicalVal> collect
+                = res.stream()
+                .sorted(Comparator.comparing(PhysicalVal::getValue).reversed()
+                        .thenComparing(PhysicalVal::getOrderNo))
+                .collect(Collectors.toList());
+        return collect;
+    }
+
+    public Boolean addEvaluator(AddEvaluatorVO addDeptInfoVO) {
+        //参数验证
+        if (!RegexValidateUtil.checkMobileNumber(addDeptInfoVO.getPhone())) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
+                    "请输入正确的手机号");
+        }
+        if (null == SexEnum.getName(addDeptInfoVO.getSex())) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
+                    "请输入正确的性别类型");
+        }
+        
+        Date now = DateUtil.now();
+        
+        QueryWrapper<InquiryInfo> inquiryInfoQe = new QueryWrapper<>();
+        inquiryInfoQe.eq("is_deleted", IsDeleteEnum.N.getKey());
+        inquiryInfoQe.eq("hospital_id", addDeptInfoVO.getHospitalId());
+        inquiryInfoQe.eq("hospital_dept_id", addDeptInfoVO.getHospitalDeptId());
+        inquiryInfoQe.eq("doctor_id", addDeptInfoVO.getDoctorId());
+        inquiryInfoQe.eq("patient_id", addDeptInfoVO.getPatientId());
+        inquiryInfoQe.eq("inquiry_code", addDeptInfoVO.getInquiryCode());
+        InquiryInfo inquiryInfo = inquiryInfoFacade.getOne(inquiryInfoQe);
+        
+        if(inquiryInfo==null){
+        	inquiryInfo = new InquiryInfo();
+        	inquiryInfo.setGmtCreate(now);
+        }
+        
+        BeanUtil.copyProperties(addDeptInfoVO, inquiryInfo);
+        inquiryInfo.setGmtModified(now);
+        inquiryInfoFacade.saveOrUpdate(inquiryInfo);
+
+        InquiryEvaluator evaluator = new InquiryEvaluator();
+        BeanUtil.copyProperties(addDeptInfoVO, evaluator);
+        evaluator.setInquiryId(inquiryInfo.getId());
+        
+        //计算
+        this.cal(evaluator);
+
+        //保存结果
+        evaluator.setIsDeleted(IsDeleteEnum.N.getKey());
+        evaluator.setGmtCreate(now);
+        evaluator.setGmtModified(now);
+        Boolean res = this.save(evaluator);
+        if (!res) {
+            throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "评估结果提交失败!");
+        }
+        return res;
+    }
+
+    public IPage<SearchEvaluatorDTO> getEvaluatorPage(SearchEvaluatorVO searchEvaluatorVO) {
+        IPage<SearchEvaluatorDTO> res = this.baseMapper.getEvaluators(searchEvaluatorVO);
+        if (ListUtil.isNotEmpty(res.getRecords())) {
+            Map<String, PhysicalInfo> pMap = physicalInfoFacade.getPhysicalMap();
 
-    
+            for (SearchEvaluatorDTO searchEvaluatorDTO : res.getRecords()) {
+                String[] physicalTypes = searchEvaluatorDTO.getPhysicalTypes().split(",");
+                List<PhysicalInfoDTO> physicalInfoDTOList = ListUtil.newArrayList();
+                for (String s : physicalTypes) {
+                    PhysicalInfoDTO physicalInfoDTO = new PhysicalInfoDTO();
+                    if (null != pMap.get(s)) {
+                        BeanUtil.copyProperties(pMap.get(s), physicalInfoDTO);
+                        physicalInfoDTOList.add(physicalInfoDTO);
+                    }
+                }
+                searchEvaluatorDTO.setPhysicalInfoDTOList(physicalInfoDTOList);
+            }
+        }
+        return res;
+    }
 
 }

+ 79 - 0
prec-service/src/main/java/com/diagbot/facade/InquiryInfoFacade.java

@@ -1,8 +1,24 @@
 package com.diagbot.facade;
 
+import java.util.Date;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.SaveInquiryDTO;
+import com.diagbot.entity.InquiryDetail;
+import com.diagbot.entity.InquiryInfo;
+import com.diagbot.entity.InquiryReport;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.InquiryDetailServiceImpl;
 import com.diagbot.service.impl.InquiryInfoServiceImpl;
+import com.diagbot.service.impl.InquiryReportServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.DateUtil;
+import com.diagbot.vo.SaveInquiryVO;
 
 /**
  * @author: zhoutg
@@ -10,7 +26,70 @@ import com.diagbot.service.impl.InquiryInfoServiceImpl;
  */
 @Component
 public class InquiryInfoFacade extends InquiryInfoServiceImpl {
+	
+	@Autowired
+    private InquiryDetailFacade inquiryDetailFacade;
+	@Autowired
+    private InquiryReportFacade inquiryReportFacade;
+	@Autowired
+    @Qualifier("inquiryDetailServiceImpl")
+    private InquiryDetailServiceImpl inquiryDetailServiceImpl;
+	@Autowired
+    @Qualifier("inquiryReportServiceImpl")
+    private InquiryReportServiceImpl inquiryReportServiceImpl;
 
     
+	public SaveInquiryDTO saveInquiry(SaveInquiryVO saveInquiryVO){
+		SaveInquiryDTO saveInquiryDTO = new SaveInquiryDTO();
+        Date now = DateUtil.now();
+        
+        QueryWrapper<InquiryInfo> inquiryInfoQe = new QueryWrapper<>();
+        inquiryInfoQe.eq("is_deleted", IsDeleteEnum.N.getKey());
+        inquiryInfoQe.eq("hospital_id", saveInquiryVO.getHospitalId());
+        inquiryInfoQe.eq("hospital_dept_id", saveInquiryVO.getHospitalDeptId());
+        inquiryInfoQe.eq("doctor_id", saveInquiryVO.getDoctorId());
+        inquiryInfoQe.eq("patient_id", saveInquiryVO.getPatientId());
+        inquiryInfoQe.eq("inquiry_code", saveInquiryVO.getInquiryCode());
+        InquiryInfo inquiryInfo = this.getOne(inquiryInfoQe);
+        
+        if(inquiryInfo==null){
+        	inquiryInfo = new InquiryInfo();
+        	inquiryInfo.setGmtCreate(now);
+        }else{
+        	QueryWrapper<InquiryDetail> inquiryDetailQe = new QueryWrapper<>();
+        	inquiryDetailQe.eq("inquiry_id", inquiryInfo.getId());
+        	inquiryDetailFacade.remove(inquiryDetailQe);
+        	
+        	QueryWrapper<InquiryReport> inquiryReportQe = new QueryWrapper<>();
+        	inquiryReportQe.eq("inquiry_id", inquiryInfo.getId());
+        	inquiryReportFacade.remove(inquiryReportQe);
+        }
+        
+        BeanUtil.copyProperties(saveInquiryVO, inquiryInfo);
+        inquiryInfo.setGmtModified(now);
+        this.saveOrUpdate(inquiryInfo);
+        
+        Long inquiryId = inquiryInfo.getId();
+        
+        List<InquiryDetail> inquiryDetailList = BeanUtil.listCopyTo(saveInquiryVO.getDetailList(), InquiryDetail.class);
+        inquiryDetailList.forEach(i->{
+        	i.setInquiryId(inquiryId);
+            i.setGmtCreate(now);
+            i.setGmtModified(now);
+        });
+        inquiryDetailServiceImpl.saveBatch(inquiryDetailList);
+        
+        List<InquiryReport> inquiryReportList = BeanUtil.listCopyTo(saveInquiryVO.getReportList(), InquiryReport.class);
+        inquiryReportList.forEach(i->{
+        	i.setInquiryId(inquiryId);
+            i.setGmtCreate(now);
+            i.setGmtModified(now);
+        });
+        inquiryReportServiceImpl.saveBatch(inquiryReportList);
+		
+        saveInquiryDTO.setInquiryId(inquiryId);
+        
+		return saveInquiryDTO;
+	}
 
 }

+ 0 - 20
prec-service/src/main/java/com/diagbot/mapper/EvaluatorMapper.java

@@ -1,20 +0,0 @@
-package com.diagbot.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.SearchEvaluatorDTO;
-import com.diagbot.entity.Evaluator;
-import com.diagbot.vo.SearchEvaluatorVO;
-
-/**
- * <p>
- * 评估用户结果表 Mapper 接口
- * </p>
- *
- * @author gaodm
- * @since 2019-05-30
- */
-public interface EvaluatorMapper extends BaseMapper<Evaluator> {
-
-    IPage<SearchEvaluatorDTO> getEvaluators(SearchEvaluatorVO searchEvaluatorVO);
-}

+ 5 - 0
prec-service/src/main/java/com/diagbot/mapper/InquiryEvaluatorMapper.java

@@ -1,7 +1,10 @@
 package com.diagbot.mapper;
 
+import com.diagbot.dto.SearchEvaluatorDTO;
 import com.diagbot.entity.InquiryEvaluator;
+import com.diagbot.vo.SearchEvaluatorVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 
 /**
  * <p>
@@ -12,5 +15,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @since 2019-06-17
  */
 public interface InquiryEvaluatorMapper extends BaseMapper<InquiryEvaluator> {
+	
+	IPage<SearchEvaluatorDTO> getEvaluators(SearchEvaluatorVO searchEvaluatorVO);
 
 }

+ 0 - 21
prec-service/src/main/java/com/diagbot/service/EvaluatorService.java

@@ -1,21 +0,0 @@
-package com.diagbot.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.diagbot.dto.SearchEvaluatorDTO;
-import com.diagbot.entity.Evaluator;
-import com.diagbot.vo.SearchEvaluatorVO;
-
-/**
- * <p>
- * 评估用户结果表 服务类
- * </p>
- *
- * @author gaodm
- * @since 2019-05-30
- */
-public interface EvaluatorService extends IService<Evaluator> {
-
-    IPage<SearchEvaluatorDTO> getEvaluators(SearchEvaluatorVO searchEvaluatorVO);
-
-}

+ 0 - 27
prec-service/src/main/java/com/diagbot/service/impl/EvaluatorServiceImpl.java

@@ -1,27 +0,0 @@
-package com.diagbot.service.impl;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.dto.SearchEvaluatorDTO;
-import com.diagbot.entity.Evaluator;
-import com.diagbot.mapper.EvaluatorMapper;
-import com.diagbot.service.EvaluatorService;
-import com.diagbot.vo.SearchEvaluatorVO;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 评估用户结果表 服务实现类
- * </p>
- *
- * @author gaodm
- * @since 2019-05-30
- */
-@Service
-public class EvaluatorServiceImpl extends ServiceImpl<EvaluatorMapper, Evaluator> implements EvaluatorService {
-
-    public IPage<SearchEvaluatorDTO> getEvaluators(SearchEvaluatorVO searchEvaluatorVO) {
-        return baseMapper.getEvaluators(searchEvaluatorVO);
-    }
-
-}

+ 39 - 0
prec-service/src/main/java/com/diagbot/vo/AddEvaluatorVO.java

@@ -5,6 +5,9 @@ import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
+
+import io.swagger.annotations.ApiModelProperty;
+
 import java.math.BigDecimal;
 
 /**
@@ -16,6 +19,42 @@ import java.math.BigDecimal;
 @Getter
 @Setter
 public class AddEvaluatorVO {
+	
+	/**
+     * 医院id
+     */
+	@ApiModelProperty(value="医院id",required=true)
+	@NotNull(message="医院id必传")
+    private Long hospitalId;
+
+    /**
+     * 科室id
+     */
+	@ApiModelProperty(value="科室id",required=true)
+	@NotNull(message="科室id必传")
+    private Long hospitalDeptId;
+
+    /**
+     * 医生id
+     */
+	@ApiModelProperty(value="医生id",required=true)
+	@NotNull(message="医生id必传")
+    private Long doctorId;
+
+    /**
+     * 患者id
+     */
+	@ApiModelProperty(value="患者id",required=true)
+	@NotNull(message="患者id必传")
+    private Long patientId;
+
+    /**
+     * 就诊序列号
+     */
+	@ApiModelProperty(value="就诊序列号",required=true)
+	@NotBlank(message="就诊序列号必传")
+    private String inquiryCode;
+	
     /**
      * 姓名
      */

+ 40 - 0
prec-service/src/main/java/com/diagbot/vo/SaveInquiryDetailVO.java

@@ -0,0 +1,40 @@
+package com.diagbot.vo;
+
+import javax.validation.constraints.NotNull;
+
+import org.hibernate.validator.constraints.Range;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description
+ * @author rengb
+ * @time 2018年11月23日下午2:29:43
+ */
+@Getter
+@Setter
+public class SaveInquiryDetailVO {
+	
+	/**
+     * 类型(1主诉,2现病史,3其他史,4补充内容)
+     */
+	@ApiModelProperty(value="类型(1主诉,2现病史,3其他史,4补充内容)",required=true)
+	@NotNull(message="问诊明细-类型必传")
+	@Range(min=1,max=4,message="问诊明细-类型必须是1-4")
+    private Integer type;
+
+    /**
+     * 内容字符串
+     */
+    @ApiModelProperty(value="内容字符串")
+    private String content;
+    
+    /**
+     * 内容字符串纯文本
+     */
+    @ApiModelProperty(value="内容字符串纯文本")
+    private String contentValue;
+
+}

+ 46 - 0
prec-service/src/main/java/com/diagbot/vo/SaveInquiryReportVO.java

@@ -0,0 +1,46 @@
+package com.diagbot.vo;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description
+ * @author rengb
+ * @time 2018年11月23日下午2:29:43
+ */
+@Getter
+@Setter
+public class SaveInquiryReportVO {
+	
+    /**
+     * 原图
+     */
+    @ApiModelProperty(value="原图",required=true)
+    @NotBlank(message="原图不能为空")
+    private String originalImage;
+
+    /**
+     * 缩略图
+     */
+    @ApiModelProperty(value="缩略图",required=true)
+    @NotBlank(message="缩略图不能为空")
+    private String narrowImage;
+
+    /**
+     * 图片排序号
+     */
+    @ApiModelProperty(value="图片排序号",required=true)
+    @NotNull(message="图片排序号不能为空")
+    private Integer orderNum;
+    
+    
+    
+    
+    
+    
+    
+}

+ 99 - 0
prec-service/src/main/java/com/diagbot/vo/SaveInquiryVO.java

@@ -0,0 +1,99 @@
+package com.diagbot.vo;
+
+import java.util.List;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+import org.hibernate.validator.constraints.Range;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: rengb
+ * @time: 2018/11/19 18:58
+ */
+@ApiModel(value="问诊记录保存接口传参")
+@Getter
+@Setter
+public class SaveInquiryVO {
+	
+	/**
+     * 医院id
+     */
+	@ApiModelProperty(value="医院id",required=true)
+	@NotNull(message="医院id必传")
+    private Long hospitalId;
+
+    /**
+     * 科室id
+     */
+	@ApiModelProperty(value="科室id",required=true)
+	@NotNull(message="科室id必传")
+    private Long hospitalDeptId;
+
+    /**
+     * 医生id
+     */
+	@ApiModelProperty(value="医生id",required=true)
+	@NotNull(message="医生id必传")
+    private Long doctorId;
+
+    /**
+     * 患者id
+     */
+	@ApiModelProperty(value="患者id",required=true)
+	@NotNull(message="患者id必传")
+    private Long patientId;
+
+    /**
+     * 就诊序列号
+     */
+	@ApiModelProperty(value="就诊序列号",required=true)
+	@NotBlank(message="就诊序列号必传")
+    private String inquiryCode;
+
+    /**
+     * 就诊状态(0待接诊,1接诊中,2完成接诊)
+     */
+	@ApiModelProperty(value="就诊状态(0待接诊,1接诊中,2完成接诊)")
+	@Range(min=0,max=2,message="就诊状态必须是0、1、2")
+	private Integer regVisitedState=1;
+
+    /**
+     * 病历分类(1:门诊,2:住院)
+     */
+	@ApiModelProperty(value="病历分类(1:门诊,2:住院)")
+	@Range(min=1,max=2,message="病历分类必须是1、2")
+    private Integer type=1;
+
+    /**
+     * 内容JSON字符串
+     */
+	@ApiModelProperty(value="内容JSON字符串",required=true)
+    @NotBlank(message="内容JSON字符串必传")
+    private String dataJson;
+    
+	/**
+	 * 问诊明细
+	 */
+    @Valid
+    @ApiModelProperty(value="问诊明细",required=true)
+    @NotEmpty(message="问诊明细不能为空")
+    private List<SaveInquiryDetailVO> detailList;
+    
+	/**
+	 * 治疗报告图片集合
+	 */
+    @Valid
+    @ApiModelProperty(value="治疗报告图片集合",required=true)
+    @NotEmpty(message="治疗报告图片集合不能为空")
+    private List<SaveInquiryReportVO> reportList;
+    
+}

+ 0 - 81
prec-service/src/main/java/com/diagbot/web/EvaluatorController.java

@@ -1,81 +0,0 @@
-package com.diagbot.web;
-
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.annotation.SysLogger;
-import com.diagbot.dto.RespDTO;
-import com.diagbot.dto.SearchEvaluatorDTO;
-import com.diagbot.entity.Evaluator;
-import com.diagbot.facade.EvaluatorFacade;
-import com.diagbot.vo.AddEvaluatorVO;
-import com.diagbot.vo.SearchEvaluatorVO;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.validation.Valid;
-
-/**
- * <p>
- * 评估用户结果表 前端控制器
- * </p>
- *
- * @author gaodm
- * @since 2019-05-30
- */
-@RestController
-@RequestMapping("/evaluator")
-@SuppressWarnings("unchecked")
-@Api(value = "体质评估API", tags = { "体质评估API" })
-public class EvaluatorController {
-    @Autowired
-    private EvaluatorFacade evaluatorFacade;
-
-    @ApiOperation(value = "体质评估——添加[by:gaodm]",
-            notes = "name: 姓名,必填<br>" +
-                    "phone: 手机号,必填<br>" +
-                    "sex: 性别(1:男 2:女),必填<br>" +
-                    "age: 年龄,必填<br>" +
-                    "mildValue: 平和体质转化分,必填<br>" +
-                    "faintValue: 气虚体质转化分,必填<br>" +
-                    "wetValue: 湿滞体质转化分,必填<br>" +
-                    "heartValue: 心肝火旺体质转化分,必填<br>" +
-                    "stagnantValue: 积滞体质转化分,必填<br>" +
-                    "exceptValue: 异禀体质转化分,必填")
-    @PostMapping("/addEvaluator")
-    @SysLogger("addEvaluator")
-    @Transactional
-    public RespDTO<Boolean> addEvaluator(@RequestBody @Valid AddEvaluatorVO addDeptInfoVO){
-        return RespDTO.onSuc(evaluatorFacade.addEvaluator(addDeptInfoVO));
-    }
-
-    @ApiOperation(value = "体质评估——获取体质评估分页信息[by:gaodm]",
-            notes = "name: 姓名<br>" +
-                    "phone: 手机号<br>" +
-                    "sex: 性别(1:男 2:女)")
-    @PostMapping("/getEvaluatorPage")
-    @SysLogger("getEvaluatorPage")
-    public RespDTO<IPage<SearchEvaluatorDTO>> getEvaluatorPage(@RequestBody SearchEvaluatorVO searchEvaluatorVO){
-        return RespDTO.onSuc(evaluatorFacade.getEvaluatorPage(searchEvaluatorVO));
-    }
-
-
-    /**
-     * 体质规则计算,测试使用
-     *
-     * @param evaluator 输入参数
-     * @return 返回计算结果值
-     */
-    @ApiOperation(value = "体质规则计算,测试使用", notes = "体质规则计算,测试使用")
-    @PostMapping("/cal2")
-    @SysLogger("cal2")
-    public RespDTO<String> cal2(@RequestBody Evaluator evaluator) {
-        evaluatorFacade.cal(evaluator);
-        return RespDTO.onSuc(evaluator.getPhysicalRes());
-    }
-}

+ 68 - 0
prec-service/src/main/java/com/diagbot/web/InquiryEvaluatorController.java

@@ -0,0 +1,68 @@
+package com.diagbot.web;
+
+import javax.validation.Valid;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.SearchEvaluatorDTO;
+import com.diagbot.entity.InquiryEvaluator;
+import com.diagbot.facade.InquiryEvaluatorFacade;
+import com.diagbot.vo.AddEvaluatorVO;
+import com.diagbot.vo.SearchEvaluatorVO;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+@RestController
+@RequestMapping("/inquiryEvaluator")
+@SuppressWarnings("unchecked")
+@Api(value = "问诊-儿童体质辨识API", tags = { "问诊-儿童体质辨识API" })
+public class InquiryEvaluatorController {
+	
+    @Autowired
+    private InquiryEvaluatorFacade inquiryEvaluatorFacade;
+
+    @ApiOperation(value = "儿童体质辨识--添加[by:gaodm]",
+            	  notes = "name: 姓名,必填<br>" +
+            			  "phone: 手机号,必填<br>" +
+            			  "sex: 性别(1:男 2:女),必填<br>" +
+            			  "age: 年龄,必填<br>" +
+            			  "mildValue: 平和体质转化分,必填<br>" +
+            			  "faintValue: 气虚体质转化分,必填<br>" +
+            			  "wetValue: 湿滞体质转化分,必填<br>" +
+            			  "heartValue: 心肝火旺体质转化分,必填<br>" +
+            			  "stagnantValue: 积滞体质转化分,必填<br>" +
+                    	  "exceptValue: 异禀体质转化分,必填")
+    @PostMapping("/addEvaluator")
+    @SysLogger("addEvaluator")
+    @Transactional
+    public RespDTO<Boolean> addEvaluator(@RequestBody @Valid AddEvaluatorVO addDeptInfoVO){
+        return RespDTO.onSuc(inquiryEvaluatorFacade.addEvaluator(addDeptInfoVO));
+    }
+
+    @ApiOperation(value = "儿童体质辨识--获取分页信息[by:gaodm]",
+            	  notes = "name: 姓名<br>" +
+            			  "phone: 手机号<br>" +
+                    	  "sex: 性别(1:男 2:女)")
+    @PostMapping("/getEvaluatorPage")
+    @SysLogger("getEvaluatorPage")
+    public RespDTO<IPage<SearchEvaluatorDTO>> getEvaluatorPage(@RequestBody SearchEvaluatorVO searchEvaluatorVO){
+        return RespDTO.onSuc(inquiryEvaluatorFacade.getEvaluatorPage(searchEvaluatorVO));
+    }
+
+    @ApiOperation(value = "体质规则计算,测试使用", notes = "体质规则计算,测试使用")
+    @PostMapping("/cal2")
+    @SysLogger("cal2")
+    public RespDTO<String> cal2(@RequestBody InquiryEvaluator inquiryEvaluator) {
+    	inquiryEvaluatorFacade.cal(inquiryEvaluator);
+        return RespDTO.onSuc(inquiryEvaluator.getPhysicalRes());
+    }
+}

+ 41 - 0
prec-service/src/main/java/com/diagbot/web/InquiryInfoController.java

@@ -0,0 +1,41 @@
+package com.diagbot.web;
+
+import javax.validation.Valid;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.SaveInquiryDTO;
+import com.diagbot.facade.InquiryInfoFacade;
+import com.diagbot.vo.SaveInquiryVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * @author rengb
+ * @since 2018-11-23
+ */
+@RestController
+@RequestMapping("/inquiryInfo")
+@Api(value = "问诊记录API", tags = { "问诊记录API" })
+@SuppressWarnings("unchecked")
+public class InquiryInfoController {
+
+    @Autowired
+    private InquiryInfoFacade inquiryInfoFacade;
+    
+    @ApiOperation(value = "问诊记录保存[by:rengb]")
+    @PostMapping("/saveInquiry")
+    @SysLogger("saveInquiry")
+    @Transactional
+    public RespDTO<SaveInquiryDTO> saveInquiry(@Valid @RequestBody SaveInquiryVO saveInquiryVO) {
+        return RespDTO.onSuc(inquiryInfoFacade.saveInquiry(saveInquiryVO));
+    }
+
+
+
+}

+ 0 - 45
prec-service/src/main/resources/mapper/EvaluatorMapper.xml

@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.diagbot.mapper.EvaluatorMapper">
-
-    <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="com.diagbot.entity.Evaluator">
-        <id column="id" property="id" />
-        <result column="is_deleted" property="isDeleted" />
-        <result column="gmt_create" property="gmtCreate" />
-        <result column="gmt_modified" property="gmtModified" />
-        <result column="creator" property="creator" />
-        <result column="modifier" property="modifier" />
-        <result column="name" property="name" />
-        <result column="phone" property="phone" />
-        <result column="sex" property="sex" />
-        <result column="age" property="age" />
-        <result column="mild_value" property="mildValue" />
-        <result column="faint_value" property="faintValue" />
-        <result column="wet_value" property="wetValue" />
-        <result column="heart_value" property="heartValue" />
-        <result column="stagnant_value" property="stagnantValue" />
-        <result column="except_value" property="exceptValue" />
-        <result column="physical_res" property="physicalRes" />
-        <result column="physical_types" property="physicalTypes" />
-    </resultMap>
-
-
-    <select id="getEvaluators" resultType="com.diagbot.dto.SearchEvaluatorDTO">
-        SELECT
-        a.*
-        FROM prec_evaluator a
-        WHERE
-        a.is_deleted = 'N'
-        <if test="name != null and name != ''">
-            AND a.`name` LIKE CONCAT('%',#{name},'%')
-        </if>
-        <if test="phone != null and phone != ''">
-            AND a.`phone` LIKE CONCAT('%',#{phone},'%')
-        </if>
-        <if test="sex != null">
-            AND a.`sex` = #{sex}
-        </if>
-        ORDER BY a.gmt_create DESC
-    </select>
-</mapper>

+ 18 - 0
prec-service/src/main/resources/mapper/InquiryEvaluatorMapper.xml

@@ -25,5 +25,23 @@
         <result column="physical_res" property="physicalRes" />
         <result column="physical_types" property="physicalTypes" />
     </resultMap>
+    
+    <select id="getEvaluators" resultType="com.diagbot.dto.SearchEvaluatorDTO">
+        SELECT
+        a.*
+        FROM prec_evaluator a
+        WHERE
+        a.is_deleted = 'N'
+        <if test="name != null and name != ''">
+            AND a.`name` LIKE CONCAT('%',#{name},'%')
+        </if>
+        <if test="phone != null and phone != ''">
+            AND a.`phone` LIKE CONCAT('%',#{phone},'%')
+        </if>
+        <if test="sex != null">
+            AND a.`sex` = #{sex}
+        </if>
+        ORDER BY a.gmt_create DESC
+    </select>
 
 </mapper>