|
@ -25,10 +25,7 @@ import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
@ -172,6 +169,11 @@ public class PatientRemindService extends BaseService {
|
|
|
*/
|
|
|
public JSONObject remindPatientExpenses(Patient p, Doctor doc, Hospital hos, boolean ignore) throws Exception {
|
|
|
try {
|
|
|
Calendar today = Calendar.getInstance();
|
|
|
today.set(Calendar.HOUR,23);
|
|
|
today.set(Calendar.MINUTE,59);
|
|
|
today.set(Calendar.SECOND,59);
|
|
|
today.set(Calendar.MILLISECOND,59);
|
|
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
JSONObject reObj = new JSONObject();
|
|
|
String mDesc = "";
|
|
@ -212,13 +214,17 @@ public class PatientRemindService extends BaseService {
|
|
|
"尽早为您提供家庭医生服务,请尽快到" + hos.getName() + "(地址:" + hos.getAddress() + ")缴费");
|
|
|
if (ignore) {
|
|
|
redisTemplate.opsForValue().set("expenses:remind:" + p.getCode(), df.format(new Date()));
|
|
|
redisTemplate.expire("expenses:remind:" + p.getCode(), 1, TimeUnit.DAYS);
|
|
|
redisTemplate.expireAt("expenses:remind:" + p.getCode(), today.getTime());
|
|
|
redisTemplate.opsForSet().add("wechat:focus:remind:set",p.getCode());
|
|
|
redisTemplate.expireAt("wechat:focus:remind:set", today.getTime());
|
|
|
}
|
|
|
|
|
|
if (wFlag || mFlag) {
|
|
|
reObj.put("status", 200);
|
|
|
redisTemplate.opsForValue().set("expenses:remind:" + p.getCode(), df.format(new Date()));
|
|
|
redisTemplate.expire("expenses:remind:" + p.getCode(), 1, TimeUnit.DAYS);
|
|
|
redisTemplate.expireAt("expenses:remind:" + p.getCode(), today.getTime());
|
|
|
redisTemplate.opsForSet().add("expenses:remind:set",p.getCode());
|
|
|
redisTemplate.expireAt("expenses:remind:set", today.getTime());
|
|
|
if (wFlag && mFlag) {
|
|
|
reObj.put("msg", "提醒成功");
|
|
|
} else if (mFlag && !wFlag) {
|
|
@ -316,6 +322,10 @@ public class PatientRemindService extends BaseService {
|
|
|
|
|
|
if (result != null && result.size() > 0) {
|
|
|
for (Map<String, Object> map : result) {
|
|
|
String epTime = redisTemplate.opsForValue().get("wechat:focus:remind:" + map.get("code").toString());
|
|
|
if (StringUtils.isNotEmpty(epTime)) {
|
|
|
continue;
|
|
|
}
|
|
|
remindWechatFocus(map, doc);
|
|
|
}
|
|
|
page = page + 1;
|
|
@ -343,10 +353,17 @@ public class PatientRemindService extends BaseService {
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject remindWechatFocus(Map<String, Object> p, Doctor doctor) {
|
|
|
Calendar today = Calendar.getInstance();
|
|
|
today.set(Calendar.HOUR,23);
|
|
|
today.set(Calendar.MINUTE,59);
|
|
|
today.set(Calendar.SECOND,59);
|
|
|
today.set(Calendar.MILLISECOND,59);
|
|
|
JSONObject result = new JSONObject();
|
|
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
redisTemplate.opsForValue().set("wechat:focus:remind:" + p.get("code").toString(), df.format(new Date()));
|
|
|
redisTemplate.expire("wechat:focus:remind:" + p.get("code").toString(), 1, TimeUnit.DAYS);
|
|
|
redisTemplate.expireAt("wechat:focus:remind:" + p.get("code").toString(), today.getTime());
|
|
|
redisTemplate.opsForSet().add("wechat:focus:remind:set",p.get("code").toString());
|
|
|
redisTemplate.expireAt("wechat:focus:remind:set", today.getTime());
|
|
|
|
|
|
if (p.get("mobile") == null || StringUtils.isEmpty(p.get("mobile").toString())) {
|
|
|
result.put("status", -1);
|