|
@ -83,6 +83,8 @@ public class PrescriptionService extends BaseService {
|
|
|
private MessageService messageService;
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
@Autowired
|
|
|
private PrescriptionLogService payLogService;
|
|
|
//健康问题 高血压
|
|
|
private static final String gxy = "HP0093";
|
|
|
//健康问题 糖尿病
|
|
@ -119,17 +121,22 @@ public class PrescriptionService extends BaseService {
|
|
|
if (type == 1){
|
|
|
//直接更改状态为已完成
|
|
|
prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
|
|
|
payLogService.addLog(prescription, PrescriptionLog.PrescriptionLogType.patientConfirm.getValue(), 1, 1);
|
|
|
prescription.setFinishTime(new Date());
|
|
|
}else if (type == 2){
|
|
|
//不更改状态只添加延长收药时间
|
|
|
int extendCount = prescription.getExtendCount();
|
|
|
if (extendCount>=1){
|
|
|
Integer extendCount = prescription.getExtendCount();
|
|
|
if (extendCount !=null && extendCount>=1){
|
|
|
result.put("code",-1);
|
|
|
result.put("msg","每笔订单只能延长一次");
|
|
|
return result;
|
|
|
}
|
|
|
if (extendCount ==null){
|
|
|
prescription.setExtendCount(1);
|
|
|
}else {
|
|
|
prescription.setExtendCount(prescription.getExtendCount()+1);
|
|
|
}
|
|
|
prescription.setExtendTime(new Date());
|
|
|
prescription.setExtendCount(prescription.getExtendCount()+1);
|
|
|
}
|
|
|
prescriptionDao.save(prescription);
|
|
|
} catch (Exception e) {
|
|
@ -640,7 +647,7 @@ public class PrescriptionService extends BaseService {
|
|
|
}
|
|
|
return rsMap;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 根据居民CODE,时间轴,就诊类型查询用药记录
|
|
|
* @param patientCode 居民CODE
|
|
@ -649,25 +656,25 @@ public class PrescriptionService extends BaseService {
|
|
|
* @return
|
|
|
*/
|
|
|
public String findPatientMedicationRecords(String patientCode, String timeline, String type) throws Exception{
|
|
|
|
|
|
|
|
|
Integer totalCount = 0;
|
|
|
|
|
|
|
|
|
String RECIPE_NO = "";//符合规则基卫处方医嘱号
|
|
|
|
|
|
|
|
|
Patient patient = patientDao.findByCode(patientCode);
|
|
|
|
|
|
|
|
|
if(patient == null){
|
|
|
throw new Exception("未找到居民!");
|
|
|
}
|
|
|
|
|
|
|
|
|
String medicationRecords = "";
|
|
|
|
|
|
|
|
|
Date timeLineDate = DateUtil.strToDateShort(timeline);
|
|
|
Date startTime = DateUtil.setDateTime(timeLineDate,-25);
|
|
|
Date endTime = DateUtil.setDateTime(timeLineDate,25);
|
|
|
|
|
|
|
|
|
com.alibaba.fastjson.JSONObject re = jwPrescriptionService.getRecipeMasterList(patientCode,DateUtil.dateToStrShort(startTime),DateUtil.dateToStrShort(endTime));
|
|
|
|
|
|
|
|
|
totalCount = re.getInteger("totalCount");
|
|
|
if(totalCount>0){
|
|
|
com.alibaba.fastjson.JSONArray pres = re.getJSONArray("list");
|
|
@ -677,7 +684,7 @@ public class PrescriptionService extends BaseService {
|
|
|
boolean flag = false;
|
|
|
for (int j = 0; j < des.size(); j++) {
|
|
|
PrescriptionDiagnosis ds = des.getObject(j, PrescriptionDiagnosis.class);
|
|
|
|
|
|
|
|
|
// String icdCode = ds.getHealthProblem();
|
|
|
// System.out.println(icdCode);
|
|
|
// Icd10Dict icd10Dict = icd10DictDao.findByCode(icdCode);
|
|
@ -729,13 +736,13 @@ public class PrescriptionService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if(org.apache.commons.lang.StringUtils.isNotBlank(RECIPE_NO)){
|
|
|
String response = jwPrescriptionService.getRecipe(RECIPE_NO,patient.getSsc());
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = presModeAdapter.modelToSinglePrescription(response);
|
|
|
//药品
|
|
|
com.alibaba.fastjson.JSONArray infos = jsonObject.getJSONArray("prescriptionInfo");
|
|
|
|
|
|
|
|
|
for(int i=0;i<infos.size();i++){
|
|
|
com.alibaba.fastjson.JSONObject info = infos.getJSONObject(i);
|
|
|
String drugname = info.getString("drugName");
|
|
@ -746,10 +753,10 @@ public class PrescriptionService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return medicationRecords;
|
|
|
}
|
|
|
}
|