|
|
@@ -7,12 +7,12 @@ import cn.hnthyy.thmz.service.his.mz.MzChargeDetailService;
|
|
|
import cn.hnthyy.thmz.service.his.mz.MzPatientMiService;
|
|
|
import cn.hnthyy.thmz.service.thmz.DispensingSocketService;
|
|
|
import cn.hnthyy.thmz.socket.PrescriptionPrintSocket;
|
|
|
-import cn.hnthyy.thmz.socket.ToMedicineSocket;
|
|
|
-import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@Service
|
|
|
@@ -20,54 +20,61 @@ public class DispensingSocketServiceImpl implements DispensingSocketService {
|
|
|
@Autowired
|
|
|
PrescriptionPrintSocket prescriptionPrintSocket;
|
|
|
@Autowired
|
|
|
- ToMedicineSocket toMedicineSocket;
|
|
|
- @Autowired
|
|
|
MzPatientMiService mzPatientMiService;
|
|
|
@Autowired
|
|
|
MzChargeDetailService mzChargeDetailService;
|
|
|
|
|
|
- @Override
|
|
|
- public int sendPrescription(String patientId,int times,String type) {
|
|
|
- Map<String,Object> msgMap = new HashMap();
|
|
|
- msgMap.put("patientId",patientId);
|
|
|
- msgMap.put("times",times);
|
|
|
- msgMap.put("type",type);
|
|
|
- JSONObject jsonObject = new JSONObject(msgMap);
|
|
|
- return prescriptionPrintSocket.sendMessage(jsonObject.toString());
|
|
|
- }
|
|
|
|
|
|
@Override
|
|
|
- public int sendToMedicine(String patientId,String type) {
|
|
|
+ public int sendToMedicine(String patientId) {
|
|
|
Map<String,Object> msgMap = new HashMap();
|
|
|
- msgMap.put("patientId",patientId);
|
|
|
+ msgMap.put("patient_id",patientId);
|
|
|
MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(patientId);
|
|
|
msgMap.put("name",mzPatientMi.getName());
|
|
|
- msgMap.put("type",type);
|
|
|
- JSONObject jsonObject = new JSONObject(msgMap);
|
|
|
- return toMedicineSocket.sendMessage(jsonObject.toString());
|
|
|
+ msgMap.put("type",SocketSenderTypeEnum.SEND_MEDICINE.code);
|
|
|
+ List<String> objTypes = new ArrayList<>();
|
|
|
+ objTypes.add(SocketSenderTypeEnum.CALL_NUMBER.code);
|
|
|
+ return prescriptionPrintSocket.sendMessage(msgMap,objTypes);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int sendToMedicine(String patientId, int times) {
|
|
|
+ public int sendToMedicineAndDispensing(String patientId, int times) {
|
|
|
//查询缴费药品的发药药房
|
|
|
MzChargeDetail mzChargeDetail = new MzChargeDetail();
|
|
|
mzChargeDetail.setPatientId(patientId);
|
|
|
mzChargeDetail.setTimes(times);
|
|
|
- mzChargeDetailService.queryChargeDetail(mzChargeDetail);
|
|
|
- Map<String,Object> msgMap = new HashMap();
|
|
|
- msgMap.put("patientId",patientId);
|
|
|
- MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(patientId);
|
|
|
- msgMap.put("name",mzPatientMi.getName());
|
|
|
- msgMap.put("type",SocketSenderTypeEnum.PAY.code);
|
|
|
- JSONObject jsonObject = new JSONObject(msgMap);
|
|
|
- return toMedicineSocket.sendMessage(jsonObject.toString());
|
|
|
+ List<MzChargeDetail> chargeDetail = mzChargeDetailService.getMzChargeDetailList(mzChargeDetail);
|
|
|
+ boolean flag = false;
|
|
|
+ for (MzChargeDetail detail : chargeDetail) {
|
|
|
+ if(detail.getGroupNo().equals("71")){
|
|
|
+ flag = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(flag){
|
|
|
+ Map<String,Object> msgMap = new HashMap();
|
|
|
+ msgMap.put("patient_id",patientId);
|
|
|
+ MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(patientId);
|
|
|
+ msgMap.put("name",mzPatientMi.getName());
|
|
|
+ msgMap.put("type",SocketSenderTypeEnum.PAY.code);
|
|
|
+ List<String> objTypes = new ArrayList<>();
|
|
|
+ objTypes.add(SocketSenderTypeEnum.CALL_NUMBER.code);
|
|
|
+ objTypes.add(SocketSenderTypeEnum.DISPENSING_MEDICINE.code);
|
|
|
+ return prescriptionPrintSocket.sendMessage(msgMap,objTypes);
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int sendDispensing(String type) {
|
|
|
+ public int sendToMedicineAndSendMedicine(String patientId) {
|
|
|
Map<String,Object> msgMap = new HashMap();
|
|
|
- msgMap.put("type",type);
|
|
|
- JSONObject jsonObject = new JSONObject(msgMap);
|
|
|
- return prescriptionPrintSocket.sendMessage(jsonObject.toString());
|
|
|
+ MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(patientId);
|
|
|
+ msgMap.put("name",mzPatientMi.getName());
|
|
|
+ msgMap.put("patient_id",patientId);
|
|
|
+ msgMap.put("type",SocketSenderTypeEnum.DISPENSING_MEDICINE.code);
|
|
|
+ List<String> objTypes = new ArrayList<>();
|
|
|
+ objTypes.add(SocketSenderTypeEnum.CALL_NUMBER.code);
|
|
|
+ objTypes.add(SocketSenderTypeEnum.SEND_MEDICINE.code);
|
|
|
+ return prescriptionPrintSocket.sendMessage(msgMap,objTypes);
|
|
|
}
|
|
|
}
|