4242import org .springframework .util .LinkedMultiValueMap ;
4343import org .springframework .util .MultiValueMap ;
4444import org .springframework .web .client .RestTemplate ;
45+ import org .springframework .web .context .request .RequestContextHolder ;
46+ import org .springframework .web .context .request .ServletRequestAttributes ;
4547
4648import com .google .gson .Gson ;
4749import com .google .gson .JsonElement ;
7880import com .iemr .hwc .service .benFlowStatus .CommonBenStatusFlowServiceImpl ;
7981import com .iemr .hwc .service .snomedct .SnomedServiceImpl ;
8082import com .iemr .hwc .service .tele_consultation .SMSGatewayServiceImpl ;
83+ import com .iemr .hwc .utils .CookieUtil ;
8184import com .iemr .hwc .utils .exception .IEMRException ;
8285import com .iemr .hwc .utils .mapper .InputMapper ;
8386import com .iemr .hwc .utils .mapper .OutputMapper ;
8487
88+ import jakarta .servlet .http .HttpServletRequest ;
89+
8590@ Service
8691@ PropertySource ("classpath:application.properties" )
8792public class CommonDoctorServiceImpl {
@@ -118,6 +123,8 @@ public class CommonDoctorServiceImpl {
118123 private SMSGatewayServiceImpl sMSGatewayServiceImpl ;
119124 @ Autowired
120125 private FoetalMonitorRepo foetalMonitorRepo ;
126+ @ Autowired
127+ private CookieUtil cookieUtil ;
121128
122129 @ Autowired
123130 public void setSnomedServiceImpl (SnomedServiceImpl snomedServiceImpl ) {
@@ -353,7 +360,7 @@ private ArrayList<BenChiefComplaint> getBenChiefComplaint(WrapperAncFindings wra
353360 benChiefComplaint .setCreatedBy (wrapperAncFindings .getCreatedBy ());
354361
355362 if (null != complaintsDetails .getChiefComplaintID ()) {
356-
363+
357364 benChiefComplaint .setChiefComplaintID (complaintsDetails .getChiefComplaintID ());
358365 }
359366 if (null != complaintsDetails .getChiefComplaint ())
@@ -406,7 +413,6 @@ else if (serviceID != null && serviceID == 9) {
406413 public String getDocWorkListNewFutureScheduledForTM (Integer providerServiceMapId , Integer serviceID ,
407414 Integer vanID ) {
408415
409-
410416 ArrayList <BeneficiaryFlowStatus > docWorkListFutureScheduled = new ArrayList <>();
411417 if (serviceID != null && serviceID == 9 ) {
412418 docWorkListFutureScheduled = beneficiaryFlowStatusRepo
@@ -543,8 +549,6 @@ public String getPrescribedDrugs(Long beneficiaryRegID, Long visitCode) {
543549 return new Gson ().toJson (prescribedDrugs );
544550 }
545551
546-
547-
548552 public String getReferralDetails (Long beneficiaryRegID , Long visitCode , Boolean rrList ) {
549553 ArrayList <BenReferDetails > resList = benReferDetailsRepo .findByBeneficiaryRegIDAndVisitCode (beneficiaryRegID ,
550554 visitCode );
@@ -717,7 +721,8 @@ public int updateBenFlowtableAfterDocDataSave(CommonUtilityClass commonUtilityCl
717721
718722 if (commonUtilityClass != null && commonUtilityClass .getVisitCategoryID () != null
719723 && commonUtilityClass .getVisitCategoryID () == 9 ) {
720- ArrayList <FoetalMonitor > foetalMonitorData = foetalMonitorRepo .getFoetalMonitorDetailsByFlowId (tmpBenFlowID );
724+ ArrayList <FoetalMonitor > foetalMonitorData = foetalMonitorRepo
725+ .getFoetalMonitorDetailsByFlowId (tmpBenFlowID );
721726 if (foetalMonitorData .size () > 0 ) {
722727 labTechnicianFlag = 3 ;
723728 for (FoetalMonitor data : foetalMonitorData ) {
@@ -771,7 +776,6 @@ public int updateBenFlowtableAfterDocDataSave(CommonUtilityClass commonUtilityCl
771776
772777 int i = 0 ;
773778
774-
775779 if (commonUtilityClass != null && commonUtilityClass .getIsSpecialist () != null
776780 && commonUtilityClass .getIsSpecialist () == true ) {
777781 i = commonBenStatusFlowServiceImpl .updateBenFlowAfterDocDataFromSpecialist (tmpBenFlowID ,
@@ -856,7 +860,8 @@ public int updateBenFlowtableAfterDocDataUpdate(CommonUtilityClass commonUtility
856860
857861 if (commonUtilityClass != null && commonUtilityClass .getVisitCategoryID () != null
858862 && commonUtilityClass .getVisitCategoryID () == 9 ) {
859- ArrayList <FoetalMonitor > foetalMonitorData = foetalMonitorRepo .getFoetalMonitorDetailsByFlowId (tmpBenFlowID );
863+ ArrayList <FoetalMonitor > foetalMonitorData = foetalMonitorRepo
864+ .getFoetalMonitorDetailsByFlowId (tmpBenFlowID );
860865 if (foetalMonitorData .size () > 0 ) {
861866 labTechnicianFlag = 3 ;
862867 for (FoetalMonitor data : foetalMonitorData ) {
@@ -951,7 +956,6 @@ public int updateBenFlowtableAfterDocDataUpdate(CommonUtilityClass commonUtility
951956 return i ;
952957 }
953958
954-
955959 public String deletePrescribedMedicine (JSONObject obj ) {
956960 int i = 0 ;
957961 if (obj != null && obj .has ("id" )) {
@@ -971,9 +975,13 @@ public int callTmForSpecialistSlotBook(TcSpecialistSlotBookingRequestOBJ tcSpeci
971975 String requestOBJ = OutputMapper .gson ().toJson (tcSpecialistSlotBookingRequestOBJ );
972976
973977 RestTemplate restTemplate = new RestTemplate ();
978+ HttpServletRequest requestHeader = ((ServletRequestAttributes ) RequestContextHolder .getRequestAttributes ())
979+ .getRequest ();
980+ String jwtTokenFromCookie = cookieUtil .getJwtTokenFromCookie (requestHeader );
974981 MultiValueMap <String , String > headers = new LinkedMultiValueMap <String , String >();
975982 headers .add ("Content-Type" , "application/json" );
976983 headers .add ("AUTHORIZATION" , Authorization );
984+ headers .add ("Cookie" , "Jwttoken=" + jwtTokenFromCookie );
977985 HttpEntity <Object > request = new HttpEntity <Object >(requestOBJ , headers );
978986 ResponseEntity <String > response = restTemplate .exchange (tcSpecialistSlotBook , HttpMethod .POST , request ,
979987 String .class );
@@ -1029,8 +1037,8 @@ public void createTMPrescriptionSms(CommonUtilityClass commonUtilityClass) throw
10291037
10301038 public String getFoetalMonitorData (Long beneFiciaryRegID , Long visitCode ) {
10311039
1032- ArrayList <FoetalMonitor > foetalMonitorData = foetalMonitorRepo . getFoetalMonitorDetailsForCaseRecord ( beneFiciaryRegID ,
1033- visitCode );
1040+ ArrayList <FoetalMonitor > foetalMonitorData = foetalMonitorRepo
1041+ . getFoetalMonitorDetailsForCaseRecord ( beneFiciaryRegID , visitCode );
10341042
10351043 return new Gson ().toJson (foetalMonitorData );
10361044
0 commit comments