|
|
|
@ -2,6 +2,7 @@ package com.docus.webservice.handler;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.docus.webservice.dto.SelectColumn;
|
|
|
|
|
import com.docus.webservice.enums.Codes;
|
|
|
|
|
import com.docus.webservice.entity.TBasic;
|
|
|
|
@ -12,10 +13,7 @@ import com.docus.webservice.utils.JsonUtils;
|
|
|
|
|
import com.docus.webservice.utils.ResultUtils;
|
|
|
|
|
import com.docus.webservice.utils.XmlUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.jws.WebService;
|
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
@ -34,7 +32,7 @@ public class TBasicWebService implements ITBasicWebService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String savaAndSub(String tbasic) {
|
|
|
|
|
XmlUtils xmlUtils = null;
|
|
|
|
|
XmlUtils xmlUtils;
|
|
|
|
|
try {
|
|
|
|
|
//解析xml
|
|
|
|
|
xmlUtils = new XmlUtils(new ByteArrayInputStream(tbasic.getBytes("UTF-8")));
|
|
|
|
@ -43,14 +41,13 @@ public class TBasicWebService implements ITBasicWebService {
|
|
|
|
|
Map jsonMap = JSON.parseObject(json, Map.class);
|
|
|
|
|
HashMap<String, Object> tBasicMap = new HashMap<>();
|
|
|
|
|
HashMap<String, Object> tBasicSubMap = new HashMap<>();
|
|
|
|
|
List<SelectColumn> selectColumns = JSON.parseArray(String.valueOf(jsonMap.get("selectColumns")), SelectColumn.class);
|
|
|
|
|
List<SelectColumn> selectColumns = JSON.parseArray(String.valueOf(jsonMap.get(Codes.SELECT_COLUMNS.getMessage())), SelectColumn.class);
|
|
|
|
|
String value;
|
|
|
|
|
for (SelectColumn selectColumn : selectColumns) {
|
|
|
|
|
try {
|
|
|
|
|
value = xmlUtils.getElementText(selectColumn.getQualityColumn())==null?null:String.valueOf(xmlUtils.getElementText(selectColumn.getQualityColumn()));
|
|
|
|
|
value = xmlUtils.getElementText(selectColumn.getQualityColumn()) == null ? null : String.valueOf(xmlUtils.getElementText(selectColumn.getQualityColumn()));
|
|
|
|
|
} catch (RuntimeException e) {
|
|
|
|
|
String message = e.getMessage();
|
|
|
|
|
System.out.println(message);
|
|
|
|
|
return ResultUtils.fail(message);
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isBlank(value)) {
|
|
|
|
@ -74,7 +71,8 @@ public class TBasicWebService implements ITBasicWebService {
|
|
|
|
|
int insert;
|
|
|
|
|
if (tBasicMap != null && tBasicMap.size() > 0) {
|
|
|
|
|
tBasic = JSON.parseObject(JSON.toJSONString(tBasicMap), TBasic.class);
|
|
|
|
|
if (StringUtils.isBlank(tBasic.getPatientId())) {
|
|
|
|
|
TBasic selectTBasic = tBasicMapper.selectOne(new QueryWrapper<TBasic>().eq("emp_id", tBasic.getEmpId()));
|
|
|
|
|
if (selectTBasic == null) {
|
|
|
|
|
//新增
|
|
|
|
|
insert = tBasicMapper.insert(tBasic);
|
|
|
|
|
if (insert <= 0) {
|
|
|
|
@ -88,15 +86,18 @@ public class TBasicWebService implements ITBasicWebService {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//修改
|
|
|
|
|
insert=tBasicMapper.updateById(tBasic);
|
|
|
|
|
insert = tBasicMapper.update(tBasic, new QueryWrapper<TBasic>().eq("emp_id", tBasic.getEmpId()));
|
|
|
|
|
if (insert <= 0) {
|
|
|
|
|
return ResultUtils.fail("数据库执行出错,请重试");
|
|
|
|
|
}
|
|
|
|
|
tBasicSub = JSON.parseObject(JSON.toJSONString(tBasicSubMap), TBasicSub.class);
|
|
|
|
|
tBasicSub.setPatientId(tBasic.getPatientId());
|
|
|
|
|
insert = tBasicSubMapper.updateById(tBasicSub);
|
|
|
|
|
if (insert <= 0) {
|
|
|
|
|
return ResultUtils.fail("数据库执行出错,请重试");
|
|
|
|
|
|
|
|
|
|
if (tBasicSubMap != null && tBasicSubMap.size() > 0) {
|
|
|
|
|
tBasicSub = JSON.parseObject(JSON.toJSONString(tBasicSubMap), TBasicSub.class);
|
|
|
|
|
tBasicSub.setPatientId(selectTBasic.getPatientId());
|
|
|
|
|
insert = tBasicSubMapper.updateById(tBasicSub);
|
|
|
|
|
if (insert <= 0) {
|
|
|
|
|
return ResultUtils.fail("数据库执行出错,请重试");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|