Browse Source

Merge branch '20201014_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20201014_xt_api_new_branch

csx 4 years ago
parent
commit
7296585d0f

+ 2 - 2
conf/app.conf View File

@@ -44,7 +44,7 @@ appsecret="61ee2e6268497d5aa9de0b0187c39aea"
44 44
 
45 45
 
46 46
 [prod]
47
-mobile_token_expiration_second = 86400
47
+mobile_token_expiration_second = 604800
48 48
 httpdomain = https://api.xt.kuyicloud.com
49 49
 sso_domain = https://sso.kuyicloud.com
50 50
 call_domain = https://hf.sgjyun.com
@@ -141,7 +141,7 @@ aliquid = 83
141 141
 
142 142
 
143 143
 [dev]
144
-mobile_token_expiration_second = 3600
144
+mobile_token_expiration_second = 604800
145 145
 httpdomain = http://new_mobile.xt.api.sgjyun.com
146 146
 sso_domain = https://testsso.sgjyun.com
147 147
 call_domain = http://hf.szjkhd.com

+ 93 - 34
controllers/dialysis_api_controller.go View File

@@ -244,6 +244,8 @@ func (c *DialysisApiController) PostPrescription() {
244 244
 	//fmt.Println("下机前推注鱼精蛋白",push_the_protamine)
245 245
 	// var prescription_doctor int64
246 246
 	blood := c.GetString("blood")
247
+	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
248
+	dialysis_irrigation := c.GetString("dialysis_irrigation")
247 249
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
248 250
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
249 251
 
@@ -322,7 +324,9 @@ func (c *DialysisApiController) PostPrescription() {
322 324
 		PreImpulse:                 preImpules,
323 325
 		AnticoagulantStopTimeHour:  anticoagulant_stop_time_hour,
324 326
 		AnticoagulantStopTimeMin:   anticoagulant_stop_time_min,
325
-		Blood: blood,
327
+		Blood:                      blood,
328
+		DialysisDialyszers:         dialysis_dialyszers,
329
+		DialysisIrrigation:         dialysis_irrigation,
326 330
 	}
327 331
 
328 332
 	if appRole.UserType == 2 || appRole.UserType == 1 {
@@ -489,6 +493,8 @@ func (c *DialysisApiController) PostSoulution() {
489 493
 	anticoagulant_stop_time_hour, _ := c.GetInt64("anticoagulant_stop_time_hour", 0)
490 494
 	anticoagulant_stop_time_min, _ := c.GetInt64("anticoagulant_stop_time_min", 0)
491 495
 	blood := c.GetString("blood")
496
+	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
497
+	dialysis_irrigation := c.GetString("dialysis_irrigation")
492 498
 	var prescription_doctor int64
493 499
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
494 500
 
@@ -578,7 +584,9 @@ func (c *DialysisApiController) PostSoulution() {
578 584
 
579 585
 		AnticoagulantStopTimeHour: anticoagulant_stop_time_hour,
580 586
 		AnticoagulantStopTimeMin:  anticoagulant_stop_time_min,
581
-		Blood: blood,
587
+		Blood:                     blood,
588
+		DialysisIrrigation:        dialysis_irrigation,
589
+		DialysisDialyszers:        dialysis_dialyszers,
582 590
 	}
583 591
 
584 592
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
@@ -1140,6 +1148,11 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1140 1148
 	urine_volume, _ := c.GetFloat("urine_volume", 0)
1141 1149
 	special_treatment := c.GetString("special_treatment")
1142 1150
 	catheter_maintenance := c.GetString("catheter_maintenance")
1151
+	thrombusType := c.GetString("thromubus_type")
1152
+	thrombusInt, _ := strconv.ParseInt(thrombusType, 10, 64)
1153
+	thrombus_a := c.GetString("thromubus_a")
1154
+	thrombus_av := c.GetString("thrombus_av")
1155
+	thrombus_v := c.GetString("thromubus_v")
1143 1156
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
1144 1157
 		DialysisCount:                  dialysis_count,
1145 1158
 		EmergencyTreatment:             emergency_treatment,
@@ -1197,6 +1210,10 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1197 1210
 		UrineVolume:                    urine_volume,
1198 1211
 		SpecialTreatment:               special_treatment,
1199 1212
 		CatheterMaintenance:            catheter_maintenance,
1213
+		ThromubusType:                  thrombusInt,
1214
+		ThrombusAv:                     thrombus_av,
1215
+		ThromubusA:                     thrombus_a,
1216
+		ThromubusV:                     thrombus_v,
1200 1217
 	}
1201 1218
 
1202 1219
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
@@ -2297,6 +2314,7 @@ func (c *DialysisApiController) GetDialysisOrder() {
2297 2314
 	dialysisway, err := service.FindDialysisWay(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
2298 2315
 	//获取临时医嘱
2299 2316
 	doctorAdvice, _ := service.FindDoctorOrder(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
2317
+	config, err := service.GetHisDoctorConfig(adminUserInfo.CurrentOrgId)
2300 2318
 
2301 2319
 	//获取医嘱内容
2302 2320
 	doctor, err := service.FindDoctor(doctorAdvice.AdviceDoctor, adminUserInfo.CurrentAppId, adminUserInfo.CurrentOrgId)
@@ -2349,38 +2367,79 @@ func (c *DialysisApiController) GetDialysisOrder() {
2349 2367
 	firstMonthDate := firstmonth.Unix()
2350 2368
 	//获取当前月份的病人透析次数
2351 2369
 	dialysiscount, err := service.GetDialysisCountByPatientId(firstMonthDate, xttime, patientInfo.ID, adminUserInfo.CurrentOrgId)
2352
-	c.ServeSuccessJSON(map[string]interface{}{
2353
-		"xtdate":                    xtdate,
2354
-		"users":                     adminUser,
2355
-		"patientInfo":               patientInfo,
2356
-		"PredialysisEvaluation":     PredialysisEvaluation,
2357
-		"AssessmentAfterDislysis":   AssessmentAfterDislysis,
2358
-		"dialysisPrescription":      dialysisPrescription,
2359
-		"advices":                   DoctorAdvice,
2360
-		"monitors":                  Record,
2361
-		"summary":                   TreatmentSummary,
2362
-		"receiverTreatmentAccess":   receiverTreatmentAccess,
2363
-		"dialysisOrder":             dialysisOrder,
2364
-		"operators":                 operators,
2365
-		"org_template_info":         templateInfo,
2366
-		"check":                     check,
2367
-		"schedule":                  schedule,
2368
-		"dialysisway":               dialysisway,
2369
-		"order":                     order,
2370
-		"doctorAdvice":              doctorAdvice,
2371
-		"doctor":                    doctor,
2372
-		"nurse":                     nurse,
2373
-		"doctorAdevieInfo":          doctorAdevieInfo,
2374
-		"total":                     total,
2375
-		"startNuse":                 startNuse,
2376
-		"DoctorName":                DoctorName,
2377
-		"assessmentAfterDislysis":   assessmentAfterDislysis,
2378
-		"predialysName":             predialysName,
2379
-		"FinishNuse":                FinishNuse,
2380
-		"lastPredialysisEvaluation": lastPredialysisEvaluation,
2381
-		"dialysiscount":             dialysiscount,
2382
-		"last_order":                lastOrder,
2383
-	})
2370
+
2371
+	//获取his数据
2372
+	hisAdvice, err := service.GetHisDoctorPatientById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
2373
+	if config.IsOpen == 1 {
2374
+		c.ServeSuccessJSON(map[string]interface{}{
2375
+			"xtdate":                    xtdate,
2376
+			"users":                     adminUser,
2377
+			"patientInfo":               patientInfo,
2378
+			"PredialysisEvaluation":     PredialysisEvaluation,
2379
+			"AssessmentAfterDislysis":   AssessmentAfterDislysis,
2380
+			"dialysisPrescription":      dialysisPrescription,
2381
+			"advices":                   hisAdvice,
2382
+			"monitors":                  Record,
2383
+			"summary":                   TreatmentSummary,
2384
+			"receiverTreatmentAccess":   receiverTreatmentAccess,
2385
+			"dialysisOrder":             dialysisOrder,
2386
+			"operators":                 operators,
2387
+			"org_template_info":         templateInfo,
2388
+			"check":                     check,
2389
+			"schedule":                  schedule,
2390
+			"dialysisway":               dialysisway,
2391
+			"order":                     order,
2392
+			"doctorAdvice":              doctorAdvice,
2393
+			"doctor":                    doctor,
2394
+			"nurse":                     nurse,
2395
+			"doctorAdevieInfo":          doctorAdevieInfo,
2396
+			"total":                     total,
2397
+			"startNuse":                 startNuse,
2398
+			"DoctorName":                DoctorName,
2399
+			"assessmentAfterDislysis":   assessmentAfterDislysis,
2400
+			"predialysName":             predialysName,
2401
+			"FinishNuse":                FinishNuse,
2402
+			"lastPredialysisEvaluation": lastPredialysisEvaluation,
2403
+			"dialysiscount":             dialysiscount,
2404
+			"last_order":                lastOrder,
2405
+		})
2406
+
2407
+	}
2408
+	if config.IsOpen == 0 || config.IsOpen == 2 {
2409
+		c.ServeSuccessJSON(map[string]interface{}{
2410
+			"xtdate":                    xtdate,
2411
+			"users":                     adminUser,
2412
+			"patientInfo":               patientInfo,
2413
+			"PredialysisEvaluation":     PredialysisEvaluation,
2414
+			"AssessmentAfterDislysis":   AssessmentAfterDislysis,
2415
+			"dialysisPrescription":      dialysisPrescription,
2416
+			"advices":                   DoctorAdvice,
2417
+			"monitors":                  Record,
2418
+			"summary":                   TreatmentSummary,
2419
+			"receiverTreatmentAccess":   receiverTreatmentAccess,
2420
+			"dialysisOrder":             dialysisOrder,
2421
+			"operators":                 operators,
2422
+			"org_template_info":         templateInfo,
2423
+			"check":                     check,
2424
+			"schedule":                  schedule,
2425
+			"dialysisway":               dialysisway,
2426
+			"order":                     order,
2427
+			"doctorAdvice":              doctorAdvice,
2428
+			"doctor":                    doctor,
2429
+			"nurse":                     nurse,
2430
+			"doctorAdevieInfo":          doctorAdevieInfo,
2431
+			"total":                     total,
2432
+			"startNuse":                 startNuse,
2433
+			"DoctorName":                DoctorName,
2434
+			"assessmentAfterDislysis":   assessmentAfterDislysis,
2435
+			"predialysName":             predialysName,
2436
+			"FinishNuse":                FinishNuse,
2437
+			"lastPredialysisEvaluation": lastPredialysisEvaluation,
2438
+			"dialysiscount":             dialysiscount,
2439
+			"last_order":                lastOrder,
2440
+		})
2441
+
2442
+	}
2384 2443
 
2385 2444
 }
2386 2445
 

+ 7 - 0
controllers/dialysis_record_api_controller.go View File

@@ -268,6 +268,11 @@ func (this *DialysisRecordAPIController) DialysisSchedule() {
268 268
 
269 269
 	_, is_open_config := service.FindXTHisRecordByOrgId(adminInfo.CurrentOrgId)
270 270
 
271
+	//获取耗材类型
272
+	stockType, _ := service.GetStockType(adminInfo.CurrentOrgId)
273
+
274
+	prepare, _ := service.GetDialyStockOut(adminInfo.CurrentOrgId, date.Unix(), patientID)
275
+
271 276
 	var his_advices []*models.HisDoctorAdviceInfo
272 277
 	if is_open_config.IsOpen == 1 {
273 278
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.CurrentOrgId, patientID, date.Unix())
@@ -299,6 +304,8 @@ func (this *DialysisRecordAPIController) DialysisSchedule() {
299 304
 		"system_prescribe":            systemDialysisPrescribe,
300 305
 		"his_advices":                 his_advices,
301 306
 		"is_open_config":              is_open_config,
307
+		"stockType":                   stockType,
308
+		"prepare":                     prepare,
302 309
 	}
303 310
 	this.ServeSuccessJSON(returnData)
304 311
 

+ 2 - 0
controllers/doctors_api_controller.go View File

@@ -33,6 +33,8 @@ func (c *DoctorsApiController) ScheduleAdvices() {
33 33
 	schedualDate := c.GetString("date")
34 34
 	adviceType, _ := c.GetInt("advice_type")
35 35
 	patientType, _ := c.GetInt("patient_type")
36
+	delivery_way := c.GetString("delivery_way")
37
+
36 38
 	delivery_way := c.GetString("delivery_way")
37 39
 	if adviceType != 1 && adviceType != 3 && adviceType != 2 {
38 40
 		adviceType = 0

+ 27 - 2
controllers/drug_stock_api_contorller.go View File

@@ -1417,7 +1417,7 @@ func (c *StockDrugApiController) EditDrugWarehouseOut() {
1417 1417
 					sys_record_time := int64(items["sys_record_time"].(float64))
1418 1418
 
1419 1419
 					warehouseOutInfo := &models.DrugWarehouseOutInfo{
1420
-						ID: id,
1420
+						ID:                      id,
1421 1421
 						WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
1422 1422
 						WarehouseOutId:          warehouseOut.ID,
1423 1423
 						DrugId:                  drug_id,
@@ -1866,9 +1866,34 @@ func (c *StockDrugApiController) GetDrugQueryInfo() {
1866 1866
 	page, _ := c.GetInt64("page", -1)
1867 1867
 	limit, _ := c.GetInt64("limit", -1)
1868 1868
 	keyword := c.GetString("keyword")
1869
+	drug_category, _ := c.GetInt64("drug_category")
1870
+	start_time := c.GetString("start_time")
1871
+	end_time := c.GetString("end_time")
1872
+	timeLayout := "2006-01-02"
1873
+	loc, _ := time.LoadLocation("Local")
1869 1874
 
1875
+	var startTime int64
1876
+	if len(start_time) > 0 {
1877
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1878
+		if err != nil {
1879
+			fmt.Println(err)
1880
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1881
+			return
1882
+		}
1883
+		startTime = theTime.Unix()
1884
+	}
1885
+	var endTime int64
1886
+	if len(end_time) > 0 {
1887
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
1888
+		if err != nil {
1889
+			utils.ErrorLog(err.Error())
1890
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1891
+			return
1892
+		}
1893
+		endTime = theTime.Unix()
1894
+	}
1870 1895
 	adminUserInfo := c.GetAdminUserInfo()
1871
-	list, total, err := service.FindAllDrugStockInfo(adminUserInfo.CurrentOrgId, page, limit, keyword)
1896
+	list, total, err := service.FindAllDrugStockInfo(adminUserInfo.CurrentOrgId, page, limit, keyword, drug_category, startTime, endTime)
1872 1897
 	if err == nil {
1873 1898
 		c.ServeSuccessJSON(map[string]interface{}{
1874 1899
 			"list":  list,

+ 34 - 707
controllers/his_api_controller.go View File

@@ -5,25 +5,18 @@ import (
5 5
 	"XT_New/models"
6 6
 	"XT_New/service"
7 7
 	"XT_New/utils"
8
-	"archive/zip"
9 8
 	"bytes"
10 9
 	"encoding/json"
11 10
 	"fmt"
12 11
 	"github.com/astaxie/beego"
13 12
 	"github.com/jinzhu/gorm"
14
-	"github.com/shopspring/decimal"
15
-	"io"
16 13
 	"io/ioutil"
17 14
 	"math/rand"
18 15
 	"net/http"
19
-	"os"
20
-	"path/filepath"
21 16
 	"reflect"
22 17
 	"strconv"
23 18
 	"strings"
24
-	"syscall"
25 19
 	"time"
26
-	"unsafe"
27 20
 )
28 21
 
29 22
 type HisApiController struct {
@@ -58,25 +51,22 @@ func HisManagerApiRegistRouters() {
58 51
 	beego.Router("/api/register/get", &HisApiController{}, "get:GetRegisterInfo")
59 52
 	beego.Router("/api/upload/get", &HisApiController{}, "get:GetUploadInfo")
60 53
 
61
-	beego.Router("/api/settle/query", &HisApiController{}, "get:GetSettleAccounts")
54
+	beego.Router("/api/refund/post", &HisApiController{}, "post:Refund")
62 55
 
63
-	beego.Router("/api/checkaccount/get", &HisApiController{}, "get:GetCheckAccount")
64
-	beego.Router("/api/checkdetailaccount/get", &HisApiController{}, "get:GetCheckDetailAccount")
56
+	beego.Router("/api/medicalinsurance/config", &HisApiController{}, "get:GetMedicalInsuranceConfig")
65 57
 
66
-	beego.Router("/api/checkdetailaccount/get", &HisApiController{}, "get:GetCheckDetailAccount")
58
+	beego.Router("/api/doctor/list", &HisApiController{}, "get:GetAdminUsers")
67 59
 
68
-	beego.Router("/api/refund/post", &HisApiController{}, "get:Refund")
60
+	//beego.Router("/api/medicalinsurance/config", &HisApiController{}, "get:GetMedicalInsuranceConfig")
69 61
 
70
-	beego.Router("/api/medicalinsurance/config", &HisApiController{}, "get:GetMedicalInsuranceConfig")
62
+	//新增附加费用
63
+	//beego.Router("/api/his/additionalcharge", &HisApiController{}, "Post:AdditionalCharge")
71 64
 
72
-	beego.Router("/api/doctor/list", &HisApiController{}, "get:GetAdminUsers")
65
+	//beego.Router("/api/additionalcharge/get", &HisApiController{}, "Get:GetAdditionalcharge")
73 66
 
74 67
 	beego.Router("/api/hisprescription/get", &DialysisApiController{}, "Get:GetLastOrNextHisPrescription")
75 68
 
76 69
 	beego.Router("/api/callhisprescription/get", &DialysisApiController{}, "Get:GetCallHisPrescription")
77
-	beego.Router("/api/sscard", &HisApiController{}, "get:Sscard")
78
-
79
-}
80 70
 
81 71
 func (c *HisApiController) Sscard() {
82 72
 	//r := CardInit()
@@ -659,7 +649,7 @@ func (c *HisApiController) CreateHisPatientCaseHistory() {
659 649
 
660 650
 	blood_fat := c.GetString("blood_fat")
661 651
 	bloodfatfloat, _ := strconv.ParseFloat(blood_fat, 64)
662
-	//fmt.Println("33333333", bloodfatfloat)
652
+	fmt.Println("33333333", bloodfatfloat)
663 653
 	blood_sugar := c.GetString("blood_sugar")
664 654
 	bloodsugarfloat, _ := strconv.ParseFloat(blood_sugar, 64)
665 655
 	fmt.Println(bloodsugarfloat)
@@ -1026,18 +1016,17 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
1026 1016
 		fmt.Println(project_id)
1027 1017
 		fmt.Println(project.ProjectId)
1028 1018
 	}
1029
-	//if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
1030
-	//	//price := int64(json["price"].(float64))
1031
-	//	//fmt.Println("price--------------------------",price)
1032
-	//	//formatInt_price := strconv.FormatInt(price, 10)
1033
-	//	//float_price, _ := strconv.ParseFloat(formatInt_price, 64)
1034
-	//	//project.Price = float_price
1035
-	//
1036
-	//}
1019
+	// if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
1020
+	// 	price := int64(json["price"].(float64))
1021
+	// 	formatInt_price := strconv.FormatInt(price, 10)
1022
+	// 	float_price, _ := strconv.ParseFloat(formatInt_price, 64)
1023
+	// 	project.Price = float_price
1024
+	// }
1037 1025
 	if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "string" {
1038 1026
 		price, _ := strconv.ParseFloat(json["price"].(string), 64)
1039 1027
 		project.Price = price
1040 1028
 	}
1029
+
1041 1030
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
1042 1031
 		total, _ := json["total"].(string)
1043 1032
 		totals, _ := strconv.ParseInt(total, 10, 64)
@@ -1092,6 +1081,12 @@ func (c *HisApiController) setAddtionWithJSON(additionalCharge *models.HisAdditi
1092 1081
 			}
1093 1082
 		}
1094 1083
 	}
1084
+	// if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
1085
+	// 	price := int64(json["price"].(float64))
1086
+	// 	formatInt_price := strconv.FormatInt(price, 10)
1087
+	// 	float_price, _ := strconv.ParseFloat(formatInt_price, 64)
1088
+	// 	additionalCharge.Price = float_price
1089
+	// }
1095 1090
 
1096 1091
 	//if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
1097 1092
 	//	price := int64(json["price"].(float64))
@@ -1336,7 +1331,6 @@ type ResultSix struct {
1336 1331
 	Signtype    interface{} `json:"signtype"`
1337 1332
 	WarnMsg     interface{} `json:"warn_msg"`
1338 1333
 }
1339
-
1340 1334
 type ResultSeven struct {
1341 1335
 	Cainfo      string `json:"cainfo"`
1342 1336
 	ErrMsg      string `json:"err_msg"`
@@ -1362,14 +1356,13 @@ type ResultSeven struct {
1362 1356
 			Gend            string  `json:"gend"`
1363 1357
 			HifesPay        float64 `json:"hifes_pay"`
1364 1358
 			HifmiPay        float64 `json:"hifmi_pay"`
1359
+			HifobPay        float64 `json:"hifob_pay"`
1365 1360
 			HifpPay         float64 `json:"hifp_pay"`
1366 1361
 			HospPartAmt     float64 `json:"hosp_part_amt"`
1367 1362
 			InscpScpAmt     float64 `json:"inscp_scp_amt"`
1368 1363
 			Insutype        string  `json:"insutype"`
1369 1364
 			MafPay          float64 `json:"maf_pay"`
1370 1365
 			MdtrtCertType   string  `json:"mdtrt_cert_type"`
1371
-			HifobPay        float64 `json:"hifob_pay"`
1372
-
1373 1366
 			MdtrtID         string  `json:"mdtrt_id"`
1374 1367
 			MedType         string  `json:"med_type"`
1375 1368
 			MedfeeSumamt    float64 `json:"medfee_sumamt"`
@@ -1556,7 +1549,7 @@ func (c *HisApiController) GetRegisterInfo() {
1556 1549
 
1557 1550
 	if config.IsOpen == 1 {
1558 1551
 
1559
-		api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + patient.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
1552
+		api := "http://127.0.0.1:9531/" + "gdyb/one?cert_no=" + patient.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
1560 1553
 		resp, requestErr := http.Get(api)
1561 1554
 
1562 1555
 		if requestErr != nil {
@@ -1639,7 +1632,7 @@ func (c *HisApiController) GetRegisterInfo() {
1639 1632
 		doctor_id := strconv.FormatInt(patientPrescription.DoctorId, 10)
1640 1633
 
1641 1634
 		if count <= 0 {
1642
-			api := "http://127.0.0.1:9532/" + "gdyb/two?cert_no=" + patient.IdCardNo + "&insutype=" +
1635
+			api := "http://127.0.0.1:9531/" + "gdyb/two?cert_no=" + patient.IdCardNo + "&insutype=" +
1643 1636
 				res.Output.Iinfo[0].Insutype + "&psn_no=" + res.Output.Baseinfo.PsnNo +
1644 1637
 				"&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&ipt_otp_no=" + ipt_otp_no +
1645 1638
 				"&dept=" + department.Name + "&fixmedins_code=" + miConfig.Code + "&dept_code=" + department.Number + "&doctor_id=" + doctor_id + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
@@ -1694,9 +1687,9 @@ func (c *HisApiController) GetRegisterInfo() {
1694 1687
 			diagnosisConfig, _ := service.FindDiagnoseById(patientPrescription.Diagnosis)
1695 1688
 
1696 1689
 			if err == nil {
1697
-				api := "http://127.0.0.1:9532/" + "gdyb/four?psn_no=" + his.PsnNo +
1690
+				api := "http://127.0.0.1:9531/" + "gdyb/four?psn_no=" + his.PsnNo +
1698 1691
 					"&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
1699
-					"&diag=" + diagnosisConfig.ClassName + "&org_name=" + miConfig.OrgName + "&med_type=" + strconv.FormatInt(patientPrescription.RegisterType, 10) + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code + "&diag_code=" + diagnosisConfig.CountryCode +
1692
+					"&diag=" + diagnosisConfig.ClassName + "&org_name=" + miConfig.OrgName + "&med_type=" + "11" + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code + "&diag_code=" + diagnosisConfig.CountryCode +
1700 1693
 					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
1701 1694
 				resp, requestErr := http.Get(api)
1702 1695
 				if requestErr != nil {
@@ -1781,7 +1774,9 @@ func (c *HisApiController) GetRegisterInfo() {
1781 1774
 		c.ServeSuccessJSON(map[string]interface{}{
1782 1775
 			"his_info": hisPatient,
1783 1776
 		})
1777
+
1784 1778
 	}
1779
+
1785 1780
 }
1786 1781
 
1787 1782
 //上传明细----结算
@@ -1833,9 +1828,7 @@ func (c *HisApiController) GetUploadInfo() {
1833 1828
 	data["chrg_bchno"] = chrg_bchno
1834 1829
 	data["org_name"] = miConfig.OrgName
1835 1830
 	data["doctor"] = patientPrescription.Doctor
1836
-	data["doctor_id"] = strconv.FormatInt(patientPrescription.DoctorId, 10)
1837
-
1838
-	data["dept"] = strconv.FormatInt(patientPrescription.Departments, 10)
1831
+	data["dept"] = patientPrescription.Departments
1839 1832
 
1840 1833
 	data["fixmedins_code"] = miConfig.Code
1841 1834
 	data["dept_code"] = department.Number
@@ -1843,21 +1836,6 @@ func (c *HisApiController) GetUploadInfo() {
1843 1836
 	data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
1844 1837
 	data["secret_key"] = miConfig.SecretKey
1845 1838
 
1846
-	fmt.Println(his.PsnNo)
1847
-	fmt.Println(his.Number)
1848
-
1849
-	fmt.Println(miConfig.OrgName)
1850
-
1851
-	fmt.Println(chrg_bchno)
1852
-	fmt.Println(patientPrescription.Doctor)
1853
-	fmt.Println(miConfig.Code)
1854
-	fmt.Println(department.Number)
1855
-	fmt.Println(strconv.FormatInt(patientPrescription.Departments, 10))
1856
-
1857
-	fmt.Println(miConfig.InsuplcAdmdvs)
1858
-	fmt.Println(miConfig.MdtrtareaAdmvs)
1859
-	fmt.Println(miConfig.SecretKey)
1860
-
1861 1839
 	var ids []int64
1862 1840
 	//var idsTwo []int64
1863 1841
 	//
@@ -1869,7 +1847,7 @@ func (c *HisApiController) GetUploadInfo() {
1869 1847
 
1870 1848
 	if config.IsOpen == 1 { //对接了医保,走医保流程
1871 1849
 		bytesData, _ := json.Marshal(data)
1872
-		req, _ := http.NewRequest("POST", "http://127.0.0.1:9532/"+"gdyb/five", bytes.NewReader(bytesData))
1850
+		req, _ := http.NewRequest("POST", "http://127.0.0.1:9531/"+"gdyb/five", bytes.NewReader(bytesData))
1873 1851
 		resp, _ := client.Do(req)
1874 1852
 		defer resp.Body.Close()
1875 1853
 		body, ioErr := ioutil.ReadAll(resp.Body)
@@ -1920,7 +1898,6 @@ func (c *HisApiController) GetUploadInfo() {
1920 1898
 				FoundPrice:            found_price,
1921 1899
 				MedicalInsurancePrice: medical_insurance_price,
1922 1900
 				PrivatePrice:          private_price,
1923
-				IsMedicineInsurance:   1,
1924 1901
 			}
1925 1902
 			err = service.CreateOrder(order)
1926 1903
 			if err != nil {
@@ -1995,7 +1972,7 @@ func (c *HisApiController) GetUploadInfo() {
1995 1972
 					}
1996 1973
 				}
1997 1974
 			}
1998
-			//org, _ := service.GetOrgById(adminUser.CurrentOrgId)
1975
+			org, _ := service.GetOrgById(adminUser.CurrentOrgId)
1999 1976
 			patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
2000 1977
 			allTotal := fmt.Sprintf("%.2f", total)
2001 1978
 			if res.Infcode == 0 {
@@ -2006,9 +1983,9 @@ func (c *HisApiController) GetUploadInfo() {
2006 1983
 				chrg_bchno := chrg_bchno
2007 1984
 				cert_no := his.Certno
2008 1985
 				insutype := rf[0].Insutype
2009
-				api := "http://127.0.0.1:9532/" + "gdyb/eight?cert_no=" + cert_no + "&insutype=" +
1986
+				api := "http://127.0.0.1:9531/" + "gdyb/eight?cert_no=" + cert_no + "&insutype=" +
2010 1987
 					insutype + "&psn_no=" + psn_no + "&chrg_bchno=" + chrg_bchno + "&mdtrt_id=" + mdtrt_id +
2011
-					"&total=" + allTotal + "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
1988
+					"&total=" + allTotal + "&org_name=" + org.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
2012 1989
 				resp, requestErr := http.Get(api)
2013 1990
 
2014 1991
 				if requestErr != nil {
@@ -2105,8 +2082,7 @@ func (c *HisApiController) GetUploadInfo() {
2105 2082
 					}
2106 2083
 				}
2107 2084
 			} else {
2108
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCalOrderException)
2109
-				return
2085
+
2110 2086
 			}
2111 2087
 
2112 2088
 		} else {
@@ -2278,108 +2254,11 @@ func (c *HisApiController) GetUploadInfo() {
2278 2254
 func (c *HisApiController) Refund() {
2279 2255
 	order_id, _ := c.GetInt64("order_id")
2280 2256
 	number := c.GetString("number")
2281
-	record_time := c.GetString("record_time")
2282
-	patient_id, _ := c.GetInt64("patient_id")
2283
-
2284
-	timeLayout := "2006-01-02"
2285
-	loc, _ := time.LoadLocation("Local")
2286 2257
 
2287 2258
 	adminUser := c.GetAdminUserInfo()
2288
-	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
2289
-	fmt.Println(err)
2290
-	if err != nil {
2291
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2292
-		return
2293
-	}
2294
-	recordDateTime := theTime.Unix()
2295
-
2296
-	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
2297
-	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
2298
-	order, _ := service.GetHisOrderByID(order_id)
2299
-
2300
-	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
2301 2259
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
2302 2260
 	if config.IsOpen == 1 { //对接了医保,走医保流程
2303
-		api := "http://127.0.0.1:9532/" + "gdyb/nine?psn_no=" + his.PsnNo +
2304
-			"&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&setl_id=" + order.SetlId + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
2305
-			"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
2306
-		resp, requestErr := http.Get(api)
2307
-		if requestErr != nil {
2308
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2309
-			return
2310
-		}
2311
-		body, ioErr := ioutil.ReadAll(resp.Body)
2312
-		if ioErr != nil {
2313
-			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
2314
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2315
-			return
2316
-		}
2317
-		var respJSON map[string]interface{}
2318
-		if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
2319
-			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
2320
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2321
-			return
2322
-		}
2323
-		respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
2324
-		userJSONBytes, _ := json.Marshal(respJSON)
2325
-		fmt.Println(respJSON)
2326
-		fmt.Println(userJSONBytes)
2327
-
2328
-		api2 := "http://127.0.0.1:9532/" + "gdyb/six?psn_no=" + his.PsnNo +
2329
-			"&mdtrt_id=" + his.Number + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
2330
-			"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
2331
-		resp2, requestErr2 := http.Get(api2)
2332
-		if requestErr2 != nil {
2333
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2334
-			return
2335
-		}
2336
-
2337
-		body2, ioErr2 := ioutil.ReadAll(resp2.Body)
2338
-		if ioErr2 != nil {
2339
-			utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
2340
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2341
-			return
2342
-		}
2343
-		var respJSON2 map[string]interface{}
2344
-		if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
2345
-			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
2346
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2347
-			return
2348
-		}
2349
-
2350
-		api3 := "http://127.0.0.1:9532/" + "gdyb/three?psn_no=" + his.PsnNo +
2351
-			"&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
2352
-			"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
2353
-		resp3, requestErr3 := http.Get(api3)
2354
-		if requestErr3 != nil {
2355
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2356
-			return
2357
-		}
2358
-
2359
-		body3, ioErr3 := ioutil.ReadAll(resp3.Body)
2360
-		if ioErr3 != nil {
2361
-			utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
2362
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2363
-			return
2364
-		}
2365
-		var respJSON3 map[string]interface{}
2366
-		if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
2367
-			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
2368
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2369
-			return
2370
-		}
2371
-
2372
-		err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
2373
-		service.UpdataRegStatus(patient_id, recordDateTime, adminUser.CurrentOrgId)
2374 2261
 
2375
-		if err == nil {
2376
-			c.ServeSuccessJSON(map[string]interface{}{
2377
-				"msg": "退费成功",
2378
-			})
2379
-		} else {
2380
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2381
-			return
2382
-		}
2383 2262
 	} else {
2384 2263
 		err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
2385 2264
 		if err == nil {
@@ -2390,462 +2269,7 @@ func (c *HisApiController) Refund() {
2390 2269
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2391 2270
 			return
2392 2271
 		}
2393
-	}
2394
-}
2395
-
2396
-//对账
2397
-func (c *HisApiController) GetCheckAccount() {
2398
-	start_time := c.GetString("start_time")
2399
-	end_time := c.GetString("end_time")
2400
-	insutype := c.GetString("insutype")
2401
-	clr_type := c.GetString("clr_type")
2402
-
2403
-	adminUser := c.GetAdminUserInfo()
2404
-	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
2405
-	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
2406
-
2407
-	timeLayout := "2006-01-02"
2408
-	loc, _ := time.LoadLocation("Local")
2409
-	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
2410
-	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
2411
-	orders, _ := service.GetOrderByTime(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, clr_type)
2412
-
2413
-	decimal.DivisionPrecision = 2
2414
-	var medfee_sumamt float64
2415
-	var acct_pay float64
2416
-	var fund_pay_sumamt float64
2417
-	fixmedins_setl_cnt := int64(len(orders))
2418
-
2419
-	for _, item := range orders {
2420
-		medfee_sumamt, _ = decimal.NewFromFloat(medfee_sumamt).Add(decimal.NewFromFloat(item.MedfeeSumamt)).Float64()
2421
-		acct_pay, _ = decimal.NewFromFloat(acct_pay).Add(decimal.NewFromFloat(item.AcctPay)).Float64()
2422
-		fund_pay_sumamt, _ = decimal.NewFromFloat(fund_pay_sumamt).Add(decimal.NewFromFloat(item.FundPaySumamt)).Float64()
2423
-
2424
-	}
2425
-
2426
-	var user_name string
2427
-	role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
2428
-	if role.ID == 0 {
2429
-		user_name = "xxx"
2430
-	} else {
2431
-		user_name = role.UserName
2432
-	}
2433
-
2434
-	if config.IsOpen == 1 {
2435
-		api := "http://127.0.0.1:9532/" + "gdyb/ten?" +
2436
-			"insutype=" + insutype +
2437
-			"&clr_type=" + clr_type +
2438
-			"&setl_optins=" + miConfig.OrgName +
2439
-			"&stmt_begndate=" + start_time +
2440
-			"&stm_enddate=" + end_time +
2441
-			"&medfee_sumamt=" + fmt.Sprintf("%.2f", medfee_sumamt) +
2442
-			"&fund_pay_sumamt=" + fmt.Sprintf("%.2f", fund_pay_sumamt) +
2443
-			"&acct_pay=" + fmt.Sprintf("%.2f", acct_pay) +
2444
-			"&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
2445
-			"&fixmedins_code=" + miConfig.Code +
2446
-			"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
2447
-			"&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
2448
-			"&secret_key=" + miConfig.SecretKey +
2449
-			"&org_name=" + miConfig.OrgName +
2450
-			"&doctor=" + user_name
2451
-
2452
-		fmt.Println(api)
2453
-		resp, requestErr := http.Get(api)
2454
-		if requestErr != nil {
2455
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2456
-			return
2457
-		}
2458
-		body, ioErr := ioutil.ReadAll(resp.Body)
2459
-		fmt.Println(body)
2460
-		if ioErr != nil {
2461
-			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
2462
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2463
-			return
2464
-		}
2465
-		var respJSON map[string]interface{}
2466
-		if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
2467
-			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
2468
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2469
-			return
2470
-		}
2471
-
2472
-		respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
2473
-		userJSONBytes, _ := json.Marshal(respJSON)
2474
-
2475
-		var res ResultEight
2476
-		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
2477
-			utils.ErrorLog("解析失败:%v", err)
2478
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2479
-			return
2480
-		}
2481
-		if res.Infcode == 0 {
2482
-			c.ServeSuccessJSON(map[string]interface{}{
2483
-				"stmt_rslt":      res.Output.Stmtinfo.StmtRslt,
2484
-				"stmt_rslt_dscr": res.Output.Stmtinfo.StmtRsltDscr,
2485
-			})
2486
-		} else {
2487
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2488
-		}
2489
-	}
2490
-}
2491
-
2492
-//对账明细
2493
-func (c *HisApiController) GetCheckDetailAccount() {
2494
-	start_time := c.GetString("start_time")
2495
-	end_time := c.GetString("end_time")
2496
-
2497
-	adminUser := c.GetAdminUserInfo()
2498
-	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
2499
-	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
2500
-
2501
-	timeLayout := "2006-01-02"
2502
-	loc, _ := time.LoadLocation("Local")
2503
-	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
2504
-	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
2505
-	orders, _ := service.GetOrderByTimeTwo(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId)
2506
-
2507
-	Mkdir(miConfig.OrgName)
2508
-	file := strconv.FormatInt(adminUser.CurrentOrgId, 10) + strconv.FormatInt(time.Now().Unix(), 10)
2509
-	file_name := file + ".txt"
2510
-	zip_name := file + ".zip"
2511
-	zip_path := miConfig.OrgName + "/" + zip_name
2512
-	file_path := miConfig.OrgName + "/" + file_name
2513
-
2514
-	decimal.DivisionPrecision = 2
2515
-	var medfee_sumamt float64
2516
-	var psn_cash_pay float64
2517
-	var fund_pay_sumamt float64
2518
-	fixmedins_setl_cnt := int64(len(orders))
2519
-
2520
-	for _, item := range orders {
2521
-		medfee_sumamt, _ = decimal.NewFromFloat(medfee_sumamt).Add(decimal.NewFromFloat(item.MedfeeSumamt)).Float64()
2522
-		psn_cash_pay, _ = decimal.NewFromFloat(psn_cash_pay).Add(decimal.NewFromFloat(item.PsnCashPay)).Float64()
2523
-		fund_pay_sumamt, _ = decimal.NewFromFloat(fund_pay_sumamt).Add(decimal.NewFromFloat(item.FundPaySumamt)).Float64()
2524
-	}
2525
-
2526
-	f, err := os.Create(miConfig.OrgName + "/" + file_name)
2527
-	defer f.Close()
2528
-	if err != nil {
2529
-		fmt.Println(err.Error())
2530
-	} else {
2531
-		for _, item := range orders {
2532
-			var refd_setl_flag string
2533
-			if item.OrderStatus == 2 {
2534
-				refd_setl_flag = "0"
2535
-			}
2536
-			if item.OrderStatus == 3 {
2537
-				refd_setl_flag = "1"
2538
-			}
2539
-			var str string
2540
-			str = item.SetlId + "	" +
2541
-				item.MdtrtId + "	" +
2542
-				item.PsnNo + "	" +
2543
-				fmt.Sprintf("%.2f", item.MedfeeSumamt) + "	" +
2544
-				fmt.Sprintf("%.2f", item.FundPaySumamt) + "	" +
2545
-				fmt.Sprintf("%.2f", item.AcctPay) + "	" + refd_setl_flag + "\n"
2546
-			_, err = f.Write([]byte(str))
2547
-		}
2548
-
2549
-	}
2550
-	Zip(file_path, zip_path)
2551
-	fmt.Println(ReadFile(zip_path))
2552
-	fmt.Println(string(ReadFile(zip_path)))
2553
-
2554
-	if config.IsOpen == 1 {
2555
-
2556
-		var user_name string
2557
-		role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
2558
-		if role.ID == 0 {
2559
-			user_name = "xxx"
2560
-		} else {
2561
-			user_name = role.UserName
2562
-		}
2563
-
2564
-		baseParams := models.BaseParams{
2565
-			SecretKey:      miConfig.SecretKey,
2566
-			FixmedinsCode:  miConfig.Code,
2567
-			InsuplcAdmdvs:  miConfig.InsuplcAdmdvs,
2568
-			MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
2569
-			OrgName:        miConfig.OrgName,
2570
-			Doctor:         user_name,
2571
-		}
2572
-
2573
-		result := service.Gdyb9101(baseParams, zip_name, ReadFile(zip_path))
2574
-
2575
-		var dat map[string]interface{}
2576
-		if err := json.Unmarshal([]byte(result), &dat); err == nil {
2577
-			fmt.Println(dat)
2578
-		} else {
2579
-			fmt.Println(err)
2580
-		}
2581
-
2582
-		userJSONBytes, _ := json.Marshal(dat)
2583
-
2584
-		var res ResultNine
2585
-		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
2586
-			utils.ErrorLog("解析失败:%v", err)
2587
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2588
-			return
2589
-		}
2590
-		if res.Infcode == 0 {
2591
-			api := "http://127.0.0.1:9532/" + "gdyb/twelve?" +
2592
-				"file_qury_no=" + res.Output.FileQuryNo +
2593
-				"&setl_optins=" + miConfig.OrgName +
2594
-				"&stmt_begndate=" + start_time +
2595
-				"&stm_enddate=" + end_time +
2596
-				"&medfee_sumamt=" + fmt.Sprintf("%.2f", medfee_sumamt) +
2597
-				"&fund_pay_sumamt=" + fmt.Sprintf("%.2f", fund_pay_sumamt) +
2598
-				"&cash_payamt=" + fmt.Sprintf("%.2f", psn_cash_pay) +
2599
-				"&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
2600
-				"&fixmedins_code=" + miConfig.Code +
2601
-				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
2602
-				"&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
2603
-				"&secret_key=" + miConfig.SecretKey +
2604
-				"&org_name=" + miConfig.OrgName +
2605
-				"&doctor=" + user_name
2606
-			resp, requestErr := http.Get(api)
2607
-			if requestErr != nil {
2608
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2609
-				return
2610
-			}
2611
-			body, ioErr := ioutil.ReadAll(resp.Body)
2612
-			if ioErr != nil {
2613
-				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
2614
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2615
-				return
2616
-			}
2617
-			var respJSON map[string]interface{}
2618
-			if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
2619
-				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
2620
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2621
-				return
2622
-			}
2623
-			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
2624
-
2625
-			userJSONBytes, _ := json.Marshal(respJSON)
2626
-			var res ResultTen
2627
-			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
2628
-				utils.ErrorLog("解析失败:%v", err)
2629
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2630
-				return
2631
-			}
2632 2272
 
2633
-			if res.Infcode == 0 {
2634
-				service.Gdyb9102(baseParams, zip_name, res.Output.FileQuryNo)
2635
-				c.ServeSuccessJSON(map[string]interface{}{
2636
-					"msg": "明细对账成功",
2637
-				})
2638
-			}
2639
-
2640
-		} else {
2641
-
2642
-		}
2643
-	}
2644
-}
2645
-
2646
-func (c *HisApiController) GetSettleAccounts() {
2647
-	//id, _ := c.GetInt64("id")
2648
-	//record_time := c.GetString("record_time")
2649
-	order_id, _ := c.GetInt64("order_id")
2650
-
2651
-	//timeLayout := "2006-01-02"
2652
-	//loc, _ := time.LoadLocation("Local")
2653
-	//
2654
-	//theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
2655
-	//if err != nil {
2656
-	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2657
-	//	return
2658
-	//}
2659
-	//recordDateTime := theTime.Unix()
2660
-	adminUser := c.GetAdminUserInfo()
2661
-	//his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
2662
-	order, _ := service.GetHisOrderByID(order_id)
2663
-	orderInfos, _ := service.GetHisOrderInfoByNumber(order.Number)
2664
-
2665
-	var bedCostTotal float64 = 0         //床位总费
2666
-	var bedCostSelfTotal float64 = 0     //床位自费
2667
-	var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
2668
-
2669
-	var operationCostTotal float64 = 0         //手术费
2670
-	var operationCostSelfTotal float64 = 0     //手术费
2671
-	var operationCostPartSelfTotal float64 = 0 //手术费
2672
-
2673
-	var otherCostTotal float64 = 0         //其他费用
2674
-	var otherCostSelfTotal float64 = 0     //其他费用
2675
-	var otherCostPartSelfTotal float64 = 0 //其他费用
2676
-
2677
-	var materialCostTotal float64 = 0         //材料费
2678
-	var materialCostSelfTotal float64 = 0     //材料费
2679
-	var materialCostPartSelfTotal float64 = 0 //材料费
2680
-
2681
-	var westernMedicineCostTotal float64 = 0         //西药费
2682
-	var westernMedicineCostSelfTotal float64 = 0     //西药费
2683
-	var westernMedicineCostPartSelfTotal float64 = 0 //西药费
2684
-
2685
-	var chineseTraditionalMedicineCostTotal float64 = 0         //中成药
2686
-	var chineseTraditionalMedicineCostSelfTotal float64 = 0     //中成药
2687
-	var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
2688
-
2689
-	var checkCostTotal float64 = 0         //检查费
2690
-	var checkCostSelfTotal float64 = 0     //检查费
2691
-	var checkCostPartSelfTotal float64 = 0 //检查费
2692
-
2693
-	var laboratoryCostTotal float64 = 0         //化验费
2694
-	var laboratoryCostSelfTotal float64 = 0     //化验费
2695
-	var laboratoryCostPartSelfTotal float64 = 0 //化验费
2696
-
2697
-	var treatCostTotal float64 = 0         //治疗费用
2698
-	var treatCostSelfTotal float64 = 0     //治疗费用
2699
-	var treatCostPartSelfTotal float64 = 0 //治疗费用
2700
-
2701
-	decimal.DivisionPrecision = 2
2702
-
2703
-	for _, item := range orderInfos {
2704
-		if item.MedChrgitmType == "01" { //床位费
2705
-
2706
-			bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
2707
-			bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2708
-			bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2709
-
2710
-		}
2711
-
2712
-		if item.MedChrgitmType == "03" { //检查费
2713
-
2714
-			checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
2715
-			checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2716
-			checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2717
-
2718
-		}
2719
-
2720
-		if item.MedChrgitmType == "04" { //化验费
2721
-
2722
-			laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
2723
-			laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2724
-			laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2725
-
2726
-		}
2727
-
2728
-		if item.MedChrgitmType == "05" { //治疗费
2729
-
2730
-			treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
2731
-			treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2732
-			treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2733
-
2734
-		}
2735
-
2736
-		if item.MedChrgitmType == "06" { //手术费
2737
-
2738
-			operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
2739
-			operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2740
-			operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2741
-
2742
-		}
2743
-
2744
-		if item.MedChrgitmType == "08" { //材料费
2745
-
2746
-			materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
2747
-			materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2748
-			materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2749
-
2750
-		}
2751
-
2752
-		if item.MedChrgitmType == "09" { //西药费
2753
-
2754
-			westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
2755
-			westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2756
-			westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2757
-
2758
-		}
2759
-
2760
-		if item.MedChrgitmType == "11" { //中成费
2761
-
2762
-			chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
2763
-			chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2764
-			chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2765
-
2766
-		}
2767
-
2768
-		if item.MedChrgitmType == "14" { //其他费
2769
-			otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
2770
-			otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2771
-			otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
2772
-		}
2773
-
2774
-	}
2775
-
2776
-	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
2777
-	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
2778
-
2779
-	var user_name string
2780
-	role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
2781
-	if role.ID == 0 {
2782
-		user_name = "xxx"
2783
-	} else {
2784
-		user_name = role.UserName
2785
-	}
2786
-
2787
-	baseParams := models.BaseParams{
2788
-		SecretKey:      miConfig.SecretKey,
2789
-		FixmedinsCode:  miConfig.Code,
2790
-		InsuplcAdmdvs:  miConfig.InsuplcAdmdvs,
2791
-		MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
2792
-		OrgName:        miConfig.OrgName,
2793
-		Doctor:         user_name,
2794
-	}
2795
-
2796
-	businessParams := models.BusinessParams{
2797
-		PsnNo:   order.PsnNo,
2798
-		MdtrtId: order.MdtrtId,
2799
-		SetlId:  order.SetlId,
2800
-	}
2801
-
2802
-	if config.IsOpen == 1 {
2803
-		result := service.Gdyb5203(baseParams, businessParams)
2804
-		var dat map[string]interface{}
2805
-		if err := json.Unmarshal([]byte(result), &dat); err == nil {
2806
-			fmt.Println(dat)
2807
-		} else {
2808
-			fmt.Println(err)
2809
-		}
2810
-		userJSONBytes, _ := json.Marshal(dat)
2811
-		var res ResultEleven
2812
-		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
2813
-			utils.ErrorLog("解析失败:%v", err)
2814
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2815
-			return
2816
-		}
2817
-		if res.Infcode == 0 {
2818
-			c.ServeSuccessJSON(map[string]interface{}{
2819
-				"info":                                        res.Output.Setlinfo,
2820
-				"bedCostTotal":                                bedCostTotal,
2821
-				"bedCostSelfTotal":                            bedCostSelfTotal,
2822
-				"bedCostPartSelfTotal":                        bedCostPartSelfTotal,
2823
-				"operationCostTotal":                          operationCostTotal,
2824
-				"operationCostSelfTotal":                      operationCostSelfTotal,
2825
-				"operationCostPartSelfTotal":                  operationCostPartSelfTotal,
2826
-				"otherCostTotal":                              otherCostTotal,
2827
-				"otherCostSelfTotal":                          otherCostSelfTotal,
2828
-				"otherCostPartSelfTotal":                      otherCostPartSelfTotal,
2829
-				"materialCostTotal":                           materialCostTotal,
2830
-				"materialCostSelfTotal":                       materialCostSelfTotal,
2831
-				"materialCostPartSelfTotal":                   materialCostPartSelfTotal,
2832
-				"westernMedicineCostTotal":                    westernMedicineCostTotal,
2833
-				"westernMedicineCostSelfTotal":                westernMedicineCostSelfTotal,
2834
-				"westernMedicineCostPartSelfTotal":            westernMedicineCostPartSelfTotal,
2835
-				"chineseTraditionalMedicineCostTotal":         chineseTraditionalMedicineCostTotal,
2836
-				"chineseTraditionalMedicineCostSelfTotal":     chineseTraditionalMedicineCostSelfTotal,
2837
-				"chineseTraditionalMedicineCostPartSelfTotal": chineseTraditionalMedicineCostPartSelfTotal,
2838
-				"checkCostTotal":                              checkCostTotal,
2839
-				"checkCostSelfTotal":                          checkCostSelfTotal,
2840
-				"checkCostPartSelfTotal":                      checkCostPartSelfTotal,
2841
-				"laboratoryCostTotal":                         laboratoryCostTotal,
2842
-				"laboratoryCostSelfTotal":                     laboratoryCostSelfTotal,
2843
-				"laboratoryCostPartSelfTotal":                 laboratoryCostPartSelfTotal,
2844
-				"treatCostTotal":                              treatCostTotal,
2845
-				"treatCostSelfTotal":                          treatCostSelfTotal,
2846
-				"treatCostPartSelfTotal":                      treatCostPartSelfTotal,
2847
-			})
2848
-		}
2849 2273
 	}
2850 2274
 
2851 2275
 }
@@ -2984,100 +2408,3 @@ func (this *DialysisApiController) GetCallHisPrescription() {
2984 2408
 		return
2985 2409
 	}
2986 2410
 }
2987
-
2988
-func PathExists(path string) (bool, error) {
2989
-	_, err := os.Stat(path)
2990
-	if err == nil {
2991
-		return true, nil
2992
-	}
2993
-	if os.IsNotExist(err) {
2994
-		return false, nil
2995
-	}
2996
-	return false, err
2997
-}
2998
-
2999
-//创建文件夹
3000
-func Mkdir(dir string) {
3001
-	// 创建文件夹
3002
-	exist, err := PathExists(dir)
3003
-	if err != nil {
3004
-		fmt.Println(err.Error())
3005
-	} else {
3006
-		if exist {
3007
-			fmt.Println(dir + "文件夹已存在!")
3008
-		} else {
3009
-			// 文件夹名称,权限
3010
-			err := os.Mkdir(dir, os.ModePerm)
3011
-			if err != nil {
3012
-				fmt.Println(dir+"文件夹创建失败:", err.Error())
3013
-			} else {
3014
-				fmt.Println(dir + "文件夹创建成功!")
3015
-			}
3016
-		}
3017
-	}
3018
-}
3019
-
3020
-//压缩文件
3021
-func Zip(srcFile string, destZip string) error {
3022
-	zipfile, err := os.Create(destZip)
3023
-	if err != nil {
3024
-		return err
3025
-	}
3026
-	defer zipfile.Close()
3027
-
3028
-	archive := zip.NewWriter(zipfile)
3029
-	defer archive.Close()
3030
-
3031
-	filepath.Walk(srcFile, func(path string, info os.FileInfo, err error) error {
3032
-		if err != nil {
3033
-			return err
3034
-		}
3035
-
3036
-		header, err := zip.FileInfoHeader(info)
3037
-		if err != nil {
3038
-			return err
3039
-		}
3040
-
3041
-		header.Name = strings.TrimPrefix(path, filepath.Dir(srcFile)+"/")
3042
-		// header.Name = path
3043
-		if info.IsDir() {
3044
-			header.Name += "/"
3045
-		} else {
3046
-			header.Method = zip.Deflate
3047
-		}
3048
-
3049
-		writer, err := archive.CreateHeader(header)
3050
-		if err != nil {
3051
-			return err
3052
-		}
3053
-
3054
-		if !info.IsDir() {
3055
-			file, err := os.Open(path)
3056
-			if err != nil {
3057
-				return err
3058
-			}
3059
-			defer file.Close()
3060
-			_, err = io.Copy(writer, file)
3061
-		}
3062
-		return err
3063
-	})
3064
-
3065
-	return err
3066
-}
3067
-
3068
-func ReadFile(filePath string) []byte {
3069
-	f, err := os.Open(filePath)
3070
-	if err != nil {
3071
-		fmt.Println("read file fail", err)
3072
-		return nil
3073
-	}
3074
-	defer f.Close()
3075
-
3076
-	fd, err := ioutil.ReadAll(f)
3077
-	if err != nil {
3078
-		fmt.Println("read to fd fail", err)
3079
-		return nil
3080
-	}
3081
-
3082
-	return fd
3083
-}

+ 36 - 29
controllers/mobile_api_controllers/check_weight_api_controller.go View File

@@ -13,7 +13,7 @@ import (
13 13
 	"net/http"
14 14
 	"net/url"
15 15
 	"strconv"
16
-	_"strings"
16
+	_ "strings"
17 17
 
18 18
 	// "fmt"
19 19
 	_ "reflect"
@@ -619,20 +619,26 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
619 619
 			}
620 620
 
621 621
 			if lastPredialysisEvaluation != nil {
622
-				evaluation.BloodAccessPartId = lastPredialysisEvaluation.BloodAccessPartId
623
-				evaluation.BloodAccessPartOperaId = lastPredialysisEvaluation.BloodAccessPartOperaId
624
-				evaluation.AdditionalWeight = lastPredialysisEvaluation.AdditionalWeight
625
-				evaluation.Temperature = lastPredialysisEvaluation.Temperature
626
-				evaluation.BreathingRate = lastPredialysisEvaluation.BreathingRate
627
-				evaluation.Catheter = lastPredialysisEvaluation.Catheter
628
-				evaluation.InternalFistula = lastPredialysisEvaluation.InternalFistula
629
-				evaluation.PulseFrequency = lastPredialysisEvaluation.PulseFrequency
630
-				evaluation.Complication = lastPredialysisEvaluation.Complication
631
-				evaluation.LastPostDialysis = lastPredialysisEvaluation.LastPostDialysis
632
-				evaluation.DialysisInterphase = lastPredialysisEvaluation.DialysisInterphase
633
-				evaluation.SymptomBeforeDialysis = lastPredialysisEvaluation.SymptomBeforeDialysis
634
-				evaluation.PunctureNeedle = lastPredialysisEvaluation.PunctureNeedle
635
-				evaluation.PunctureWay = lastPredialysisEvaluation.PunctureWay
622
+				evaluation.BloodAccessPartId = lastPredialysisEvaluation.BloodAccessPartId           //血管通路部位
623
+				evaluation.BloodAccessPartOperaId = lastPredialysisEvaluation.BloodAccessPartOperaId //血管通路
624
+				evaluation.AdditionalWeight = lastPredialysisEvaluation.AdditionalWeight             //衣物重
625
+				evaluation.Temperature = lastPredialysisEvaluation.Temperature                       //温度
626
+				evaluation.BreathingRate = lastPredialysisEvaluation.BreathingRate                   //呼吸
627
+				evaluation.Catheter = lastPredialysisEvaluation.Catheter                             //导管
628
+				evaluation.InternalFistula = lastPredialysisEvaluation.InternalFistula               //内瘘
629
+				evaluation.PulseFrequency = lastPredialysisEvaluation.PulseFrequency                 //脉搏
630
+				evaluation.Complication = lastPredialysisEvaluation.Complication                     //并发症
631
+				evaluation.LastPostDialysis = lastPredialysisEvaluation.LastPostDialysis             //前次透析后症状
632
+				evaluation.DialysisInterphase = lastPredialysisEvaluation.DialysisInterphase         //透析期间
633
+				evaluation.SymptomBeforeDialysis = lastPredialysisEvaluation.SymptomBeforeDialysis   //透析前症状
634
+				evaluation.PunctureNeedle = lastPredialysisEvaluation.PunctureNeedle                 //穿刺针
635
+				evaluation.PunctureWay = lastPredialysisEvaluation.PunctureWay                       //穿刺方法
636
+
637
+				evaluation.InternalFistulaSkin = lastPredialysisEvaluation.InternalFistulaSkin //血透通路皮肤情况
638
+				evaluation.CatheterBend = lastPredialysisEvaluation.CatheterBend               //导管打折
639
+				evaluation.IsHemorrhage = lastPredialysisEvaluation.IsHemorrhage               //出血
640
+				evaluation.IsInfect = lastPredialysisEvaluation.IsInfect                       //感染
641
+				evaluation.Exposed = lastPredialysisEvaluation.Exposed                         // 外漏
636 642
 
637 643
 			}
638 644
 		} else {
@@ -696,40 +702,41 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
696 702
 	}
697 703
 }
698 704
 
699
-func (c *CheckWeightApiController) SetSyncTime(){
705
+func (c *CheckWeightApiController) SetSyncTime() {
700 706
 	sn := c.GetString("sn")
701
-	if len(sn)  > 0 {
707
+	if len(sn) > 0 {
702 708
 		redis := service.RedisClient()
703 709
 		defer redis.Close()
704
-		redis.Set(sn, 0,0)
710
+		redis.Set(sn, 0, 0)
705 711
 	}
706 712
 	serviceTime := time.Now().Unix()
707 713
 	c.ServeSuccessJSON(map[string]interface{}{
708
-		"status": 	1,
714
+		"status":      1,
709 715
 		"servicetime": serviceTime,
710 716
 	})
711 717
 }
712 718
 
713 719
 func (c *CheckWeightApiController) GetPatientList() {
714
-	ftype,_ := c.GetInt64("type",0)
720
+	ftype, _ := c.GetInt64("type", 0)
715 721
 	sn := c.GetString("sn")
716 722
 	syncTime := int64(0)
717 723
 
718 724
 	redis := service.RedisClient()
719 725
 	defer redis.Close()
720
-	if len(sn)  > 0 {
726
+	if len(sn) > 0 {
721 727
 		syncTimeStr, _ := redis.Get(sn).Result()
722
-		syncTime,_ = strconv.ParseInt(syncTimeStr, 10, 64)
728
+		syncTime, _ = strconv.ParseInt(syncTimeStr, 10, 64)
723 729
 	}
724 730
 
725 731
 	if ftype == 1 {
726 732
 		timeNow := time.Now().Unix()
727
-		redis.Set(sn, timeNow,0)
733
+		redis.Set(sn, timeNow, 0)
728 734
 	}
729 735
 
730 736
 	adminUserInfo := c.GetMobileAdminUserInfo()
731 737
 
732 738
 	patientList, total, error := service.GetPatientListByUpdateTime(adminUserInfo.Org.Id, int64(syncTime))
739
+	if len(patientList) > 0 {
733 740
 	need_update := 0
734 741
 	if syncTime ==  0 {
735 742
 		need_update = 1
@@ -741,7 +748,7 @@ func (c *CheckWeightApiController) GetPatientList() {
741 748
 	}
742 749
 	serviceTime := time.Now().Unix()
743 750
 	c.ServeSuccessJSON(map[string]interface{}{
744
-		"need_update" : need_update,
751
+		"need_update": need_update,
745 752
 		"patientlist": patientList,
746 753
 		"total":       total,
747 754
 		"servicetime": serviceTime,
@@ -780,7 +787,7 @@ func (c *CheckWeightApiController) GetPatientListForSchedules() {
780 787
 }
781 788
 
782 789
 func (c *CheckWeightApiController) GetPatientListForSchedulesFind() {
783
-	patient_name := c.GetString("patient_name")                   //脉率
790
+	patient_name := c.GetString("patient_name") //脉率
784 791
 	thisTime := time.Now()
785 792
 	scheduleDateStart := thisTime.Format("2006-01-02") + " 00:00:00"
786 793
 	timeLayout := "2006-01-02 15:04:05"
@@ -811,8 +818,8 @@ func (c *CheckWeightApiController) GetPatientListForSchedulesFind() {
811 818
 			"servicetime": serviceTime,
812 819
 		})
813 820
 	} else {
814
-		patientList, total, error := service.GetPatientListBySchedulesFind(adminUserInfo.Org.Id, syncTime,patient_name)
815
-		patientSchedule := make([]map[string]interface{},0)
821
+		patientList, total, error := service.GetPatientListBySchedulesFind(adminUserInfo.Org.Id, syncTime, patient_name)
822
+		patientSchedule := make([]map[string]interface{}, 0)
816 823
 		for _, item := range patientList {
817 824
 			if item.Patient.ID > 0 {
818 825
 				patientTemp := make(map[string]interface{})
@@ -923,12 +930,12 @@ func (c *CheckWeightApiController) GetPatientInfoDialysis() {
923 930
 		}
924 931
 
925 932
 		// 排队叫号的签到
926
-		go func (){
933
+		go func() {
927 934
 			ssoDomain := beego.AppConfig.String("call_domain")
928 935
 			api := ssoDomain + "/index/patientsign/" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + "/" + strconv.FormatInt(id, 10)
929 936
 			values := make(url.Values)
930 937
 			http.PostForm(api, values)
931
-		} ()
938
+		}()
932 939
 	} else {
933 940
 		nextSchedule, _ := service.GetNextSchedule(adminUserInfo.Org.Id, endTime, id)
934 941
 		if len(nextSchedule) <= 0 {

+ 27 - 4
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -251,7 +251,7 @@ func (this *DialysisAPIController) DialysisRecord() {
251 251
 	}
252 252
 
253 253
 	schedual, getSchedualErr := service.MobileGetSchedualDetail(adminInfo.Org.Id, patientID, date.Unix())
254
-	// this.TraceLog("==================================%+v", schedual)
254
+
255 255
 	if getSchedualErr != nil {
256 256
 		this.ErrorLog("获取患者排班信息失败:%v", getSchedualErr)
257 257
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -372,6 +372,9 @@ func (this *DialysisAPIController) DialysisRecord() {
372 372
 
373 373
 	_, is_open_config := service.FindXTHisRecordByOrgId(adminInfo.Org.Id)
374 374
 
375
+	stockType, _ := service.GetStockType(adminInfo.Org.Id)
376
+
377
+	prepare, _ := service.GetDialyStockOut(adminInfo.Org.Id, date.Unix(), patientID)
375 378
 	var his_advices []*models.HisDoctorAdviceInfo
376 379
 	if is_open_config.IsOpen == 1 {
377 380
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.Org.Id, patientID, date.Unix())
@@ -424,6 +427,8 @@ func (this *DialysisAPIController) DialysisRecord() {
424 427
 		"system_prescription":            systemDialysisPrescribe,
425 428
 		"his_advices":                    his_advices,
426 429
 		"is_open_config":                 is_open_config,
430
+		"stockType":                      stockType,
431
+		"prepare":                        prepare,
427 432
 	}
428 433
 	this.ServeSuccessJSON(returnData)
429 434
 }
@@ -1057,6 +1062,8 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1057 1062
 	anticoagulant_stop_time_hour, _ := c.GetInt64("anticoagulant_stop_time_hour", 0)
1058 1063
 	anticoagulant_stop_time_min, _ := c.GetInt64("anticoagulant_stop_time_min", 0)
1059 1064
 	blood := c.GetString("blood")
1065
+	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
1066
+	dialysis_irrigation := c.GetString("dialysis_irrigation")
1060 1067
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1061 1068
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1062 1069
 	//
@@ -1140,6 +1147,8 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1140 1147
 		AnticoagulantStopTimeHour:  anticoagulant_stop_time_hour,
1141 1148
 		AnticoagulantStopTimeMin:   anticoagulant_stop_time_min,
1142 1149
 		Blood:                      blood,
1150
+		DialysisDialyszers:         dialysis_dialyszers,
1151
+		DialysisIrrigation:         dialysis_irrigation,
1143 1152
 	}
1144 1153
 
1145 1154
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -1853,6 +1862,8 @@ func (c *DialysisAPIController) PostSolution() {
1853 1862
 	anticoagulant_stop_time_hour, _ := c.GetInt64("anticoagulant_stop_time_hour", 0)
1854 1863
 	anticoagulant_stop_time_min, _ := c.GetInt64("anticoagulant_stop_time_min", 0)
1855 1864
 	blood := c.GetString("blood")
1865
+	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
1866
+	dialysis_irrigation := c.GetString("dialysis_irrigation")
1856 1867
 	if mode_id > 0 {
1857 1868
 		service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
1858 1869
 	}
@@ -1937,6 +1948,8 @@ func (c *DialysisAPIController) PostSolution() {
1937 1948
 		AnticoagulantStopTimeMin:  anticoagulant_stop_time_min,
1938 1949
 		AnticoagulantStopTimeHour: anticoagulant_stop_time_hour,
1939 1950
 		Blood:                     blood,
1951
+		DialysisDialyszers:        dialysis_dialyszers,
1952
+		DialysisIrrigation:        dialysis_irrigation,
1940 1953
 	}
1941 1954
 
1942 1955
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -3005,7 +3018,8 @@ func (c *DialysisAPIController) CreateConsumables() {
3005 3018
 				}
3006 3019
 
3007 3020
 				count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
3008
-
3021
+				//commdity_code := items["commdity_code"].(string)
3022
+				//fmt.Println("新建22222222222222",commdity_code)
3009 3023
 				adminUser := c.GetMobileAdminUserInfo()
3010 3024
 				prepare := &models.DialysisBeforePrepare{
3011 3025
 					UserOrgId:  adminUser.Org.Id,
@@ -3018,6 +3032,7 @@ func (c *DialysisAPIController) CreateConsumables() {
3018 3032
 					Mtime:      time.Now().Unix(),
3019 3033
 					Creater:    adminUser.AdminUser.Id,
3020 3034
 					Modifier:   0,
3035
+					//CommdityCode:commdity_code,
3021 3036
 				}
3022 3037
 				record_count := service.FindDialysisBeforePrepare(prepare.PatientId, prepare.GoodId, prepare.GoodTypeId, adminUser.Org.Id, record_time)
3023 3038
 				if record_count == 0 {
@@ -3096,6 +3111,8 @@ func (c *DialysisAPIController) CreateConsumables() {
3096 3111
 				}
3097 3112
 				ctime := int64(items["ctime"].(float64))
3098 3113
 
3114
+				//commdity_code := items["commdity_code"].(string)
3115
+				//fmt.Println("commdityecode22222222222222222222",commdity_code)
3099 3116
 				prepare := &models.DialysisBeforePrepare{
3100 3117
 					ID:         id,
3101 3118
 					UserOrgId:  adminUser.Org.Id,
@@ -3109,6 +3126,7 @@ func (c *DialysisAPIController) CreateConsumables() {
3109 3126
 					Creater:    creater,
3110 3127
 					Modifier:   adminUser.AdminUser.Id,
3111 3128
 					Status:     1,
3129
+					//CommdityCode: commdity_code,
3112 3130
 				}
3113 3131
 				updateBeforePrepares = append(updateBeforePrepares, prepare)
3114 3132
 
@@ -3405,7 +3423,8 @@ func (c *DialysisAPIController) EditConsumables() {
3405 3423
 						return
3406 3424
 					}
3407 3425
 					ctime := int64(items["ctime"].(float64))
3408
-
3426
+					//commdity_code := items["commdity_code"].(string)
3427
+					//fmt.Println("commdityecode22222222222222222222",commdity_code)
3409 3428
 					adminUser := c.GetMobileAdminUserInfo()
3410 3429
 					prepare := &models.DialysisBeforePrepare{
3411 3430
 						ID:         id,
@@ -3420,6 +3439,7 @@ func (c *DialysisAPIController) EditConsumables() {
3420 3439
 						Creater:    creater,
3421 3440
 						Modifier:   adminUser.AdminUser.Id,
3422 3441
 						Status:     1,
3442
+						//CommdityCode: commdity_code,
3423 3443
 					}
3424 3444
 					beforePrepares = append(beforePrepares, prepare)
3425 3445
 
@@ -3456,7 +3476,8 @@ func (c *DialysisAPIController) EditConsumables() {
3456 3476
 					}
3457 3477
 
3458 3478
 					count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
3459
-
3479
+					//commdity_code := items["commdity_code"].(string)
3480
+					//fmt.Println("commdityecode22222222222222222222",commdity_code)
3460 3481
 					adminUser := c.GetMobileAdminUserInfo()
3461 3482
 					prepare := &models.DialysisBeforePrepare{
3462 3483
 						UserOrgId:  adminUser.Org.Id,
@@ -3469,6 +3490,7 @@ func (c *DialysisAPIController) EditConsumables() {
3469 3490
 						Mtime:      time.Now().Unix(),
3470 3491
 						Creater:    adminUser.AdminUser.Id,
3471 3492
 						Modifier:   0,
3493
+						//CommdityCode:commdity_code,
3472 3494
 					}
3473 3495
 					newBeforePrepares = append(newBeforePrepares, prepare)
3474 3496
 
@@ -4282,6 +4304,7 @@ func (c *DialysisAPIController) CreateOtherStockOutInfo() {
4282 4304
 						GoodTypeId:              item.GoodTypeId,
4283 4305
 						Count:                   item.Count,
4284 4306
 					}
4307
+
4285 4308
 					service.AddSigleAutoReduceRecordInfo(details)
4286 4309
 				}
4287 4310
 			}

+ 72 - 19
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -2363,6 +2363,27 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
2363 2363
 		evaluation.CatheterMaintenance = catheter_maintenance
2364 2364
 	}
2365 2365
 
2366
+	if dataBody["thromubus_type"] != nil && reflect.TypeOf(dataBody["thromubus_type"]).String() == "float64" {
2367
+
2368
+		thromubusType := int64(dataBody["thromubus_type"].(float64))
2369
+
2370
+		evaluation.ThromubusType = thromubusType
2371
+	}
2372
+
2373
+	if dataBody["thrombus_av"] != nil && reflect.TypeOf(dataBody["thrombus_av"]).String() == "string" {
2374
+		thrombus_av := dataBody["thrombus_av"].(string)
2375
+		evaluation.ThrombusAv = thrombus_av
2376
+	}
2377
+
2378
+	if dataBody["thromubus_a"] != nil && reflect.TypeOf(dataBody["thromubus_a"]).String() == "string" {
2379
+		thromubus_a := dataBody["thromubus_a"].(string)
2380
+		evaluation.ThromubusA = thromubus_a
2381
+	}
2382
+
2383
+	if dataBody["thromubus_v"] != nil && reflect.TypeOf(dataBody["thromubus_v"]).String() == "string" {
2384
+		thromubus_v := dataBody["thromubus_v"].(string)
2385
+		evaluation.ThromubusV = thromubus_v
2386
+	}
2366 2387
 	return
2367 2388
 }
2368 2389
 
@@ -2686,6 +2707,7 @@ func (c *PatientApiController) GetRecords() {
2686 2707
 func (c *PatientApiController) GetPatientMonitor() {
2687 2708
 	partition, _ := c.GetInt64("partition")
2688 2709
 	monitorDate := c.GetString("date")
2710
+	patient_id, _ := c.GetInt64("patient_id")
2689 2711
 
2690 2712
 	timeLayout := "2006-01-02"
2691 2713
 	loc, _ := time.LoadLocation("Local")
@@ -2700,10 +2722,16 @@ func (c *PatientApiController) GetPatientMonitor() {
2700 2722
 	}
2701 2723
 	adminInfo := c.GetMobileAdminUserInfo()
2702 2724
 	orgID := adminInfo.Org.Id
2703
-	monitor, err := service.GetMonitorRecord(orgID, theStartTime, partition)
2725
+	monitor, err := service.GetMonitorRecord(orgID, theStartTime, partition, patient_id)
2726
+	//获取患者的透析次数
2727
+	count, err := service.GetDialysisCount(orgID, partition)
2728
+
2729
+	patients, err := service.GetAllpatient(orgID)
2704 2730
 	if err == nil {
2705 2731
 		c.ServeSuccessJSON(map[string]interface{}{
2706
-			"monitor": monitor,
2732
+			"monitor":      monitor,
2733
+			"patientCount": count,
2734
+			"patients":     patients,
2707 2735
 		})
2708 2736
 	} else {
2709 2737
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -2904,23 +2932,48 @@ func (c *PatientApiController) GetPrintDialysisOrder() {
2904 2932
 	check, _ := service.FindDoubleCheckById(adminUserInfo.Org.Id, patientInfo.ID, xttime)
2905 2933
 
2906 2934
 	dialysiscount, err := service.GetDialysisCountByPatientId(firstMonthDate, xttime, patientInfo.ID, adminUserInfo.Org.Id)
2907
-	c.ServeSuccessJSON(map[string]interface{}{
2908
-		"users":                   adminUser,
2909
-		"patientInfo":             patientInfo,
2910
-		"PredialysisEvaluation":   PredialysisEvaluation,
2911
-		"AssessmentAfterDislysis": AssessmentAfterDislysis,
2912
-		"dialysisPrescription":    dialysisPrescription,
2913
-		"advices":                 DoctorAdvice,
2914
-		"monitors":                Record,
2915
-		"summary":                 TreatmentSummary,
2916
-		"receiverTreatmentAccess": receiverTreatmentAccess,
2917
-		"dialysisOrder":           dialysisOrder,
2918
-		"operators":               operators,
2919
-		"org_template_info":       templateInfo,
2920
-		"check":                   check,
2921
-		"dialysiscount":           dialysiscount,
2922
-		"last_order":              last_order,
2923
-	})
2935
+
2936
+	config, err := service.GetHisDoctorConfig(adminUserInfo.Org.Id)
2937
+	hisAdvice, err := service.GetHisDoctorPatientById(adminUserInfo.Org.Id, patientInfo.ID, xttime)
2938
+	if config.IsOpen == 1 {
2939
+		c.ServeSuccessJSON(map[string]interface{}{
2940
+			"users":                   adminUser,
2941
+			"patientInfo":             patientInfo,
2942
+			"PredialysisEvaluation":   PredialysisEvaluation,
2943
+			"AssessmentAfterDislysis": AssessmentAfterDislysis,
2944
+			"dialysisPrescription":    dialysisPrescription,
2945
+			"advices":                 hisAdvice,
2946
+			"monitors":                Record,
2947
+			"summary":                 TreatmentSummary,
2948
+			"receiverTreatmentAccess": receiverTreatmentAccess,
2949
+			"dialysisOrder":           dialysisOrder,
2950
+			"operators":               operators,
2951
+			"org_template_info":       templateInfo,
2952
+			"check":                   check,
2953
+			"dialysiscount":           dialysiscount,
2954
+			"last_order":              last_order,
2955
+		})
2956
+	}
2957
+
2958
+	if config.IsOpen == 0 || config.IsOpen == 2 {
2959
+		c.ServeSuccessJSON(map[string]interface{}{
2960
+			"users":                   adminUser,
2961
+			"patientInfo":             patientInfo,
2962
+			"PredialysisEvaluation":   PredialysisEvaluation,
2963
+			"AssessmentAfterDislysis": AssessmentAfterDislysis,
2964
+			"dialysisPrescription":    dialysisPrescription,
2965
+			"advices":                 DoctorAdvice,
2966
+			"monitors":                Record,
2967
+			"summary":                 TreatmentSummary,
2968
+			"receiverTreatmentAccess": receiverTreatmentAccess,
2969
+			"dialysisOrder":           dialysisOrder,
2970
+			"operators":               operators,
2971
+			"org_template_info":       templateInfo,
2972
+			"check":                   check,
2973
+			"dialysiscount":           dialysiscount,
2974
+			"last_order":              last_order,
2975
+		})
2976
+	}
2924 2977
 
2925 2978
 }
2926 2979
 

+ 15 - 1
controllers/stock_in_api_controller.go View File

@@ -65,6 +65,8 @@ func StockManagerApiRegistRouters() {
65 65
 	beego.Router("/api/warehouseout/user", &StockManagerApiController{}, "get:GetUserDetailInfo")
66 66
 
67 67
 	beego.Router("/api/warehouseout/postsearchstock", &StockManagerApiController{}, "Get:PostSearchStock")
68
+
69
+	beego.Router("/api/warehouseout/getoutstocktotalcount", &StockManagerApiController{}, "Get:GetOutStockTotalCount")
68 70
 }
69 71
 
70 72
 func (c *StockManagerApiController) CreateWarehouse() {
@@ -1965,7 +1967,6 @@ func (this *StockManagerApiController) GetUserDetailInfo() {
1965 1967
 func (this *StockManagerApiController) PostSearchStock() {
1966 1968
 
1967 1969
 	keyword := this.GetString("keyword")
1968
-	fmt.Println("keyword2222222222222", keyword)
1969 1970
 	adminUserInfo := this.GetAdminUserInfo()
1970 1971
 	orgId := adminUserInfo.CurrentOrgId
1971 1972
 	stock, err := service.PostSearchStock(keyword, orgId)
@@ -1976,3 +1977,16 @@ func (this *StockManagerApiController) PostSearchStock() {
1976 1977
 		"stock": stock,
1977 1978
 	})
1978 1979
 }
1980
+
1981
+func (this *StockManagerApiController) GetOutStockTotalCount() {
1982
+
1983
+	warehouseOutTime, _ := this.GetInt64("warehouse_out_time")
1984
+	adminUserInfo := this.GetAdminUserInfo()
1985
+	stockCount, err := service.GetOutStockTotalCount(warehouseOutTime, adminUserInfo.CurrentOrgId)
1986
+	if err != nil {
1987
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDeleteFail)
1988
+	}
1989
+	this.ServeSuccessJSON(map[string]interface{}{
1990
+		"stockCount": stockCount,
1991
+	})
1992
+}

+ 34 - 12
models/dialysis.go View File

@@ -276,6 +276,10 @@ type PredialysisEvaluation struct {
276 276
 	Edema                          string  `gorm:"column:edema" json:"edema" form:"edema"`
277 277
 	SpecialTreatment               string  `gorm:"column:special_treatment" json:"special_treatment" form:"special_treatment"`
278 278
 	CatheterMaintenance            string  `gorm:"column:catheter_maintenance" json:"catheter_maintenance" form:"catheter_maintenance"`
279
+	ThromubusType                  int64   `gorm:"column:thromubus_type" json:"thromubus_type" form:"thromubus_type"`
280
+	ThrombusAv                     string  `gorm:"column:thrombus_av" json:"thrombus_av" form:"thrombus_av"`
281
+	ThromubusA                     string  `gorm:"column:thromubus_a" json:"thromubus_a" form:"thromubus_a"`
282
+	ThromubusV                     string  `gorm:"column:thromubus_v" json:"thromubus_v" form:"thromubus_v"`
279 283
 }
280 284
 
281 285
 func (PredialysisEvaluation) TableName() string {
@@ -940,18 +944,19 @@ type UserAdminRoles struct {
940 944
 }
941 945
 
942 946
 type DialysisBeforePrepare struct {
943
-	ID         int64 `gorm:"column:id" json:"id" form:"id"`
944
-	UserOrgId  int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
945
-	PatientId  int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
946
-	RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
947
-	GoodId     int64 `gorm:"column:good_id" json:"good_id" form:"good_id"`
948
-	GoodTypeId int64 `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
949
-	Count      int64 `gorm:"column:count" json:"count" form:"count"`
950
-	Ctime      int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
951
-	Mtime      int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
952
-	Creater    int64 `gorm:"column:creater" json:"creater" form:"creater"`
953
-	Modifier   int64 `gorm:"column:modifier" json:"modifier" form:"modifier"`
954
-	Status     int64 `gorm:"column:status" json:"status" form:"status"`
947
+	ID           int64  `gorm:"column:id" json:"id" form:"id"`
948
+	UserOrgId    int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
949
+	PatientId    int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
950
+	RecordDate   int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
951
+	GoodId       int64  `gorm:"column:good_id" json:"good_id" form:"good_id"`
952
+	GoodTypeId   int64  `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
953
+	Count        int64  `gorm:"column:count" json:"count" form:"count"`
954
+	Ctime        int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
955
+	Mtime        int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
956
+	Creater      int64  `gorm:"column:creater" json:"creater" form:"creater"`
957
+	Modifier     int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
958
+	Status       int64  `gorm:"column:status" json:"status" form:"status"`
959
+	CommdityCode string `gorm:"column:commdity_code" json:"commdity_code" form:"commdity_code"`
955 960
 }
956 961
 
957 962
 func (DialysisBeforePrepare) TableName() string {
@@ -977,3 +982,20 @@ type QueueCallConfig struct {
977 982
 func (QueueCallConfig) TableName() string {
978 983
 	return "xt_queue_call_config"
979 984
 }
985
+
986
+type XtDialysisBeforePrepare struct {
987
+	ID                int64  `gorm:"column:id" json:"id" form:"id"`
988
+	UserOrgId         int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
989
+	PatientId         int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
990
+	RecordDate        int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
991
+	GoodId            int64  `gorm:"column:good_id" json:"good_id" form:"good_id"`
992
+	GoodTypeId        int64  `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
993
+	Count             int64  `gorm:"column:count" json:"count" form:"count"`
994
+	Ctime             int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
995
+	Mtime             int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
996
+	Creater           int64  `gorm:"column:creater" json:"creater" form:"creater"`
997
+	Modifier          int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
998
+	Status            int64  `gorm:"column:status" json:"status" form:"status"`
999
+	CommdityCode      string `gorm:"column:commdity_code" json:"commdity_code" form:"commdity_code"`
1000
+	SpecificationName string `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
1001
+}

+ 5 - 0
models/dialysis_parameter_models.go View File

@@ -148,3 +148,8 @@ type PredialysisEvaluationParameter struct {
148 148
 func (PredialysisEvaluationParameter) TableName() string {
149 149
 	return "xt_assessment_before_dislysis"
150 150
 }
151
+
152
+type NewXtAutomaticReduceDetail struct {
153
+	GoodId int64 `gorm:"column:good_id" json:"good_id" form:"good_id"`
154
+	Count  int64 `gorm:"column:count" json:"count" form:"count"`
155
+}

+ 1 - 0
models/good_models.go View File

@@ -66,6 +66,7 @@ type GoodInfo struct {
66 66
 	Agent                  string    `gorm:"column:agent" json:"agent" form:"agent"`
67 67
 	GoodNumber             string    `gorm:"column:good_number" json:"good_number" form:"good_number"`
68 68
 	GoodsType              GoodsType `gorm:"ForeignKey:ID;AssociationForeignKey:GoodTypeId" json:"type"`
69
+	CommdityCode           string    `gorm:"column:commdity_code" json:"commdity_code" form:"commdity_code"`
69 70
 }
70 71
 
71 72
 func (GoodInfo) TableName() string {

+ 51 - 50
models/his_models.go View File

@@ -167,56 +167,57 @@ func (HisCaseHistoryTemplate) TableName() string {
167 167
 }
168 168
 
169 169
 type HisDoctorAdviceInfo struct {
170
-	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
171
-	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
172
-	PatientId             int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
173
-	HisPatientId          int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
174
-	AdviceType            int64   `gorm:"column:advice_type" json:"advice_type" form:"advice_type"`
175
-	AdviceDate            int64   `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
176
-	StartTime             int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
177
-	AdviceName            string  `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
178
-	AdviceDesc            string  `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
179
-	ReminderDate          int64   `gorm:"column:reminder_date" json:"reminder_date" form:"reminder_date"`
180
-	SingleDose            float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
181
-	SingleDoseUnit        string  `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
182
-	PrescribingNumber     float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
183
-	PrescribingNumberUnit string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
184
-	DeliveryWay           string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
185
-	ExecutionFrequency    string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
186
-	AdviceDoctor          int64   `gorm:"column:advice_doctor" json:"advice_doctor" form:"advice_doctor"`
187
-	Status                int64   `gorm:"column:status" json:"status" form:"status"`
188
-	CreatedTime           int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
189
-	UpdatedTime           int64   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
190
-	AdviceAffirm          string  `gorm:"column:advice_affirm" json:"advice_affirm" form:"advice_affirm"`
191
-	Remark                string  `gorm:"column:remark" json:"remark" form:"remark"`
192
-	StopTime              int64   `gorm:"column:stop_time" json:"stop_time" form:"stop_time"`
193
-	StopReason            string  `gorm:"column:stop_reason" json:"stop_reason" form:"stop_reason"`
194
-	StopDoctor            int64   `gorm:"column:stop_doctor" json:"stop_doctor" form:"stop_doctor"`
195
-	StopState             int64   `gorm:"column:stop_state" json:"stop_state" form:"stop_state"`
196
-	ParentId              int64   `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
197
-	ExecutionTime         int64   `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
198
-	ExecutionStaff        int64   `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
199
-	ExecutionState        int64   `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
200
-	Checker               int64   `gorm:"column:checker" json:"checker" form:"checker"`
201
-	RecordDate            int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
202
-	DialysisOrderId       int64   `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
203
-	CheckTime             int64   `gorm:"column:check_time" json:"check_time" form:"check_time"`
204
-	CheckState            int64   `gorm:"column:check_state" json:"check_state" form:"check_state"`
205
-	DrugSpec              float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
206
-	DrugSpecUnit          string  `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
207
-	Groupno               int64   `gorm:"column:groupno" json:"groupno" form:"groupno"`
208
-	RemindType            int64   `gorm:"column:remind_type" json:"remind_type" form:"remind_type"`
209
-	FrequencyType         int64   `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
210
-	DayCount              int64   `gorm:"column:day_count" json:"day_count" form:"day_count"`
211
-	WeekDay               string  `gorm:"column:week_day" json:"week_day" form:"week_day"`
212
-	TemplateId            string  `gorm:"column:template_id" json:"template_id" form:"template_id"`
213
-	Modifier              int64   `gorm:"column:modifier" json:"modifier" form:"modifier"`
214
-	DrugId                int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
215
-	Price                 float64 `gorm:"column:price" json:"price" form:"price"`
216
-	PrescriptionId        int64   `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
217
-	MedListCodg           string  `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
218
-	FeedetlSn             string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
219
-	Day                   int64   `gorm:"column:day" json:"day" form:"day"`
170
+	ID                    int64                  `gorm:"column:id" json:"id" form:"id"`
171
+	UserOrgId             int64                  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
172
+	PatientId             int64                  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
173
+	HisPatientId          int64                  `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
174
+	AdviceType            int64                  `gorm:"column:advice_type" json:"advice_type" form:"advice_type"`
175
+	AdviceDate            int64                  `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
176
+	StartTime             int64                  `gorm:"column:start_time" json:"start_time" form:"start_time"`
177
+	AdviceName            string                 `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
178
+	AdviceDesc            string                 `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
179
+	ReminderDate          int64                  `gorm:"column:reminder_date" json:"reminder_date" form:"reminder_date"`
180
+	SingleDose            float64                `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
181
+	SingleDoseUnit        string                 `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
182
+	PrescribingNumber     float64                `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
183
+	PrescribingNumberUnit string                 `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
184
+	DeliveryWay           string                 `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
185
+	ExecutionFrequency    string                 `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
186
+	AdviceDoctor          int64                  `gorm:"column:advice_doctor" json:"advice_doctor" form:"advice_doctor"`
187
+	Status                int64                  `gorm:"column:status" json:"status" form:"status"`
188
+	CreatedTime           int64                  `gorm:"column:created_time" json:"created_time" form:"created_time"`
189
+	UpdatedTime           int64                  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
190
+	AdviceAffirm          string                 `gorm:"column:advice_affirm" json:"advice_affirm" form:"advice_affirm"`
191
+	Remark                string                 `gorm:"column:remark" json:"remark" form:"remark"`
192
+	StopTime              int64                  `gorm:"column:stop_time" json:"stop_time" form:"stop_time"`
193
+	StopReason            string                 `gorm:"column:stop_reason" json:"stop_reason" form:"stop_reason"`
194
+	StopDoctor            int64                  `gorm:"column:stop_doctor" json:"stop_doctor" form:"stop_doctor"`
195
+	StopState             int64                  `gorm:"column:stop_state" json:"stop_state" form:"stop_state"`
196
+	ParentId              int64                  `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
197
+	ExecutionTime         int64                  `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
198
+	ExecutionStaff        int64                  `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
199
+	ExecutionState        int64                  `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
200
+	Checker               int64                  `gorm:"column:checker" json:"checker" form:"checker"`
201
+	RecordDate            int64                  `gorm:"column:record_date" json:"record_date" form:"record_date"`
202
+	DialysisOrderId       int64                  `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
203
+	CheckTime             int64                  `gorm:"column:check_time" json:"check_time" form:"check_time"`
204
+	CheckState            int64                  `gorm:"column:check_state" json:"check_state" form:"check_state"`
205
+	DrugSpec              float64                `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
206
+	DrugSpecUnit          string                 `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
207
+	Groupno               int64                  `gorm:"column:groupno" json:"groupno" form:"groupno"`
208
+	RemindType            int64                  `gorm:"column:remind_type" json:"remind_type" form:"remind_type"`
209
+	FrequencyType         int64                  `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
210
+	DayCount              int64                  `gorm:"column:day_count" json:"day_count" form:"day_count"`
211
+	WeekDay               string                 `gorm:"column:week_day" json:"week_day" form:"week_day"`
212
+	TemplateId            string                 `gorm:"column:template_id" json:"template_id" form:"template_id"`
213
+	Modifier              int64                  `gorm:"column:modifier" json:"modifier" form:"modifier"`
214
+	DrugId                int64                  `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
215
+	Price                 float64                `gorm:"column:price" json:"price" form:"price"`
216
+	PrescriptionId        int64                  `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
217
+	MedListCodg           string                 `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
218
+	FeedetlSn             string                 `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
219
+	Day                   int64                  `gorm:"column:day" json:"day" form:"day"`
220
+	ChildDoctorAdvice     []*HisDoctorAdviceInfo `gorm:"ForeignKey:ParentId;AssociationForeignKey:ID" json:"child"`
220 221
 }
221 222
 
222 223
 func (HisDoctorAdviceInfo) TableName() string {

+ 7 - 6
models/new_monitor.go View File

@@ -20,7 +20,7 @@ type NewVMMonitorDialysisSchedule struct {
20 20
 	Prescription             VMDialysisPrescription    `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
21 21
 	AssessmentBeforeDislysis VMPredialysisEvaluation   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_before_dislysis"`
22 22
 	AssessmentAfterDislysis  VMAssessmentAfterDislysis `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_after_dislysis"`
23
-	MonitoringRecord         []VMMonitoringRecord      `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
23
+	MonitoringRecord         []VMMonitoringRecord      `gorm:"ForeignKey:PatientId,MonitoringDate;AssociationForeignKey:PatientId,ScheduleDate" json:"monitoring_record"`
24 24
 }
25 25
 
26 26
 func (NewVMMonitorDialysisSchedule) TableName() string {
@@ -28,11 +28,12 @@ func (NewVMMonitorDialysisSchedule) TableName() string {
28 28
 }
29 29
 
30 30
 type VMMonitorPatients struct {
31
-	ID         int64  `gorm:"column:id" json:"id" form:"id"`
32
-	UserOrgId  int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
33
-	Name       string `gorm:"column:name" json:"name" form:"name"`
34
-	Status     int64  `gorm:"column:status" json:"status" form:"status"`
35
-	DialysisNo string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
31
+	ID                 int64  `gorm:"column:id" json:"id" form:"id"`
32
+	UserOrgId          int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
33
+	Name               string `gorm:"column:name" json:"name" form:"name"`
34
+	Status             int64  `gorm:"column:status" json:"status" form:"status"`
35
+	DialysisNo         string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
36
+	UserSysBeforeCount int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
36 37
 }
37 38
 
38 39
 func (VMMonitorPatients) TableName() string {

+ 2 - 0
models/patient_models.go View File

@@ -225,6 +225,8 @@ type DialysisPrescription struct {
225 225
 	AnticoagulantStopTimeMin   int64         `gorm:"column:anticoagulant_stop_time_min" json:"anticoagulant_stop_time_min" form:"anticoagulant_stop_time_min"`
226 226
 	AnticoagulantStopTimeHour  int64         `gorm:"column:anticoagulant_stop_time_hour" json:"anticoagulant_stop_time_hour" form:"anticoagulant_stop_time_hour"`
227 227
 	Blood                      string        `gorm:"column:blood" json:"blood"`
228
+	DialysisDialyszers         string        `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
229
+	DialysisIrrigation         string        `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
228 230
 }
229 231
 
230 232
 func (DialysisPrescription) TableName() string {

+ 4 - 4
service/dialysis_service.go View File

@@ -1055,11 +1055,11 @@ func CreateDialysisBeforePrepare(beforePrepares []*models.DialysisBeforePrepare)
1055 1055
 	if len(beforePrepares) > 0 {
1056 1056
 		utx := writeDb.Begin()
1057 1057
 		if len(beforePrepares) > 0 {
1058
-			thisSQL := "INSERT INTO dialysis_before_prepare (user_org_id, patient_id, record_date, good_id, good_type_id,count,ctime,mtime,creater,modifier,status) VALUES "
1058
+			thisSQL := "INSERT INTO dialysis_before_prepare (user_org_id, patient_id, record_date, good_id, good_type_id,count,ctime,mtime,creater,modifier,status,commdity_code) VALUES "
1059 1059
 			insertParams := make([]string, 0)
1060 1060
 			insertData := make([]interface{}, 0)
1061 1061
 			for _, prepare := range beforePrepares {
1062
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?)")
1062
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?)")
1063 1063
 				insertData = append(insertData, prepare.UserOrgId)
1064 1064
 				insertData = append(insertData, prepare.PatientId)
1065 1065
 				insertData = append(insertData, prepare.RecordDate)
@@ -1071,7 +1071,7 @@ func CreateDialysisBeforePrepare(beforePrepares []*models.DialysisBeforePrepare)
1071 1071
 				insertData = append(insertData, prepare.Creater)
1072 1072
 				insertData = append(insertData, prepare.Modifier)
1073 1073
 				insertData = append(insertData, 1)
1074
-
1074
+				insertData = append(insertData, prepare.CommdityCode)
1075 1075
 			}
1076 1076
 			thisSQL += strings.Join(insertParams, ", ")
1077 1077
 			err = utx.Exec(thisSQL, insertData...).Error
@@ -1094,7 +1094,7 @@ func UpdateDialysisBeforePrepare(info *models.DialysisBeforePrepare) (err error)
1094 1094
 func UpdateDialysisBeforePrepareTwo(info *models.DialysisBeforePrepare) (err error) {
1095 1095
 	err = writeDb.Model(&models.DialysisBeforePrepare{}).
1096 1096
 		Where("status = 1 AND good_id = ? AND good_type_id = ? AND patient_id = ? AND user_org_id = ? AND record_date = ?", info.GoodId, info.GoodTypeId, info.PatientId, info.UserOrgId, info.RecordDate).
1097
-		Updates(map[string]interface{}{"count": info.Count, "updated_time": time.Now().Unix(), "modifier": info.Modifier}).Error
1097
+		Updates(map[string]interface{}{"count": info.Count, "updated_time": time.Now().Unix(), "modifier": info.Modifier, "commdity_code": info.CommdityCode}).Error
1098 1098
 
1099 1099
 	return err
1100 1100
 }

+ 49 - 10
service/drug_stock_service.go View File

@@ -90,17 +90,56 @@ func (DrugStockInfo) TableName() string {
90 90
 	return "xt_base_drug"
91 91
 }
92 92
 
93
-func FindAllDrugStockInfo(orgId int64, page int64, limit int64, keyword string) (list []*DrugStockInfo, total int64, err error) {
93
+func FindAllDrugStockInfo(orgId int64, page int64, limit int64, keyword string, drugCategory int64, startTime int64, endTime int64) (list []*DrugStockInfo, total int64, err error) {
94 94
 	db := readDb.Model(&DrugStockInfo{})
95
-	db = db.Where("xt_base_drug.org_id = ? AND xt_base_drug.status = 1", orgId)
96
-	db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
97
-		return db.Where("org_id = ? AND status = 1", orgId)
98
-	})
99
-	db = db.Preload("QuerySalesReturnInfo", "org_id = ? AND status = 1", orgId)
100
-	db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
101
-		return db.Where("org_id = ? AND status = 1", orgId)
102
-	})
103
-	db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1", orgId)
95
+	if drugCategory > 0 {
96
+		db = db.Where("xt_base_drug.org_id = ? AND xt_base_drug.status = 1 AND xt_base_drug.drug_category = ?", orgId, drugCategory)
97
+	} else {
98
+		db = db.Where("xt_base_drug.org_id = ? AND xt_base_drug.status = 1", orgId)
99
+	}
100
+
101
+	if startTime > 0 {
102
+		db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
103
+			return db.Where("org_id = ? AND status = 1 and ctime >=?", orgId, startTime)
104
+		})
105
+		db = db.Preload("QuerySalesReturnInfo", "org_id = ? AND status = 1 and ctime>=?", orgId, startTime)
106
+		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
107
+			return db.Where("org_id = ? AND status = 1 and sys_record_time>=?", orgId, startTime)
108
+		})
109
+		db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1 and ctime>=?", orgId, startTime)
110
+	} else {
111
+
112
+		db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
113
+			return db.Where("org_id = ? AND status = 1", orgId)
114
+		})
115
+		db = db.Preload("QuerySalesReturnInfo", "org_id = ? AND status = 1", orgId)
116
+		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
117
+			return db.Where("org_id = ? AND status = 1", orgId)
118
+		})
119
+		db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1", orgId)
120
+	}
121
+
122
+	if endTime > 0 {
123
+		db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
124
+			return db.Where("org_id = ? AND status = 1 and ctime>=? and ctime <=?", orgId, startTime, endTime)
125
+		})
126
+		db = db.Preload("QuerySalesReturnInfo", "org_id = ? AND status = 1 and ctime>=? and ctime<=?", orgId, startTime, endTime)
127
+		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
128
+			return db.Where("org_id = ? AND status = 1 and sys_record_time<=?", orgId, endTime)
129
+		})
130
+		db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1 and ctime >=? and ctime<=?", orgId, startTime, endTime)
131
+	} else {
132
+
133
+		db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
134
+			return db.Where("org_id = ? AND status = 1", orgId)
135
+		})
136
+		db = db.Preload("QuerySalesReturnInfo", "org_id = ? AND status = 1", orgId)
137
+		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
138
+			return db.Where("org_id = ? AND status = 1", orgId)
139
+		})
140
+		db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1", orgId)
141
+	}
142
+
104 143
 	if len(keyword) > 0 {
105 144
 		likeKey := "%" + keyword + "%"
106 145
 		db = db.Where("xt_base_drug.drug_name LIKE ? OR xt_base_drug.drug_spec LIKE ?", likeKey, likeKey)

+ 1 - 1
service/manage_service.go View File

@@ -901,7 +901,7 @@ func GetTimeLastData(equitid int64, orgId int64) (models.DeviceInformation, erro
901 901
 }
902 902
 
903 903
 func GetAllpatient(orgid int64) (patients []*models.Patients, err error) {
904
-	err = XTReadDB().Where("user_org_id = ?", orgid).Find(&patients).Error
904
+	err = XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&patients).Error
905 905
 	return patients, err
906 906
 }
907 907
 

+ 17 - 1
service/mobile_dialysis_service.go View File

@@ -1529,7 +1529,7 @@ func MobileGetDialysisGoods(orgID int64, scheduleDate int64, schedule_type int64
1529 1529
 			return db.Preload("VMGoodInfo", "status = 1 AND org_id = ?", orgID).Preload("GoodsType", "status = 1 AND (org_id = ? OR org_id = 0) ", orgID).Where("status = 1 AND user_org_id = ? AND record_date = ?  AND count > 0 ", orgID, scheduleDate)
1530 1530
 		}).
1531 1531
 		Preload("AutomaticReduceDetail", func(db *gorm.DB) *gorm.DB {
1532
-			return db.Preload("VMGoodInfo", "status = 1 AND org_id = ? ", orgID).Preload("GoodsType", "status = 1 AND (org_id = ? OR org_id = 0)  ", orgID).Where("status = 1 AND org_id = ? AND count > 0 AND record_time >= ? AND record_time <= ?  ", orgID, scheduleDate, end_time)
1532
+			return db.Preload("VMGoodInfo", "status = 1 AND org_id = ? ", orgID).Preload("GoodsType", "status = 1 AND (org_id = ? OR org_id = 0)  ", orgID).Where("status = 1 AND org_id = ? AND count > 0 AND record_time >= ? AND record_time <= ?  ", orgID, scheduleDate, end_time).Group("patient_id,good_id")
1533 1533
 		}).Where("sch.status = 1 AND sch.user_org_id = ?", orgID)
1534 1534
 	if scheduleDate != 0 {
1535 1535
 		db = db.Where("schedule_date = ?", scheduleDate)
@@ -1710,3 +1710,19 @@ func GetHisDoctorConfig(orgid int64) (models.XtHisConfig, error) {
1710 1710
 	err := XTReadDB().Model(&config).Where("user_org_id = ? and status =1", orgid).Find(&config).Error
1711 1711
 	return config, err
1712 1712
 }
1713
+
1714
+func GetHisDoctorPatientById(orgid int64, patientid int64, recordtime int64) (advice []*models.HisDoctorAdviceInfo, err error) {
1715
+
1716
+	db := XTReadDB().Table("his_doctor_advice_info as x").Where("x.status = 1")
1717
+	if orgid > 0 {
1718
+		db = db.Where("x.user_org_id = ?", orgid)
1719
+	}
1720
+	if patientid > 0 {
1721
+		db = db.Where("x.patient_id =?", patientid)
1722
+	}
1723
+	if recordtime > 0 {
1724
+		db = db.Where("x.advice_date = ?", recordtime)
1725
+	}
1726
+	err = db.Select("x.id,x.user_org_id,x.patient_id,x.his_patient_id,x.advice_type,x.advice_date,x.start_time,x.advice_name,x.advice_desc,x.reminder_date,x.single_dose,x.single_dose_unit,x.single_dose_unit,x.prescribing_number_unit,x.prescribing_number,x.delivery_way,x.execution_frequency,x.advice_doctor,x.status,x.advice_affirm,x.remark,x.stop_time,x.stop_reason,x.stop_doctor,x.stop_state,x.parent_id,x.execution_time,x.execution_staff,x.checker,x.record_date,x.dialysis_order_id,x.check_time,x.check_state,x.drug_spec,x.drug_spec_unit,x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.template_id,x.modifier,x.drug_id,x.price,x.prescription_id,x.med_list_codg,x.feedetl_sn,x.day").Find(&advice).Error
1727
+	return advice, err
1728
+}

+ 66 - 23
service/patient_service.go View File

@@ -82,9 +82,9 @@ func GetAllPatientList(orgID int64) (patients []*models.Patients, total int64, e
82 82
 
83 83
 func GetPatientListByUpdateTime(orgID int64, syncTime int64) (patients []*models.PatientListForFaceList, total int64, err error) {
84 84
 	db := readDb.Model(&models.PatientListForFaceList{}).Where("user_org_id=?  AND  status=1  AND  avatar <> 'https://images.shengws.com/201809182128222.png' AND avatar <> 'https://images.shengws.com/201809182128111.png' AND avatar <> ''", orgID)
85
-	
86
-		db = db.Where("updated_time >= ?", syncTime)
87
-	
85
+
86
+	db = db.Where("updated_time >= ?", syncTime)
87
+
88 88
 	err = db.Count(&total).Find(&patients).Error
89 89
 	return
90 90
 }
@@ -1013,28 +1013,58 @@ func GetPatientScheduleList(orgID int64, patientID int64, page int64, limit int6
1013 1013
 	return
1014 1014
 }
1015 1015
 
1016
-func GetMonitorRecord(orgID int64, date int64, partition int64) ([]*models.NewVMMonitorDialysisSchedule, error) {
1016
+func GetMonitorRecord(orgID int64, date int64, partition int64, patientId int64) ([]*models.NewVMMonitorDialysisSchedule, error) {
1017 1017
 	var mds []*models.NewVMMonitorDialysisSchedule
1018
-	db := readDb.
1019
-		Model(&models.NewVMMonitorDialysisSchedule{}).
1020
-		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
1021
-		Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).
1022
-		Preload("TreatmentMode", "status = 1").
1023
-		Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, date).
1024
-		Preload("AssessmentBeforeDislysis", "status = 1 AND  user_org_id = ? AND assessment_date = ?", orgID, date).
1025
-		Preload("AssessmentAfterDislysis", "status = 1 AND  user_org_id = ? AND assessment_date = ? ", orgID, date).
1026
-		Preload("MonitoringRecord", "status = 1 AND  user_org_id = ? AND monitoring_date = ?", orgID, date).
1027
-		Preload("DialysisOrder", "status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, date).
1028
-		Preload("DialysisOrder.DeviceNumber", "status = 1 AND  org_id = ?", orgID).
1029
-		Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID).
1030
-		Where("status = 1 AND user_org_id = ?", orgID)
1031
-	if date != 0 {
1032
-		db = db.Where("schedule_date = ? ", date)
1033
-	}
1034
-	if partition != 0 {
1035
-		db = db.Where("partition_id = ? ", partition)
1018
+
1019
+	if patientId == 0 {
1020
+		db := readDb.
1021
+			Model(&models.NewVMMonitorDialysisSchedule{}).
1022
+			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
1023
+			Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).
1024
+			Preload("TreatmentMode", "status = 1").
1025
+			Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, date).
1026
+			Preload("AssessmentBeforeDislysis", "status = 1 AND  user_org_id = ? AND assessment_date = ?", orgID, date).
1027
+			Preload("AssessmentAfterDislysis", "status = 1 AND  user_org_id = ? AND assessment_date = ? ", orgID, date).
1028
+			Preload("MonitoringRecord", "status = 1 AND  user_org_id = ? AND monitoring_date = ?", orgID, date).
1029
+			Preload("DialysisOrder", "status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, date).
1030
+			Preload("DialysisOrder.DeviceNumber", "status = 1 AND  org_id = ?", orgID).
1031
+			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID).
1032
+			Where("status = 1 AND user_org_id = ?", orgID)
1033
+		if date != 0 {
1034
+			db = db.Where("schedule_date = ? ", date)
1035
+		}
1036
+		if partition != 0 {
1037
+			db = db.Where("partition_id = ? ", partition)
1038
+		}
1039
+		err := db.Find(&mds).Error
1040
+		fmt.Println("err", err)
1041
+	}
1042
+
1043
+	if patientId > 0 {
1044
+		db := readDb.Table("xt_schedule as x").Where("x.status = 1")
1045
+		db = db.
1046
+			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
1047
+			Preload("TreatmentMode", "status = 1").
1048
+			Preload("Prescription", "status = 1 AND user_org_id = ? AND patient_id = ?", orgID, patientId).
1049
+			Preload("AssessmentBeforeDislysis", "status = 1 AND  user_org_id = ? AND patient_id = ?", orgID, patientId).
1050
+			Preload("AssessmentAfterDislysis", "status = 1 AND  user_org_id = ? AND patient_id = ? ", orgID, patientId).
1051
+			Preload("MonitoringRecord", "status = 1 AND  user_org_id = ?  AND patient_id = ?", orgID, patientId).
1052
+			Preload("DialysisOrder", "status = 1 AND user_org_id = ? AND patient_id = ?", orgID, patientId).
1053
+			Preload("DialysisOrder.DeviceNumber", "status = 1 AND  org_id = ?", orgID).
1054
+			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID).
1055
+			Where("status = 1 AND user_org_id = ?", orgID)
1056
+		if partition != 0 {
1057
+			db = db.Where("partition_id = ? ", partition)
1058
+		}
1059
+
1060
+		db = db.Where("schedule_date <= ? ", time.Now().Unix())
1061
+
1062
+		db = db.Where("patient_id = ?", patientId)
1063
+		db = db.Order("schedule_date desc")
1064
+		err := db.Find(&mds).Error
1065
+		fmt.Println("err", err)
1036 1066
 	}
1037
-	err := db.Find(&mds).Error
1067
+
1038 1068
 	return mds, err
1039 1069
 }
1040 1070
 
@@ -1424,3 +1454,16 @@ func CreateHisGroupAdvice(orgId int64, advices []*models.HisGroupAdvice, groupNo
1424 1454
 	tx.Commit()
1425 1455
 	return
1426 1456
 }
1457
+
1458
+func GetDialysisCount(orgid int64, partitionid int64) (order []*models.BloodDialysisOrderCount, err error) {
1459
+
1460
+	db := XTReadDB().Table("xt_dialysis_order as o")
1461
+	if partitionid == 0 {
1462
+		db.Raw("select count(o.id) as count,o.patient_id from xt_dialysis_order as o left join xt_schedule as x on x.patient_id = o.patient_id where o.status =1 and o.user_org_id = ? and  x.schedule_date = o.dialysis_date and x.status = 1", orgid).Group("o.patient_id").Scan(&order)
1463
+	}
1464
+
1465
+	if partitionid > 0 {
1466
+		db.Raw("select count(o.id) as count,o.patient_id from xt_dialysis_order as o left join xt_schedule as x on x.patient_id = o.patient_id where o.status =1  and o.user_org_id = ? and x.partition_id = ? and  x.schedule_date = o.dialysis_date and x.status = 1", orgid, partitionid).Group("o.patient_id").Scan(&order)
1467
+	}
1468
+	return order, err
1469
+}

+ 72 - 7
service/stock_service.go View File

@@ -1155,11 +1155,20 @@ func FindAllStockInfo(orgId int64, page int64, limit int64, keyword string, star
1155 1155
 
1156 1156
 	db := readDb.Model(&models.StockInfo{})
1157 1157
 	if startime > 0 {
1158
+
1158 1159
 		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
1159 1160
 			return db.Where("org_id = ? AND status = 1 and sys_record_time>=?", orgId, startime)
1160 1161
 		})
1161 1162
 	}
1163
+
1164
+	if startime == 0 || endtime == 0 {
1165
+		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
1166
+			return db.Where("org_id = ? AND status = 1", orgId)
1167
+		})
1168
+	}
1169
+
1162 1170
 	if endtime > 0 {
1171
+
1163 1172
 		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
1164 1173
 			return db.Where("org_id = ? AND status = 1 and sys_record_time<=?", orgId, endtime)
1165 1174
 		})
@@ -1167,19 +1176,36 @@ func FindAllStockInfo(orgId int64, page int64, limit int64, keyword string, star
1167 1176
 
1168 1177
 	db = db.Where("xt_good_information.org_id = ? AND xt_good_information.status = 1", orgId)
1169 1178
 	db = db.Group("xt_good_information.id")
1170
-	db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
1171
-		return db.Where("org_id = ? AND status = 1", orgId)
1172
-	})
1179
+	if startime == 0 || endtime == 0 {
1180
+		db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
1181
+			return db.Where("org_id = ? AND status = 1", orgId)
1182
+		})
1183
+	}
1184
+
1185
+	if startime > 0 {
1186
+		db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
1187
+			return db.Where("org_id = ? AND status = 1 and ctime >= ?", orgId, startime)
1188
+		})
1189
+	}
1190
+
1191
+	if endtime > 0 {
1192
+		db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
1193
+			return db.Where("org_id = ? AND status = 1 and ctime>=? and ctime <= ?", orgId, startime, endtime)
1194
+		})
1195
+	}
1173 1196
 
1174 1197
 	db = db.Preload("QuerySalesReturnInfo", "org_id = ? AND status = 1", orgId)
1175 1198
 
1176 1199
 	if startime == 0 || endtime == 0 {
1177
-		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
1178
-			return db.Where("org_id = ? AND status = 1", orgId)
1179
-		})
1200
+		db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1", orgId)
1201
+	}
1202
+	if startime > 0 {
1203
+		db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1 and ctime >=?", orgId, startime)
1204
+	}
1205
+	if endtime > 0 {
1206
+		db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1 and ctime >=? and ctime<=?", orgId, startime, endtime)
1180 1207
 	}
1181 1208
 
1182
-	db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1", orgId)
1183 1209
 	db = db.Preload("GoodsType", "org_id = ? AND status = 1", orgId)
1184 1210
 
1185 1211
 	if len(keyword) > 0 {
@@ -2098,3 +2124,42 @@ func GetStockType(orgid int64) (goodstype []*models.GoodsTypeOne, err error) {
2098 2124
 		Preload("GoodInfo", "org_id = ? and status = 1", orgid).Find(&goodstype).Error
2099 2125
 	return goodstype, err
2100 2126
 }
2127
+
2128
+func GetDialyStockOut(orgid int64, recordtime int64, patientId int64) (prepare []*models.XtDialysisBeforePrepare, err error) {
2129
+
2130
+	db := XTReadDB().Table("dialysis_before_prepare as x").Where("x.status = 1")
2131
+	if orgid > 0 {
2132
+		db = db.Where("x.user_org_id = ?", orgid)
2133
+	}
2134
+	if recordtime > 0 {
2135
+		db = db.Where("x.record_date = ?", recordtime)
2136
+	}
2137
+	if patientId > 0 {
2138
+		db = db.Where("x.patient_id = ?", patientId)
2139
+	}
2140
+	err = db.Select("x.id,x.user_org_id,x.patient_id,x.record_date,x.good_id,x.good_type_id,x.count,x.commdity_code,t.specification_name").Joins("left join xt_good_information as t on t.id = x.good_id and t.org_id = ? and t.status = 1", orgid).Scan(&prepare).Error
2141
+	return prepare, err
2142
+}
2143
+
2144
+func GetAutoReduceRecordInfoById(orgid int64, recordtime int64, goodid int64, goodtypeid int64) (*models.XtAutomaticReduceDetail, error) {
2145
+
2146
+	detail := models.XtAutomaticReduceDetail{}
2147
+	err := XTReadDB().Model(&detail).Where("org_id = ? and record_time = ? and good_id = ? and good_type_id = ? and status =1", orgid, recordtime, goodid, goodtypeid).Find(&detail).Error
2148
+	if err == gorm.ErrRecordNotFound {
2149
+		return nil, err
2150
+	}
2151
+
2152
+	if err != nil {
2153
+		return nil, err
2154
+	}
2155
+
2156
+	return &detail, nil
2157
+}
2158
+
2159
+func GetOutStockTotalCount(wareouttime int64, orgid int64) (autoMatic []*models.NewXtAutomaticReduceDetail, err error) {
2160
+
2161
+	err = XTReadDB().Raw("SELECT good_id,SUM(b.count) as count FROM (SELECT DISTINCT x.patient_id,x.good_id,x.count FROM xt_automatic_reduce_detail as x WHERE x.org_id = ? and x.record_time = ? and `status` = 1)  as b GROUP BY good_id", orgid, wareouttime).Scan(&autoMatic).Error
2162
+
2163
+	return autoMatic, err
2164
+
2165
+}