|  | @ -3,7 +3,10 @@ package com.yihu.jw.care.service.sign;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.dao.apply.PatientBedApplyDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.dao.sign.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.common.DictService;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.util.ConstantUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.org.BaseOrgDO;
 | 
	
	
		
			
				|  | @ -14,6 +17,7 @@ import com.yihu.jw.entity.base.servicePackage.ServicePackageRecordDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.apply.PatientBedApplyDo;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.archive.ArchiveDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.util.ImUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.service.BasePatientMedicardCardService;
 | 
	
	
		
			
				|  | @ -73,6 +77,10 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
 | 
	
		
			
				|  |  |     private PatientBedApplyDao bedApplyDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private ImUtil imUtil;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private WlyyPatientLabelDao patientLabelDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private DictService dictService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查找签约机构
 | 
	
	
		
			
				|  | @ -268,7 +276,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
 | 
	
		
			
				|  |  |      * @param doctorId
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |     public JSONObject servicePackageSign(String jsonData,String doctorId,String patientId,String signYear) throws Exception{
 | 
	
		
			
				|  |  |     public JSONObject servicePackageSign(String jsonData,String doctorId,String patientId,String signYear,String lableCode) throws Exception{
 | 
	
		
			
				|  |  |         BasePatientDO patientDO = patientDao.findById(patientId);
 | 
	
		
			
				|  |  |         JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  |         ServicePackageSignRecordDO signRecordDO = objectMapper.readValue(jsonData, ServicePackageSignRecordDO.class);
 | 
	
	
		
			
				|  | @ -324,6 +332,15 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
 | 
	
		
			
				|  |  |             result.put(ResponseContant.resultMsg,"请勿重复签约");
 | 
	
		
			
				|  |  |             return result;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //生成居民标签
 | 
	
		
			
				|  |  |         patientLabelDao.deleteByPatientAndLabelType(patientId,"1");
 | 
	
		
			
				|  |  |         WlyyPatientLabelDO patientLabelDO = new WlyyPatientLabelDO();
 | 
	
		
			
				|  |  |         patientLabelDO.setCzrq(new Date());
 | 
	
		
			
				|  |  |         patientLabelDO.setLabelType("1");
 | 
	
		
			
				|  |  |         patientLabelDO.setPatient(patientId);
 | 
	
		
			
				|  |  |         patientLabelDO.setLabelCode(lableCode);
 | 
	
		
			
				|  |  |         patientLabelDO.setLabelName(dictService.fingByNameAndCode(ConstantUtil.DICT_SERVICE_TYPE,lableCode));
 | 
	
		
			
				|  |  |         patientLabelDao.save(patientLabelDO);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //服务项目 emergencyAssistance 只能签约一个
 | 
	
		
			
				|  |  |         String sqlItem = "select item.`code`,item.name from base_service_package_item item INNER JOIN base_service_package_record pr on item.service_package_id = pr.service_package_id\n" +
 |