Jelajahi Sumber

Merge branch 'dev' of liubing/wlyy2.0 into dev

liubing 3 tahun lalu
induk
melakukan
83eece10bd

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/prescription/BaseCarePrescriptionDO.java

@ -26,6 +26,7 @@ public class BaseCarePrescriptionDO extends UuidIdentityEntityWithCreateTime {
    private String sex;
    private String age;
    private String photo;
    @Column(name = "patient")
    public String getPatient() {
@ -125,4 +126,13 @@ public class BaseCarePrescriptionDO extends UuidIdentityEntityWithCreateTime {
    public void setAge(String age) {
        this.age = age;
    }
    @Transient
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
}

+ 4 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/prescription/BaseCarePrescriptionDao.java

@ -3,10 +3,14 @@ package com.yihu.jw.care.dao.prescription;
import com.yihu.jw.entity.care.message.OrgNoticeDO;
import com.yihu.jw.entity.care.prescription.BaseCarePrescriptionDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2021/10/11.
 */
public interface BaseCarePrescriptionDao  extends PagingAndSortingRepository<BaseCarePrescriptionDO,String>, JpaSpecificationExecutor<BaseCarePrescriptionDO> {
    @Query(value = " select * from base_care_prescription a where a.patient =?1 order by a.create_time desc limit 1",nativeQuery = true)
    BaseCarePrescriptionDO selectOneByPatient(String patient);
}

+ 16 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/prescription/PrescriptionEndpoint.java

@ -72,6 +72,22 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "getPrescriptionInfo")
    @ApiOperation(value = "获取续方详情")
    public ObjEnvelop getPrescriptionInfo(
            @ApiParam(name = "id", value = "续方id") @RequestParam(value = "id", required = false) String id,
            @ApiParam(name = "patient", value = "patient") @RequestParam(value = "patient", required = false) String patient) {
        try{
            JSONObject obj =  prescriptionService.getPrescriptionInfo(id,patient);
            if (obj.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(obj.getString(ResponseContant.resultMsg));
            }
            return ObjEnvelop.getSuccess("查询成功",obj.getJSONObject(ResponseContant.resultMsg));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping(value = "applyPrescription")
    @ApiOperation(value = "申请续方")
    public ObjEnvelop applyPrescription(@ApiParam(name = "applyImgs", value = "申请图片")

+ 32 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/prescription/BaseCarePrescriptionService.java

@ -1,6 +1,8 @@
package com.yihu.jw.care.service.prescription;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.jw.care.dao.prescription.BaseCarePrescriptionDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
@ -10,6 +12,7 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.prescription.BaseCarePrescriptionDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.util.common.IdCardUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
@ -96,6 +99,35 @@ public class BaseCarePrescriptionService {
        return result;
    }
    public JSONObject getPrescriptionInfo(String id,String patient){
        JSONObject result = new JSONObject();
        BaseCarePrescriptionDO prescriptionDO = null;
        if (StringUtils.isNotBlank(id)){
            prescriptionDO =  carePrescriptionDao.findOne(id);
        }
        else if (StringUtils.isNotBlank(patient)){
            prescriptionDO = carePrescriptionDao.selectOneByPatient(patient);
        }
        if (null==prescriptionDO){
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"续方记录不存在");
        }else {
            BasePatientDO patientDO = patientDao.findById(prescriptionDO.getPatient());
            if (null!=patientDO){
                Integer sex = patientDO.getSex();
                prescriptionDO.setSex(null==sex?null:1==sex?"男":"女");
                prescriptionDO.setPhoto(patientDO.getPhoto());
                try{
                    prescriptionDO.setAge(IdCardUtil.getAgeByIdcardOrBirthday(patientDO.getIdcard(),patientDO.getBirthday())+"");
                }catch (Exception e){}
            }
            JSONObject objDo = JSONObject.parseObject(JSON.toJSONStringWithDateFormat(prescriptionDO,"yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
            result.put(ResponseContant.resultFlag,ResponseContant.success);
            result.put(ResponseContant.resultMsg,objDo);
        }
        return result;
    }
    /**
     * 居民端列表查询
     * @param patientId