|
@ -467,7 +467,7 @@ public class JwPrescriptionService {
|
|
|
Integer jwCode = jwData.getInteger("CODE");
|
|
|
if (1 == jwCode) {
|
|
|
JSONArray dataArray = jwData.getJSONArray("DATA");
|
|
|
logger.info("从基卫获取随访信息数量"+ dataArray.size());
|
|
|
logger.info("从基卫获取随访信息数量"+ dataArray.size()+",社区名称:"+hospitalMapping.getName());
|
|
|
for (int i = 0; i < dataArray.size(); i++) {
|
|
|
Followup followup = new Followup();
|
|
|
|
|
@ -525,6 +525,8 @@ public class JwPrescriptionService {
|
|
|
if (doctor == null) {
|
|
|
logger.info("no mapping hospital:" + jworgCode + ",familyDoctor:" + jwdoctorCode);
|
|
|
continue;
|
|
|
}else{
|
|
|
|
|
|
}
|
|
|
followup.setOrgCode(hm.getCode());//i健康机构编码
|
|
|
String doctorCode = doctor.getCode();//医生CODE
|
|
@ -536,6 +538,11 @@ public class JwPrescriptionService {
|
|
|
|
|
|
String idcard = json.getString("IDENTITY_CARD_NO");//患者身份证
|
|
|
Patient patient = patientDao.findByIdcard(idcard);
|
|
|
|
|
|
if(patient == null){
|
|
|
logger.info("no patient idcard:" + idcard);
|
|
|
continue;
|
|
|
}
|
|
|
String patientCode = patient.getCode();//患者CODE
|
|
|
String patientName = patient.getName();//患者姓名
|
|
|
followup.setIdcard(idcard);
|
|
@ -570,9 +577,8 @@ public class JwPrescriptionService {
|
|
|
continue;
|
|
|
}
|
|
|
Integer signType = Integer.parseInt(sign.getSignSource());//签约类型 1三师 2家庭
|
|
|
Long adminTeamCode = new Long(sign.getAdminTeamId());//行政团队
|
|
|
String signCode = sign.getCode();//签约表Code
|
|
|
followup.setAdminTeamCode(adminTeamCode);
|
|
|
followup.setAdminTeamCode(sign.getAdminTeamId());//行政团队
|
|
|
followup.setSignCode(signCode);
|
|
|
|
|
|
//随访记录详
|
|
@ -668,9 +674,15 @@ public class JwPrescriptionService {
|
|
|
followupContent7.put("CONTROL_CONSTITUTOR_JWDOCTORCODE", jwdoctorCode);//制定者本地CODE V05
|
|
|
}else{
|
|
|
Doctor control_doctor = doctorDao.findMappingDoctor(CONTROL_CONSTITUTOR, jworgCode);
|
|
|
followupContent7.put("CONTROL_CONSTITUTOR", control_doctor.getName());//制定者姓名 V05
|
|
|
followupContent7.put("CONTROL_CONSTITUTOR_DOCTORCODE", control_doctor.getCode());//制定者本地CODE V05
|
|
|
followupContent7.put("CONTROL_CONSTITUTOR_JWDOCTORCODE", CONTROL_CONSTITUTOR);//制定者本地CODE V05
|
|
|
|
|
|
if(control_doctor == null){
|
|
|
logger.info("no control doctor mapping CONTROL_CONSTITUTOR:" + CONTROL_CONSTITUTOR);
|
|
|
}else{
|
|
|
followupContent7.put("CONTROL_CONSTITUTOR", CONTROL_CONSTITUTOR);//制定者姓名 V05
|
|
|
followupContent7.put("CONTROL_CONSTITUTOR_DOCTORCODE", "");//制定者本地CODE V05
|
|
|
followupContent7.put("CONTROL_CONSTITUTOR_JWDOCTORCODE", CONTROL_CONSTITUTOR);//制定者基卫医生CODE V05
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -709,6 +721,7 @@ public class JwPrescriptionService {
|
|
|
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事物隔离级别,开启新事务
|
|
|
TransactionStatus transactionStatus = transactionManager.getTransaction(def); // 获得事务状态
|
|
|
try {
|
|
|
followup.setCreateTime(new Date());
|
|
|
followup = followUpDao.save(followup);
|
|
|
Long followupId = followup.getId();
|
|
|
|
|
@ -1120,8 +1133,9 @@ public class JwPrescriptionService {
|
|
|
*@date 2017/11/1 15:17
|
|
|
*/
|
|
|
public void esDeleteFollowUpContent(List<FollowupContentESDO> datalist) throws Exception{
|
|
|
JestClient jestClient = null;
|
|
|
try {
|
|
|
JestClient jestClient = elasticFactory.getJestClient();
|
|
|
jestClient = elasticFactory.getJestClient();
|
|
|
//根据id批量删除
|
|
|
Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
|
|
|
for (FollowupContentESDO obj : datalist) {
|
|
@ -1134,6 +1148,11 @@ public class JwPrescriptionService {
|
|
|
logger.info("delete flag:" + br.isSucceeded());
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
logger.error(" delete error :" + e.getMessage());
|
|
|
}finally {
|
|
|
if (jestClient != null) {
|
|
|
jestClient.shutdownClient();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
@ -1144,25 +1163,29 @@ public class JwPrescriptionService {
|
|
|
*@date 2017/11/1 19:41
|
|
|
*/
|
|
|
public List<FollowupContentESDO> esfindFollowUpContestsByFollowupId(String id) throws Exception {
|
|
|
//根据随访ID、分类ID获取随访记录详情
|
|
|
|
|
|
JestClient jestClient = null;
|
|
|
List<String> resultList = new ArrayList<>();
|
|
|
|
|
|
JestClient jestClient = elasticFactory.getJestClient();
|
|
|
//先根据条件查找出来
|
|
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
|
|
searchSourceBuilder.query(
|
|
|
new BoolQueryBuilder()
|
|
|
.must(QueryBuilders.matchQuery("followup_id", id))
|
|
|
);
|
|
|
|
|
|
Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
|
|
|
.build();
|
|
|
SearchResult result = jestClient.execute(search);
|
|
|
|
|
|
List<FollowupContentESDO> followupContentESDOList = new ArrayList<>();
|
|
|
|
|
|
jestClient.shutdownClient();
|
|
|
try {
|
|
|
//根据随访ID、分类ID获取随访记录详情
|
|
|
jestClient = elasticFactory.getJestClient();
|
|
|
//先根据条件查找出来
|
|
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
|
|
searchSourceBuilder.query(
|
|
|
new BoolQueryBuilder()
|
|
|
.must(QueryBuilders.matchQuery("followup_id", id))
|
|
|
);
|
|
|
|
|
|
Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
|
|
|
.build();
|
|
|
SearchResult result = jestClient.execute(search);
|
|
|
followupContentESDOList = result.getSourceAsObjectList(FollowupContentESDO.class);
|
|
|
jestClient.shutdownClient();
|
|
|
} finally {
|
|
|
if (jestClient != null) {
|
|
|
jestClient.shutdownClient();
|
|
|
}
|
|
|
}
|
|
|
return followupContentESDOList;
|
|
|
}
|
|
|
|
|
@ -1172,21 +1195,34 @@ public class JwPrescriptionService {
|
|
|
*@date 2017/11/1 14:57
|
|
|
*/
|
|
|
public void esSaveFollowupContentData(String followupid, List<FollowupContentESDO> newdatalist) throws Exception {
|
|
|
JestClient jestClient = elasticFactory.getJestClient();
|
|
|
//先根据条件查找出来
|
|
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
|
|
searchSourceBuilder.query(
|
|
|
new BoolQueryBuilder()
|
|
|
.must(QueryBuilders.matchQuery("followup_id", id))
|
|
|
);
|
|
|
Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType).build();
|
|
|
SearchResult result = jestClient.execute(search);
|
|
|
List<FollowupContentESDO> dataList = result.getSourceAsObjectList(FollowupContentESDO.class);
|
|
|
//删除原有记录
|
|
|
this.esDeleteFollowUpContent(dataList);
|
|
|
//保存新的随访详情记录
|
|
|
elastricSearchSave.save(newdatalist,esIndex,esType);
|
|
|
jestClient.shutdownClient();
|
|
|
JestClient jestClient = null;
|
|
|
|
|
|
try {
|
|
|
jestClient = elasticFactory.getJestClient();
|
|
|
//先根据条件查找出来
|
|
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
|
|
searchSourceBuilder.query(
|
|
|
new BoolQueryBuilder()
|
|
|
.must(QueryBuilders.matchQuery("followup_id", id))
|
|
|
);
|
|
|
Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType).build();
|
|
|
SearchResult result = jestClient.execute(search);
|
|
|
List<FollowupContentESDO> dataList = result.getSourceAsObjectList(FollowupContentESDO.class);
|
|
|
if(!dataList.isEmpty()){
|
|
|
//删除原有记录
|
|
|
this.esDeleteFollowUpContent(dataList);
|
|
|
}
|
|
|
//保存新的随访详情记录
|
|
|
elastricSearchSave.save(newdatalist,esIndex,esType);
|
|
|
jestClient.shutdownClient();
|
|
|
}catch (Exception e){
|
|
|
logger.error(" save error :" + e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
} finally {
|
|
|
if (jestClient != null) {
|
|
|
jestClient.shutdownClient();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public HashMap<String,String> operaESFollowUpContentData(List<FollowupContentESDO> esdataList){
|