|
@ -1,7 +1,11 @@
|
|
|
package com.yihu.jw.care.service.patient;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.jw.care.service.common.DictService;
|
|
|
import com.yihu.jw.care.service.sign.ServicePackageService;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.patient.service.BasePatientMedicardCardService;
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
@ -10,6 +14,7 @@ import com.yihu.jw.utils.StringUtil;
|
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.repository.CrudRepository;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
@ -35,9 +40,12 @@ public class CarePatientService<T, R extends CrudRepository> extends BaseJpaServ
|
|
|
|
|
|
@Autowired
|
|
|
private BasePatientMedicardCardService basePatientMedicardCardService;
|
|
|
|
|
|
@Autowired
|
|
|
private ServicePackageService servicePackageService;
|
|
|
@Autowired
|
|
|
private ObjectMapper objectMapper;
|
|
|
@Autowired
|
|
|
private DictService dictService;
|
|
|
|
|
|
/**
|
|
|
* 签约记录
|
|
@ -81,8 +89,43 @@ public class CarePatientService<T, R extends CrudRepository> extends BaseJpaServ
|
|
|
* @param patientId
|
|
|
* @return
|
|
|
*/
|
|
|
public BasePatientDO findPatientById(String patientId) throws Exception{
|
|
|
return basePatientDao.findById(patientId);
|
|
|
public JSONObject findPatientById(String patientId) throws Exception{
|
|
|
JSONObject res = new JSONObject();
|
|
|
BasePatientDO patientDO = basePatientDao.findById(patientId);
|
|
|
patientDO.setArchiveStatusName(dictService.fingByNameAndCode("archiveStatus",String.valueOf(patientDO.getArchiveStatus())));
|
|
|
patientDO.setNationalName(dictService.fingByNameAndCode("national",String.valueOf(patientDO.getNational())));
|
|
|
patientDO.setArchiveTypeName(dictService.fingByNameAndCode("archiveType",String.valueOf(patientDO.getArchiveType())));
|
|
|
patientDO.setBloodName(dictService.fingByNameAndCode("blood",String.valueOf(patientDO.getBlood())));
|
|
|
patientDO.setMarriageName(dictService.fingByNameAndCode("marriage_status",String.valueOf(patientDO.getMarriage())));
|
|
|
|
|
|
res.put("patient",patientDO);
|
|
|
|
|
|
String sql = "select * from base_service_package_sign_record where patient = '"+patientId+"' and status = 1 limit 1";
|
|
|
List<ServicePackageSignRecordDO> signRecordDOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ServicePackageSignRecordDO.class));
|
|
|
if(signRecordDOs.size()>0){
|
|
|
ServicePackageSignRecordDO signRecordDO = signRecordDOs.get(0);
|
|
|
String signId = signRecordDO.getId();
|
|
|
List<Map<String,Object>> packageList = servicePackageService.fingdBySignId(signId);
|
|
|
List<Map<String,Object>> doctorList = servicePackageService.fingdDoctorBySignId(signId,"generalDoctor");
|
|
|
List<Map<String,Object>> helperList = servicePackageService.fingdDoctorBySignId(signId,"helper");
|
|
|
String doctorInfo = "";
|
|
|
String helperInfo = "";
|
|
|
String packageInfo = "";
|
|
|
if(doctorList.size()>0){
|
|
|
doctorInfo = doctorList.get(0).get("name").toString()+"等"+doctorList.size()+"名";
|
|
|
}
|
|
|
if(helperList.size()>0){
|
|
|
helperInfo = doctorList.get(0).get("name").toString()+"等"+helperList.size()+"名";
|
|
|
}
|
|
|
if(packageList.size()>0){
|
|
|
packageInfo = packageList.get(0).get("name").toString()+"等"+packageList.size()+"个";
|
|
|
}
|
|
|
signRecordDO.setDoctorInfo(doctorInfo);
|
|
|
signRecordDO.setHelperInfo(helperInfo);
|
|
|
signRecordDO.setPackageInfo(packageInfo);
|
|
|
res.put("signRecordDO",signRecordDO);
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
}
|