e.Toscana Compliance 
Request for Comments: 
Del: 13/09/2010
Categoria: Applicativa
Destinatari: Regione Toscana, ASL/AO

Flusso CSPA ad eventi

Indice
================================================================================
1. Contesto di riferimento	
2. Obiettivi	
3. Analisi 
3.1. Casi d'uso
3.2. XML Schema[1] degli eventi
3.3. WSDL[2] dei servizi
4. Prodotti attesi
5. Bibliografia
6. Storico Versioni



1. Contesto di riferimento
==========================

La presente versione stabilisce le regole e le codifiche da utilizzare per la
trasmissione del contenuto informativo dell'evento CSPA (Compensazione Intraregionale
Scheda Prestazioni Ambulatoriali).
Viene inoltre illustrata, all'interno del presente documento, l'interfaccia (WSDL) del
Web Service dedicato alla gestione degli eventi della tipologia descritta. 
Il Web Service in questione svolge il ruolo di interfaccia per il servizio di
archiviazione della schede di prestazione ambulatoriale all'interno del
database di trasporto(DBSCC_TRAN) di ogni ASL/AO di competenza.
 
- database di trasporto del NAL affiliato al ASL/AO di competenza per la
  compensazione intraregionale.


2. Obiettivi
============

Assunto il contesto di riferimento descritto nel precedente paragrafo, obiettivo
di questo documento RFC e' descrivere il modello organizzativo adottato, i suoi 
scenari e casi d'uso, la tipologia di informazioni e gli eventi al verificarsi 
dei quali tali informazioni sono generate e trasmesse dalle Aziende di origine
verso le Aziende di competenza.

L'obiettivo principale e' quello di permettere l'invio delle compensazioni
intraregionali relative alle schede di prestazione ambulatoriali ad eventi
eliminando la necessit di invio massivo a flussi.
I vantaggi che questo meccanismo permette di raggiungere sono :
a. Invio in tempo reale delle compensazioni delle prestazioni
b. Riduzione dell'intervento umano


3. Analisi
==========

Le funzionalit principali offerte dall'applicazione sono:

1)	accettazione del record CSPA di test.

2)	accettazione del record CSPA e scritturea del record all'interno della
	basedati del NAL associato alle ASL/AO di competenza della compensazione
	intraregionale per il servizio erogatore.
	
3) 	accettazione del record CSPA e relativo salvataggio, all'interno di una 
	basedati storicizzata, delle informazioni relative alla singola
	trasmissione dell'evento (tempistiche di trasmissione e id_egov).

Per ogni CSPA deve essere comunicato:

1)	La modalit di esecuzione del servizio (effettiva, o di test)
2)	L'anno di riferimento del flusso
3)	Tutte le informazione che compongono il record SPA, definite nel documento 
	Manuali dei Flussi DOC

I processi elaborativi implementati dall'applicazione consistono di:

1) 	ricezione di una chiamata al web service
2) 	verifica della validita' del documento XML trasmesso, verifica basata
	su schema XSD
3) 	archiviazione, sulla basedati di trasporto del NAL associato al ASL/AO
	di competenza della compensazione

	
L'invio dell'informazione avviene attraverso messaggi XML e con l'utilizzo di 
servizi erogati da Regione Toscana ed esposti alle ASL dall'infrastruttura di 
cooperazione applicativa CART. Il dettaglio sulla modalita' di interfacciamento 
con la infrastruttura e' descritto in [3] e [4]. 
	
Gli schema XML che definiscono il formato dei messaggi scambiati dal client con 
i servizi esposti dal web-service,ovvero i documenti XML contenenti il record CSPA, 
sono riportati di seguito.

L'attributo test serve per discriminare la modalita' di test (validazione del record
senza salvataggio sulla basedati) dalla modalita' canonica di esecuzione del 
processo di archiviazione.


3.1. Casi d'uso
================================================================================

3.1.1. Ev01 - Trasmissione evento CSPA
--------------------------------------------------------------------------------
L'evento si verifica quando viene validato dalla ASL di riferimento 
del ente erogante la prestazione ambulatoriale,  una scheda SPA e questo provoca
la generazione di compensazione intraregionale.

Al verificarsi dell'evento, la ASL invia alle ASL di competenza un messaggio XML che 
contiene le seguenti informazioni rilevanti:

- 	anno di riferimento   
- 	codice ASL di riferimento 

Il formato del messaggio e' definito in sezione 3.2 utilizzando la notazione
XML Schema.


3.2. XML Schema degli eventi
================================================================================


<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2006 U (http://www.altova.com) by BattisSa (EMBRACE) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="PrestazioniAmbulatoriali">
		<xs:annotation>
			<xs:documentation>Record validato</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element name="Testata" type="TestataType" minOccurs="0"/>
				<xs:element name="PrestazioniAmbulatoriali1" type="PrestazioniAmbulatoriali1Type" minOccurs="0"/>
				<xs:element name="PrestazioniAmbulatoriali2" type="PrestazioniAmbulatoriali2Type" minOccurs="0" maxOccurs="unbounded"/>
			</xs:sequence>
			<xs:attribute name="test" type="xs:boolean" use="optional" default="false"/>
			<xs:attribute name="annoRiferimento" type="xs:int" use="required"/>
		</xs:complexType>
	</xs:element>
	<xs:complexType name="PrestazioniAmbulatoriali1Type">
		<xs:annotation>
			<xs:documentation>Intero record CSPA1 validato</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="Meta" type="MetaType"/>
			<xs:element name="Body" type="BodyCSPA1Type"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="PrestazioniAmbulatoriali2Type">
		<xs:annotation>
			<xs:documentation>Intero record CSPA2 validato</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="Meta" type="MetaType"/>
			<xs:element name="Body" type="BodyCSPA2Type"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="BodyCSPA1Type">
		<xs:annotation>
			<xs:documentation>Campi specifici CSPA1</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="TipoRecord" type="xs:string"/>
			<xs:element name="TipoOp" type="xs:string"/>
			<xs:element name="Chiave" type="xs:string"/>
			<xs:element name="TipoCodUtente" type="xs:string"/>
			<xs:element name="CodUtente" type="xs:string"/>
			<xs:element name="Sesso" type="xs:string"/>
			<xs:element name="DataNascita" type="xs:string"/>
			<xs:element name="Cittadinanza" type="xs:string"/>
			<xs:element name="RgnResidenza" type="xs:string"/>
			<xs:element name="PrvResidenza" type="xs:string"/>
			<xs:element name="CmnResidenza" type="xs:string"/>
			<xs:element name="ASLResidenza" type="xs:string"/>
			<xs:element name="ZonaSanResidenza" type="xs:string"/>
			<xs:element name="RgnIscrSan" type="xs:string"/>
			<xs:element name="ASLIscrSan" type="xs:string"/>
			<xs:element name="ModAccesso" type="xs:string"/>
			<xs:element name="FinalitaPrest" type="xs:string"/>
			<xs:element name="CodRicetta" type="xs:string"/>
			<xs:element name="CFMedicoProponente" type="xs:string"/>
			<xs:element name="RgnMedicoProponente" type="xs:string"/>
			<xs:element name="ASLMedicoProponente" type="xs:string"/>
			<xs:element name="ZonaSanMedicoProponente" type="xs:string"/>
			<xs:element name="TipoMedicoProponente" type="xs:string"/>
			<xs:element name="RgnASLErogatrice" type="xs:string"/>
			<xs:element name="CodASLErogatrice" type="xs:string"/>
			<xs:element name="NrPrest" type="xs:string"/>
			<xs:element name="ImpNettoPrest" type="xs:string"/>
			<xs:element name="ImpTicket" type="xs:string"/>
			<xs:element name="QuoRic" type="xs:string"/>
			<xs:element name="QuotAcPS" type="xs:string"/>
			<xs:element name="DataPres" type="xs:string"/>
			<xs:element name="DataSped" type="xs:string"/>
			<xs:element name="VeriCf" type="xs:string"/>
			<xs:element name="IstiCompEurop" type="xs:string"/>
			<xs:element name="CodIdeUteEurop" type="xs:string"/>
			<xs:element name="CodIdeDocuEurop" type="xs:string"/>
			<xs:element name="CodStatDocuEurop" type="xs:string"/>
			<xs:element name="BiffaStmpElet" type="xs:string"/>
			<xs:element name="AltrVerStmpElet" type="xs:string"/>
			<xs:element name="TriagePs" type="xs:string"/>
			<xs:element name="PatolPs" type="xs:string"/>
			<xs:element name="MotAcutPs" type="xs:string"/>
			<xs:element name="RicSug" type="xs:string"/>
			<xs:element name="TipoAssist" type="xs:string"/>
			<xs:element name="NumPrestEff" type="xs:string"/>
			<!-- <xs:element name="NNImpTik" type="xs:string"/>
			<xs:element name="NNPreEro" type="xs:string"/>
			<xs:element name="DDNasUte" type="xs:string"/>-->
			<xs:element name="DataScadDocEu" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="BodyCSPA2Type">
		<xs:annotation>
			<xs:documentation>Campi specifici CSPA2</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="TipoRecord" type="xs:string"/>
			<xs:element name="Chiave" type="xs:string"/>
			<xs:element name="TipoPresidio" type="xs:string"/>
			<xs:element name="PrvPresidio" type="xs:string"/>
			<xs:element name="ComPresidio" type="xs:string"/>
			<xs:element name="CodPresidio" type="xs:string"/>
			<xs:element name="CodSpecialitaPrest" type="xs:string"/>
			<xs:element name="CodRepartoPrest" type="xs:string"/>
			<xs:element name="cod_dis_qua" type="xs:string"/>
			<xs:element name="cod_tip_con" type="xs:string"/>
			<xs:element name="DataPrimoContattoPrest" type="xs:string"/>
			<xs:element name="cod_cup" type="xs:string"/>
			<xs:element name="UrgenzaPrest" type="xs:string"/>
			<xs:element name="DataInizio" type="xs:string"/>
			<xs:element name="DataFine" type="xs:string"/>
			<xs:element name="CodPatologia" type="xs:string"/>
			<xs:element name="cod_icd_9_pre" type="xs:string"/>
			<xs:element name="TipoPrest" type="xs:string"/>
			<xs:element name="CodPrest" type="xs:string"/>
			<xs:element name="CodBrancaPrest" type="xs:string"/>
			<xs:element name="NraccessiPrest" type="xs:string"/>
			<xs:element name="NrPrestErogate" type="xs:string"/>
			<xs:element name="Tariffa" type="xs:string"/>
			<xs:element name="ImpLordo" type="xs:string"/>
			<xs:element name="CostoProdottiSomministrati" type="xs:string"/>
			<xs:element name="Ticket" type="xs:string"/>
			<xs:element name="EsenzioneTicket" type="xs:string"/>
			<xs:element name="cod_ese" type="xs:string"/>
			<xs:element name="OnerePrest" type="xs:string"/>
			<xs:element name="FormaPrest" type="xs:string"/>
			<xs:element name="CFMedicoPrescrittore" type="xs:string"/>
			<xs:element name="TipoMedicoPrescrittore" type="xs:string"/>
			<xs:element name="RegimePrest" type="xs:string"/>
			<xs:element name="TipoMedicoRegime" type="xs:string"/>
			<xs:element name="PrestSoggettaConvenzione" type="xs:string"/>
			<xs:element name="Compensazioni" type="xs:string"/>
			<!--<xs:element name="NnAccPre" type="xs:string"/>
			<xs:element name="NnImpLor" type="xs:string"/>
			<xs:element name="DdRicPre" type="xs:string"/>
			<xs:element name="DdIniPre" type="xs:string"/>
			<xs:element name="DdFinPre" type="xs:string"/>
			<xs:element name="NnEffPre" type="xs:string"/>
			<xs:element name="NnCstPro" type="xs:string"/>
			<xs:element name="NCodTrfPre" type="xs:string"/>-->
			<xs:element name="CodCatalogo" type="xs:string"/>
			<xs:element name="ChiIntSPA2" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="TestataType">
		<xs:annotation>
			<xs:documentation>Meta informazioni di testata</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="ID" type="xs:string"/>
			<xs:element name="DAcq" type="xs:string"/>
			<xs:element name="CodModAcq" type="xs:string"/>
			<xs:element name="CodNodOri" type="xs:string"/>
			<xs:element name="CodNodDes" type="xs:string"/>
			<xs:element name="CodTipHdr" type="xs:string"/>
			<xs:element name="CodMotTrs" type="xs:string"/>
			<xs:element name="NRec" type="xs:string"/>
			<xs:element name="DTra" type="xs:string"/>
			<xs:element name="CodSta" type="xs:string"/>
			<xs:element name="TDes" type="xs:string"/>
			<xs:element name="NRecWrn" type="xs:string"/>
			<xs:element name="NRecErr" type="xs:string"/>
			<xs:element name="NRecRes" type="xs:string"/>
			<xs:element name="BEsp" type="xs:string"/>
			<xs:element name="TNomefile" type="xs:string"/>
			<xs:element name="DFinAcq" type="xs:string"/>
			<xs:element name="DExe" type="xs:string"/>
			<xs:element name="IdUniOriCmp" type="xs:string"/>
			<xs:element name="DImport" type="xs:string"/>
			<xs:element name="DInvio" type="xs:string"/>
			<xs:element name="DInvioGrouper" type="xs:string"/>
			<xs:element name="CodStaExp" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="HeaderType">
		<xs:annotation>
			<xs:documentation>Meta informazioni</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="Contatore" type="xs:string"/>
			<xs:element name="ID" type="xs:string"/>
			<xs:element name="IDHdr" type="xs:string"/>
			<xs:element name="IDCor" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="FooterType">
		<xs:annotation>
			<xs:documentation>Meta informazioni</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="refTimestamp" type="xs:dateTime"/>
			<xs:element name="AnnoRiferimento" type="xs:string"/>
			<xs:element name="NrErr" type="xs:string"/>
			<xs:element name="NrWrn" type="xs:string"/>
			<xs:element name="CodASLResidenza" type="xs:string"/>
			<xs:element name="CodRgnResidenza" type="xs:string"/>
			<xs:element name="CodASLInv" type="xs:string"/>
			<xs:element name="FlagErr" type="xs:string"/>
			<xs:element name="FlagErr2" type="xs:string"/>
			<xs:element name="FlagErr3" type="xs:string"/>
			<xs:element name="FlagErrTot" type="xs:string"/>
			<xs:element name="CodStaRec" type="xs:string"/>
			<xs:element name="DataInvioFlusso" type="xs:string" minOccurs="0"/>
			<xs:element name="DataImportFlusso" type="xs:string" minOccurs="0"/>
			<xs:element name="DataSpedizioneRecord" type="xs:dateTime" minOccurs="0"/>
			<xs:element name="StepFlow" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="MetaType">
		<xs:annotation>
			<xs:documentation>Meta informazioni</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="Header" type="HeaderType"/>
			<xs:element name="Footer" type="FooterType"/>
		</xs:sequence>
	</xs:complexType>
</xs:schema>


3.3. WSDL dei servizi
================================================================================



3.3.1 SPFService.wsdl
--------------------------------------------------------------------------------
<definitions name='CSPAService' targetNamespace='http://www.regione.toscana.it/ws/2008/ods/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:ns1='http://ws.common.dsh.sys.eng.it/' xmlns:ns2='http://www.openspcoop.org/pdd/services/PD' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://www.regione.toscana.it/ws/2008/ods/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
 <import location='CSpaPort.wsdl' namespace='http://ws.common.dsh.sys.eng.it/'></import>
 <service name='CSPAService'>
  <port binding='ns1:ODSServiceBinding' name='CSPAServicePort'>
   <soap:address location='@consumer-service-url-cspa@'/>
  </port>
 </service>
</definitions>




3.3.2 SPFPort.wsdl
--------------------------------------------------------------------------------

<definitions name='CSPAService' targetNamespace='http://ws.common.dsh.sys.eng.it/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:ns1='http://ws.common.dsh.sys.eng.it/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://www.regione.toscana.it/ws/2008/ods/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
 <types>
  <xs:schema targetNamespace='http://ws.common.dsh.sys.eng.it/' version='1.0' xmlns:tns='http://ws.common.dsh.sys.eng.it/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
   <xs:element name='Exception' type='tns:Exception'/>
   <xs:element name='processMessage' nillable='true' type='xs:string'/>
   <xs:complexType name='Exception'>
    <xs:sequence>
     <xs:element minOccurs='0' name='message' type='xs:string'/>
    </xs:sequence>

   </xs:complexType>
  </xs:schema>
 </types>
 <message name='ODSService_processMessageResponse'></message>
 <message name='Exception'>
  <part element='ns1:Exception' name='Exception'></part>
 </message>
 <message name='ODSService_processMessage'>
  <part element='ns1:processMessage' name='processMessage'></part>

 </message>
 <portType name='ODSService'>
  <operation name='processMessage' parameterOrder='processMessage'>
   <input message='ns1:ODSService_processMessage'></input>
   <output message='ns1:ODSService_processMessageResponse'></output>
   <fault message='ns1:Exception' name='Exception'></fault>
  </operation>
 </portType>
 <binding name='ODSServiceBinding' type='ns1:ODSService'>

  <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
  <operation name='processMessage'>
   <soap:operation soapAction=''/>
   <input>
    <soap:body use='literal'/>
   </input>
   <output>
    <soap:body use='literal'/>
   </output>

   <fault name='Exception'>
    <soap:fault name='Exception' use='literal'/>
   </fault>
  </operation>
 </binding>
</definitions>





4. Prodotti attesi
==================

NN.


5. Bibliografia
===============

[1] XML Schema http://www.w3.org/XML/Schema
[2] Web Services Description Language (WSDL) 1.1 http://www.w3.org/TR/wsdl
[3] "Manuale d'Uso Infrastruttura CART", Regione Toscana, Versione 1.01 del 03/12/2007 
[4] "SDK-CART", Regione Toscana, Versione 1.1 del 20/04/2008 

6. Storico versioni
================================================================================

[rev 0 - 13/09/2010]
 - Prima versione pubblicata.

