chenweida 7 rokov pred
rodič
commit
462b32e96d

+ 1 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java

@ -42,6 +42,7 @@ public class SwaggerConfig {
                .select()
                .paths(or(
                        regex("/wlyygc/.*"),
                        regex("/manage_util/.*"),
                        regex("/gc/.*")
                ))
                .build()
@ -83,7 +84,6 @@ public class SwaggerConfig {
                .pathMapping("/")
                .select()
                .paths(or(regex("/doctor/.*"),
                        regex("/manage_util/.*"),
                        regex("/PC/.*")))
                .build()
                .globalOperationParameters(pars)
@ -156,7 +156,6 @@ public class SwaggerConfig {
                        regex("/job/.*"),
                        regex("/family_contract/.*"),
                        regex("/hosptail/.*"),
                        regex("/manage_util/.*"),
                        regex("/common/.*"),
                        regex("/hospitals/.*"),
                        regex("/index/.*"),

+ 2 - 15
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java

@ -371,7 +371,6 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
            if(StringUtils.isNotBlank(attachedContent)){
                endMsg = attachedContent;
            }
            JSONArray messages = new JSONArray();
            Map<String, Map<String, Object>> msgs = new HashMap<>();
            String batchNo = UUID.randomUUID().toString();
            Date createTime = new Date();
@ -421,6 +420,8 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                        //创建时间
                        heap.setCzrq(createTime);
                        heap.setSignCode(patientService.getSignCodeByPatient(p));
                        heap.setSendType(1);
                        heap.setTitle(temp.getTitle());
                        list.add(heap);
                        consultService.sendMucMessageBySingnType(doctor.getCode(), doctor.getName(), p, "{\"title\":\"" + temp.getTitle()+ "\",\"type\":0,\"id\":\"" + temp.getCode() + "\",\"img\":\"" + temp.getUrl() + "\",\"content\":\"为了您的健康,我给您发送了一篇文章,请咨询查阅,如有问题,可随时与我沟通\"}", "4", patientTemp.getName());
                        if(StringUtils.isNotBlank(attachedContent)){
@ -463,18 +464,6 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                                map.get("name") == null ? "" : map.get("name").toString(),
                                (JSONObject) map.get("json"));
                    }
//                    else{
//                        JSONObject j = weiXinOpenIdUtils.getFamilyOpenId((String)map.get("code"));
//                        Patient p = patientService.findByCode((String)map.get("code"));
//                        Patient member = (Patient)j.get("member");
//                        JSONObject data = (JSONObject) map.get("json");
//                        String first = (String)data.get("first");
//                        data.remove("first");
//                        data.put("first",weiXinOpenIdUtils.getTitleMes(p,j.isNull("relation")?1:j.getInt("relation"),p.getName()));
//                        if(StringUtils.isNotBlank(member.getOpenid())){
//                            pushMsgTask.putWxMsg(getAccessToken(), 9, member.getOpenid(), member.getName(), data);
//                        }
//                    }
                    //发送代理人
                    JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId((String)map.get("code"),openid);
                    if(jsonArray!=null&&jsonArray.length()>0){
@ -499,8 +488,6 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                for (HealthEduArticlePatient heap : list) {
                    BusinessLogs.info(BusinessLogs.BusinessType.article, getUID(), heap.getPatient(), new JSONObject(heap));
                }
                // 推送消息给患者
                pushMsgTask.put(messages);
                return success("发送成功!");
            }
        } catch (Exception e) {

+ 152 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcEduArticleController.java

@ -1,11 +1,37 @@
package com.yihu.wlyy.web.third.gateway.controller.doctor;
import com.yihu.wlyy.entity.education.HealthEduArticlePatient;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.consult.ConsultService;
import com.yihu.wlyy.service.app.health.HealthEduArticleService;
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ImUtill;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.web.third.gateway.service.GcEduArticleService;
import com.yihu.wlyy.web.third.gateway.vo.base.BaseResultModel;
import com.yihu.wlyy.web.third.gateway.vo.base.ResultBatchModel;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.*;
/**
 * Created by chenweida on 2017/8/30.
 */
@ -13,6 +39,131 @@ import org.springframework.web.bind.annotation.ResponseBody;
@RequestMapping(value = "/wlyygc/doctor/edu/article", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
@Api(description = "医生文章相关服务")
public class GcEduArticleController {
public class GcEduArticleController extends WeixinBaseController {
    @Autowired
    private WeiXinOpenIdUtils weiXinOpenIdUtils;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private PatientService patientService;
    @Autowired
    private ConsultService consultService;
    @Autowired
    private HealthEduArticleService healthEduArticleService;
    @Autowired
    private DoctorService doctorService;
    @Autowired
    private SignPatientLabelInfoService signPatientLabelInfoService;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private GcEduArticleService gcEduArticleService;
    /**
     * 参考原来的教育文章推送
     * http://172.19.103.88:9092/wlyy//doctor/health/edu/send?code=2e6467b5bb2f4b81b598633624d7f98e&patient=e911d1b756cd4680ab241ab76a463282&teamCode=1&attachedContent=
     *
     * @param sendCode
     * @param sendName
     * @param sendMessage
     * @param labelCode
     * @param labelType
     * @param teamId
     * @param receiveCodes
     * @param articleIds
     * @param articlePics
     * @param articleTitles
     * @return
     */
    @RequestMapping(value = "send", method = RequestMethod.POST)
    @ApiOperation("文章推送")
    public ResultBatchModel send(
            @ApiParam(name = "sendType", value = "发送类型 1医生发送 2卫纪委发送", required = true) @RequestParam(value = "sendType", required = true) String sendType,
            @ApiParam(name = "sendCode", value = "发送人code", required = true) @RequestParam(value = "sendCode", required = true) String sendCode,
            @ApiParam(name = "sendName", value = "发送人名", required = true) @RequestParam(value = "sendName", required = true) String sendName,
            @ApiParam(name = "sendMessage", value = "发送人信息", required = false) @RequestParam(value = "sendMessage", required = false) String sendMessage,
            @ApiParam(name = "teamId", value = "发送人是医生的时候,医生所属的团队", required = true) @RequestParam(value = "teamId", required = true) Long teamId,
            @ApiParam(name = "labelCode", value = "所选群组,多个用逗号分隔", required = true) @RequestParam(value = "labelCode", required = false, defaultValue = "") String labelCode,
            @ApiParam(name = "labelType", value = "标签类型  1 服务类型  2 健康情况 3 疾病类型 4 自定义标签", required = true) @RequestParam(value = "labelType", required = false, defaultValue = "") String labelType,
            @ApiParam(name = "receiveCodes", value = "接收人code,多个逗号分割", required = false) @RequestParam(value = "receiveCodes", required = false, defaultValue = "") String receiveCodes,
            @ApiParam(name = "articleIds", value = "文章ID,多个逗号分割", required = true) @RequestParam(value = "articleIds", required = true) String articleIds,
            @ApiParam(name = "articlePics", value = "文章封面,多个逗号分割", required = true) @RequestParam(value = "articlePics", required = true) String articlePics,
            @ApiParam(name = "articleTitles", value = "文章标题,多个逗号分割", required = true) @RequestParam(value = "articleTitles", required = true) String articleTitles
    ) {
        try {
            String[] patients = receiveCodes.split(",");//接收人的code
            Set<String> patientSet = new HashSet<>(); //放入set中可以去重复
            String[] articleIdArr = articleIds.split(",");
            String[] articlePicArr = articlePics.split(",");
            String[] articleTitleArr = articleTitles.split(",");
            if ((articleIdArr.length != articlePicArr.length) || (articleIdArr.length != articleTitleArr.length) || (articlePicArr.length != articleTitleArr.length)) {
                return new ResultBatchModel(BaseResultModel.statusEm.opera_error.getCode(), BaseResultModel.statusEm.opera_error.getMessage() + ":文章参数长度错误");
            }
            int success = 0;
            int error = 0;
            //得到需要发送的患者
            gcEduArticleService.initPatient(patientSet, patients, labelType, labelCode, teamId);
            //保存发送记录
            List<HealthEduArticlePatient> healthEduArticlePatients = gcEduArticleService.saveArticle(patientSet, sendCode, sendName, sendMessage, teamId, articleIdArr, articlePicArr, articleTitleArr);
            //推送微信模板消息和发送im消息
            sendWxTemplateAndIM(healthEduArticlePatients);
            return null;
        } catch (Exception e) {
            return new ResultBatchModel(BaseResultModel.statusEm.opera_error.getCode(), BaseResultModel.statusEm.opera_error.getMessage() + ":" + e.getMessage());
        }
    }
    private void sendWxTemplateAndIM(List<HealthEduArticlePatient> healthEduArticlePatients) throws  Exception{
        String endMsg = "";//"为了您的健康," + doctor.getName() + "医生给您发送了一篇患教文章,请仔细查阅,如有问题,可随时咨询医生。";
        healthEduArticlePatients.stream().forEach(one -> {
            Patient patient=patientService.findByCode(one.getPatient());
            consultService.sendMucMessageBySingnType(one.getDoctor(), one.getDoctorName(), patient.getCode(), "{\"title\":\"" + one.getAttachedTitle()+ "\",\"type\":0,\"id\":\"" + one.getId() + "\",\"img\":\"" + one.getAttachedPic() + "\",\"content\":\"为了您的健康,我给您发送了一篇文章,请咨询查阅,如有问题,可随时与我沟通\"}", "4", patient.getName());
            if(StringUtils.isNotBlank(one.getAttachedContent())){
                //发送备注
                consultService.sendMucMessageBySingnType(one.getDoctor(),one.getDoctorName(), patient.getCode(), one.getAttachedContent(), ImUtill.CONTENT_TYPE_TEXT, patient.getName());
            }
            // 推送消息给微信端
            JSONObject json = new JSONObject();
            json.put("first", patient.getName() + ",您好!\n" +  one.getDoctorName() + "医生给您发来了一篇患教文章");
            json.put("toUser", patient.getCode());
            json.put("article", one.getId()+ "");
            json.put("title", one.getAttachedTitle());
            json.put("doctorName", one.getDoctorName());
            json.put("represented",patient.getCode());//被代理人
            json.put("date", DateUtil.dateToStrLong(DateUtil.getNowDate()));
            json.put("remark", one.getAttachedContent());
            if(StringUtils.isNotBlank(patient.getOpenid())){
                pushMsgTask.putWxMsg(getAccessToken(), 9,
                        patient.getOpenid(),
                        patient.getName(),
                        json);
            }
            //发送代理人
            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient.getCode(),patient.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");
                    json.remove("toUser");
                    json.put("toUser",member.getCode());
                    json.remove("first");
                    try {
                        json.put("first",weiXinOpenIdUtils.getTitleMes(patient,j.isNull("relation")?1:j.getInt("relation"),patient.getName()));
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    if(StringUtils.isNotBlank(member.getOpenid())){
                        pushMsgTask.putWxMsg(getAccessToken(), 9, member.getOpenid(), patient.getName(), json);
                    }
                }
            }
        });
    }
}

+ 5 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcLableController.java

@ -43,11 +43,11 @@ public class GcLableController extends BaseController {
    @RequestMapping(value = "/labels", method = RequestMethod.GET)
    @ApiOperation("根据分组类型查找标签")
    public ResultListModel<List<PatientLabelModel>> labels(
            @ApiParam(name = "type", value = "1:卫计委三大分组 2:健康情况 3:疾病类型 4:自定义", required = true) @RequestParam(value = "type", required = true) String type,
            @ApiParam(name = "type", value = "1:服务类型(卫计委三大分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = true) @RequestParam(value = "type", required = true) String type,
            @ApiParam(name = "team", value = "type是4的时候需要传team", required = false) @RequestParam(value = "team", required = false) Long team
    ) {
        try {
            List<SignPatientLabel> signPatientLabels = signPatientLabelService.getLabelsByTypeAndTeam(type, team.toString());
            List<SignPatientLabel> signPatientLabels = signPatientLabelService.getLabelsByTypeAndTeam(type, String.valueOf(team));
            List<PatientLabelModel> patientLabelModels = new ArrayList<>();
            for (SignPatientLabel signPatientLabel : signPatientLabels) {
                PatientLabelModel patientLabelModel = new PatientLabelModel();
@ -63,7 +63,7 @@ public class GcLableController extends BaseController {
    @RequestMapping(value = "/labelsWithNum", method = RequestMethod.GET)
    @ApiOperation("根据分组类型查找标签已经标签下的患者数目")
    public ResultListModel<List<PatientLabelModel>> labelsWithNum(
            @ApiParam(name = "type", value = "1:卫计委三大分组 2:健康情况 3:疾病类型 4:自定义", required = true) @RequestParam(value = "type", required = true) String type,
            @ApiParam(name = "type", value = "1:服务类型(卫计委三大分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = true) @RequestParam(value = "type", required = true) String type,
            @ApiParam(name = "team", value = "医生所属的团队ID", required = true) @RequestParam(value = "team", required = true) Long team
    ) {
        try {
@ -84,7 +84,7 @@ public class GcLableController extends BaseController {
        }
    }
    @RequestMapping(value = "/signPatients", method = RequestMethod.GET)
    @RequestMapping(value = "/signPatientsByLabel", method = RequestMethod.GET)
    @ApiOperation("获取医生签约的患者列表")
    public ResultPageListModel<PatientModel> signPatients(
            @ApiParam(name = "labelType", value = "标签类型", required = true) @RequestParam(value = "labelType", required = true) String labelType,
@ -113,4 +113,5 @@ public class GcLableController extends BaseController {
            return new ResultPageListModel(BaseResultModel.statusEm.find_error.getCode(), BaseResultModel.statusEm.find_error.getMessage() + "," + e.getMessage());
        }
    }
}

+ 21 - 17
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcMessageController.java

@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
/**
 * Created by chenweida on 2017/8/17.
@ -32,7 +33,7 @@ import java.util.List;
@Api(description = "消息相关服务,包括短信,微信模板")
public class GcMessageController {
    private Logger logger= LoggerFactory.getLogger(GcMessageController.class);
    private Logger logger = LoggerFactory.getLogger(GcMessageController.class);
    @Autowired
    private WeiXinTempMsgSendUtils weiXinTempMsgSendUtils;
    @Autowired
@ -48,23 +49,26 @@ public class GcMessageController {
            @ApiParam(name = "teampolateJson", value = "微信模板内容json格式", required = true) @RequestParam(value = "teampolateJson", required = true) String teampolateJson,
            @ApiParam(name = "url", value = "模板跳转的url", required = true) @RequestParam(value = "url", required = true) String url
    ) {
        Integer success = 0;
        Integer error = 0;
        List<String> errorLiust = new ArrayList<>();
        String[] codeArr = codes.split(",");
        for (String code : codeArr) {
            try {
                Patient patient = patientService.findByCode(code);
                weiXinTempMsgSendUtils.sendTemplateMessage(templateId, patient.getOpenid(), url, new JSONObject(teampolateJson));
                success++;
            } catch (Exception e) {
                logger.error("code "+code+"send Template error:"+e.getMessage());
                error++;
                errorLiust.add(code);
        try {
            Integer success = 0;
            Integer error = 0;
            List<String> errorLiust = new ArrayList<>();
            String[] codeArr = codes.split(",");
            for (String code : codeArr) {
                try {
                    Patient patient = patientService.findByCode(code);
                    weiXinTempMsgSendUtils.sendTemplateMessage(templateId, patient.getOpenid(), url, new JSONObject(teampolateJson));
                    success++;
                } catch (Exception e) {
                    logger.error("code " + code + "send Template error:" + e.getMessage());
                    error++;
                    errorLiust.add(code);
                }
            }
            return new ResultBatchModel(success, error, errorLiust);
        } catch (Exception e) {
            return new ResultBatchModel(BaseResultModel.statusEm.opera_error.getCode(), BaseResultModel.statusEm.opera_error.getMessage() + ":" + e.getMessage());
        }
        return new ResultBatchModel(success, error, errorLiust);
    }
    @RequestMapping(value = "/sendMobileMessage", method = RequestMethod.POST)
@ -87,7 +91,7 @@ public class GcMessageController {
                    smsService.sendWithContent(mobile, ip, 11, content);
                    success++;
                } catch (Exception e) {
                    logger.error("mobile "+mobile+"send message error:"+e.getMessage());
                    logger.error("mobile " + mobile + "send message error:" + e.getMessage());
                    error++;
                    errorLiust.add(mobile);
                }

+ 23 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/patient/GcPatientController.java

@ -1,9 +1,12 @@
package com.yihu.wlyy.web.third.gateway.controller.patient;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.web.third.gateway.vo.DoctorModel;
import com.yihu.wlyy.web.third.gateway.vo.PatientModel;
import com.yihu.wlyy.web.third.gateway.vo.base.ResultOneModel;
import io.swagger.annotations.Api;
@ -29,6 +32,8 @@ public class GcPatientController {
    private PatientService patientService;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private DoctorService doctorService;
    @RequestMapping(value = "/patient", method = RequestMethod.GET)
@ -53,6 +58,22 @@ public class GcPatientController {
        }
    }
    @RequestMapping(value = "/doctor", method = RequestMethod.GET)
    @ApiOperation("根据医生code查询医生信息")
    public ResultOneModel<DoctorModel> doctor(
            @ApiParam(name = "code", value = "医生code", required = true) @RequestParam(value = "code", required = true) String code
    ) {
        Doctor doctor = doctorService.findDoctorByCode(code);
        DoctorModel doctorModel = null;
        if (doctor != null) {
            doctorModel = new DoctorModel();
            BeanUtils.copyProperties(doctor, doctorModel);
            return new ResultOneModel(doctorModel);
        } else {
            return new ResultOneModel(new JSONObject());
        }
    }
    @RequestMapping(value = "/patientHasSign", method = RequestMethod.GET)
    @ApiOperation("判断患者是否签约")
@ -66,4 +87,6 @@ public class GcPatientController {
        }
        return new ResultOneModel(isSign);
    }
}

+ 138 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/service/GcEduArticleService.java

@ -0,0 +1,138 @@
package com.yihu.wlyy.web.third.gateway.service;
import com.yihu.wlyy.entity.education.HealthEduArticleOpHistory;
import com.yihu.wlyy.entity.education.HealthEduArticlePatient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.education.HealthEduArticlePatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.health.HealthEduArticleOpHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
 * Created by chenweida on 2017/8/31.
 */
@Service
public class GcEduArticleService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private HealthEduArticleOpHistoryService healthEduArticleOpHistoryService;
    @Autowired
    private HealthEduArticlePatientDao healthEduArticlePatientDao;
    /**
     * 初始化需要发送的患者
     *
     * @param patientSet
     * @param patients
     * @param labelType
     * @param labelCode
     * @param teamId
     */
    public void initPatient(Set<String> patientSet, String[] patients, String labelType, String labelCode, Long teamId) {
        List params = new ArrayList();//sql参数
        StringBuffer sb = new StringBuffer();//sql
        //1 服务类型  2 健康情况 3 疾病类型 4 自定义标签
        if (!org.springframework.util.StringUtils.isEmpty(labelType)) {
            switch (labelType) {
                case "1": {
                    sb.append(" select w.patient from wlyy_sign_family w where w.server_type=? and w.`status`>0 ");
                    params.add(labelCode);
                    if (teamId != null && teamId > 0) {
                        sb.append(" and w.admin_team_code=? ");
                        params.add(teamId);
                    }
                    break;
                }
                case "2":
                case "3":
                case "4": {
                    sb.append("SELECT w.patient FROM wlyy_sign_family w " +
                            "WHERE " +
                            "  w.patient in (SELECT  l.patient FROM  wlyy_sign_patient_label_info l WHERE l.label_type = ? AND l.label = ?) " +
                            "AND w.`status` > 0");
                    params.add(labelType);
                    params.add(labelCode);
                    if (teamId != null && teamId > 0) {
                        sb.append(" and w.admin_team_code=? ");
                        params.add(teamId);
                    }
                    break;
                }
            }
            List<String> groupPatient = jdbcTemplate.queryForList(sb.toString(), String.class, params.toArray());
            patientSet.addAll(groupPatient);
        }
        if (patients != null && patients.length > 0) {
            List<String> arrPatient = java.util.Arrays.asList(patients);
            patientSet.addAll(arrPatient);
        }
    }
    /**
     * 保存发送信息
     *
     * @param patientSet    患者set集和
     * @param sendCode      发送人code、
     * @param sendName      发送人名称
     * @param sendMessage   发送人携带的信息
     * @param teamId        发送人所属团队
     * @param articleIds    文章列表
     * @param articlePics   文件封面
     * @param articleTitles 文章主题
     */
    @Transactional
    public List<HealthEduArticlePatient> saveArticle(Set<String> patientSet, String sendCode, String sendName, String sendMessage, Long teamId, String[] articleIds, String[] articlePics, String[] articleTitles) {
        List<HealthEduArticlePatient> healthEduArticlePatients = new ArrayList<>();
        String batchNo = UUID.randomUUID().toString();
        Date createTime = new Date();
        for (String patient : patientSet) {
            SignFamily signFamily = signFamilyDao.findByjiatingPatient(patient);
            for (int i = 0; i < articleIds.length; i++) {
                HealthEduArticlePatient healthEduArticlePatient = new HealthEduArticlePatient();
                // 设置文章标识
                healthEduArticlePatient.setArticle(articleIds[i]);
                // 设置医生标识
                healthEduArticlePatient.setDoctor(sendCode);
                // 设置医生姓名
                healthEduArticlePatient.setDoctorName(sendName);
                // 设置患者标识
                healthEduArticlePatient.setPatient(patient);
                // 设置为示读
                healthEduArticlePatient.setRead(1);
                // 签约类型
                healthEduArticlePatient.setSignType(2);
                // 行政团队
                healthEduArticlePatient.setAdminTeamCode(teamId);
                //附加内容
                healthEduArticlePatient.setAttachedContent(sendMessage);
                //批次号记录发送批次
                healthEduArticlePatient.setBatchNo(batchNo);
                //创建时间
                healthEduArticlePatient.setCzrq(createTime);
                healthEduArticlePatient.setSignCode(signFamily.getCode());
                healthEduArticlePatient.setSendType(2);
                healthEduArticlePatient.setAttachedTitle(articleTitles[i]);
                healthEduArticlePatient.setAttachedPic(articlePics[i]);
                healthEduArticlePatients.add(healthEduArticlePatient);
            }
        }
        healthEduArticlePatientDao.save(healthEduArticlePatients);
        //记录转发量
        for (HealthEduArticlePatient healthEduArticlePatient : healthEduArticlePatients) {
            healthEduArticleOpHistoryService.saveByStatus(HealthEduArticleOpHistory.REPEAT_STATUS, healthEduArticlePatient.getArticle(), healthEduArticlePatient.getTitle(), healthEduArticlePatient.getDoctor());
        }
        return healthEduArticlePatients;
    }
}

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/vo/base/BaseResultModel.java

@ -44,6 +44,7 @@ public class BaseResultModel {
        login_publickey_error(-10030, "获取公钥失败"),
        file_upload_error(-10040, "文件上传失败"),
        find_error(-10050, "查询失败"),
        opera_error(-10060, "操作失败"),
        login_account_error(-20010, "账号不存在"),
        login_password_error(-20020, "密码错误"),

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/vo/base/ResultBatchModel.java

@ -37,6 +37,10 @@ public class ResultBatchModel extends BaseResultModel {
    }
    public ResultBatchModel(Integer status, String message) {
        super(status, message);
    }
    public Integer getSuccessNum() {
        return successNum;
    }