|
|
@@ -4,13 +4,7 @@ import java.io.ByteArrayOutputStream;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Collection;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Iterator;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
@@ -27,10 +21,14 @@ import com.lc.ibps.bpmn.repository.BpmInstHisRepository;
|
|
|
import com.lc.ibps.bpmn.repository.BpmInstRepository;
|
|
|
import com.lc.ibps.components.poi.excel.entity.enmus.ExcelType;
|
|
|
import com.lc.ibps.components.poi.excel.export.styler.ExcelExportStylerColorImpl;
|
|
|
+import com.lc.ibps.form.dao.ReagentConsumableDao;
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
import org.apache.commons.lang3.BooleanUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
+import org.codehaus.jackson.JsonNode;
|
|
|
+import org.codehaus.jackson.map.ObjectMapper;
|
|
|
import org.slf4j.event.Level;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -164,6 +162,9 @@ public class DataTemplateProvider extends GenericProvider implements IDataTempla
|
|
|
@Autowired
|
|
|
private ICommonDao<?> commonDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ReagentConsumableDao reagentConsumableDao;
|
|
|
+
|
|
|
@ApiOperation(value = "数据模版列表(分页条件查询)数据", notes = "数据模版列表(分页条件查询)数据")
|
|
|
@Override
|
|
|
public APIResult<APIPageList<DataTemplatePo>> query(
|
|
|
@@ -1600,11 +1601,66 @@ public class DataTemplateProvider extends GenericProvider implements IDataTempla
|
|
|
|
|
|
result.addVariable("id", resultVo.getResultId());
|
|
|
result.setMessage(I18nUtil.getMessage("com.lc.ibps.form.provider.DataTemplateProvider.saveFormDataVo"));
|
|
|
+
|
|
|
+ /** 新增 恒生医院试剂耗材入库hrp接入逻辑 */
|
|
|
+ ReagentConsumabInputForHSYY(dataTemplateRequestVo);
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
setExceptionResult(result, StateEnum.ERROR_FORM_DESIGN.getCode(), I18nUtil.getMessage(StateEnum.ERROR_FORM_DESIGN.getCode()+""), e);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 恒生医院 试剂耗材 入库流水hrp接口逻辑
|
|
|
+ */
|
|
|
+ private void ReagentConsumabInputForHSYY(DataTemplateRequestVo dataTemplateRequestVo) throws Exception{
|
|
|
+ /**
|
|
|
+ * 入库流水保存成功后,要从 试剂耗材入库流水表(t_sjhcrkls)里删除对应数据
|
|
|
+ */
|
|
|
+
|
|
|
+ /** 1.是否 恒生医院环境 */
|
|
|
+ String setting = ContextUtil.getSetting();
|
|
|
+ //ContextUtil.getSetting()的作用:从t_ipcc表的id_为1的数据的setting字段获取每个环境的独有的标识参数
|
|
|
+ //恒生环境的特有标识:"HSYY":"true"
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ HashMap<String, Object> map =(HashMap) objectMapper.readValue(setting, Map.class);
|
|
|
+ String hsyy = Optional.ofNullable(map)
|
|
|
+ .map(m -> m.get("HSYY"))
|
|
|
+ .map(Object::toString)
|
|
|
+ .orElse("");
|
|
|
+ boolean flag1 = Boolean.parseBoolean(hsyy);
|
|
|
+ //flag1为 是否 恒生医院环境 的标识
|
|
|
+
|
|
|
+
|
|
|
+ /** 2.是否 试剂耗材入库登记保存接口 */
|
|
|
+ boolean flag2 = Optional.ofNullable(dataTemplateRequestVo)
|
|
|
+ .map(DataTemplateRequestVo::getBoCode)
|
|
|
+ .map("sjhxhclrkysdjb"::equalsIgnoreCase)
|
|
|
+ .orElse(false);
|
|
|
+ //flag1为 是否 试剂耗材入库登记保存接口 的标识
|
|
|
+
|
|
|
+ /** 3.如果 <是 恒生医院环境> 并且 <是 试剂耗材入库登记保存接口> */
|
|
|
+ if(flag1 && flag2){
|
|
|
+
|
|
|
+ /** 4. 则删除 试剂耗材入库流水表(t_sjhcrkls)里对应数据 */
|
|
|
+
|
|
|
+ /** 4-1.从 shiJiHeHaoCai 字段 中获取数据id */
|
|
|
+ ObjectMapper objectMapper1 = new ObjectMapper();
|
|
|
+ String dataStr = dataTemplateRequestVo.getData();
|
|
|
+ JsonNode dataNode = objectMapper1.readTree(dataStr);
|
|
|
+ if (dataNode.has("shiJiHeHaoCai")) {
|
|
|
+ String ids = dataNode.get("shiJiHeHaoCai").asText();
|
|
|
+ if(StringUtils.isNotEmpty(ids)){
|
|
|
+ /** 4-2. 数据库操作,删除已保存确认的入库流水记录 */
|
|
|
+ List<String> idsList = Arrays.asList(ids.split(","));
|
|
|
+ reagentConsumableDao.deleteByIdsForInput(idsList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
@ApiOperation(value = "上传解析excel文件", notes = "上传解析excel文件")
|
|
|
@Override
|