Browse Source

Merge branch 'dev' of chenweida/patient-co-management into dev

chenweida 8 years ago
parent
commit
1e21775e50

+ 32 - 6
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -37,6 +37,7 @@ import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -872,15 +873,23 @@ public class DoctorInfoService extends BaseService {
    }
    @Transactional
    public void updateTeamHealthDoctors(String newDoctorCode, String oldDoctorCode, String patients, String loginUser) throws Exception {
    public Map<String, Integer> updateTeamHealthDoctors(String newDoctorCode, String oldDoctorCode, String patients, String loginUser) throws Exception {
        Map<String, Integer> returnMap = new HashedMap();
        String[] patiensString = patients.split(",");
        Integer successs = 0;//转移成功
        Integer error = 0;//转移失败
        for (int i = 0; i < patiensString.length; i++) {
            updateTeamHealthDoctor(newDoctorCode, oldDoctorCode, patiensString[i]);
            try {
                updateTeamHealthDoctor(newDoctorCode, oldDoctorCode, patiensString[i]);
                successs++;
            } catch (Exception e) {
                error++;
            }
        }
        OperatorLog operatorLog = new OperatorLog();
        operatorLog.setCreateTime(new Date());
        operatorLog.setMethod("/doctor/updateTeamHealthDoctors");
        operatorLog.setMethodName("转换团队中的健康管理师");
        operatorLog.setMethodName("转换团队中的健康管理师:成功:" + successs + ",失败:" + error);
        operatorLog.setCreateUser(loginUser);
        JSONObject jo = new JSONObject();
        jo.put("newDoctorCode", newDoctorCode);
@ -888,6 +897,9 @@ public class DoctorInfoService extends BaseService {
        jo.put("patients", patients);
        operatorLog.setParams(jo.toString());
        operatorLogDao.save(operatorLog);
        returnMap.put("success", successs);
        returnMap.put("error", error);
        return returnMap;
    }
    @Transactional
@ -917,7 +929,7 @@ public class DoctorInfoService extends BaseService {
            return -1;
        }
        if(StringUtils.isNotEmpty(signFamily.getDoctorHealth())){
        if (StringUtils.isNotEmpty(signFamily.getDoctorHealth())) {
            return -2;
        }
@ -1063,10 +1075,20 @@ public class DoctorInfoService extends BaseService {
    }
    @Transactional
    public void updateTeamDoctors(String newDoctorCode, String oldDoctorCode, String patients, String loginUser) throws Exception {
    public Map<String, Integer> updateTeamDoctors(String newDoctorCode, String oldDoctorCode, String patients, String loginUser) throws Exception {
        Map<String, Integer> returnMap = new HashedMap();
        String[] patiensString = patients.split(",");
        Integer successs = 0;//转移成功
        Integer error = 0;//转移失败
        for (int i = 0; i < patiensString.length; i++) {
            updateTeamDoctor(newDoctorCode, oldDoctorCode, patiensString[i]);
            try {
                updateTeamDoctor(newDoctorCode, oldDoctorCode, patiensString[i]);
                successs++;
            } catch (Exception e) {
                error++;
            }
        }
        OperatorLog operatorLog = new OperatorLog();
        operatorLog.setCreateTime(new Date());
@ -1079,6 +1101,10 @@ public class DoctorInfoService extends BaseService {
        jo.put("patients", patients);
        operatorLog.setParams(jo.toString());
        operatorLogDao.save(operatorLog);
        returnMap.put("success", successs);
        returnMap.put("error", error);
        return returnMap;
    }
    private void updateTeamDoctor(String newDoctorCode, String oldDoctorCode, String patient) throws Exception {

+ 14 - 11
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -1565,15 +1565,15 @@ public class DoctorController extends BaseController {
        try {
            String status = redisTemplate.opsForValue().get("jianguanshifenpei:" + getUID());
            status = StringUtils.isEmpty(status) ? "0" : status;
            if(!status.equals("1")){
                redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(),"1");
            if (!status.equals("1")) {
                redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(), "1");
                redisTemplate.expire("jianguanshifenpei:" + getUID(), 20, TimeUnit.MINUTES);
            } else {
                return error(-2,"正在分配,请勿重复操作");
                return error(-2, "正在分配,请勿重复操作");
            }
            if (StringUtils.isNotEmpty(isAll) && isAll.equals("1")) {
                int result = doctorInfoService.updateTeamHealthDoctorsAll(newDoctorCode, getUID());
                redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(),"0");
                redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(), "0");
                redisTemplate.expire("jianguanshifenpei:" + getUID(), 10, TimeUnit.MINUTES);
                if (result == 1) {
                    return write(200, "分配健管师成功");
@ -1584,9 +1584,10 @@ public class DoctorController extends BaseController {
                if (StringUtils.isEmpty(patients)) {
                    return error(-1, "居民不能为空");
                }
                doctorInfoService.updateTeamHealthDoctors(newDoctorCode, oldDoctorCode, patients, getUID());
                Map<String, Integer> returnMap = doctorInfoService.updateTeamHealthDoctors(newDoctorCode, oldDoctorCode, patients, getUID());
                return write(200, "已成功处理" + returnMap.get("success") + "个居民," + returnMap.get("error") + "个居民因有未结束的咨询,无法处理");
            }
            redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(),"0");
            redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(), "0");
            redisTemplate.expire("jianguanshifenpei:" + getUID(), 10, TimeUnit.MINUTES);
            return write(200, "更新成功");
        } catch (Exception e) {
@ -1613,16 +1614,18 @@ public class DoctorController extends BaseController {
        try {
            String status = redisTemplate.opsForValue().get("quankeyishengfenpei:" + getUID());
            status = StringUtils.isEmpty(status) ? "0" : status;
            if(!status.equals("1")){
                redisTemplate.opsForValue().set("quankeyishengfenpei:" + getUID(),"1");
            if (!status.equals("1")) {
                redisTemplate.opsForValue().set("quankeyishengfenpei:" + getUID(), "1");
                redisTemplate.expire("quankeyishengfenpei:" + getUID(), 20, TimeUnit.MINUTES);
            } else {
                return error(-2,"正在分配,请勿重复操作");
                return error(-2, "正在分配,请勿重复操作");
            }
            doctorInfoService.updateTeamDoctors(newDoctorCode, oldDoctorCode, patients, getUID());
            Map<String, Integer> returnMap = doctorInfoService.updateTeamDoctors(newDoctorCode, oldDoctorCode, patients, getUID());
            redisTemplate.opsForValue().set("quankeyishengfenpei:" + getUID(), "0");
            redisTemplate.expire("quankeyishengfenpei:" + getUID(), 10, TimeUnit.MINUTES);
            return write(200, "更新成功");
            return write(200, "已成功处理" + returnMap.get("success") + "个居民," + returnMap.get("error") + "个居民因有未结束的咨询,无法处理");
        } catch (Exception e) {
            redisTemplate.opsForValue().set("quankeyishengfenpei:" + getUID(), "0");
            redisTemplate.expire("quankeyishengfenpei:" + getUID(), 10, TimeUnit.MINUTES);