Kaynağa Gözat

Merge branch 'dev' of huangwenjie/patient-co-management into dev

huangwenjie 7 yıl önce
ebeveyn
işleme
d70299f059

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDeviceLogDao.java

@ -14,4 +14,7 @@ public interface PatientDeviceLogDao extends PagingAndSortingRepository<PatientD
    @Query("select pdl from PatientDeviceLog pdl where pdl.patient=?1 and pdl.categoryCode=?2")
    List<PatientDeviceLog> findByPatientAndCategoryCode(String patient,String categoryCode);
    
    @Query("select pdl from PatientDeviceLog pdl where pdl.patient=?1 group by deviceSn ")
    List<PatientDeviceLog> findByPatientGroupByDeviceSn(String patient);
}

+ 28 - 25
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -6,6 +6,7 @@ import com.yihu.wlyy.entity.address.Town;
import com.yihu.wlyy.entity.charge.WlyyCharge;
import com.yihu.wlyy.entity.consult.Consult;
import com.yihu.wlyy.entity.device.PatientDevice;
import com.yihu.wlyy.entity.device.PatientDeviceLog;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
@ -136,6 +137,8 @@ public class SignWebService extends BaseService {
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private PatientDeviceDao patientDeviceDao;
    @Autowired
    private PatientDeviceLogDao patientDeviceLogDao;
    /**
     * 厦门市
     */
@ -773,34 +776,34 @@ public class SignWebService extends BaseService {
            jsonObject.put("statusName", statusName);
            jsonArray.add(jsonObject);
        }
        
        List<PatientDevice> patientDevices = patientDeviceDao.findByPatient(patient);
        for (PatientDevice patientDevice: patientDevices) {
        List<PatientDeviceLog> patientDeviceLogs = patientDeviceLogDao.findByPatientGroupByDeviceSn(patient);
//        List<PatientDevice> patientDevices = patientDeviceDao.findByPatient(patient);
        for (PatientDeviceLog patientDeviceLog: patientDeviceLogs) {
            JSONObject jsonObject = new JSONObject();
            SignFamily signFamily = signFamilyDao.findByPatient(patient);//签约社区
            if(signFamily == null || signFamily.getCode() == null){
                continue;
            }
            if(StringUtils.isNotBlank(patientDevice.getDoctor())){
                Doctor deviceDoctor = doctorService.findDoctorByCode(patientDevice.getDoctor());
                jsonObject.put("doctor",patientDevice.getDoctor());//操作医生代码
                jsonObject.put("doctorName",deviceDoctor.getName());//操作医生姓名
//            SignFamily signFamily = signFamilyDao.findByPatient(patient);//签约社区
//            if(signFamily == null || signFamily.getCode() == null){
//                continue;
//            }
            if(1 == patientDeviceLog.getRole() ){
                Doctor deviceDoctor = doctorService.findDoctorByCode(patientDeviceLog.getOperator());
                jsonObject.put("doctor",patientDeviceLog.getOperator());//操作医生代码
                jsonObject.put("doctorName",patientDeviceLog.getOperatorName());//操作医生姓名
                jsonObject.put("hospitalName",deviceDoctor.getHospitalName());//社区名称
            }
            jsonObject.put("dataType","device");//家庭医生签约服务包
            jsonObject.put("deviceId",patientDevice.getDeviceId());//设备ID
            jsonObject.put("deviceSn",patientDevice.getDeviceSn());//设备SN码
            jsonObject.put("sim",patientDevice.getSim());//设备SIM卡号
            jsonObject.put("deviceName",patientDevice.getDeviceName());//设备名称
            jsonObject.put("user",patientDevice.getUser());//居民CODE
            jsonObject.put("categoryCode",patientDevice.getCategoryCode());//1血糖仪,2.血压计
            jsonObject.put("userType",patientDevice.getUserType());//-1代表单用户
            jsonObject.put("userIdcard",patientDevice.getUserIdcard());//用户身份证号
            jsonObject.put("agent",patientDevice.getAgent());//代绑人代码(家人)
            jsonObject.put("agentName",patientDevice.getAgentName());//代绑人姓名
            jsonObject.put("createTime",patientDevice.getCzrq());//操作时间
            jsonObject.put("agreementPhoto",patientDevice.getAgreementPhoto());//上传的协议图片地址
            jsonObject.put("hospitalName",signFamily.getHospitalName());//社区名称
            jsonObject.put("deviceId",patientDeviceLog.getDeviceId());//设备ID
            jsonObject.put("deviceSn",patientDeviceLog.getDeviceSn());//设备SN码
            jsonObject.put("deviceName",patientDeviceLog.getDeviceName());//设备名称
            jsonObject.put("user",patient);//居民CODE
            jsonObject.put("categoryCode",patientDeviceLog.getCategoryCode());//1血糖仪,2.血压计
//            jsonObject.put("userType",patientDevice.getUserType());//-1代表单用户
//            jsonObject.put("userIdcard",patientDevice.getUserIdcard());//用户身份证号
//            jsonObject.put("agent",patientDevice.getAgent());//代绑人代码(家人)
//            jsonObject.put("agentName",patientDevice.getAgentName());//代绑人姓名
            jsonObject.put("createTime",patientDeviceLog.getCreateTime());//操作时间
            jsonObject.put("agreementPhoto",patientDeviceLog.getAgreementPhoto());//上传的协议图片地址
            
            jsonArray.add(jsonObject);
        }