DECLARE @json NVARCHAR(MAX)
SET @json =
N'[
{
"Order": {
"Number":"SO43659",
"Date":"2011-05-31T00:00:00"
},
"AccountNumber":"AW29825",
"Item": {
"Price":2024.9940,
"Quantity":1
}
},
{
"Order": {
"Number":"SO43661",
"Date":"2011-06-01T00:00:00"
},
"AccountNumber":"AW73565",
"Item": {
"Price":2024.9940,
"Quantity":3
}
}
]'
SELECT * FROM
OPENJSON ( @json ) ;
WITH (
Number varchar(200) '$.Order.Number' ,
Date datetime '$.Order.Date',
Customer varchar(200) '$.AccountNumber',
Quantity int '$.Item.Quantity'
)
SELECT * FROM OPENJSON('{"name" : null}');
SELECT * FROM OPENJSON('["Cat","Dog","Bird"]');
SELECT * FROM OPENJSON('[1,2,3]');
SELECT * FROM OPENJSON('[true,false]');
SELECT * FROM OPENJSON('{"cats":[{ "id":1, "name":"Fluffy"},{ "id":2, "name":"Scratch"}]}');
SELECT * FROM OPENJSON('[{"A":1,"B":0,"C":1}]');
DECLARE @json NVARCHAR(4000) = N'{
"pets" : {
"cats" : [
{ "id" : 1, "name" : "Fluffy", "sex" : "Female" },
{ "id" : 2, "name" : "Long Tail", "sex" : "Female" },
{ "id" : 3, "name" : "Scratch", "sex" : "Male" }
],
"dogs" : [
{ "name" : "Fetch", "sex" : "Male" },
{ "name" : "Fluffy", "sex" : "Male" },
{ "name" : "Wag", "sex" : "Female" }
]
}
}';
SELECT * FROM OPENJSON(@json, '$.pets.cats');
ECLARE @json NVARCHAR(4000) = N'{
"pets" : {
"cats" : [
{ "id" : 1, "name" : "Fluffy", "sex" : "Female" },
{ "id" : 2, "name" : "Long Tail", "sex" : "Female" },
{ "id" : 3, "name" : "Scratch", "sex" : "Male" }
],
"dogs" : [
{ "name" : "Fetch", "sex" : "Male" },
{ "name" : "Fluffy", "sex" : "Male" },
{ "name" : "Wag", "sex" : "Female" }
]
}
}';
SELECT * FROM OPENJSON(@json, '$.pets.cats[1]');
DECLARE @json NVARCHAR(4000) = N'{
"pets" : {
"cats" : [
{ "id" : 1, "name" : "Fluffy", "sex" : "Female" },
{ "id" : 2, "name" : "Long Tail", "sex" : "Female" },
{ "id" : 3, "name" : "Scratch", "sex" : "Male" }
],
"dogs" : [
{ "name" : "Fetch", "sex" : "Male" },
{ "name" : "Fluffy", "sex" : "Male" },
{ "name" : "Wag", "sex" : "Female" }
]
}
}';
SELECT * FROM OPENJSON(@json, '$.pets.cats')
WITH (
[Cat Id] int '$.id',
[Cat Name] varchar(60) '$.name',
[Sex] varchar(6) '$.sex',
[Cats] nvarchar(max) '$' AS JSON
);
DECLARE @json NVARCHAR(4000) = N'{
"pets" : {
"cats" : [
{ "id" : 1, "name" : "Fluffy", "sex" : "Female" },
{ "id" : 2, "name" : "Long Tail", "sex" : "Female" },
{ "id" : 3, "name" : "Scratch", "sex" : "Male" }
],
"dogs" : [
{ "name" : "Fetch", "sex" : "Male" },
{ "name" : "Fluffy", "sex" : "Male" },
{ "name" : "Wag", "sex" : "Female" }
]
}
}';
SELECT
name,
system_type_name
FROM sys.dm_exec_describe_first_result_set(
'SELECT * FROM OPENJSON(@json, ''$.pets.cats'') WITH (
[Cat Id] int ''$.id'',
[Cat Name] varchar(60) ''$.name'',
[Sex] varchar(6) ''$.sex'',
[Cats] nvarchar(max) ''$'' AS JSON
)',
null,
0
);
DECLARE @json NVARCHAR(4000) = N'{
"pets" : {
"cats" : [
{ "id" : 1, "name" : "Fluffy", "sex" : "Female" },
{ "id" : 2, "name" : "Long Tail", "sex" : "Female" },
{ "id" : 3, "name" : "Scratch", "sex" : "Male" }
],
"dogs" : [
{ "name" : "Fetch", "sex" : "Male" },
{ "name" : "Fluffy", "sex" : "Male" },
{ "name" : "Wag", "sex" : "Female" }
]
}
}';
SELECT * INTO JsonCats
FROM OPENJSON(@json, '$.pets.cats')
WITH (
[Cat Id] int '$.id',
[Cat Name] varchar(60) '$.name',
[Sex] varchar(6) '$.sex',
[Cats] nvarchar(max) '$' AS JSON
);
DECLARE @json NVARCHAR(4000) = N'{
"pets" : {
"cats" : [
{ "id" : 1, "name" : "Fluffy", "sex" : "Female" },
{ "id" : 2, "name" : "Long Tail", "sex" : "Female" },
{ "id" : 3, "name" : "Scratch", "sex" : "Male" }
],
"dogs" : [
{ "name" : "Fetch", "sex" : "Male" },
{ "name" : "Fluffy", "sex" : "Male" },
{ "name" : "Wag", "sex" : "Female" }
]
}
}';
SELECT * FROM OPENJSON(@json, 'lax $.pets.cows');
--严格模式 现在它处于
DECLARE @json NVARCHAR(4000) = N'{
"pets" : {
"cats" : [
{ "id" : 1, "name" : "Fluffy", "sex" : "Female" },
{ "id" : 2, "name" : "Long Tail", "sex" : "Female" },
{ "id" : 3, "name" : "Scratch", "sex" : "Male" }
],
"dogs" : [
{ "name" : "Fetch", "sex" : "Male" },
{ "name" : "Fluffy", "sex" : "Male" },
{ "name" : "Wag", "sex" : "Female" }
]
}
}'
SELECT * FROM OPENJSON(@json, 'strict $.pets.cows');
--具有显式结构的 OPEN
DECLARE @json NVARCHAR(MAX)
SET @json =
N'[
{
"Order": {
"Number":"SO43659",
"Date":"2011-05-31T00:00:00"
},
"AccountNumber":"AW29825",
"Item": {
"Price":2024.9940,
"Quantity":1
}
},
{
"Order": {
"Number":"SO43661",
"Date":"2011-06-01T00:00:00"
},
"AccountNumber":"AW73565",
"Item": {
"Price":2024.9940,
"Quantity":3
}
}
]'
SELECT * FROM
OPENJSON ( @json )
WITH (
Number varchar(200) '$.Order.Number' ,
Date datetime '$.Order.Date',
Customer varchar(200) '$.AccountNumber',
Quantity int '$.Item.Quantity'
)
--在 WITH 子
DECLARE @json NVARCHAR(4000) = N'{
"pets" : {
"cats" : [
{ "id" : 1, "name" : "Fluffy", "sex" : "Female" },
{ "id" : 2, "name" : "Long Tail", "sex" : "Female" },
{ "id" : 3, "name" : "Scratch", "sex" : "Male" }
],
"dogs" : [
{ "name" : "Fetch", "sex" : "Male" },
{ "name" : "Fluffy", "sex" : "Male" },
{ "name" : "Wag", "sex" : "Female" }
]
}
}';
SELECT *
FROM OPENJSON(@json, '$.pets.cats')
WITH (
[Cat Id] int '$.id',
[Cat Name] varchar(60) '$.name',
[Born] date 'lax $.born',
[Cats] nvarchar(max) '$' AS JSON
);
--
DECLARE @json NVARCHAR(4000) = N'{
"pets" : {
"cats" : [
{ "id" : 1, "name" : "Fluffy", "sex" : "Female" },
{ "id" : 2, "name" : "Long Tail", "sex" : "Female" },
{ "id" : 3, "name" : "Scratch", "sex" : "Male" }
],
"dogs" : [
{ "name" : "Fetch", "sex" : "Male" },
{ "name" : "Fluffy", "sex" : "Male" },
{ "name" : "Wag", "sex" : "Female" }
]
}
}';
SELECT *
FROM OPENJSON(@json, '$.pets.cats')
WITH (
[Cat Id] int '$.id',
[Cat Name] varchar(60) '$.name',
[Born] date 'strict $.born',
[Cats] nvarchar(max) '$' AS JSON
);
--PENJSON 要求兼容性级别 130 ?
--查看?
--database为数据
USE database;
GO
SELECT compatibility_level
FROM sys.databases WHERE name = 'database';
GO
--示
USE model;
GO
SELECT compatibility_level
FROM sys.databases WHERE name = 'model';
GO
-------------1、-------------
declare @json as varchar(8000)
set @json='[
{"id":1178,"myObject.Plies":3,"myObject.Createtime":"2020-07-21T14:33:18.480"},
{"id":1179,"myObject.Plies":3,"myObject.Createtime":"2020-07-21T14:36:27.457"}]'
select * from openjson(@json);
--key value type
--0 {"id":1178,"myObject.Plies":3,"myObject.Createtime":"2020-07-21T14:33:18.480"} 5
--1 {"id":1179,"myObject.Plies":3,"myObject.Createtime":"2020-07-21T14:36:27.457"} 5
-------------2、-------------
declare @json1 as varchar(8000)
set @json1='[
{"id":1178,"myObject.Plies":3,"myObject.Createtime":"2020-07-21T14:33:18.480"},
{"id":1179,"myObject.Plies":3,"myObject.Createtime":"2020-07-21T14:36:27.457"}]
'
select * from openjson(@json1)
with(
id varchar(10) '$.id',
Plies int '$."myObject.Plies"',
Createtime datetime '$."myObject.Createtime"'
);
--id Plies Createtime
--1178 3 2020-07-21 14:33:18.480
--1179 3 2020-07-21 14:36:27.457
-------------3、-------------
declare @json2 as varchar(8000)
set @json2='{"myRoot":[
{"id":1178,"myObject":{"Plies":3,"Createtime":"2020-07-21T14:33:18.480"}},
{"id":1179,"myObject":{"Plies":3,"Createtime":"2020-07-21T14:36:27.457"}}
]}'
select * from openjson(@json2,'$.myRoot')
with(
id varchar(10) ,
Plies int '$.myObject.Plies',
Createtime datetime '$.myObject.Createtime'
);
--id Plies Createtime
--1178 3 2020-07-21 14:33:18.480
--1179 3 2020-07-21 14:36:27.457
declare @param nvarchar(max);
set @param = N'{
"info":{
"type":1,
"address":{
"town":"Bristol",
"county":"Avon",
"country":"England"
},
"tags":["Sport", "Water polo"]
},
"type":"Basic"
}';
print iif(isjson(@param) > 0, 'OK', 'NO');
print json_value(@param, '$.info.address.town');
print json_value(@param, '$.info.tags[1]');
print json_query(@param, '$.info');
declare @param nvarchar(max);
set @param=N'{
"info":{
"type":1,
"address":{
"town":"Bristol",
"county":"Avon",
"country":"England"
},
"tags":["Sport", "Water polo"]
},
"type":"Basic"
}';
print iif(isjson(@param)>0, 'OK', 'NO');
print json_query(@param);
print json_value(@param, '$.info.address.town');
print json_value(@param, '$.info.tags[1]');
print json_query(@param, '$.info');
print json_query('["2020-1-8","2020-1-9"]');
print json_modify(@param, '$.info.address.town', 'London');
DECLARE @txt1 varchar(max) = '{ "Rv0005": { "p.Glu540Asp": { "annotations":
[ { "type": "drug", "drug": "moxifloxacin", "literature": "10.1128/AAC.00825-17;10.1128/JCM.06860-11", "confers": "resistance" } ],
"genome_positions": [ 6857, 6858, 6859 ] }, "p.Ala504Thr": { "annotations": [ { "type": "drug", "drug": "ciprofloxacin", "confers": "resistance" }, { "type": "drug", "drug": "fluoroquinolones", "confers": "resistance" }, { "type": "drug", "drug": "levofloxacin", "confers": "resistance" }, { "type": "drug", "drug": "moxifloxacin", "confers": "resistance" }, { "type": "drug", "drug": "ofloxacin", "confers": "resistance" } ], "genome_positions": [ 6749, 6750, 6751 ] }, "p.Ala504Val": { "annotations": [ { "type": "drug", "drug": "ciprofloxacin", "confers": "resistance" }, { "type": "drug", "drug": "fluoroquinolones", "confers": "resistance" }, { "type": "drug", "drug": "levofloxacin", "confers": "resistance" }, { "type": "drug", "drug": "moxifloxacin", "confers": "resistance" }, { "type": "drug", "drug": "ofloxacin", "confers": "resistance" } ], "genome_positions": [ 6749, 6750, 6751 ] } }, "Rv2043c": { "p.Thr100Ile": { "annotations": [ { "type": "drug", "drug": "pyrazinamide", "literature": "10.1128/JCM.01214-17", "confers": "resistance" } ], "genome_positions": [ 2288942, 2288943, 2288944 ] }, "p.Thr160Ala": { "annotations": [ { "type": "drug", "drug": "pyrazinamide", "literature": "10.1128/JCM.01214-17", "confers": "resistance" } ], "genome_positions": [ 2288762, 2288763, 2288764 ] }, "c.101_102insT": { "annotations": [ { "type": "drug", "drug": "pyrazinamide", "confers": "resistance" } ], "genome_positions": [ 2289140, 2289141 ] } } }'
--SELECT * FROM OPENJSON(@txt1, '$.Rv0005."p.Glu540Asp".genome_positions')
SELECT a.[key] as gene, b.[key] as mutations, c.*, d.value as genome_positions
FROM OPENJSON(@txt1) a
CROSS APPLY OPENJSON(a.value) b
CROSS APPLY OPENJSON(b.value,'$.annotations')
WITH (
annotation_type nvarchar(100) '$.type'
, annotation_drug nvarchar(100) '$.drug'
, annotation_literature nvarchar(100) '$.literature'
, annotation_confers nvarchar(100) '$.confers'
) c
CROSS APPLY OPENJSON(b.value,'$.genome_positions') d
DECLARE @txt1 varchar(max) = '{ "Rv0005": { "p.Glu540Asp": { "annotations":
[ { "type": "drug", "drug": "moxifloxacin", "literature": "10.1128/AAC.00825-17;10.1128/JCM.06860-11", "confers": "resistance" } ],
"genome_positions": [ 6857, 6858, 6859 ] }, "p.Ala504Thr": { "annotations": [ { "type": "drug", "drug": "ciprofloxacin", "confers": "resistance" }, { "type": "drug", "drug": "fluoroquinolones", "confers": "resistance" }, { "type": "drug", "drug": "levofloxacin", "confers": "resistance" }, { "type": "drug", "drug": "moxifloxacin", "confers": "resistance" }, { "type": "drug", "drug": "ofloxacin", "confers": "resistance" } ], "genome_positions": [ 6749, 6750, 6751 ] }, "p.Ala504Val": { "annotations": [ { "type": "drug", "drug": "ciprofloxacin", "confers": "resistance" }, { "type": "drug", "drug": "fluoroquinolones", "confers": "resistance" }, { "type": "drug", "drug": "levofloxacin", "confers": "resistance" }, { "type": "drug", "drug": "moxifloxacin", "confers": "resistance" }, { "type": "drug", "drug": "ofloxacin", "confers": "resistance" } ], "genome_positions": [ 6749, 6750, 6751 ] } }, "Rv2043c": { "p.Thr100Ile": { "annotations": [ { "type": "drug", "drug": "pyrazinamide", "literature": "10.1128/JCM.01214-17", "confers": "resistance" } ], "genome_positions": [ 2288942, 2288943, 2288944 ] }, "p.Thr160Ala": { "annotations": [ { "type": "drug", "drug": "pyrazinamide", "literature": "10.1128/JCM.01214-17", "confers": "resistance" } ], "genome_positions": [ 2288762, 2288763, 2288764 ] }, "c.101_102insT": { "annotations": [ { "type": "drug", "drug": "pyrazinamide", "confers": "resistance" } ], "genome_positions": [ 2289140, 2289141 ] } } }'
--SELECT * FROM OPENJSON(@txt1, '$.Rv0005."p.Glu540Asp".genome_positions')
SELECT a.[key] as gene, b.[key] as mutations, c.*, d.value as genome_positions
FROM OPENJSON(@txt1) a
CROSS APPLY OPENJSON(a.value) b
CROSS APPLY OPENJSON(b.value,'$.annotations')
WITH (
annotation_type nvarchar(100) '$.type'
, annotation_drug nvarchar(100) '$.drug'
, annotation_literature nvarchar(100) '$.literature'
, annotation_confers nvarchar(100) '$.confers'
) c
CROSS APPLY OPENJSON(b.value,'$.genome_positions') d
DECLARE @txt1 varchar(max) = '[
[
{
"ControlType": "60",
"ControlCaption": "1034036",
"ControlStyle": "width:100%; padding:0px;",
"IsTableItem": true
},
{
"ControlType": "60",
"ControlCaption": "19/10/2021",
"ControlStyle": "width:100%; padding:0px;",
"IsTableItem": true
},
{
"ControlType": "60",
"ControlCaption": "CD",
"ControlStyle": "width:100%; padding:0px;",
"IsTableItem": true
},
{
"ControlType": "60",
"ControlCaption": "1034036",
"ControlStyle": "width:100%; padding:0px;",
"IsTableItem": true
},
{
"ControlType": "60",
"ControlCaption": "18/11/2021",
"ControlStyle": "width:100%; padding:0px;",
"IsTableItem": true
},
{
"ControlType": "60",
"ControlCaption": "373.64",
"ControlStyle": "width:100%; padding:0px; text-align: right;",
"IsTableItem": true
},
{
"ControlType": "20",
"LabelStyle": "display:none",
"CheckboxValue": true,
"ControlStyle": "text-align:left",
"IsTableItem": true,
"CheckboxIconSize": "15px",
"Misc": {
"Company": "TTT",
"ReferenceDuplicate": "1",
"Type": "CD",
"ReferenceNumber": "1034036"
}
}
],
[
{
"ControlType": "60",
"ControlCaption": "1035375",
"ControlStyle": "width:100%; padding:0px;",
"IsTableItem": true
},
{
"ControlType": "60",
"ControlCaption": "27/10/2021",
"ControlStyle": "width:100%; padding:0px;",
"IsTableItem": true
},
{
"ControlType": "60",
"ControlCaption": "CD",
"ControlStyle": "width:100%; padding:0px;",
"IsTableItem": true
},
{
"ControlType": "60",
"ControlCaption": "1035375",
"ControlStyle": "width:100%; padding:0px;",
"IsTableItem": true
},
{
"ControlType": "60",
"ControlCaption": "26/11/2021",
"ControlStyle": "width:100%; padding:0px;",
"IsTableItem": true
},
{
"ControlType": "60",
"ControlCaption": "20.24",
"ControlStyle": "width:100%; padding:0px; text-align: right;",
"IsTableItem": true
},
{
"ControlType": "20",
"LabelStyle": "display:none",
"CheckboxValue": false,
"ControlStyle": "text-align:left",
"IsTableItem": true,
"CheckboxIconSize": "15px",
"Misc": {
"Company": "TTT",
"ReferenceDuplicate": "1",
"Type": "CD",
"ReferenceNumber": "1035375"
}
}
],
[
{
"ControlType": "60",
"ControlCaption": "1036326",
"ControlStyle": "width:100%; padding:0px;",
"IsTableItem": true
},
{
"ControlType": "60",
"ControlCaption": "02/11/2021",
"ControlStyle": "width:100%; padding:0px;",
"IsTableItem": true
},
{
"ControlType": "60",
"ControlCaption": "CD",
"ControlStyle": "width:100%; padding:0px;",
"IsTableItem": true
},
{
"ControlType": "60",
"ControlCaption": "1036326",
"ControlStyle": "width:100%; padding:0px;",
"IsTableItem": true
},
{
"ControlType": "60",
"ControlCaption": "02/12/2021",
"ControlStyle": "width:100%; padding:0px;",
"IsTableItem": true
},
{
"ControlType": "60",
"ControlCaption": "57.24",
"ControlStyle": "width:100%; padding:0px; text-align: right;",
"IsTableItem": true
},
{
"ControlType": "20",
"LabelStyle": "display:none",
"CheckboxValue": false,
"ControlStyle": "text-align:left",
"IsTableItem": true,
"CheckboxIconSize": "15px",
"Misc": {
"Company": "TTT",
"ReferenceDuplicate": "1",
"Type": "CD",
"ReferenceNumber": "1036326"
}
}
]
]';
select A2.Company,
A2.ReferenceDuplicate,
A2.Type,
A2.ReferenceNumber
from openjson(@txt1) as A1
cross apply openjson(A1.value)
with (
CheckboxValue bit,
Company varchar(100) '$.Misc.Company',
ReferenceDuplicate int '$.Misc.ReferenceDuplicate',
Type varchar(100) '$.Misc.Type',
ReferenceNumber int '$.Misc.ReferenceNumber'
) as A2
where A2.CheckboxValue = 1;
select json_value(A2.value, '$.Misc.Company') as Company,
json_value(A2.value, '$.Misc.ReferenceDuplicate') as ReferenceDuplicate,
json_value(A2.value, '$.Misc.Type') as Type,
json_value(A2.value, '$.Misc.ReferenceNumber') as ReferenceNumber
from openjson(@txt1) as A1
cross apply openjson(A1.value) as A2
where json_value(A2.value, '$.CheckboxValue') = 'true';
DECLARE @json NVARCHAR(MAX)
SET @json =
N'{"Version":"3.0.202303.1","BaseInfo":{"DefinedProp":[{"Key":"baioqin","Val":"","Sort":null,"IsShow":1,"IsSys":0},{"Key":"钱包","Val":"","Sort":null,"IsShow":1,"IsSys":0}],"BuildTime":"2023-05-08","UserName":"临床药师-hwm001","MedNo":"0000164751_20230508","HospitalNo":"0000164751","PatientName":"田义","Nationality":"","Ethnic_group":"","BirthDate":"1963-09-11","Sex":"男","Age":"51","BedNo":"282112-0","StartDate":"2014-07-07","EndDate":"2014-07-18","DeptName":"泌尿外科","DoctorName":"刘世博","Pharmacist":"临床药师-hwm001","WorkAddress":"","Address":"","Telephone":"13940076300","Postcode":"","PayClass":"市医保","Education":"","Marital_Status":"","In_Diagnosis":"输尿管恶性肿瘤","Out_Diagnosis":"独立的多个部位的(原发性)恶性肿瘤(治愈),睾丸恶性肿瘤(治愈),结肠恶性肿瘤,输尿管恶性肿瘤(治愈),为肿瘤化学治疗疗程(治愈),胃恶性肿瘤,移行细胞癌NOS(治愈)","agevalue":59.0,"IAge":null,"mhiscode":1,"Height":"173","Weight":"100","Abo_Type":"","Rh_Type":""},"InhospCheckup":{"DefinedProp":[{"Key":"体脂","Val":"","Sort":null,"IsShow":1,"IsSys":0}],"BMI":"33.41","BSA":"2.182","Temperature":"","Pulse":"","Breathe":"","BloodPressure":"","Height":"173","Weight":"100","Abo_Type":"","Rh_Type":""},"InhospLab":{"DefinedProp":[{"Key":"自定义","Val":"","Sort":null,"IsShow":1,"IsSys":0}],"eGFR":"","CCR":"","ScR":"151.00g/L","ALT":"","AST":"","Pct":"","CReactive":"","Esr":""},"InhospOther":{"DefinedProp":[],"AdvancedAge":0,"LiverFunction":null,"RenalFunction":null,"BadHabits":null},"MedPharmHistory":{"DefinedProp":[],"MDescript":"","MhisDescript":"","Elapse":"","InfoSource":"","InfoSourceDes":"","TreatRecords":[],"Family":"","Allergen":[],"MedicationSituation":"","Adr":[],"InDiagnose":null,"OutDiagnose":null},"LisLab":[],"YaoMinWswLab":[],"LisExam":[],"InitTreatmentPlan":{"InitialDrugDBGrid":[{"cid":"18805776","grouptag":"15514533","groupstate":null,"is_temp":"长期","drugname":"注射用胸腺五肽","singledose":"10.00","doseunit":"mg","frequency":"BID","routename":"im","startdate":"2014-07-08 08:27:42","enddate":"2014-07-17 23:59:59","PAEndDateTime":"","singledoseunit":"10.00mg","routefrequency":" im BID","druguniquecode":"Y00000003100"}],"InitialProgramme":"一、诊断依据及病史特点<br/>1.病史:<br/>2.主诉:<br/>3.查体:<br/>4.检查:<br/>5.其他:<br/>二、治疗原则","InitialCustody":""},"OtherTreatmentPlan":{"OtherTDrugDBGrid":[],"OtherMainDrugSummary":""},"TreatmentLog":[{"DefinedProp":[],"date":"2014-07-08","inhospDays":2,"Illness":"<div class=\"ql-editor\"><p>说的 </p></div>","treatmentKey":"<div class=\"ql-editor\"><p>撒 </p></div>","drugNew":[{"cid":"18805776","grouptag":"15514533","groupstate":null,"is_temp":"长期","drugname":"注射用胸腺五肽","singledose":"10","doseunit":"mg","frequency":"BID","routename":"im","startdate":"2014-07-08 08:27:42","enddate":"2014-07-17 23:59:59","PAEndDateTime":"2014-07-17 23:59:59","singledoseunit":"10mg","routefrequency":" im BID","druguniquecode":"Y00000003100"},{"cid":"18805667","grouptag":"15514413","groupstate":null,"is_temp":"临时","drugname":"0.9%氯化钠注射液","singledose":"500","doseunit":"ml","frequency":"ST","routename":"膀胱灌注","startdate":"2014-07-08 08:26:07","enddate":"2014-07-08 08:26:07","PAEndDateTime":"2014-07-08 08:26:07","singledoseunit":"500ml","routefrequency":" 膀胱灌注 ST","druguniquecode":"Y00000000505"},{"cid":"18816470","grouptag":"15527563","groupstate":1,"is_temp":"临时","drugname":"0.9%氯化钠注射液","singledose":"250","doseunit":"ml","frequency":"ST","routename":"iv.dri","startdate":"2014-07-08 13:23:25","enddate":"2014-07-08 13:23:25","PAEndDateTime":"2014-07-08 13:23:25","singledoseunit":"250ml","routefrequency":" iv.dri ST","druguniquecode":"Y00000003416"},{"cid":"18816471","grouptag":"15527563","groupstate":3,"is_temp":"临时","drugname":"5%葡萄糖注射液","singledose":"250","doseunit":"ml","frequency":"ST","routename":"iv.dri","startdate":"2014-07-08 13:23:25","enddate":"2014-07-08 13:23:25","PAEndDateTime":"2014-07-08 13:23:25","singledoseunit":"250ml","routefrequency":" iv.dri ST","druguniquecode":"Y00000003421"},{"cid":"18816472","grouptag":"15527563","groupstate":2,"is_temp":"临时","drugname":"氟尿嘧啶注射液","singledose":"0.5","doseunit":"g","frequency":"ST","routename":"iv.dri","startdate":"2014-07-08 13:23:25","enddate":"2014-07-08 13:23:25","PAEndDateTime":"2014-07-08 13:23:25","singledoseunit":"0.5g","routefrequency":" iv.dri ST","druguniquecode":"Y00000003327"}],"drugStop":[{"cid":"18816470","grouptag":"15527563","groupstate":1,"is_temp":"临时","drugname":"0.9%氯化钠注射液","singledose":"250.00","doseunit":"ml","frequency":"ST","routename":"iv.dri","startdate":"2014-07-08 13:23:25","enddate":"2014-07-08 13:23:25","PAEndDateTime":"","singledoseunit":"250.00ml","routefrequency":" iv.dri ST","druguniquecode":"Y00000003416"},{"cid":"18816471","grouptag":"15527563","groupstate":3,"is_temp":"临时","drugname":"5%葡萄糖注射液","singledose":"250.00","doseunit":"ml","frequency":"ST","routename":"iv.dri","startdate":"2014-07-08 13:23:25","enddate":"2014-07-08 13:23:25","PAEndDateTime":"","singledoseunit":"250.00ml","routefrequency":" iv.dri ST","druguniquecode":"Y00000003421"},{"cid":"18816472","grouptag":"15527563","groupstate":2,"is_temp":"临时","drugname":"氟尿嘧啶注射液","singledose":"0.50","doseunit":"g","frequency":"ST","routename":"iv.dri","startdate":"2014-07-08 13:23:25","enddate":"2014-07-08 13:23:25","PAEndDateTime":"","singledoseunit":"0.50g","routefrequency":" iv.dri ST","druguniquecode":"Y00000003327"}],"DrugHistory":"<div class=\"ql-editor\"><p> 阿萨 </p></div>"},{"DefinedProp":[],"date":"2014-07-12","inhospDays":6,"Illness":"<div class=\"ql-editor\"><p>阿萨 </p></div>","treatmentKey":"<div class=\"ql-editor\"><p>啊 </p></div>","drugNew":[{"cid":"18816470","grouptag":"15527563","groupstate":1,"is_temp":"临时","drugname":"0.9%氯化钠注射液","singledose":"250.00","doseunit":"ml","frequency":"ST","routename":"iv.dri","startdate":"2014-07-08 13:23:25","enddate":"2014-07-08 13:23:25","PAEndDateTime":"","singledoseunit":"250.00ml","routefrequency":" iv.dri ST","druguniquecode":"Y00000003416"},{"cid":"18816471","grouptag":"15527563","groupstate":3,"is_temp":"临时","drugname":"5%葡萄糖注射液","singledose":"250.00","doseunit":"ml","frequency":"ST","routename":"iv.dri","startdate":"2014-07-08 13:23:25","enddate":"2014-07-08 13:23:25","PAEndDateTime":"","singledoseunit":"250.00ml","routefrequency":" iv.dri ST","druguniquecode":"Y00000003421"},{"cid":"18816472","grouptag":"15527563","groupstate":2,"is_temp":"临时","drugname":"氟尿嘧啶注射液","singledose":"0.50","doseunit":"g","frequency":"ST","routename":"iv.dri","startdate":"2014-07-08 13:23:25","enddate":"2014-07-08 13:23:25","PAEndDateTime":"","singledoseunit":"0.50g","routefrequency":" iv.dri ST","druguniquecode":"Y00000003327"}],"drugStop":[],"DrugHistory":"<div class=\"ql-editor\"></div>"}],"SummaryOfDrugTherapy":""}';
select 1 as id ,json_value(@json, '$.BaseInfo.UserName') as UserName,
json_value(@json, '$.BaseInfo.MedNo') as MedNo,
json_value(@json, '$.BaseInfo.HospitalNo') as HospitalNo,
json_value(@json, '$.TreatmentLog[0].date');
ALTER DATABASE [PASSPA2DB] SET COMPATIBILITY_LEVEL = 130