|
|
@@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.jfcloud.error.annotation.ErrorLog;
|
|
|
+import com.github.jfcloud.error.ex.ErrorLogMessageException;
|
|
|
import com.github.jfcloud.error.util.ErrorLogTool;
|
|
|
import com.github.jfcloud.gene.event.SyncLisEvent;
|
|
|
import com.github.jfcloud.gene.lis.config.LisDb;
|
|
|
@@ -59,7 +60,7 @@ public class LisSyncService {
|
|
|
@ErrorLog("同步LIS")
|
|
|
public void sync(Long sampleId) {
|
|
|
if (!systemPropertiesService.getBooleanValue("sample.sync.lis")) {
|
|
|
- return;
|
|
|
+ throw new ErrorLogMessageException("同步LIS失败,未开启配置");
|
|
|
}
|
|
|
|
|
|
SampleInfo sampleInfo = sampleInfoService.getById(sampleId);
|
|
|
@@ -89,14 +90,20 @@ public class LisSyncService {
|
|
|
Assert.notEmpty(sampleInfo.getApplicantName(), "同步LIS失败,申请人姓名为空", sampleInfo.getApplicantName());
|
|
|
Entity applyUser = lisDb.queryOne("select top 1 user_id from dbo.HT_INFO_USER_EXTEND where name = N'" + sampleInfo.getApplicantName() + "' order by user_id desc");
|
|
|
Assert.notNull(applyUser, "同步LIS失败,申请人姓名[{}]不存在LIS系统", sampleInfo.getApplicantName());
|
|
|
+ Entity receiveUser = lisDb.queryOne("select top 1 user_id from dbo.HT_INFO_USER_EXTEND where name = N'" + sampleInfo.getReceiveUserName() + "' order by user_id desc");
|
|
|
|
|
|
//同步LIS
|
|
|
CheckItemSerumVo item = serum.getItems().get(0);
|
|
|
|
|
|
HtScienceApply scienceApply = new HtScienceApply();
|
|
|
scienceApply.setPetType(item.getLisPetTypeId());
|
|
|
- scienceApply.setCreateId(applyUser.getStr("user_id"));
|
|
|
- scienceApply.setCreateName(sampleInfo.getApplicantName());
|
|
|
+ if (receiveUser != null) {
|
|
|
+ scienceApply.setCreateId(receiveUser.getStr("user_id"));
|
|
|
+ scienceApply.setCreateName(sampleInfo.getReceiveUserName());
|
|
|
+ } else {
|
|
|
+ scienceApply.setCreateId(applyUser.getStr("user_id"));
|
|
|
+ scienceApply.setCreateName(sampleInfo.getApplicantName());
|
|
|
+ }
|
|
|
scienceApply.setApplyDocId(scienceApply.getCreateId());
|
|
|
scienceApply.setApplyDoc(scienceApply.getCreateName());
|
|
|
scienceApply.setEmail(StrUtil.nullToDefault(serum.getApplyUserEmail(), sampleInfo.getApplicantEmail()));
|