Parcourir la source

新增医生端获取关注详情接口

chenweida il y a 7 ans
Parent
commit
f6669da4e0

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/concern/ConcernService.java

@ -188,4 +188,8 @@ public class ConcernService extends BaseService {
    public ConcernDO getByDoctorAndPatient(String doctorCode, String patientCode) {
        return concernDao.findByPatientAndDoctor(patientCode,doctorCode);
    }
    public ConcernDO findByCode(String concernCode) {
        return concernDao.findByCode(concernCode);
    }
}

+ 35 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/concern/DoctorConcernController.java

@ -1,7 +1,9 @@
package com.yihu.wlyy.web.doctor.concern;
import com.yihu.wlyy.entity.concern.ConcernDO;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.service.app.concern.ConcernService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.web.BaseController;
@ -28,6 +30,8 @@ import java.util.List;
public class DoctorConcernController extends BaseController {
    @Autowired
    private ConcernService concernService;
    @Autowired
    private PatientService patientService;
    @RequestMapping(value = "/getConcernPatients", method = RequestMethod.GET)
    @ApiOperation(value = "获取医生关注的患者", notes = "", response = Patient.class)
@ -50,6 +54,7 @@ public class DoctorConcernController extends BaseController {
                jsonObject.put("photo", patient.getPhoto());
                jsonObject.put("sex", patient.getSex());
                jsonObject.put("phone", patient.getPhone());
                jsonObject.put("address", patient.getAddress());
                jsonObject.put("age", IdCardUtil.getAgeForIdcard(patient.getIdcard()));
                jsonObject.put("isWX", StringUtils.isEmpty(patient.getOpenid()) ? false : true);
                jsonObject.put("concernTime", DateUtil.dateToStr(patient.getConcernCreateTime(), "yyyy-MM-dd HH:mm:ss"));
@ -88,4 +93,34 @@ public class DoctorConcernController extends BaseController {
            return error(-100, "查询失败");
        }
    }
    @RequestMapping(value = "/findByCode", method = RequestMethod.GET)
    @ApiOperation(value = "获取关注详细信息", notes = "")
    public String findByCode(
            @ApiParam(name = "concernCode", value = "关注code", required = true) @RequestParam(required = true, name = "concernCode") String concernCode
    ) {
        try {
            ConcernDO concernDO= concernService.findByCode(concernCode);
            Patient patient=patientService.findByCode(concernDO.getPatient());
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("code", patient.getCode());//患者code
            jsonObject.put("name", patient.getName());//患者名称
            jsonObject.put("photo", patient.getPhoto());//患者头像
            jsonObject.put("sex", patient.getSex());//患者性别
            jsonObject.put("phone", patient.getPhone());//患者电话
            jsonObject.put("idcard", patient.getIdcard());//患者身份证
            jsonObject.put("address", patient.getAddress());//患者详细地址
            jsonObject.put("age", IdCardUtil.getAgeForIdcard(patient.getIdcard()));//患者年龄
            jsonObject.put("isWX", StringUtils.isEmpty(patient.getOpenid()) ? false : true);//是否关注微信
            jsonObject.put("concernType", concernDO.getConcernSource());//关注类型
            jsonObject.put("concernTime", DateUtil.dateToStr(concernDO.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));//关注事件
            return write(200, "查询成功", "data", jsonObject);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-100, "查询失败");
        }
    }
}