Bläddra i källkod

Merge remote-tracking branch 'origin/dev/icss' into debug

wangyu 6 år sedan
förälder
incheckning
0f7eacd693

+ 101 - 2
icss-service/src/main/java/com/diagbot/dto/PatientInfoDTO.java

@@ -1,9 +1,10 @@
 package com.diagbot.dto;
 
-import com.diagbot.entity.PatientInfo;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.Date;
+
 /**
  * @Description:
  * @author: wangyu
@@ -11,5 +12,103 @@ import lombok.Setter;
  */
 @Getter
 @Setter
-public class PatientInfoDTO extends PatientInfo {
+public class PatientInfoDTO{
+    /**
+     * 主键
+     */
+    private Long id;
+    /**
+     * 医院编码
+     */
+    private String hospitalCode;
+
+    /**
+     * 医院患者编号
+     */
+    private String code;
+
+    /**
+     * 患者姓名
+     */
+    private String name;
+
+    /**
+     * 性别
+     */
+    private Integer sex;
+
+    /**
+     * 出生日期
+     */
+    private Date birthday;
+
+    /**
+     * 证件类型
+     */
+    private String idType;
+
+    /**
+     * 证件号码
+     */
+    private String idNo;
+
+    /**
+     * 家庭住址
+     */
+    private String address;
+
+    /**
+     * 联系电话
+     */
+    private String phone;
+
+    /**
+     * 身份证号
+     */
+    private String identityNum;
+
+    /**
+     * 家庭邮编
+     */
+    private String postcode;
+
+    /**
+     * 联系人
+     */
+    private String contacts;
+
+    /**
+     * 联系人电话
+     */
+    private String contactPhone;
+
+    /**
+     * 就职单位名称
+     */
+    private String workUnit;
+
+    /**
+     * 职业
+     */
+    private String operation;
+
+    /**
+     * 国籍
+     */
+    private String country;
+
+    /**
+     * 民族
+     */
+    private String nationality;
+
+    /**
+     * 婚姻状况:0未婚,1已婚,2未知
+     */
+    private Integer matrimony;
+
+    /**
+     * 备注
+     */
+    private String remark;
 }

+ 3 - 12
icss-service/src/main/java/com/diagbot/facade/PatientInfoFacade.java

@@ -4,18 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.dto.GetTopPatientInfoDTO;
 import com.diagbot.dto.PatientInfoDTO;
 import com.diagbot.entity.PatientInfo;
-import com.diagbot.exception.CommonErrorCode;
-import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.PatientInfoServiceImpl;
 import com.diagbot.util.DateUtil;
-import com.diagbot.util.ListUtil;
 import com.diagbot.vo.GetTopPatientInfoVO;
 import com.diagbot.vo.PatientInfoVO;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.RequestBody;
 
-import java.util.List;
-
 /**
  * @Description: 患者业务逻辑
  * @author: wangyu
@@ -30,13 +25,9 @@ public class PatientInfoFacade extends PatientInfoServiceImpl {
      * @param patientInfoVO
      * @return
      */
-    public List<PatientInfoDTO> getPatientInfo(@RequestBody PatientInfoVO patientInfoVO) {
-        List<PatientInfoDTO> patientInfoDTOList = this.getPatientInfos(patientInfoVO.getPatientCode(), patientInfoVO.getHospitalCode());
-        if (ListUtil.isEmpty(patientInfoDTOList)) {
-            throw new CommonException(CommonErrorCode.NOT_EXISTS,
-                    "获取患者信息失败");
-        }
-        return patientInfoDTOList;
+    public PatientInfoDTO getPatientInfo(@RequestBody PatientInfoVO patientInfoVO) {
+        PatientInfoDTO patientInfoDTO = this.getPatientInfos(patientInfoVO.getPatientCode(), patientInfoVO.getHospitalCode());
+        return patientInfoDTO;
     }
 
     /**

+ 3 - 6
icss-service/src/main/java/com/diagbot/mapper/PatientInfoMapper.java

@@ -1,15 +1,12 @@
 package com.diagbot.mapper;
 
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
-import org.springframework.web.bind.annotation.RequestBody;
-
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.diagbot.dto.GetTopPatientInfoDTO;
 import com.diagbot.dto.PatientInfoDTO;
 import com.diagbot.entity.PatientInfo;
 import com.diagbot.vo.GetTopPatientInfoVO;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.web.bind.annotation.RequestBody;
 
 /**
  * @Description: 患者信息
@@ -22,7 +19,7 @@ public interface PatientInfoMapper extends BaseMapper<PatientInfo> {
      * @param patientCode,hospitalCode
      * @return
      */
-    public List<PatientInfoDTO> getPatientInfos(@Param("patientCode") String patientCode, @Param("hospitalCode") String hospitalCode);
+    public PatientInfoDTO getPatientInfos(@Param("patientCode") String patientCode, @Param("hospitalCode") String hospitalCode);
     
     /**
      * 顶部病人医生科室信息查询

+ 1 - 1
icss-service/src/main/java/com/diagbot/service/PatientInfoService.java

@@ -16,5 +16,5 @@ import java.util.List;
  */
 public interface PatientInfoService extends IService<PatientInfo> {
 
-    public List<PatientInfoDTO> getPatientInfos(String patientCode, String hospitalCode);
+    public PatientInfoDTO getPatientInfos(String patientCode, String hospitalCode);
 }

+ 1 - 1
icss-service/src/main/java/com/diagbot/service/impl/PatientInfoServiceImpl.java

@@ -21,7 +21,7 @@ import java.util.List;
 public class PatientInfoServiceImpl extends ServiceImpl<PatientInfoMapper, PatientInfo> implements PatientInfoService {
 
     @Override
-    public List<PatientInfoDTO> getPatientInfos(String patientCode, String hospitalCode) {
+    public PatientInfoDTO getPatientInfos(String patientCode, String hospitalCode) {
         return baseMapper.getPatientInfos(patientCode, hospitalCode);
     }
 }

+ 0 - 2
icss-service/src/main/java/com/diagbot/web/DisclaimerInformationController.java

@@ -8,7 +8,6 @@ import com.diagbot.facade.DisclaimerInformationFacade;
 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.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -33,7 +32,6 @@ public class DisclaimerInformationController {
     @ApiOperation(value = "获取免责申明详情[by:wangfeng]", notes = "获取免责申明详情")
     @PostMapping("/getDisclaimerInformations")
     @SysLogger("getDisclaimerInformations")
-    @Transactional
     public RespDTO<List<DisclaimerInformationDTO>> getDisclaimerInformations() {
 
         List<DisclaimerInformationDTO> data = disclaimerInformationFacade.getDisclaimerInformation();

+ 0 - 1
icss-service/src/main/java/com/diagbot/web/DoctorPageModeController.java

@@ -56,7 +56,6 @@ public class DoctorPageModeController {
     @ApiOperation(value = "获取医生页面结构设置信息[by:wangfeng]", notes = "获取医生页面结构设置信息")
     @PostMapping("/getDoctorPageModes")
     @SysLogger("getDoctorPageModes")
-    @Transactional
     public RespDTO<DoctorPageMode> getDoctorPageModes(@Valid @RequestBody DoctorIdVO doctorIdVO) {
 
         DoctorPageMode doctorPageModeData = doctorPageModeFacade.getDoctorPageMode(doctorIdVO);

+ 2 - 3
icss-service/src/main/java/com/diagbot/web/PatientInfoController.java

@@ -17,7 +17,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
-import java.util.List;
 
 /**
  * <p>
@@ -40,8 +39,8 @@ public class PatientInfoController {
                     "hospitalCode:医院编号,必填<br>")
     @PostMapping("/getPatientInfo")
     @SysLogger("getPatientInfo")
-    public RespDTO<List<PatientInfoDTO>> getPatientInfo(@Valid @RequestBody PatientInfoVO patientInfoVO) {
-        List<PatientInfoDTO> data = patientInfoFacade.getPatientInfo(patientInfoVO);
+    public RespDTO<PatientInfoDTO> getPatientInfo(@Valid @RequestBody PatientInfoVO patientInfoVO) {
+        PatientInfoDTO data = patientInfoFacade.getPatientInfo(patientInfoVO);
         return RespDTO.onSuc(data);
     }
 

+ 0 - 2
icss-service/src/main/java/com/diagbot/web/VersionInfoController.java

@@ -7,7 +7,6 @@ import com.diagbot.facade.VersionInfoFacade;
 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.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -32,7 +31,6 @@ public class VersionInfoController {
     @ApiOperation(value = "获取版本信息[by:wangfeng]", notes = "获取版本信息")
     @PostMapping("/getVersionInfoAlls")
     @SysLogger("getVersionInfoAlls")
-    @Transactional
     public RespDTO<VersionWrapperDTO> getVersionInfoAlls() {
 
         VersionWrapperDTO data = versionInfoFacade.getVersionInfoAll();

+ 65 - 0
icssman-service/src/main/java/com/diagbot/entity/wrapper/QuestionMappingWrapper.java

@@ -0,0 +1,65 @@
+package com.diagbot.entity.wrapper;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 标签映射表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-03
+ */
+@Getter
+@Setter
+public class QuestionMappingWrapper implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 上级question
+     */
+    private Long parentQuestion;
+
+    /**
+     * 下级question
+     */
+    private Long sonQuestion;
+
+    /**
+     * 排序号
+     */
+    private Integer orderNo;
+
+    /**
+     * 标签显示位置(0:在标签后,1:在标签前)
+     */
+    private Integer position;
+
+    /**
+     * 填写单显示位置(0:左, 1:上)
+     */
+    private Integer formPosition;
+
+    /**
+     * 互斥类型(0:不互斥, 1:互斥 主要用在组合项:例如既往史无殊)
+     */
+    private Integer exclusionType;
+
+    /**
+     * 主症状和伴随症状对应的question类型(0:症状公用 1:主症状特有 2:伴随症状特有 )
+     */
+    private Integer symptomType;
+
+    private String text;
+
+
+}

+ 1 - 4
icssman-service/src/main/java/com/diagbot/entity/wrapper/QuestionWrapper.java

@@ -1,8 +1,6 @@
 package com.diagbot.entity.wrapper;
 
 import com.diagbot.entity.QuestionDetail;
-import com.diagbot.entity.QuestionMapping;
-import com.diagbot.vo.QuestionTextVO;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -45,6 +43,5 @@ public class QuestionWrapper implements Serializable {
     private String joint;     //标签连接符
     private String remark; //备注
     private List<QuestionDetail> questionDetails = new ArrayList<>(); //明细
-    private List<QuestionMapping> questionMappings = new ArrayList<>(); //映射关系
-    private List<QuestionTextVO> questionText = new ArrayList<>(); //形成的文字标签
+    private List<QuestionMappingWrapper> questionMappings = new ArrayList<>(); //映射关系
 }

+ 8 - 8
icssman-service/src/main/java/com/diagbot/enums/TagTypeEnum.java

@@ -9,14 +9,14 @@ import lombok.Setter;
  * @time: 2018/11/21 11:39
  */
 public enum TagTypeEnum implements KeyedNamed {
-    V1(1, "单项单列"),
-    V2(2, "单项多列"),
-    V3(3, "横铺单标签形式"),
-    V4(4, "横铺多标签形式"),
-    V5(5, "竖铺组合项"),
-    V6(6, "组合项多列"),
-    V7(7, "化验类型"),
-    V8(8, "模板专用文字");
+    T1(1, "单项单列"),
+    T2(2, "单项多列"),
+    T3(3, "横铺单标签形式"),
+    T4(4, "横铺多标签形式"),
+    T5(5, "竖铺组合项"),
+    T6(6, "组合项多列"),
+    T7(7, "化验类型"),
+    T8(8, "模板专用文字");
 
     @Setter
     private Integer key;

+ 83 - 14
icssman-service/src/main/java/com/diagbot/facade/QuestionInfoFacade.java

@@ -7,14 +7,18 @@ import com.diagbot.dto.GetQuestionInfoDTO;
 import com.diagbot.dto.QuestionIndexDTO;
 import com.diagbot.dto.QuestionPageDTO;
 import com.diagbot.entity.CommonParam;
+import com.diagbot.entity.DeptInfo;
 import com.diagbot.entity.QuestionDetail;
 import com.diagbot.entity.QuestionInfo;
 import com.diagbot.entity.QuestionMapping;
+import com.diagbot.entity.wrapper.QuestionMappingWrapper;
 import com.diagbot.entity.wrapper.QuestionWrapper;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.TagTypeEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.QuestionDetailService;
+import com.diagbot.service.QuestionInfoService;
 import com.diagbot.service.QuestionMappingService;
 import com.diagbot.service.impl.QuestionInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
@@ -36,6 +40,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @Description:
@@ -48,6 +53,9 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
     @Autowired
     QuestionDetailFacade questionDetailFacade;
     @Autowired
+    @Qualifier("questionInfoServiceImpl")
+    QuestionInfoService questionInfoService;
+    @Autowired
     @Qualifier("questionDetailServiceImpl")
     QuestionDetailService questionDetailService;
     @Autowired
@@ -57,6 +65,8 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
     QuestionMappingFacade questionMappingFacade;
     @Autowired
     ModuleDetailFacade moduleDetailFacade;
+    @Autowired
+    DeptInfoFacade deptInfoFacade;
 
 
     /**
@@ -73,19 +83,17 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
                 saveQuestionDetail(questionWrapper, param);
                 break;
             case "2":   //组合项,例如:杂音,修改主表和mapping
+            case "3":   //组合项,例如:血压
+            case "4":   //组合项,例如:咳嗽
                 saveQuestionMapping(questionWrapper, param);
                 break;
-            case "3":
-                break;
-            case "4":
-                break;
-            case "5":
+            case "5":   //组合项,例如:有无治疗
                 break;
-            case "6":
+            case "6":  // 组合项,例如:既往史
                 break;
-            case "7":
+            case "7":  //化验
                 break;
-            case "8":
+            case "8":  //模板专用文字,无单独维护
                 break;
             default:
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "请选择标签显示类型");
@@ -105,8 +113,6 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
         param.setNow(DateUtil.now());
         param.setPerson(person);
         param.setSaveOrUpdate("save");
-        QuestionInfo questionInfo = new QuestionInfo();
-        param.setQuestionInfo(questionInfo);
         return param;
     }
 
@@ -129,11 +135,17 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
                         .set("gmt_modified", now)
                         .set("modifier", person)
                         .set("is_deleted", IsDeleteEnum.Y.getKey()));
-        List<QuestionMapping> questionMappings = questionWrapper.getQuestionMappings();
+        List<QuestionMappingWrapper> questionMappings = questionWrapper.getQuestionMappings();
         if (ListUtil.isNotEmpty(questionMappings)) {
+            //预处理文字标签,之后统一添加映射关系
+            Map<String, Long> map = getNameMap(questionMappings, now, person, questionInfo.getType());
             List<QuestionMapping> saveMapping = new ArrayList<>();
             int i = 1;
-            for (QuestionMapping mapping : questionMappings) {
+            for (QuestionMappingWrapper mapping : questionMappings) {
+                String text = mapping.getText();
+                if (StringUtil.isNotEmpty(text)) {
+                    mapping.setSonQuestion(map.get(text));
+                }
                 QuestionMapping bean = new QuestionMapping();
                 BeanUtil.copyProperties(mapping, bean);
                 bean.setId(null); //防止前端传参,将前端的id置空自动插入
@@ -141,6 +153,7 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
                 bean.setGmtCreate(now);
                 bean.setModifier(person);
                 bean.setGmtModified(now);
+                bean.setParentQuestion(questionInfo.getId());
                 bean.setOrderNo(i++);
                 saveMapping.add(bean);
             }
@@ -149,6 +162,52 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
     }
 
 
+    /**
+     * 获取name对应map列表,key为name,value为id
+     *
+     * @param questionMappings
+     * @param now
+     * @param person
+     * @param type
+     * @return
+     */
+    public Map<String, Long> getNameMap(List<QuestionMappingWrapper> questionMappings, Date now, String person, Integer type) {
+        List<String> nameList = questionMappings.stream().filter(row -> StringUtil.isNotEmpty(row.getText())).map(row -> row.getText()).collect(Collectors.toList());
+        List<QuestionInfo> questionInfos = this.list(new QueryWrapper<QuestionInfo>()
+                .eq("type", type)
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("tag_type", TagTypeEnum.T8.getKey())
+                .in("name", nameList)
+        );
+        Map<String, Long> map = questionInfos.stream().collect(Collectors.toMap(row -> row.getName(), row -> row.getId(), (k1, k2) -> k1));
+        List<QuestionInfo> addBatch = new ArrayList<>();
+        List<String> nameExist = new ArrayList<>();
+        for (String s : nameList) {
+            if (map.get(s) == null && !nameExist.contains(s)) {
+                nameExist.add(s);
+                QuestionInfo bean = new QuestionInfo();
+                bean.setModifier(person);
+                bean.setCreator(person);
+                bean.setGmtCreate(now);
+                bean.setGmtModified(now);
+                bean.setTagType(String.valueOf(TagTypeEnum.T8.getKey()));
+                bean.setTagName(s);
+                bean.setName(s);
+                bean.setType(type);
+                bean.setSubType(1); //描述类型
+                addBatch.add(bean);
+            }
+        }
+        questionInfoService.saveBatch(addBatch); //批量插入question
+        for (QuestionInfo bean : addBatch) {
+            if (map.get(bean.getName()) == null) {
+                map.put(bean.getName(), bean.getId());
+            }
+        }
+        return map;
+    }
+
+
     /**
      * 保存明细
      *
@@ -195,7 +254,7 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
      * @param param
      */
     public void saveQuestionInfo(QuestionWrapper questionWrapper, CommonParam param) {
-        QuestionInfo questionInfo = param.getQuestionInfo();
+        QuestionInfo questionInfo = new QuestionInfo();
         if (questionWrapper.getId() != null) {
             questionInfo = this.getOne(new QueryWrapper<QuestionInfo>()
                     .eq("id", questionWrapper.getId())
@@ -220,6 +279,7 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
         }
         questionInfo.setGmtModified(param.getNow());//修改时间
         questionInfo.setModifier(param.getPerson());//修改人
+        param.setQuestionInfo(questionInfo);
         this.saveOrUpdate(questionInfo);
     }
 
@@ -318,7 +378,16 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
      * @return
      */
     public List<GetQuestionInfoDTO> getQuestionUsualByDept(GetQuestionUsualByDeptVO getQuestionUsualByDeptVO) {
+        //先判断科室是不是已被删除
+        QueryWrapper<DeptInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("id", getQuestionUsualByDeptVO.getDeptId());
+        List<DeptInfo> deptInfoList = deptInfoFacade.list(queryWrapper);
+        if (ListUtil.isEmpty(deptInfoList)) {
+            throw new CommonException(CommonErrorCode.NOT_EXISTS, "科室信息不存在");
+        }
+        //获取常用标签信息
         List<GetQuestionInfoDTO> getQuestionInfoDTOList = this.getQuestionUsualsByDept(getQuestionUsualByDeptVO);
         return getQuestionInfoDTOList;
     }
-}
+}

+ 2 - 0
icssman-service/src/main/java/com/diagbot/facade/VersionInfoFacade.java

@@ -83,10 +83,12 @@ public class VersionInfoFacade extends VersionInfoServiceImpl {
 		for (VersionInfo versionInfo : versionInfos) {
 			VersionWrapperDTO versionList = new VersionWrapperDTO();
 			versionList.setId(versionInfo.getId());
+			versionList.setGmtCreate(versionInfo.getGmtCreate());
 			versionList.setName(versionInfo.getName());
 			versionList.setModifierid(userNames.get(versionInfo.getModifier()));
 			versionList.setRefreshTime(versionInfo.getRefreshTime());
 			versionList.setStatus(versionInfo.getStatus());
+			versionList.setRemark(versionInfo.getRemark());
 			versionLists.add(versionList);
 		}
         // 取版本id查明细