|
|
|
@ -14,12 +14,14 @@ 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;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
@WebService
|
|
|
|
|
public class TBasicWebService implements ITBasicWebService {
|
|
|
|
|
|
|
|
|
@ -33,7 +35,6 @@ public class TBasicWebService implements ITBasicWebService {
|
|
|
|
|
@Override
|
|
|
|
|
public String savaAndSub(String tbasic) {
|
|
|
|
|
XmlUtils xmlUtils = null;
|
|
|
|
|
String resXml;
|
|
|
|
|
try {
|
|
|
|
|
//解析xml
|
|
|
|
|
xmlUtils = new XmlUtils(new ByteArrayInputStream(tbasic.getBytes("UTF-8")));
|
|
|
|
@ -46,8 +47,8 @@ public class TBasicWebService implements ITBasicWebService {
|
|
|
|
|
String value;
|
|
|
|
|
for (SelectColumn selectColumn : selectColumns) {
|
|
|
|
|
try {
|
|
|
|
|
value = String.valueOf(xmlUtils.getElementText(selectColumn.getQualityColumn()));
|
|
|
|
|
}catch (RuntimeException e){
|
|
|
|
|
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);
|
|
|
|
@ -68,23 +69,36 @@ public class TBasicWebService implements ITBasicWebService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//处理业务
|
|
|
|
|
TBasic tBasic = new TBasic();
|
|
|
|
|
|
|
|
|
|
TBasic tBasic;
|
|
|
|
|
TBasicSub tBasicSub;
|
|
|
|
|
int insert;
|
|
|
|
|
if (tBasicMap != null && tBasicMap.size() > 0) {
|
|
|
|
|
tBasic=JsonUtils.map2bean(tBasicMap,TBasic.class);
|
|
|
|
|
// insert = tBasicMapper.insert(tBasic);
|
|
|
|
|
// if (insert <= 0) {
|
|
|
|
|
// return ResultUtils.fail("数据库执行出错,请重试");
|
|
|
|
|
// }
|
|
|
|
|
TBasicSub tBasicSub = new TBasicSub();
|
|
|
|
|
// BeanUtils.copyProperties(tBasicSubMap, tBasicSub);
|
|
|
|
|
tBasicSub=JsonUtils.map2bean(tBasicSubMap,TBasicSub.class);
|
|
|
|
|
tBasicSub.setPatientId(tBasic.getPatientId());
|
|
|
|
|
// insert = tBasicSubMapper.insert(tBasicSub);
|
|
|
|
|
// if (insert <= 0) {
|
|
|
|
|
// return ResultUtils.fail("数据库执行出错,请重试");
|
|
|
|
|
// }
|
|
|
|
|
tBasic = JSON.parseObject(JSON.toJSONString(tBasicMap), TBasic.class);
|
|
|
|
|
if (StringUtils.isBlank(tBasic.getPatientId())) {
|
|
|
|
|
//新增
|
|
|
|
|
insert = tBasicMapper.insert(tBasic);
|
|
|
|
|
if (insert <= 0) {
|
|
|
|
|
return ResultUtils.fail("数据库执行出错,请重试");
|
|
|
|
|
}
|
|
|
|
|
tBasicSub = JSON.parseObject(JSON.toJSONString(tBasicSubMap), TBasicSub.class);
|
|
|
|
|
tBasicSub.setPatientId(tBasic.getPatientId());
|
|
|
|
|
insert = tBasicSubMapper.insert(tBasicSub);
|
|
|
|
|
if (insert <= 0) {
|
|
|
|
|
return ResultUtils.fail("数据库执行出错,请重试");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//修改
|
|
|
|
|
insert=tBasicMapper.updateById(tBasic);
|
|
|
|
|
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("数据库执行出错,请重试");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|