|
@@ -559,12 +559,29 @@ func (c *HisApiController) GetHisPatientInfo() {
|
559
|
559
|
return
|
560
|
560
|
|
561
|
561
|
}
|
|
562
|
+
|
562
|
563
|
func (c *HisApiController) GetHisPrescriptionConfig() {
|
563
|
564
|
adminInfo := c.GetAdminUserInfo()
|
564
|
565
|
//获取医嘱模版
|
565
|
566
|
advices, _ := service.FindAllHisAdviceTemplate(adminInfo.CurrentOrgId)
|
566
|
567
|
//获取所有基础药
|
567
|
568
|
drugs, _ := service.GetAllDrugLibList(adminInfo.CurrentOrgId)
|
|
569
|
+
|
|
570
|
+ _, config := service.FindHisStockPriceRecordByOrgId(adminInfo.CurrentOrgId)
|
|
571
|
+ if config.ID > 0 && config.IsOpen == 1 {
|
|
572
|
+ for _, item := range drugs {
|
|
573
|
+ var index = 0
|
|
574
|
+ for _, subItem := range item.OtherDrugWarehouseInfo {
|
|
575
|
+ if index == 0 {
|
|
576
|
+ if subItem.StockMaxNumber*item.MinNumber+subItem.StockMinNumber > 0 {
|
|
577
|
+ index = index + 1
|
|
578
|
+ item.MinPrice = subItem.Price
|
|
579
|
+ }
|
|
580
|
+ }
|
|
581
|
+ }
|
|
582
|
+ }
|
|
583
|
+ }
|
|
584
|
+
|
568
|
585
|
drugways, _, _ := service.GetDrugWayDics(adminInfo.CurrentOrgId)
|
569
|
586
|
efs, _, _ := service.GetExecutionFrequencyDics(adminInfo.CurrentOrgId)
|
570
|
587
|
doctors, _ := service.GetHisAdminUserDoctors(adminInfo.CurrentOrgId)
|
|
@@ -943,6 +960,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
943
|
960
|
s.PatientId = patient_id
|
944
|
961
|
s.HisPatientId = his_patient_id
|
945
|
962
|
s.StartTime = pTime
|
|
963
|
+
|
946
|
964
|
errcode := c.setAdviceWithJSON(&s, advice.(map[string]interface{}))
|
947
|
965
|
if errcode > 0 {
|
948
|
966
|
c.ServeFailJSONWithSGJErrorCode(errcode)
|
|
@@ -1045,7 +1063,8 @@ func (c *HisApiController) CreateHisPrescription() {
|
1045
|
1063
|
if p.Type == 3 { //处理透前准备耗材数量数据
|
1046
|
1064
|
consumables, _ := service.FindHisConsumablesByID(adminInfo.CurrentOrgId, patient_id, recordDateTime, p.ProjectId)
|
1047
|
1065
|
if consumables.ID > 0 {
|
1048
|
|
- consumables.Count = int64(p.Count)
|
|
1066
|
+ cnt, _ := strconv.ParseInt(p.Count, 10, 64)
|
|
1067
|
+ consumables.Count = cnt
|
1049
|
1068
|
service.UpdateConsumables(&consumables)
|
1050
|
1069
|
}
|
1051
|
1070
|
}
|
|
@@ -1359,10 +1378,12 @@ func (c *HisApiController) DeletePrescription() {
|
1359
|
1378
|
if err == nil {
|
1360
|
1379
|
if len(projects) > 0 {
|
1361
|
1380
|
for _, item := range projects {
|
|
1381
|
+ service.DeletePrintInfo(item.ID) //删除打印信息
|
1362
|
1382
|
if stockConfig.IsOpen == 1 {
|
1363
|
1383
|
if item.Type == 3 {
|
1364
|
1384
|
good, _ := service.FindGoodInfoByIdTwo(item.ProjectId)
|
1365
|
|
- f_count, _ := strconv.ParseFloat(strconv.FormatInt(int64(item.Count), 10), 64)
|
|
1385
|
+ //cnt, _ := strconv.ParseInt(item.Count, 10, 64)
|
|
1386
|
+ f_count, _ := strconv.ParseFloat(item.Count, 64)
|
1366
|
1387
|
good.Total = good.Total + f_count
|
1367
|
1388
|
service.UpdateGoodInfo(&good)
|
1368
|
1389
|
}
|
|
@@ -1447,6 +1468,7 @@ func (c *HisApiController) DeleteProject() {
|
1447
|
1468
|
}
|
1448
|
1469
|
err := service.DelelteProject(id, c.GetAdminUserInfo().CurrentOrgId)
|
1449
|
1470
|
if err == nil {
|
|
1471
|
+ service.DeletePrintInfo(id)
|
1450
|
1472
|
label, _ := service.GetProjectById(adminInfo.CurrentOrgId, id, project.RecordDate, project.PatientId)
|
1451
|
1473
|
label.Status = 0
|
1452
|
1474
|
service.CreateHisLabelRecord(&label)
|
|
@@ -1454,7 +1476,8 @@ func (c *HisApiController) DeleteProject() {
|
1454
|
1476
|
if stockConfig.IsOpen == 1 {
|
1455
|
1477
|
if project.Type == 3 {
|
1456
|
1478
|
good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
|
1457
|
|
- f_count, _ := strconv.ParseFloat(strconv.FormatInt(int64(project.Count), 10), 64)
|
|
1479
|
+
|
|
1480
|
+ f_count, _ := strconv.ParseFloat(project.Count, 64)
|
1458
|
1481
|
good.Total = good.Total + f_count
|
1459
|
1482
|
service.UpdateGoodInfo(&good)
|
1460
|
1483
|
}
|
|
@@ -1952,8 +1975,7 @@ func (c *HisApiController) setProjectWithJSONTwo(project *models.HisPrescription
|
1952
|
1975
|
|
1953
|
1976
|
if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
|
1954
|
1977
|
total, _ := json["total"].(string)
|
1955
|
|
- totals, _ := strconv.ParseInt(total, 10, 64)
|
1956
|
|
- project.Count = totals
|
|
1978
|
+ project.Count = total
|
1957
|
1979
|
}
|
1958
|
1980
|
|
1959
|
1981
|
if json["medical_code"] != nil && reflect.TypeOf(json["medical_code"]).String() == "string" {
|
|
@@ -2099,6 +2121,41 @@ func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo,
|
2099
|
2121
|
// advice.WeekDay = week_day
|
2100
|
2122
|
//}
|
2101
|
2123
|
|
|
2124
|
+ if json["min_unit"] != nil && reflect.TypeOf(json["min_unit"]).String() == "string" {
|
|
2125
|
+ drugSpecUnit, _ := json["min_unit"].(string)
|
|
2126
|
+ advice.DrugSpecUnit = drugSpecUnit
|
|
2127
|
+ }
|
|
2128
|
+ if json["single_dose"] != nil && reflect.TypeOf(json["single_dose"]).String() == "string" {
|
|
2129
|
+ singleDose, _ := strconv.ParseFloat(json["single_dose"].(string), 64)
|
|
2130
|
+ advice.SingleDose = singleDose
|
|
2131
|
+ }
|
|
2132
|
+ if json["single_dose_unit"] != nil && reflect.TypeOf(json["single_dose_unit"]).String() == "string" {
|
|
2133
|
+ singleDoseUnit, _ := json["single_dose_unit"].(string)
|
|
2134
|
+ advice.SingleDoseUnit = singleDoseUnit
|
|
2135
|
+ }
|
|
2136
|
+
|
|
2137
|
+ if json["delivery_way"] != nil && reflect.TypeOf(json["delivery_way"]).String() == "string" {
|
|
2138
|
+ deliveryWay, _ := json["delivery_way"].(string)
|
|
2139
|
+ advice.DeliveryWay = deliveryWay
|
|
2140
|
+ }
|
|
2141
|
+ if json["execution_frequency"] != nil && reflect.TypeOf(json["execution_frequency"]).String() == "string" {
|
|
2142
|
+ executionFrequency, _ := json["execution_frequency"].(string)
|
|
2143
|
+ advice.ExecutionFrequency = executionFrequency
|
|
2144
|
+ }
|
|
2145
|
+
|
|
2146
|
+ if json["retail_price"] != nil || reflect.TypeOf(json["retail_price"]).String() == "string" {
|
|
2147
|
+ price, _ := strconv.ParseFloat(json["retail_price"].(string), 64)
|
|
2148
|
+ advice.Price = price
|
|
2149
|
+ }
|
|
2150
|
+ if json["medical_insurance_number"] != nil || reflect.TypeOf(json["medical_insurance_number"]).String() == "string" {
|
|
2151
|
+ med_list_codg, _ := json["medical_insurance_number"].(string)
|
|
2152
|
+ advice.MedListCodg = med_list_codg
|
|
2153
|
+ }
|
|
2154
|
+ if json["day"] != nil || reflect.TypeOf(json["day"]).String() == "float64" {
|
|
2155
|
+ day := int64(json["day"].(float64))
|
|
2156
|
+ advice.Day = day
|
|
2157
|
+ }
|
|
2158
|
+
|
2102
|
2159
|
if json["prescribing_number_unit"] != nil && reflect.TypeOf(json["prescribing_number_unit"]).String() == "string" {
|
2103
|
2160
|
prescribingNumberUnit, _ := json["prescribing_number_unit"].(string)
|
2104
|
2161
|
advice.PrescribingNumberUnit = prescribingNumberUnit
|
|
@@ -2111,6 +2168,7 @@ func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo,
|
2111
|
2168
|
hisAdvice, err := service.GetHisDoctorAdvicesById(advice.ID)
|
2112
|
2169
|
if err == nil {
|
2113
|
2170
|
if hisAdvice.ID > 0 {
|
|
2171
|
+
|
2114
|
2172
|
advice.ExecutionTime = hisAdvice.ExecutionTime
|
2115
|
2173
|
advice.ExecutionStaff = hisAdvice.ExecutionStaff
|
2116
|
2174
|
advice.ExecutionState = hisAdvice.ExecutionState
|
|
@@ -2119,6 +2177,16 @@ func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo,
|
2119
|
2177
|
advice.CheckState = hisAdvice.CheckState
|
2120
|
2178
|
advice.StartTime = hisAdvice.StartTime
|
2121
|
2179
|
advice.HospApprFlag = hisAdvice.HospApprFlag
|
|
2180
|
+
|
|
2181
|
+ if hisAdvice.SingleDose != advice.SingleDose || hisAdvice.DeliveryWay != advice.DeliveryWay || hisAdvice.ExecutionFrequency != advice.ExecutionFrequency || hisAdvice.Day != advice.Day || hisAdvice.PrescribingNumber != advice.PrescribingNumber || hisAdvice.Price != advice.Price || hisAdvice.Remark != advice.Remark {
|
|
2182
|
+ advice.ExecutionTime = 0
|
|
2183
|
+ advice.ExecutionStaff = 0
|
|
2184
|
+ advice.ExecutionState = 2
|
|
2185
|
+ advice.CheckTime = 0
|
|
2186
|
+ advice.Checker = 0
|
|
2187
|
+ advice.CheckState = 2
|
|
2188
|
+ }
|
|
2189
|
+
|
2122
|
2190
|
//advice.Groupno = hisAdvice.Groupno
|
2123
|
2191
|
|
2124
|
2192
|
}
|
|
@@ -2246,40 +2314,6 @@ func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo,
|
2246
|
2314
|
// advice.StartTime = start_time
|
2247
|
2315
|
//}
|
2248
|
2316
|
|
2249
|
|
- if json["min_unit"] != nil && reflect.TypeOf(json["min_unit"]).String() == "string" {
|
2250
|
|
- drugSpecUnit, _ := json["min_unit"].(string)
|
2251
|
|
- advice.DrugSpecUnit = drugSpecUnit
|
2252
|
|
- }
|
2253
|
|
- if json["single_dose"] != nil && reflect.TypeOf(json["single_dose"]).String() == "string" {
|
2254
|
|
- singleDose, _ := strconv.ParseFloat(json["single_dose"].(string), 64)
|
2255
|
|
- advice.SingleDose = singleDose
|
2256
|
|
- }
|
2257
|
|
- if json["single_dose_unit"] != nil && reflect.TypeOf(json["single_dose_unit"]).String() == "string" {
|
2258
|
|
- singleDoseUnit, _ := json["single_dose_unit"].(string)
|
2259
|
|
- advice.SingleDoseUnit = singleDoseUnit
|
2260
|
|
- }
|
2261
|
|
-
|
2262
|
|
- if json["delivery_way"] != nil && reflect.TypeOf(json["delivery_way"]).String() == "string" {
|
2263
|
|
- deliveryWay, _ := json["delivery_way"].(string)
|
2264
|
|
- advice.DeliveryWay = deliveryWay
|
2265
|
|
- }
|
2266
|
|
- if json["execution_frequency"] != nil && reflect.TypeOf(json["execution_frequency"]).String() == "string" {
|
2267
|
|
- executionFrequency, _ := json["execution_frequency"].(string)
|
2268
|
|
- advice.ExecutionFrequency = executionFrequency
|
2269
|
|
- }
|
2270
|
|
-
|
2271
|
|
- if json["retail_price"] != nil || reflect.TypeOf(json["retail_price"]).String() == "string" {
|
2272
|
|
- price, _ := strconv.ParseFloat(json["retail_price"].(string), 64)
|
2273
|
|
- advice.Price = price
|
2274
|
|
- }
|
2275
|
|
- if json["medical_insurance_number"] != nil || reflect.TypeOf(json["medical_insurance_number"]).String() == "string" {
|
2276
|
|
- med_list_codg, _ := json["medical_insurance_number"].(string)
|
2277
|
|
- advice.MedListCodg = med_list_codg
|
2278
|
|
- }
|
2279
|
|
- if json["day"] != nil || reflect.TypeOf(json["day"]).String() == "float64" {
|
2280
|
|
- day := int64(json["day"].(float64))
|
2281
|
|
- advice.Day = day
|
2282
|
|
- }
|
2283
|
2317
|
return 0
|
2284
|
2318
|
}
|
2285
|
2319
|
|
|
@@ -2326,8 +2360,8 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
|
2326
|
2360
|
|
2327
|
2361
|
if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
|
2328
|
2362
|
total, _ := json["total"].(string)
|
2329
|
|
- totals, _ := strconv.ParseInt(total, 10, 64)
|
2330
|
|
- project.Count = totals
|
|
2363
|
+ //totals, _ := strconv.ParseInt(total, 10, 64)
|
|
2364
|
+ project.Count = total
|
2331
|
2365
|
}
|
2332
|
2366
|
|
2333
|
2367
|
if json["medical_code"] != nil && reflect.TypeOf(json["medical_code"]).String() == "string" {
|
|
@@ -2383,7 +2417,7 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
|
2383
|
2417
|
if stockConfig.IsOpen == 1 {
|
2384
|
2418
|
if project.Type == 3 {
|
2385
|
2419
|
good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
|
2386
|
|
- f_count, _ := strconv.ParseFloat(strconv.FormatInt(int64(project.Count), 10), 64)
|
|
2420
|
+ f_count, _ := strconv.ParseFloat(project.Count, 64)
|
2387
|
2421
|
good.Total = good.Total - f_count
|
2388
|
2422
|
service.UpdateGoodInfo(&good)
|
2389
|
2423
|
}
|
|
@@ -2396,12 +2430,18 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
|
2396
|
2430
|
if project.Type == 3 {
|
2397
|
2431
|
good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
|
2398
|
2432
|
if project.Count < temp_project.Count {
|
2399
|
|
- other_count := temp_project.Count - project.Count
|
|
2433
|
+ f_count_one, _ := strconv.ParseFloat(project.Count, 64)
|
|
2434
|
+ f_count_two, _ := strconv.ParseFloat(temp_project.Count, 64)
|
|
2435
|
+
|
|
2436
|
+ other_count := f_count_two - f_count_one
|
2400
|
2437
|
other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
|
2401
|
2438
|
good.Total = good.Total + other_count_two
|
2402
|
2439
|
service.UpdateGoodInfo(&good)
|
2403
|
2440
|
} else if project.Count > temp_project.Count {
|
2404
|
|
- other_count := project.Count - temp_project.Count
|
|
2441
|
+ f_count_one, _ := strconv.ParseFloat(project.Count, 64)
|
|
2442
|
+ f_count_two, _ := strconv.ParseFloat(temp_project.Count, 64)
|
|
2443
|
+
|
|
2444
|
+ other_count := f_count_one - f_count_two
|
2405
|
2445
|
other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
|
2406
|
2446
|
good.Total = good.Total - other_count_two
|
2407
|
2447
|
service.UpdateGoodInfo(&good)
|
|
@@ -2557,8 +2597,8 @@ func (c *HisApiController) setProjectTemplateWithJSON(project *models.HisPrescri
|
2557
|
2597
|
|
2558
|
2598
|
if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
|
2559
|
2599
|
total, _ := json["total"].(string)
|
2560
|
|
- totals, _ := strconv.ParseInt(total, 10, 64)
|
2561
|
|
- project.Count = totals
|
|
2600
|
+ //totals, _ := strconv.ParseInt(total, 10, 64)
|
|
2601
|
+ project.Count = total
|
2562
|
2602
|
}
|
2563
|
2603
|
|
2564
|
2604
|
if json["medical_code"] != nil && reflect.TypeOf(json["medical_code"]).String() == "string" {
|
|
@@ -3260,7 +3300,8 @@ func (c *HisApiController) GetUploadInfo() {
|
3260
|
3300
|
}
|
3261
|
3301
|
if item.Type == 2 { //项目
|
3262
|
3302
|
for _, subItem := range item.HisPrescriptionProject {
|
3263
|
|
- total = total + (subItem.Price * float64(subItem.Count))
|
|
3303
|
+ cnt, _ := strconv.ParseFloat(subItem.Count, 64)
|
|
3304
|
+ total = total + (subItem.Price * cnt)
|
3264
|
3305
|
}
|
3265
|
3306
|
}
|
3266
|
3307
|
|
|
@@ -3330,11 +3371,12 @@ func (c *HisApiController) GetUploadInfo() {
|
3330
|
3371
|
}
|
3331
|
3372
|
if item.Type == 2 { //项目
|
3332
|
3373
|
for _, subItem := range item.HisPrescriptionProject {
|
|
3374
|
+ cnt, _ := strconv.ParseFloat(subItem.Count, 64)
|
3333
|
3375
|
cus := &Custom{
|
3334
|
3376
|
AdviceId: 0,
|
3335
|
3377
|
ProjectId: subItem.ID,
|
3336
|
|
- DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*float64(subItem.Count)),
|
3337
|
|
- Cut: fmt.Sprintf("%.4f", float64(subItem.Count)),
|
|
3378
|
+ DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
|
|
3379
|
+ Cut: fmt.Sprintf("%.4f", cnt),
|
3338
|
3380
|
FeedetlSn: subItem.FeedetlSn,
|
3339
|
3381
|
Price: fmt.Sprintf("%.4f", float64(subItem.Price)),
|
3340
|
3382
|
MedListCodg: subItem.MedListCodg,
|
|
@@ -5097,7 +5139,8 @@ func (c *HisApiController) PreSettle() {
|
5097
|
5139
|
}
|
5098
|
5140
|
if item.Type == 2 { //项目
|
5099
|
5141
|
for _, subItem := range item.HisPrescriptionProject {
|
5100
|
|
- total = total + (subItem.Price * float64(subItem.Count))
|
|
5142
|
+ cnt, _ := strconv.ParseFloat(subItem.Count, 64)
|
|
5143
|
+ total = total + (subItem.Price * cnt)
|
5101
|
5144
|
}
|
5102
|
5145
|
}
|
5103
|
5146
|
|
|
@@ -5155,12 +5198,12 @@ func (c *HisApiController) PreSettle() {
|
5155
|
5198
|
|
5156
|
5199
|
if item.Type == 2 { //项目
|
5157
|
5200
|
for _, subItem := range item.HisPrescriptionProject {
|
5158
|
|
-
|
|
5201
|
+ cnt, _ := strconv.ParseFloat(subItem.Count, 64)
|
5159
|
5202
|
cus := &Custom{
|
5160
|
5203
|
AdviceId: 0,
|
5161
|
5204
|
ProjectId: subItem.ID,
|
5162
|
|
- DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
|
5163
|
|
- Cut: fmt.Sprintf("%.2f", float64(subItem.Count)),
|
|
5205
|
+ DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*cnt),
|
|
5206
|
+ Cut: fmt.Sprintf("%.2f", cnt),
|
5164
|
5207
|
FeedetlSn: subItem.FeedetlSn,
|
5165
|
5208
|
Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
|
5166
|
5209
|
MedListCodg: subItem.MedListCodg,
|