|
@ -0,0 +1,81 @@
|
|
|
package com.yihu.jw.hospital.prescription.service;
|
|
|
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
|
|
|
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
|
|
|
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
|
|
|
import com.yihu.jw.hospital.prescription.service.entrance.MlwyyEntranceService;
|
|
|
import com.yihu.jw.mysql.query.BaseJpaService;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
|
|
|
import net.sf.json.JSON;
|
|
|
import net.sf.json.JSONArray;
|
|
|
import net.sf.json.JSONObject;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
@Service
|
|
|
@Transactional
|
|
|
public class MlwyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, PrescriptionDao> {
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(MlwyyPrescriptionService.class);
|
|
|
@Autowired
|
|
|
private BasePatientMedicareCardDao patientMedicareCardDao;
|
|
|
@Autowired
|
|
|
private BasePatientDao basePatientDao;
|
|
|
@Autowired
|
|
|
private MlwyyEntranceService mlwyyEntranceService;
|
|
|
|
|
|
public JSONArray findPatientCardList(String patientId) throws Exception {
|
|
|
patientMedicareCardDao.deleteByPatientId(patientId);
|
|
|
net.sf.json.JSONArray array =findPatientCard(patientId);
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
net.sf.json.JSONObject object = array.getJSONObject(i);
|
|
|
String cardType = object.getString("CARD_TYPE");
|
|
|
String cardNo = object.getString("CARD_NO");
|
|
|
String cardTypeName = object.getString("CARD_TYPE_NAME");
|
|
|
PatientMedicareCardDO patientMedicareCardDO = new PatientMedicareCardDO();
|
|
|
patientMedicareCardDO.setCode(cardNo);
|
|
|
patientMedicareCardDO.setParentType("A");
|
|
|
if (cardType.equalsIgnoreCase("2")){
|
|
|
patientMedicareCardDO.setType("A_01");
|
|
|
}else {
|
|
|
patientMedicareCardDO.setType("A_03");
|
|
|
}
|
|
|
patientMedicareCardDO.setPatientCode(patientId);
|
|
|
patientMedicareCardDO.setOrgCode("350211A1002");
|
|
|
patientMedicareCardDO.setCityCode("350200");
|
|
|
patientMedicareCardDO.setDel("1");
|
|
|
patientMedicareCardDO.setRemark(cardTypeName);
|
|
|
patientMedicareCardDao.save(patientMedicareCardDO);
|
|
|
}
|
|
|
return array;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取卡记录
|
|
|
*
|
|
|
* @param patient
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray findPatientCard(String patient) throws Exception {
|
|
|
JSONArray rs =new JSONArray();
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("PAT_NO","P5616242-0");
|
|
|
jsonObject.put("CARD_NO","D40136791");
|
|
|
jsonObject.put("CARD_STAT","激活");
|
|
|
jsonObject.put("OP_DATE","2011-09-27 15:35:57");
|
|
|
jsonObject.put("CARD_TYPE","2");
|
|
|
jsonObject.put("CARD_TYPE_NAME","社保卡");
|
|
|
jsonObject.put("social_no","350211198411053024");
|
|
|
jsonObject.put("name","白海灵");
|
|
|
rs.add(jsonObject);
|
|
|
return rs;
|
|
|
}
|
|
|
}
|