|
@@ -8,6 +8,7 @@ import com.diagbot.dto.QcCasesEntrySimpleDTO;
|
|
|
import com.diagbot.dto.QcTypeDTO;
|
|
|
import com.diagbot.dto.QcTypePageDTO;
|
|
|
import com.diagbot.entity.CommonParam;
|
|
|
+import com.diagbot.entity.QcModuleInfo;
|
|
|
import com.diagbot.entity.QcType;
|
|
|
import com.diagbot.entity.QcTypeCasesEntry;
|
|
|
import com.diagbot.enums.InsertOrUpdateEnum;
|
|
@@ -21,13 +22,7 @@ import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.EntityUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.UserUtils;
|
|
|
-import com.diagbot.vo.DeleteQcTypeVO;
|
|
|
-import com.diagbot.vo.QcEntryHospitalVO;
|
|
|
-import com.diagbot.vo.QcTypeCasesEntryVO;
|
|
|
-import com.diagbot.vo.QcTypeIndexVO;
|
|
|
-import com.diagbot.vo.QcTypePageVO;
|
|
|
-import com.diagbot.vo.QcTypeSaveVO;
|
|
|
-import com.diagbot.vo.QcTypeVO;
|
|
|
+import com.diagbot.vo.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -62,12 +57,27 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
*
|
|
|
* @param qcTypeSaveVO
|
|
|
*/
|
|
|
- public void saveOrUpdate(QcTypeSaveVO qcTypeSaveVO) {
|
|
|
+ public Object saveOrUpdate(QcTypeSaveVO qcTypeSaveVO) {
|
|
|
CommonParam param = initCommonParam();
|
|
|
// 保存主表
|
|
|
- saveQcType(qcTypeSaveVO, param);
|
|
|
+ Object data = null;
|
|
|
+ data = saveQcType(qcTypeSaveVO, param);
|
|
|
// 保存质控类型和质控条目映射关系
|
|
|
saveQcTypeCasesEntry(qcTypeSaveVO, param);
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 模板列表首页默认模版设置
|
|
|
+ *
|
|
|
+ * @param qcTypeControlVO
|
|
|
+ */
|
|
|
+ public Object ControModuleInfo(QcTypeControlVO qcTypeControlVO) {
|
|
|
+ CommonParam param = initCommonParam();
|
|
|
+ // 保存主表
|
|
|
+ Object data = null;
|
|
|
+ data = ControModule(qcTypeControlVO);
|
|
|
+ return data;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -95,9 +105,10 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
String person = param.getPerson();
|
|
|
// 先删除原明细(物理删除)
|
|
|
qcTypeCasesEntryService.remove(new QueryWrapper<QcTypeCasesEntry>()
|
|
|
- .eq("type_id", qcTypeSaveVO.getId())
|
|
|
+ .eq("type_id", qcTypeSaveVO.getId())
|
|
|
);
|
|
|
// 再插入新明细
|
|
|
+ boolean data = false;
|
|
|
List<QcTypeCasesEntryVO> qcTypeCasesEntryVOList = qcTypeSaveVO.getQcTypeCasesEntryVOList();
|
|
|
if (ListUtil.isNotEmpty(qcTypeCasesEntryVOList)) {
|
|
|
List<QcTypeCasesEntry> saveQcTypeCasesEntry = new ArrayList<>();
|
|
@@ -111,8 +122,68 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
bean.setTypeId(qcTypeSaveVO.getId());
|
|
|
saveQcTypeCasesEntry.add(bean);
|
|
|
}
|
|
|
- qcTypeCasesEntryService.saveBatch(saveQcTypeCasesEntry);
|
|
|
+ data = qcTypeCasesEntryService.saveBatch(saveQcTypeCasesEntry);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 质控类型默认模版修改
|
|
|
+ *
|
|
|
+ * @param qcTypeControlVO
|
|
|
+ * @param
|
|
|
+ */
|
|
|
+ public Object ControModule(QcTypeControlVO qcTypeControlVO) {
|
|
|
+ Boolean flag = false;
|
|
|
+ //用户选择添加默认(标准)模块
|
|
|
+ if (1 == qcTypeControlVO.getDefaultModule()) {
|
|
|
+ //用户同意更换默认(标准)模版 校验标准模版是否存在之前,提示信息用户操作默认为0 当用户点击提示信息确定则1
|
|
|
+ if (1 == qcTypeControlVO.getDefineType()) {
|
|
|
+ //此时不会给出提示
|
|
|
+ flag = true;
|
|
|
+// 原有的标准模版设置为0 体现互斥行性
|
|
|
+ UpdateWrapper<QcType> serviceInfoWrapper = new UpdateWrapper<>();
|
|
|
+ serviceInfoWrapper
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", qcTypeControlVO.getHospitalId())
|
|
|
+ .eq("default_module", 1)
|
|
|
+ .set("default_module", "0");
|
|
|
+ this.update(new QcType(), serviceInfoWrapper);
|
|
|
+ }
|
|
|
+ //校验标准模版是否存在
|
|
|
+ int sum = this.count(new QueryWrapper<QcType>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", qcTypeControlVO.getHospitalId())
|
|
|
+ .eq("default_module", 1));
|
|
|
+ if (sum > 0) {
|
|
|
+ //发现标准模版已经存在,默认给出提示
|
|
|
+ if (flag == false) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Boolean bac = false;
|
|
|
+ //更新模版状态
|
|
|
+ UpdateWrapper<QcType> serviceInfoWrapper = new UpdateWrapper<>();
|
|
|
+ serviceInfoWrapper
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", qcTypeControlVO.getHospitalId())
|
|
|
+ .eq("name", qcTypeControlVO.getName())
|
|
|
+ .set("default_module", "1");
|
|
|
+ bac = this.update(new QcType(), serviceInfoWrapper);
|
|
|
+ return bac;
|
|
|
+
|
|
|
+ } else {
|
|
|
+ //用户直接取消,无视互斥
|
|
|
+ UpdateWrapper<QcType> serviceWrapper = new UpdateWrapper<>();
|
|
|
+ serviceWrapper
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", qcTypeControlVO.getHospitalId())
|
|
|
+ .eq("name", qcTypeControlVO.getName())
|
|
|
+ .eq("default_module", 1)
|
|
|
+ .set("default_module", qcTypeControlVO.getDefaultModule());
|
|
|
+ this.update(new QcType(), serviceWrapper);
|
|
|
+
|
|
|
}
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -121,7 +192,45 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
* @param qcTypeSaveVO
|
|
|
* @param param
|
|
|
*/
|
|
|
- public void saveQcType(QcTypeSaveVO qcTypeSaveVO, CommonParam param) {
|
|
|
+ public Object saveQcType(QcTypeSaveVO qcTypeSaveVO, CommonParam param) {
|
|
|
+ Boolean flag = false;
|
|
|
+ //用户选择添加默认(标准)模块
|
|
|
+ if (1 == qcTypeSaveVO.getDefaultModule()) {
|
|
|
+ //用户同意更换默认(标准)模版 校验标准模版是否存在之前,提示信息用户操作默认为0 当用户点击提示信息确定则1
|
|
|
+ if (1 == qcTypeSaveVO.getDefineType()) {
|
|
|
+ //此时不会给出提示
|
|
|
+ flag = true;
|
|
|
+// 原有的标准模版设置为0 互斥行性
|
|
|
+ UpdateWrapper<QcType> serviceInfoWrapper = new UpdateWrapper<>();
|
|
|
+ serviceInfoWrapper
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", qcTypeSaveVO.getHospitalId())
|
|
|
+ .eq("default_module", 1)
|
|
|
+ .set("default_module", "0");
|
|
|
+ this.update(new QcType(), serviceInfoWrapper);
|
|
|
+ }
|
|
|
+ //校验标准模版是否存在
|
|
|
+ List<QcType> list = this.list(new QueryWrapper<QcType>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", qcTypeSaveVO.getHospitalId())
|
|
|
+ .eq("default_module", 1));
|
|
|
+ if (list.size() > 0) {
|
|
|
+ //发现标准模版已经存在
|
|
|
+ if (flag == false) {
|
|
|
+ //修改页面
|
|
|
+ if (null != qcTypeSaveVO.getId()) {
|
|
|
+ //当默认唯一模版提交修改按钮不提示
|
|
|
+ if (!qcTypeSaveVO.getId().equals(list.get(0).getId())) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ } else if (null == qcTypeSaveVO.getId()) {
|
|
|
+ //新增时候互斥给出提示
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
QcType qcType = new QcType();
|
|
|
Long id = qcTypeSaveVO.getId();
|
|
|
|
|
@@ -151,8 +260,9 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
}
|
|
|
qcType.setGmtModified(param.getNow());//修改时间
|
|
|
qcType.setModifier(param.getPerson());//修改人
|
|
|
- this.saveOrUpdate(qcType);
|
|
|
+ boolean data = this.saveOrUpdate(qcType);
|
|
|
qcTypeSaveVO.setId(qcType.getId());
|
|
|
+ return data;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -249,4 +359,4 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+}
|