|
@ -4,15 +4,21 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.service.specialist.SpecialistEvaluateSevice;
|
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
|
import com.yihu.wlyy.util.IdCardUtil;
|
|
|
import com.yihu.wlyy.util.http.HttpResponse;
|
|
|
import com.yihu.wlyy.util.http.HttpUtils;
|
|
|
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
|
|
|
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -21,6 +27,8 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@ -42,6 +50,14 @@ public class RehabilitationManageService extends BaseService {
|
|
|
private PatientDao patientDao;
|
|
|
@Autowired
|
|
|
private SpecialistEvaluateSevice specialistEvaluateSevice;
|
|
|
@Autowired
|
|
|
private WechatTemplateConfigDao templateConfigDao;
|
|
|
@Autowired
|
|
|
private PushMsgTask pushMsgTask;
|
|
|
@Autowired
|
|
|
private WeiXinOpenIdUtils weiXinOpenIdUtils;
|
|
|
@Autowired
|
|
|
private WeiXinAccessTokenUtils accessTokenUtils;
|
|
|
|
|
|
/************************************************************* start ************************************************************************/
|
|
|
private String findRehabilitationPlanList = "/svr-specialist/findRehabilitationPlanList";//康复管理-康复计划列表
|
|
@ -484,6 +500,53 @@ public class RehabilitationManageService extends BaseService {
|
|
|
//specialistUrl= "http://localhost:10051";
|
|
|
HttpResponse response = HttpUtils.doPost(specialistUrl + updateNoteAndImageRehabilitationOperate, param);
|
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
|
if(result.getString("status").equals("200")){
|
|
|
JSONArray array = result.getJSONArray("detailModelList");
|
|
|
JSONObject object = array.getJSONObject(0);
|
|
|
int evaluation = object.getInt("evaluation");
|
|
|
if (evaluation == 1){
|
|
|
String serviceItemId = object.getString("serviceItemId");
|
|
|
String doctor = object.getString("doctorCode");
|
|
|
String patient = object.getString("patientCode");
|
|
|
String title = object.getString("title");
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
String patientName = p.getName();
|
|
|
String openId = p.getOpenid();
|
|
|
WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey","fwxmpj");
|
|
|
String first = templateConfig.getFirst();
|
|
|
first = first.replace("key1",(patientName==null?"":patientName));
|
|
|
String keyword1 = templateConfig.getKeyword1();
|
|
|
JSONObject json = new JSONObject();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
json.put("keyword1", keyword1);
|
|
|
json.put("keyword2", sdf.format(new Date()));
|
|
|
json.put("toUser", p.getCode());
|
|
|
json.put("represented",p.getCode());//被代理人
|
|
|
json.put("remark", "");
|
|
|
json.put("doctor",doctor);
|
|
|
json.put("serviceItemId", serviceItemId);
|
|
|
first = first.replace("key2",title);
|
|
|
json.put("first", first);
|
|
|
if(StringUtils.isNotBlank(p.getOpenid())){
|
|
|
pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 25, openId, p.getName(), json);
|
|
|
}else {
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(), p.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
JSONObject data = json;
|
|
|
data.remove("toUser");
|
|
|
data.put("toUser", member.getCode());
|
|
|
data.remove("first");
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()) + first);
|
|
|
pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 25, member.getOpenid(), p.getName(), data);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|