trick9191 преди 7 години
родител
ревизия
deb0b61d0d

+ 62 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.service.app.prescription;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
@ -167,8 +168,7 @@ public class PrescriptionInfoService extends BaseService {
    }
    public JSONArray getDoctorPrescription(String doctor,String state,String diseases,String startDate,String endDate ){
    public JSONArray getDoctorPrescription(Integer teamCode,String state,String diseases,String startDate,String endDate ){
        StringBuffer pre_sql = new StringBuffer("SELECT " +
                " p.`name`, " +
                " TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age, " +
@ -186,14 +186,14 @@ public class PrescriptionInfoService extends BaseService {
            //疾病类型不为空,关联查询疾病类型表
            pre_sql.append(" ,wlyy_prescription_diagnosis s " +
                    " WHERE s.prescription_code = pr.code " +
                    " AND pr.doctor =? AND s.code = ?");
            params.add(doctor);
                    " AND pr.admin_team_id =? AND s.code = ?");
            params.add(teamCode);
            params.add(diseases);
            setSQL(pre_sql,params,state,startDate,endDate);
        }else{
            //查询所有疾病类型表
            pre_sql.append(" WHERE pr.doctor =?");
            params.add(doctor);
            pre_sql.append(" WHERE pr.admin_team_id =?");
            params.add(teamCode);
            setSQL(pre_sql,params,state,startDate,endDate);
        }
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(),params.toArray());
@ -215,4 +215,60 @@ public class PrescriptionInfoService extends BaseService {
        }
        pre_sql.append(" ORDER BY pr.create_time DESC");
    }
    /**
     * 获取续方信息
     * @param code
     * @return
     */
    public JSONObject getContinuedPrescriptionAsDoctor(String code){
        Prescription prescription = prescriptionDao.findByCode(code);
        List<PrescriptionInfo> prescriptionInfos = prescriptionInfoDao.findByPrescriptionCode(code);
        JSONObject rs = new JSONObject();
        rs.put("prescription",prescription);
        rs.put("prescriptionInfos",prescriptionInfos);
        if(prescription!=null&&StringUtils.isNotBlank(prescription.getDoctor())){
            rs.put("doctor",doctorDao.findByCode(prescription.getDoctor()));
        }else{
            rs.put("doctor","");
        }
        return rs;
    }
    public int reviewPrescription(String code ,String reason,String state){
        if(StringUtils.isNotBlank(state)){
            Prescription p = prescriptionDao.findByCode(code);
            if("1".equals(state)){
                //审核通过
                p.setStatus(10);
            }else{
                //审核不通过
                p.setStatus(-1);
                p.setReviewedReason(reason);
            }
            prescriptionDao.save(p);
            //患者操作日志
            PrescriptionLog log = new PrescriptionLog();
            log.setCode(getCode());
            log.setStatus(p.getStatus());
            log.setType(4);
            log.setCreateTime(new Date());
            log.setPrescriptionCode(p.getCode());
            log.setUserCode(p.getDoctor());
            log.setUserName(p.getDoctorName());
            log.setHospitalName(p.getHospitalName());
            log.setHospital(p.getHospital());
            log.setUserType(2);
            log.setFlag(1);
            log.setRemark("医生审核");
            prescriptionLogDao.save(log);
            //同步智业接口
            upLoadPrescriotionState();
            return 1;
        }
        return 0;
    }
}

+ 30 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -59,18 +59,45 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getDoctorPrescription", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取全科医生续方列表")
    public String getDoctorPrescription(@RequestParam(required = false)@ApiParam(value = "续方状态", name = "state") String state,
    @ApiOperation(value = "获取全科医生/建管师续方列表")
    public String getDoctorPrescription(@RequestParam(required = false)@ApiParam(value = "团队code", name = "teamCode") Integer teamCode,
                                        @RequestParam(required = false)@ApiParam(value = "续方状态", name = "state") String state,
                                        @RequestParam(required = false)@ApiParam(value = "所有诊断:1 糖尿病 2高血压", name = "dispensary") String diseases,
                                        @RequestParam(required = false)@ApiParam(name="startDate",value="开始时间")String startDate,
                                        @RequestParam(required = false)@ApiParam(name="endDate",value="结束时间")String endDate){
        try {
            return write(200, "查询成功!", "data",prescriptionInfoService.getDoctorPrescription(getUID(),state,diseases,startDate,endDate));
            return write(200, "查询成功!", "data",prescriptionInfoService.getDoctorPrescription(teamCode,state,diseases,startDate,endDate));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getContinuedPrescriptionAsDoctor", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "续方详情")
    public String getContinuedPrescriptionAsDoctor(@RequestParam(required = true)@ApiParam(value = "续方CODE", name = "code") String code,
                                                   @RequestParam(required = true)@ApiParam(value = "团队长标识:1:是;2否", name = "type") String type){
        try {
            return write(200, "查询成功!", "data",prescriptionInfoService.getContinuedPrescriptionAsDoctor(code));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/reviewPrescription", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "续方详情")
    public String reviewPrescription(@RequestParam(required = true)@ApiParam(value = "续方CODE", name = "code") String code,
                                     @RequestParam(required = false)@ApiParam(value = "不同意原因", name = "reason") String reason,
                                     @RequestParam(required = false)@ApiParam(value = "1同意,2不同意", name = "state") String state){
        try {
            return write(200, "查询成功!", "data",prescriptionInfoService.reviewPrescription(code,reason,state));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
}