Pārlūkot izejas kodu

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

chenweida 7 gadi atpakaļ
vecāks
revīzija
b8c9f4c2b5

+ 8 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/Patient.java

@ -96,6 +96,8 @@ public class Patient extends IdEntity implements Serializable {
	private Date sicardTime;
	//是否分配过微信标签  1分配过 0或者空没有
	private Integer isWxtag;
	//微信iagId
	private Integer wxtagid;
	public Integer getSicardStatus() {
@ -401,7 +403,13 @@ public class Patient extends IdEntity implements Serializable {
		this.isWxtag = isWxtag;
	}
	public Integer getWxtagid() {
		return wxtagid;
	}
	public void setWxtagid(Integer wxtagid) {
		this.wxtagid = wxtagid;
	}
	//---------------------------常量----------------------------
	public enum isWchatTage{

+ 0 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java

@ -64,8 +64,4 @@ public interface PatientDao extends PagingAndSortingRepository<Patient, Long> {
    //获取所有的openid并排重
    @Query("select distinct p.openid from Patient p where p.openid is not null and p.openid <> '' ")
    List<String> findOpenids();
    @Modifying
    @Query("update Patient p set p.isWxtag=?2 where p.code=?1")
    void updateIsWXTagByCode(String patient, Integer status);
}

+ 0 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -33,7 +33,6 @@ import com.yihu.wlyy.task.SignUploadTask;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import com.yihu.wlyy.wechat.util.WeiXinTagUtil;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.sql.Select;
import org.json.JSONArray;
@ -128,8 +127,6 @@ public class FamilyContractService extends BaseService {
    private SignFamilyRenewDao signFamilyRenewDao;
    @Autowired
    private SignFamilyMappingDao signFamilyMappingDao;
    @Autowired
    private WeiXinTagUtil weiXinTagUtil;
    @Autowired
    private ImUtill ImUtill;
@ -1187,7 +1184,6 @@ public class FamilyContractService extends BaseService {
        //签约成功之后给患者新增标签
        String openId=sf.getOpenid();
       hospital=sf.getHospital();
        weiXinTagUtil.addTagWithOpenid(openId,hospital,sf.getPatient(),sf.getName());
        return temp;
    }
@ -1535,7 +1531,6 @@ public class FamilyContractService extends BaseService {
        //签约成功之后给患者新增标签
        String openId=sf.getOpenid();
        String hospital=sf.getHospital();
        weiXinTagUtil.addTagWithOpenid(openId,hospital,sf.getPatient(),sf.getName());
        return result;
    }
@ -1672,7 +1667,6 @@ public class FamilyContractService extends BaseService {
        //根据openId给患者清掉标签
        String openId=sf.getOpenid();
        String hospital=sf.getHospital();
        weiXinTagUtil.deleteTagWithOpenid(openId,hospital,sf.getPatient(),sf.getName());
        return 1;
    }

+ 8 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java

@ -18,6 +18,7 @@ import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.common.account.TokenService;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.wechat.util.WeiXinTagUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@ -69,6 +70,8 @@ public class PatientController extends WeixinBaseController {
    private SMSService smsService;
    @Autowired
    private SignFamilyServerDao signFamilyServerDao;
    @Autowired
    private WeiXinTagUtil weiXinTagUtil;
    /**
     * 患者基本信息查询接口
@ -391,6 +394,11 @@ public class PatientController extends WeixinBaseController {
                token.setDel("0");
                tokenDao.save(token);
                SystemData.wxPatientTokens.remove(getUID());
                //清空患者的微信标签
                weiXinTagUtil.deleteTagWithOpenid(patient.getOpenid(),patient.getWxtagid());
                patient.setIsWxtag(Patient.isWchatTage.no.getValue());
                patient.setWxtagid(null);
                patientInfoService.updatePatient(patient);
                return success("已成功退出!");
            }
        } catch (Exception e) {

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/PatientSignFamilyServiceController.java

@ -10,6 +10,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@ -34,6 +35,9 @@ public class PatientSignFamilyServiceController extends BaseController {
    ) {
        try {
            JSONObject jo = new JSONObject();
            if (StringUtils.isEmpty(patientCode)) {
                patientCode = getUID();
            }
            Service service = signFamilyServiceService.getPatientService(patientCode, null);
            List<ServiceItem> serviceItems = signFamilyServiceService.getPatientServiceItem(patientCode, null);
            jo.put("service", service);

+ 10 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinTagUtil.java

@ -118,9 +118,10 @@ public class WeiXinTagUtil {
                    throw new Exception("创建失败," + result);
                }
                //更新患者表
                patientDao.updateIsWXTagByCode(patient, Patient.isWchatTage.yes.getValue());
                Patient patientObj = patientDao.findByCode(patient);
                patientObj.setIsWxtag(Patient.isWchatTage.yes.getValue());
                patientObj.setWxtagid(tagId);
            }
            return result;
        } catch (Exception e) {
            logger.error(e.getMessage());
@ -156,8 +157,9 @@ public class WeiXinTagUtil {
            } else {
                saveLog(openid, patient, patientName, null, 1, "wx_tag中不存在区是" + town + "的标签");
            }
            //更新患者表
            patientDao.updateIsWXTagByCode(patient, Patient.isWchatTage.yes.getValue());
            Patient patientObj = patientDao.findByCode(patient);
            patientObj.setIsWxtag(Patient.isWchatTage.yes.getValue());
            patientObj.setWxtagid(tagId.getTagId());
            return str;
        } catch (Exception e) {
            logger.error(e.getMessage());
@ -220,7 +222,9 @@ public class WeiXinTagUtil {
            } else {
                saveLog(openid, patient, patientName, null, 2, "wx_tag中不存在区是" + town + "的标签");
            }
            patientDao.updateIsWXTagByCode(patient, Patient.isWchatTage.no.getValue());
            Patient patientObj = patientDao.findByCode(patient);
            patientObj.setIsWxtag(Patient.isWchatTage.no.getValue());
            patientObj.setWxtagid(null);
            return str;
        } catch (Exception e) {
            logger.error(e.getMessage());
@ -268,6 +272,7 @@ public class WeiXinTagUtil {
     */
    public String deleteTagWithOpenid(String openIds, Integer tagId) {
        try {
            net.sf.json.JSONObject params = new net.sf.json.JSONObject();
            net.sf.json.JSONArray ja = new JSONArray();
            ja.add(openIds);