trick9191 7 tahun lalu
induk
melakukan
54f67f2749

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/specialist/TeamDiseaseRelation.java

@ -11,7 +11,7 @@ import java.util.Date;
 * Created by Trick on 2018/7/4.
 */
@Entity
@Table(name = "wlyy_special_disease")
@Table(name = "wlyy_team_disease_relation")
public class TeamDiseaseRelation extends IdEntity {
    private Long teamCode;//团队id',

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyServerDao.java

@ -16,4 +16,5 @@ public interface SignFamilyServerDao extends PagingAndSortingRepository<SignFami
    @Query("select f from SignFamilyServer f where f.signCode = ?1 and f.serverType in (4,5)")
    List<SignFamilyServer> findBySignCodeAndType(String signCode);
    List<SignFamilyServer> findBySignCode(String signCode);
}

+ 54 - 21
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistService.java

@ -387,7 +387,13 @@ public class SpecialistService extends BaseService {
    public Map<String, Object> findSpecialistTeamInfo(String doctor, Long teamCode) {
        String sql = "SELECT t.id, " +
                " t. NAME, " +
                " d.photo " +
                " d.photo," +
                " d.hospital," +
                " d.hospital_name AS hospitalName," +
                " d.code AS doctor," +
                " d.name AS doctorName ," +
                " d.dept," +
                " d.dept_name AS deptName" +
                " FROM " +
                " wlyy_admin_team t " +
                " JOIN wlyy_admin_team_member m ON t.id = m.team_id " +
@ -430,8 +436,7 @@ public class SpecialistService extends BaseService {
        Patient p = patientDao.findByCode(patient);
        Doctor d = doctorDao.findByCode(doctor);
        SpecialDisease dis = specialDiseaseDao.findByCode(disease);
        if (p != null && d != null && dis != null) {
        if (p != null && d != null) {
            Map<String, Object> param = new HashedMap();
            param.put("doctor", doctor);
            param.put("doctorName", d.getName());
@ -441,18 +446,22 @@ public class SpecialistService extends BaseService {
            HttpResponse response = HttpUtils.doPost(specialistUrl + "svr-specialist/signSpecialistTeam", param);
            JSONObject rs = new JSONObject(response.getContent());
            if ("succes".equals(rs.getString("message"))) {
                // 保存居民病种
                PatientDiseaseServer server = new PatientDiseaseServer();
                server.setCode(getCode());
                server.setDel("1");
                server.setSpecialistRelationCode(rs.getString("obj"));
                server.setPatient(patient);
                server.setPatientName(p.getName());
                server.setDisease(dis.getCode());
                server.setDiseaseName(dis.getName());
                server.setCreateTime(new Date());
                patientDiseaseServerDao.save(server);
                String[] str = disease.split(",");
                for (String ds : str) {
                    SpecialDisease dis = specialDiseaseDao.findByCode(ds);
                    // 保存居民病种
                    PatientDiseaseServer server = new PatientDiseaseServer();
                    server.setCode(getCode());
                    server.setDel("1");
                    server.setSpecialistRelationCode(rs.getString("obj"));
                    server.setPatient(patient);
                    server.setPatientName(p.getName());
                    server.setDisease(dis.getCode());
                    server.setDiseaseName(dis.getName());
                    server.setCreateTime(new Date());
                    patientDiseaseServerDao.save(server);
                }
                // 添加签约申请消息
                Message message = new Message();
                message.setCzrq(new Date());
@ -482,22 +491,24 @@ public class SpecialistService extends BaseService {
            } else if ("doctor_exist".equals(rs.getString("message"))) {
                mes.put("code", -1);
                mes.put("mes", "医生与患者已经签约");
                mes.put("data", rs.getJSONObject("obj"));
            } else if ("team_exist".equals(rs.getString("message"))){
                mes.put("data", rs.getJSONObject("obj").toString());
                return mes;
            } else if ("team_exist".equals(rs.getString("message"))) {
                mes.put("code", -2);
                mes.put("mes", "团队与患者已经签约");
                mes.put("data", rs.getJSONObject("obj"));
                mes.put("data", rs.getJSONObject("obj").toString());
                return mes;
            } else {
                logger.info(response.getContent());
            }
        }
        mes.put("code",-3);
        mes.put("mes","获取居民信息失败");
        mes.put("code", -3);
        mes.put("mes", "获取居民信息失败");
        mes.put("data", "");
        return mes;
    }
    public String agreeSpecialistTeam(String state,String relationCode,String remark,Long mesId)throws Exception{
    public String agreeSpecialistTeam(String state, String relationCode, String remark, Long mesId) throws Exception {
        Map<String, Object> param = new HashedMap();
        param.put("state", state);
        param.put("relationCode", relationCode);
@ -506,7 +517,7 @@ public class SpecialistService extends BaseService {
        JSONObject rs = new JSONObject(response.getContent());
        if ("succes".equals(rs.getString("message"))) {
            if(mesId!=null){
            if (mesId != null) {
                Message m = messageDao.findOne(mesId);
                m.setOver("0");
                m.setRead(0);
@ -517,5 +528,27 @@ public class SpecialistService extends BaseService {
        return "0";
    }
    public JSONObject findPatientSigninfo(String code) throws Exception {
        Map<String, Object> param = new HashedMap();
        param.put("code", code);
        HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/agreeSpecialistTeam", param);
        JSONObject rs = new JSONObject(response.getContent());
        if ("succes".equals(rs.getString("message"))) {
            return rs.getJSONObject("obj");
        }
        return null;
    }
    public JSONArray findPatientTeamList(String patient) throws Exception {
        Map<String, Object> param = new HashedMap();
        param.put("patient", patient);
        HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/findPatientTeamList", param);
        JSONObject rs = new JSONObject(response.getContent());
        if ("succes".equals(rs.getString("message"))) {
            return rs.getJSONArray("obj");
        }
        return null;
    }
}

+ 6 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -9,8 +9,10 @@ import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.SignFamilyServer;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.doctor.SignPatientLabelDao;
import com.yihu.wlyy.repository.patient.SignFamilyServerDao;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.family.FamilyMemberService;
import com.yihu.wlyy.service.app.message.MessageService;
@ -74,6 +76,8 @@ public class DoctorFamilyContractController extends WeixinBaseController {
    FamilyMemberService familyMemberService;
    @Autowired
    SignPatientLabelDao labelDao;
    @Autowired
    SignFamilyServerDao signFamilyServerDao;
    @Autowired
    private CommonUtil CommonUtil;
@ -1098,9 +1102,11 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                }
                // 家庭签约
                if (jtSign != null) {
                    List<SignFamilyServer> servers = signFamilyServerDao.findBySignCode(jtSign.getCode());
                    json.put("applySurrDate", jtSign.getPatientApplyUnsignDate());
                    json.put("applyDate", jtSign.getPatientApplyDate());
                    json.put("jtSign",jtjson);
                    json.put("signFamilyServer",servers);
                }
                json.put("countryCode", temp.getSickVillage() == null ? "" : temp.getSickVillage());

+ 59 - 35
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/SpecialistController.java

@ -40,7 +40,7 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "findHealthAssistant", method = RequestMethod.GET)
    @ApiOperation("获取所有计管师")
    public String findHealthAssistant(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor) {
    public String findHealthAssistant(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor) {
        try {
            return write(200, "获取成功", "data", specialistService.findHealthAssistant(doctor));
        } catch (Exception e) {
@ -51,7 +51,7 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "findHealthAssistantPatientCount", method = RequestMethod.GET)
    @ApiOperation("获取所有计管师下居民数目")
    public String findHealthAssistantPatientCount(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor){
    public String findHealthAssistantPatientCount(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor) {
        try {
            return write(200, "获取成功", "data", specialistService.findHealthAssistantPatientCount(doctor));
        } catch (Exception e) {
@ -75,11 +75,11 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "findLabelAndPatientCount", method = RequestMethod.GET)
    @ApiOperation("获取标签与居民数量")
    public String findLabelAndPatientCount(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true)String doctor,
                                           @ApiParam(name = "type", value = "标签类型") @RequestParam(required = true)String type,
                                           @ApiParam(name = "teamCode", value = "团队id") @RequestParam(required = false)Long teamCode) {
    public String findLabelAndPatientCount(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true) String doctor,
                                           @ApiParam(name = "type", value = "标签类型") @RequestParam(required = true) String type,
                                           @ApiParam(name = "teamCode", value = "团队id") @RequestParam(required = false) Long teamCode) {
        try {
            return write(200, "获取成功", "data", specialistService.findLabelAndPatientCount(doctor,type,teamCode));
            return write(200, "获取成功", "data", specialistService.findLabelAndPatientCount(doctor, type, teamCode));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -111,12 +111,12 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "findPatientRelatioByAssistant", method = RequestMethod.GET)
    @ApiOperation("获取计管师下未分配标签居民")
    public String findPatientRelatioByAssistant(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true)String doctor,
    public String findPatientRelatioByAssistant(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true) String doctor,
                                                @ApiParam(name = "assistant", value = "计管师") @RequestParam(required = true) String assistant,
                                                @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true) Integer page,
                                                @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true) Integer size) throws Exception {
        try {
            return write(200, "获取成功", "data", specialistService.findPatientRelatioByAssistant(doctor,assistant, page, size));
            return write(200, "获取成功", "data", specialistService.findPatientRelatioByAssistant(doctor, assistant, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -137,13 +137,13 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "getPatientByLabel", method = RequestMethod.POST)
    @ApiOperation("获取标签下居民")
    public String getPatientByLabel(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
                                    @ApiParam(name = "labelType", value = "标签类型")@RequestParam(required = true) String labelType,
                                    @ApiParam(name = "labelCode", value = "标签code") @RequestParam(required = true)String labelCode,
                                    @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
                                    @ApiParam(name = "size", value = "每页大小")@RequestParam(required = true) Integer size) {
    public String getPatientByLabel(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor,
                                    @ApiParam(name = "labelType", value = "标签类型") @RequestParam(required = true) String labelType,
                                    @ApiParam(name = "labelCode", value = "标签code") @RequestParam(required = true) String labelCode,
                                    @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true) Integer page,
                                    @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true) Integer size) {
        try {
            return write(200, "获取成功", "data", specialistService.getPatientByLabel(doctor,labelType, labelCode, page, size));
            return write(200, "获取成功", "data", specialistService.getPatientByLabel(doctor, labelType, labelCode, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -152,7 +152,7 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "findDoctorTeamMenmber", method = RequestMethod.GET)
    @ApiOperation("获取团队及团队成员")
    public String findDoctorTeamMenmber(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor) {
    public String findDoctorTeamMenmber(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor) {
        try {
            return write(200, "获取成功", "data", specialistService.findDoctorTeamMenmber(doctor));
        } catch (Exception e) {
@ -163,12 +163,12 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "getDoctorInHospital", method = RequestMethod.GET)
    @ApiOperation("获取院内工作人员")
    public String getDoctorInHospital(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
                                      @ApiParam(name = "name", value = "医生姓名模糊") @RequestParam(required = false)String name,
                                      @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
                                      @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size){
    public String getDoctorInHospital(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor,
                                      @ApiParam(name = "name", value = "医生姓名模糊") @RequestParam(required = false) String name,
                                      @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true) Integer page,
                                      @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true) Integer size) {
        try {
            return write(200, "获取成功", "data", specialistService.getDoctorInHospital(doctor,name,page,size));
            return write(200, "获取成功", "data", specialistService.getDoctorInHospital(doctor, name, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -177,12 +177,12 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "getDoctorPatientByName", method = RequestMethod.GET)
    @ApiOperation("搜索专科医生下的居民")
    public String getDoctorPatientByName(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
                                         @ApiParam(name = "nameKey", value = "居民姓名模糊") @RequestParam(required = false)String nameKey,
                                         @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
                                         @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size) {
    public String getDoctorPatientByName(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor,
                                         @ApiParam(name = "nameKey", value = "居民姓名模糊") @RequestParam(required = false) String nameKey,
                                         @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true) Integer page,
                                         @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true) Integer size) {
        try {
            return write(200, "获取成功", "data", specialistService.getDoctorPatientByName(doctor,nameKey,page,size));
            return write(200, "获取成功", "data", specialistService.getDoctorPatientByName(doctor, nameKey, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -191,11 +191,11 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "findPatientNoAssistant", method = RequestMethod.GET)
    @ApiOperation(value = "获取未分配计管师居民列表")
    public String findPatientNoAssistant(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
                                       @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
                                       @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size) {
    public String findPatientNoAssistant(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor,
                                         @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true) Integer page,
                                         @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true) Integer size) {
        try {
            return write(200, "获取成功", "data", specialistService.findPatientNoAssistant(doctor,page,size));
            return write(200, "获取成功", "data", specialistService.findPatientNoAssistant(doctor, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -204,7 +204,7 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "getSpecialistTeamList", method = RequestMethod.GET)
    @ApiOperation(value = "获取专科医生所在团队信息列表")
    public String getSpecialistTeamList(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor) {
    public String getSpecialistTeamList(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor) {
        try {
            return write(200, "获取成功", "data", specialistService.getSpecialistTeamList(doctor));
        } catch (Exception e) {
@ -216,15 +216,39 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "/agreeSpecialistTeam", method = RequestMethod.GET)
    @ApiOperation(value = "医生审核")
    @ObserverRequired
    public String agreeSpecialistTeam(@ApiParam(name = "state", value = "状态0为拒绝,1为同意") @RequestParam(required = true)String state,
                                      @ApiParam(name = "relationCode", value = "关联code") @RequestParam(required = true)String relationCode,
                                      @ApiParam(name = "remark", value = "审核失败原因") @RequestParam(required = false)String remark,
                                      @ApiParam(name = "mesId", value = "消息Id") @RequestParam(required = false)Long mesId)throws Exception {
    public String agreeSpecialistTeam(@ApiParam(name = "state", value = "状态0为拒绝,1为同意") @RequestParam(required = true) String state,
                                      @ApiParam(name = "relationCode", value = "关联code") @RequestParam(required = true) String relationCode,
                                      @ApiParam(name = "remark", value = "审核失败原因") @RequestParam(required = false) String remark,
                                      @ApiParam(name = "mesId", value = "消息Id") @RequestParam(required = false) Long mesId) throws Exception {
        try {
            return write(200, "获取成功", "data", specialistService.agreeSpecialistTeam( state, relationCode, remark, mesId));
            return write(200, "获取成功", "data", specialistService.agreeSpecialistTeam(state, relationCode, remark, mesId));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "/findPatientSigninfo", method = RequestMethod.GET)
    @ApiOperation(value = "医生审核")
    @ObserverRequired
    public String findPatientSigninfo(@ApiParam(name = "code", value = "专科医生签约code") @RequestParam(required = true) String code) {
        try {
            return write(200, "获取成功", "data", specialistService.findPatientSigninfo(code));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "/findPatientTeamList", method = RequestMethod.GET)
    @ApiOperation(value = "获取居民所有专科医生签约信息")
    public String findPatientTeamList(@ApiParam(name = "patient", value = "居民code") @RequestParam(required = true) String patient) {
        try {
            return write(200, "获取成功", "data", specialistService.findPatientTeamList(patient));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
}

+ 11 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/specialist/PatientSpecialistController.java

@ -87,5 +87,16 @@ public class PatientSpecialistController extends BaseController{
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "/findPatientTeamList", method = RequestMethod.GET)
    @ApiOperation(value = "获取居民所有专科医生签约信息")
    public String findPatientTeamList(@ApiParam(name = "patient", value = "居民code") @RequestParam(required = true) String patient) {
        try {
            return write(200, "获取成功", "data", specialistService.findPatientTeamList(patient));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
//----
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java

@ -809,7 +809,7 @@ public class WeiXinEventProcess {
            List<Map<String, String>> articles = new ArrayList<>();
            // 二维码参数
            String[] keys = eventKey.replace("sp_disease_", "").split("_");
            //设置抽奖
            //设置图文消息
            setSpDisease(articles,keys[0],keys[1],systemConf);
            // 构建回复消息XMLs
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);